node-red-contrib-power-saver 5.1.2 → 5.1.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-power-saver",
3
- "version": "5.1.2",
3
+ "version": "5.1.3",
4
4
  "description": "A module for Node-RED that you can use to turn on and off a switch based on power prices",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -201,6 +201,10 @@ module.exports = function (RED) {
201
201
 
202
202
  // Set lights to night level after delay
203
203
  nightActivationTimer = setTimeout(() => {
204
+ if (state.timedOut || !funcs.isNightMode(nodeConfig)) {
205
+ debugLog("Skipping night level change: lights are off or night mode no longer active");
206
+ return;
207
+ }
204
208
  debugLog("Applying night level to lights");
205
209
  const level = funcs.findCurrentLevel(nodeConfig, nodeWrapper);
206
210
  if (level !== null) {
@@ -223,6 +227,10 @@ module.exports = function (RED) {
223
227
 
224
228
  // Set lights to away level after delay
225
229
  awayActivationTimer = setTimeout(() => {
230
+ if (state.timedOut || !funcs.isAwayMode(nodeConfig)) {
231
+ debugLog("Skipping away level change: lights are off or away mode no longer active");
232
+ return;
233
+ }
226
234
  debugLog("Applying away level to lights");
227
235
  const level =
228
236
  nodeConfig.awaySensor.level !== null && nodeConfig.awaySensor.level !== undefined