node-red-contrib-power-saver 5.0.0 → 5.0.1

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.0.0",
3
+ "version": "5.0.1",
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": {
@@ -47,27 +47,26 @@
47
47
  "url": "https://github.com/ottopaulsen/node-red-contrib-power-saver.git"
48
48
  },
49
49
  "devDependencies": {
50
- "@vuepress/bundler-vite": "2.0.0-rc.19",
51
- "@vuepress/plugin-google-analytics": "2.0.0-rc.66",
52
- "@vuepress/plugin-register-components": "2.0.0-rc.66",
53
- "@vuepress/plugin-search": "2.0.0-rc.66",
54
- "@vuepress/theme-default": "2.0.0-rc.66",
55
- "@vuepress/utils": "2.0.0-rc.19",
56
- "chai": "^4.3.10",
57
- "eslint": "9.17.0",
58
- "expect": "29.7.0",
59
- "mocha": "^11.0.1",
60
- "node-red": "^4.0.8",
61
- "node-red-node-test-helper": "0.3.4",
62
- "sass-embedded": "^1.83.1",
63
- "sass-loader": "^16.0.4",
64
- "vuepress": "2.0.0-rc.19"
50
+ "@vuepress/bundler-vite": "2.0.0-rc.26",
51
+ "@vuepress/plugin-google-analytics": "2.0.0-rc.123",
52
+ "@vuepress/plugin-register-components": "2.0.0-rc.123",
53
+ "@vuepress/plugin-search": "2.0.0-rc.123",
54
+ "@vuepress/theme-default": "2.0.0-rc.123",
55
+ "@vuepress/utils": "2.0.0-rc.26",
56
+ "chai": "6.2.2",
57
+ "eslint": "10.0.0",
58
+ "expect": "30.2.0",
59
+ "mocha": "^11.7.5",
60
+ "node-red": "^4.1.5",
61
+ "node-red-node-test-helper": "0.3.6",
62
+ "sass-embedded": "^1.97.3",
63
+ "sass-loader": "^16.0.7",
64
+ "vuepress": "2.0.0-rc.26"
65
65
  },
66
66
  "dependencies": {
67
67
  "floating-vue": "5.2.2",
68
68
  "lodash.clonedeep": "4.5.0",
69
69
  "luxon": "3.5.0",
70
- "nano-time": "1.0.0",
71
- "node-fetch": "2.6.7"
70
+ "nano-time": "1.0.0"
72
71
  }
73
72
  }
@@ -1,4 +1,4 @@
1
- const fetch = require("node-fetch");
1
+ // const fetch = require("node-fetch");
2
2
 
3
3
  function ping(node, subscriptionKey, setResultStatus = true) {
4
4
  const url = "https://elvia.azure-api.net/grid-tariff/Ping";
@@ -596,6 +596,17 @@ function fetchMissingStates(config, state, node, homeAssistant, clock = null) {
596
596
 
597
597
  state.timedOut = allTimedOut;
598
598
  node.log(`Initial timedOut set to ${state.timedOut} (all triggers actually timed out: ${allTimedOut})`);
599
+
600
+ // If motion is detected at startup (timedOut is false), turn lights on
601
+ if (!allTimedOut) {
602
+ node.log('Motion detected at startup, turning lights on');
603
+ const level = findCurrentLevel(config, node, clock);
604
+ if (level !== null && isBrightnessAllowingLights(config)) {
605
+ controlLights(config.lights, level, node, homeAssistant);
606
+ node.log(`Lights turned on to ${level}% at startup (motion detected)`);
607
+ }
608
+ }
609
+
599
610
  return true; // Indicates that initial timedOut was set
600
611
  }
601
612