node-red-contrib-dmx-for-ha 0.6.15 → 0.6.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -228,7 +228,9 @@ Typical workflow: Remove → update node settings → Deploy → node auto-disco
228
228
 
229
229
  ## System control topic
230
230
 
231
- All nodes subscribe to a system control topic for **bulk add/remove during commissioning**. No wiring needed — publish one MQTT message and all matching nodes respond.
231
+ All nodes subscribe to a system control topic for **bulk add/remove during commissioning**. No wiring needed — publish one MQTT message and all matching nodes respond instantly.
232
+
233
+ This is one of the most useful commissioning features in the package. On large installations with hundreds of entities, the ability to wipe and rediscover a specific zone or type in one click saves hours of manual work.
232
234
 
233
235
  **Topic:** `{siteId}/system/control` (e.g. `MW3D/system/control`)
234
236
 
@@ -242,18 +244,66 @@ All nodes subscribe to a system control topic for **bulk add/remove during commi
242
244
  | Field | Values | Description |
243
245
  |---|---|---|
244
246
  | `cmd` | `add`, `remove` | Add or remove HA discovery |
245
- | `zone` | `all`, `Master`, `BnB` | Matches config node zone |
246
- | `type` | `all`, `dmx`, `button`, `pir`, `relay` | Node type filter |
247
+ | `zone` | `all`, or any zone name e.g. `Master`, `BnB` | Matches config node Zone field — case insensitive |
248
+ | `type` | `all`, `dmx`, `group`, `button`, `pir`, `relay` | Node type filter |
249
+
250
+ **Type reference:**
251
+
252
+ | Type | Node | Description |
253
+ |---|---|---|
254
+ | `dmx` | ha-mqtt-dmx | Individual DMX fixtures |
255
+ | `group` | ha-mqtt-dmx-group | DMX group nodes |
256
+ | `button` | ha-mqtt-button | Wall button inputs |
257
+ | `pir` | ha-mqtt-pir | PIR / motion sensors |
258
+ | `relay` | ha-mqtt-relay | Relay / power outputs |
259
+ | `all` | all of the above | Everything in the zone |
260
+
261
+ **Commissioning workflow — roll out one type at a time:**
262
+ ```
263
+ Day 1 — DMX lights:
264
+ ADD Master DMX → all lights appear in HA
265
+ Test each light
266
+ REMOVE Master DMX → wipe and fix any wrong names/channels
267
+ ADD Master DMX → rediscover clean
268
+
269
+ Day 2 — Buttons:
270
+ ADD Master Button → all buttons appear in HA
271
+ Test each button
272
+ etc.
273
+ ```
274
+
275
+ **How to send the command:**
276
+
277
+ Option A — from anywhere on the network (MQTT Explorer, HA automation, script):
278
+ ```
279
+ Topic: MW3D/system/control
280
+ Payload: {"cmd":"add","zone":"all","type":"all"}
281
+ ```
282
+
283
+ Option B — from Node-RED using the included System Control flow:
284
+
285
+ Import `system_control_flow.json` into Node-RED. Connect the MQTT out node to your broker. You get a dedicated tab with one-click buttons for every zone and type combination:
286
+
287
+ ```
288
+ 🗑 REMOVE ALL ✅ ADD ALL
289
+
290
+ 🗑 REMOVE Master DMX ✅ ADD Master DMX
291
+ 🗑 REMOVE Master Group ✅ ADD Master Group
292
+ 🗑 REMOVE Master Button ✅ ADD Master Button
293
+ 🗑 REMOVE Master PIR ✅ ADD Master PIR
294
+ 🗑 REMOVE Master Relay ✅ ADD Master Relay
295
+
296
+ 🗑 REMOVE BnB DMX ✅ ADD BnB DMX
297
+ ... etc.
298
+ ```
247
299
 
248
- **Commissioning workflow:**
300
+ Option C — wire an inject node directly to any ha-mqtt node input:
249
301
  ```
250
- 1. ADD Master DMX test all lights
251
- 2. REMOVE Master DMX fix wrong names/channels
252
- 3. ADD Master DMX → verify clean
253
- 4. Move to next type: Button → PIR → Relay
302
+ msg.device = "add" add that node only
303
+ msg.device = "remove" → remove that node only
254
304
  ```
255
305
 
256
- A **System Control flow** ships with the package (`system_control_flow.json`). Import it into Node-RED, connect the MQTT out node to your broker, and you have one-click bulk control per zone and type.
306
+ > **Tip:** The system control topic is zone and type filtered — sending `REMOVE BnB DMX` only affects BnB DMX fixtures. Master lights, buttons, relays are completely unaffected. This makes it safe to use on a live installation with clients present.
257
307
 
258
308
  ---
259
309
 
@@ -285,6 +285,7 @@ module.exports = function (RED) {
285
285
 
286
286
  // ── Device remove ─────────────────────────────────────────
287
287
  function handleDeviceRemove() {
288
+ _discovered = false; // Allow re-discovery after remove
288
289
  unregisterFixtureId();
289
290
  pub(cfgTopic, '', true);
290
291
  pub(uiBtnCfgTopic, '', true);
@@ -70,6 +70,24 @@ module.exports = function (RED) {
70
70
  handleDeviceAdd();
71
71
  }
72
72
 
73
+ // ── System control topic ─────────────────────────────────
74
+ const systemTopic = `${cfg.siteId}/system/control`;
75
+ broker.subscribe(systemTopic, 0, function (topic, rawPayload) {
76
+ let msg;
77
+ try { msg = JSON.parse(rawPayload.toString()); } catch(e) { return; }
78
+ if (!msg.cmd) return;
79
+ const zone = (msg.zone || 'all').toLowerCase();
80
+ if (zone !== 'all' && zone !== cfg.zone.toLowerCase()) return;
81
+ const type = (msg.type || 'all').toLowerCase();
82
+ if (type !== 'all' && type !== 'group') return;
83
+ if (msg.cmd === 'remove') {
84
+ _discovered = false;
85
+ handleDeviceRemove(null);
86
+ } else if (msg.cmd === 'add') {
87
+ _tryDiscover();
88
+ }
89
+ }, node.id + '_sys');
90
+
73
91
  // Auto-discover if broker already connected on deploy
74
92
  if (broker.connected) {
75
93
  _tryDiscover();
@@ -347,6 +365,7 @@ module.exports = function (RED) {
347
365
 
348
366
  // ── Device remove ─────────────────────────────────────────
349
367
  function handleDeviceRemove(incomingTrace) {
368
+ _discovered = false; // Allow re-discovery after remove
350
369
  if (diskTimer) { clearTimeout(diskTimer); diskTimer = null; }
351
370
  // No flush needed on remove — state is cleared below
352
371
  // Keep disk state on remove — state survives remove/add cycles
@@ -797,6 +797,7 @@ module.exports = function (RED) {
797
797
 
798
798
  // ── Device remove ─────────────────────────────────────────
799
799
  function handleDeviceRemove() {
800
+ _discovered = false; // Allow re-discovery after remove
800
801
  unregisterFixtureId();
801
802
  clearChannelRegistry();
802
803
  stopEffect();
@@ -318,6 +318,7 @@ module.exports = function (RED) {
318
318
 
319
319
  // ── Device remove ─────────────────────────────────────────
320
320
  function handleDeviceRemove() {
321
+ _discovered = false; // Allow re-discovery after remove
321
322
  unregisterFixtureId();
322
323
  cancelWarmup();
323
324
  pub(avtyTopic, 'offline', true);
@@ -405,6 +405,7 @@ module.exports = function (RED) {
405
405
 
406
406
  // ── Device remove ─────────────────────────────────────────
407
407
  function handleDeviceRemove() {
408
+ _discovered = false; // Allow re-discovery after remove
408
409
  unregisterFixtureId();
409
410
  stopEffect();
410
411
  if (diskTimer) { clearTimeout(diskTimer); diskTimer = null; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-dmx-for-ha",
3
- "version": "0.6.15",
3
+ "version": "0.6.17",
4
4
  "description": "DMX lighting control for Home Assistant via Node-RED and MQTT. Place a node, fill in the settings, deploy. Full HA device registry integration with RGBW/RGBWW/CCT/brightness colour modes, transitions, effects, and group control.",
5
5
  "keywords": [
6
6
  "node-red",