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

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.
@@ -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 !== 'dmx') 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.16",
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",