node-red-contrib-knx-ultimate 2.2.35 → 2.2.36

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/CHANGELOG.md CHANGED
@@ -6,6 +6,9 @@
6
6
 
7
7
  # CHANGELOG
8
8
 
9
+ **Version 2.2.36** - December 2023<br/>
10
+ - HUE Light Node: Ensure at least one liht belonging to a group was on before switching to nighttime. Otherwise turn all lights on at daytime.<br/>
11
+
9
12
  **Version 2.2.35** - December 2023<br/>
10
13
  - NEW: HUE Light Node: now it resumes the old status of all lights belonging to the selected group.<br/>
11
14
 
@@ -108,12 +108,11 @@ module.exports = function (RED) {
108
108
  // If you try and control multiple conflicting parameters at once e.g. {"color": {"xy": {"x":0.5,"y":0.5}}, "color_temperature": {"mirek": 250}}
109
109
  // the lights can only physically do one, for this we apply the rule that xy beats ct. Simple.
110
110
  // color_temperature.mirek: color temperature in mirek is null when the light color is not in the ct spectrum
111
- if (node.DayTime === true && config.specifySwitchOnBrightness === "no") {
111
+ if ((node.DayTime === true && config.specifySwitchOnBrightness === "no") && ((node.isGrouped_light === false && node.HUEDeviceWhileDaytime !== null) || (node.isGrouped_light === true && node.HUELightsBelongingToGroupWhileDaytime !== null))) {
112
112
  if (node.isGrouped_light === false && node.HUEDeviceWhileDaytime !== null) {
113
113
  // The DayNight has switched into day, so restore the previous light status
114
114
  state = { on: { on: true }, dimming: node.HUEDeviceWhileDaytime.dimming, color: node.HUEDeviceWhileDaytime.color, color_temperature: node.HUEDeviceWhileDaytime.color_temperature };
115
115
  if (node.HUEDeviceWhileDaytime.color_temperature.mirek === null) delete state.color_temperature; // Otherwise the lamp will not turn on due to an error. color_temperature.mirek: color temperature in mirek is null when the light color is not in the ct spectrum
116
- node.HUEDeviceWhileDaytime = null; // Nullize the object.
117
116
  node.serverHue.hueManager.writeHueQueueAdd(node.hueDevice, state, node.isGrouped_light === false ? "setLight" : "setGroupedLight");
118
117
  node.setNodeStatusHue({
119
118
  fill: "green",
@@ -121,21 +120,35 @@ module.exports = function (RED) {
121
120
  text: "KNX->HUE",
122
121
  payload: "Restore light status",
123
122
  });
123
+ node.HUEDeviceWhileDaytime = null; // Nullize the object.
124
124
  } else if (node.isGrouped_light === true && node.HUELightsBelongingToGroupWhileDaytime !== null) {
125
125
  // The DayNight has switched into day, so restore the previous light state, belonging to the group
126
+ let bAtLeastOneIsOn = false;
127
+ for (let index = 0; index < node.HUELightsBelongingToGroupWhileDaytime.length; index++) { // Ensure, at least 1 lamp was on, otherwise turn all lamps on
128
+ const element = node.HUELightsBelongingToGroupWhileDaytime[index].light[0];
129
+ if (element.on.on === true) {
130
+ bAtLeastOneIsOn = true;
131
+ break;
132
+ }
133
+ }
126
134
  for (let index = 0; index < node.HUELightsBelongingToGroupWhileDaytime.length; index++) {
127
135
  const element = node.HUELightsBelongingToGroupWhileDaytime[index].light[0];
128
- state = { on: { on: true }, dimming: element.dimming, color: element.color, color_temperature: element.color_temperature };
136
+ if (bAtLeastOneIsOn === true) {
137
+ state = { on: element.on, dimming: element.dimming, color: element.color, color_temperature: element.color_temperature };
138
+ } else {
139
+ // Failsafe all on
140
+ state = { on: { on: true }, dimming: element.dimming, color: element.color, color_temperature: element.color_temperature };
141
+ }
129
142
  if (element.color_temperature.mirek === null) delete state.color_temperature; // Otherwise the lamp will not turn on due to an error. color_temperature.mirek: color temperature in mirek is null when the light color is not in the ct spectrum
130
143
  node.serverHue.hueManager.writeHueQueueAdd(element.id, state, "setLight");
131
144
  }
132
- node.HUELightsBelongingToGroupWhileDaytime = null; // Nullize the object.
133
145
  node.setNodeStatusHue({
134
146
  fill: "green",
135
147
  shape: "dot",
136
148
  text: "KNX->HUE",
137
149
  payload: "Resuming all group's light",
138
150
  });
151
+ node.HUELightsBelongingToGroupWhileDaytime = null; // Nullize the object.
139
152
  return;
140
153
  }
141
154
  } else {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "engines": {
4
4
  "node": ">=16.0.0"
5
5
  },
6
- "version": "2.2.35",
6
+ "version": "2.2.36",
7
7
  "description": "Control your KNX intallation via Node-Red! A bunch of KNX nodes, with integrated Philips HUE control and ETS group address importer. Easy to use and highly configurable.",
8
8
  "dependencies": {
9
9
  "binary-parser": "2.2.1",