Skip to content

v2.12 - Per-unit naming for multi-unit devices

Choose a tag to compare

@Rouzax Rouzax released this 22 Aug 07:26
· 8 commits to main since this release

Read this before updating if you use a Central Scene remote. This is the first release that renames devices you were already using. If a dzVents script or scene looks a device up by name, that name may change. Run with -DryRun first, check the listed names against your automations, and remember the undo script reverses the run. Automations that reference devices by idx are unaffected.

The problem

A DeviceID is not unique in Domoticz. A multi-unit device, most visibly a Central Scene remote, is stored as one DeviceID with several Unit rows, and Domoticz names all of them from a single MQTT discovery payload. The result is three identically named devices in your UI:

Living Room - Remote - Scene 001
Living Room - Remote - Scene 001
Living Room - Remote - Scene 001

v2.11 made this safe by skipping such devices. It did not make it useful.

What changes

Each row now gets its own name, derived from the Z-Wave state the unit represents:

Living Room - Remote - Scene 001 - Short
Living Room - Remote - Scene 001 - Released
Living Room - Remote - Scene 001 - Held

The meanings come from the value's own states array (KeyPressed, KeyReleased, KeyHeldDown), and bundled rules rewrite them to Short, Released and Held. Those words are yours to change: it is one with value in rename_rules.json, no different from any other label the tool rewrites. If you trigger long presses on KeyReleased, as many WallMote setups do, you may prefer Long there.

The mapping is treated as untrusted

Domoticz numbers Unit rows by state value, but that is an observed correspondence, not a documented contract. Mislabelling a real light switch is worse than leaving it duplicated, so per-unit naming applies only when the row count matches the state count and every Unit maps to a state value. If a state's value is not a whole number, its label is missing or blank, or a Unit has no matching state, the tool falls back to v2.11's behaviour: skip the device, leave every row exactly as it was, and say so.

Writes and undo are now per row

Every UPDATE and every undo statement carries AND Unit = N. This closes the v2.11 bug structurally rather than by guarding against it: the undo script now restores each unit its own name, where previously it would have rewritten every row with whichever single name happened to be captured.

Also in this release

  • Unchanged and Renamed count rows, not devices, for a mapped multi-unit device. A re-run may report a smaller Unchanged figure than before; no devices have gone missing.
  • A rules-engine compatibility change. A rule that matches a DeviceID pattern but changes nothing and sets no switchType/customImage now falls through to the next rule instead of ending the chain. No bundled rule changes behaviour as a result. If you used a broad no-op rule to shadow later rules, use -ExcludePattern instead.
  • The CSV summary gains a Unit column and no longer risks serializing internal fields.
  • If you already hand-named individual units, you may see a collision reported rather than a rename. That is expected and safe: the tool never creates a silent duplicate.

Preview with -DryRun first, as always.