@haydendonald/node-red-contrib-hass-stuff 1.2.6 → 1.2.7

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.
@@ -122,7 +122,7 @@ module.exports = function LightControlConfigNode(RED) {
122
122
  groupEntities = data.data.attributes.entity_id;
123
123
  currentState = data.data;
124
124
  entitiesOffDuringNight = config.entitiesOffAtNight.split(",").filter((entity) => entity != "");
125
- entitiesOnDuringNight = groupEntities.filter((entity) => !entitiesOffDuringNight.includes(entity));
125
+ entitiesOnDuringNight = entitiesOffDuringNight.length > 0 ? groupEntities.filter((entity) => !entitiesOffDuringNight.includes(entity)) : [config.groupEntityId];
126
126
  });
127
127
  //Get the state of the night mode switch and store it
128
128
  if (config.nightModeEntityId && config.nightModeEntityId != "") {
@@ -292,13 +292,13 @@ module.exports = function LightControlConfigNode(RED) {
292
292
  shuffle: true,
293
293
  smart_shuffle: true,
294
294
  targets: {
295
- entity_id: entitiesOn ? entitiesOn : [config.groupEntityId]
295
+ entity_id: (entitiesOn || []).length > 0 ? entitiesOn : [config.groupEntityId]
296
296
  }
297
297
  };
298
298
  //Run via adaptive lights
299
299
  connectionsConfigNode.sendHASSAction("scene_presets.apply_preset", undefined, msg, undefined);
300
300
  //Run any lights off that need to be off
301
- if (entitiesOff && entitiesOff.length > 0) {
301
+ if ((entitiesOff || []).length > 0) {
302
302
  connectionsConfigNode.sendHASSAction("light.turn_off", {
303
303
  entity_id: entitiesOff
304
304
  }, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haydendonald/node-red-contrib-hass-stuff",
3
- "version": "1.2.6",
3
+ "version": "1.2.7",
4
4
  "description": "A collection of stuff I use on my Node Red + Home Assistant server. This could be of use for others, i don't know..",
5
5
  "devDependencies": {
6
6
  "@types/node": "^18.14.0",