node-red-contrib-dmx-for-ha 0.4.1 → 0.4.3

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.
@@ -290,7 +290,7 @@ module.exports = function (RED) {
290
290
  catch(e) { node.warn(`${groupId} — failed to parse HA command`); return; }
291
291
 
292
292
  saveGroupState(payload);
293
- pubState({ state: payload.state, color_mode: S.colorMode, brightness: payload.brightness });
293
+ pubState({ state: payload.state, color_mode: S.colorMode, brightness: payload.brightness, color: payload.color });
294
294
  forwardToChildren(payload, null);
295
295
  const _lbl = payload.effect ? `effect:${payload.effect}` : `${payload.state}`;
296
296
  groupStatus(payload.state, `${groupId} → ${_lbl}`);
@@ -318,7 +318,8 @@ module.exports = function (RED) {
318
318
  function handleDeviceRemove(incomingTrace) {
319
319
  if (diskTimer) { clearTimeout(diskTimer); diskTimer = null; }
320
320
  // No flush needed on remove — state is cleared below
321
- ctxSet('state', null); ctxSet('state', null, 'disk_values');
321
+ // Keep disk state on remove — state survives remove/add cycles
322
+ ctxSet('state', null); // RAM only
322
323
  pub(cfgTopic, '', true);
323
324
  broker.unsubscribe(cmdTopic, node.id);
324
325
  forwardToChildren({ device: 'remove' }, incomingTrace);
@@ -337,7 +338,7 @@ module.exports = function (RED) {
337
338
  // Forward payload deeper
338
339
  if (msg.payload) {
339
340
  saveGroupState(msg.payload);
340
- pubState({ state: msg.payload.state, color_mode: S.colorMode, brightness: msg.payload.brightness });
341
+ pubState({ state: msg.payload.state, color_mode: S.colorMode, brightness: msg.payload.brightness, color: msg.payload.color });
341
342
  forwardToChildren(msg.payload, msg.dmx_trace);
342
343
  groupStatus(msg.payload.state, `${groupId} → cascade:${msg.payload.state}`);
343
344
  }
@@ -354,7 +355,7 @@ module.exports = function (RED) {
354
355
  }
355
356
  } else if (msg.payload && msg.payload.state != null) {
356
357
  saveGroupState(msg.payload);
357
- pubState({ state: msg.payload.state, color_mode: S.colorMode, brightness: msg.payload.brightness });
358
+ pubState({ state: msg.payload.state, color_mode: S.colorMode, brightness: msg.payload.brightness, color: msg.payload.color });
358
359
  forwardToChildren(msg.payload, null);
359
360
  groupStatus(msg.payload.state, `${groupId} → ${msg.payload.state}`);
360
361
  } else {
@@ -693,8 +693,10 @@ module.exports = function (RED) {
693
693
  ctxSet('warmWhite',ww,'disk_values');
694
694
  }
695
695
  }
696
+ // Keep disk state on remove — state survives remove/add cycles
697
+ // Only clear RAM so recovery on re-add reads last known disk state
696
698
  ['state','brightness','red','green','blue','white','warmWhite'].forEach(function (k) {
697
- ctxSet(k, null); ctxSet(k, null, 'disk_values');
699
+ ctxSet(k, null);
698
700
  });
699
701
  pub(cfgTopic, '', true);
700
702
  broker.unsubscribe(cmdTopic, node.id);
@@ -332,7 +332,8 @@ module.exports = function (RED) {
332
332
  function handleDeviceRemove() {
333
333
  stopEffect();
334
334
  if (diskTimer) { clearTimeout(diskTimer); diskTimer = null; }
335
- ctxSet('state', null); ctxSet('state', null, 'disk_values');
335
+ // Keep disk state on remove — state survives remove/add cycles
336
+ ctxSet('state', null); // RAM only
336
337
  pub(cfgTopic, '', true);
337
338
  broker.unsubscribe(cmdTopic, node.id);
338
339
  setStatus('red', 'ring', `${fixtureId} removed`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-dmx-for-ha",
3
- "version": "0.4.1",
3
+ "version": "0.4.3",
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",