node-red-contrib-power-saver 4.1.5 → 4.2.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.
@@ -86,7 +86,7 @@
86
86
  <tr v-for="(hour, i) in payload.hours" :key="hour.start">
87
87
  <td>{{ DateTime.fromISO(hour.start).day }}</td>
88
88
  <td>
89
- {{ DateTime.fromISO(hour.start).toLocaleString(DateTime.TIME_SIMPLE) }}
89
+ {{ DateTime.fromISO(hour.start).toFormat("HH:mm") }}
90
90
  </td>
91
91
  <td :class="priceClasses(i)">{{ hour.price }}</td>
92
92
  <td>{{ hour.onOff ? "On" : "Off" }}</td>
@@ -16,15 +16,6 @@
16
16
  />
17
17
  </form>
18
18
  </div>
19
- <div v-if="patreon" class="center">
20
- <a
21
- class="patreonButton"
22
- href="https://www.patreon.com/bePatron?u=65948417"
23
- data-patreon-widget-type="become-patron-button"
24
- target="_blank"
25
- >Become a Patron!
26
- </a>
27
- </div>
28
19
  <div v-if="vipps" class="right vipps-box">
29
20
  <span>
30
21
  <img src="../../images/vipps-smiling-rgb-orange-pos.png" height="30" />
@@ -30,7 +30,7 @@ export default defineUserConfig({
30
30
  ],
31
31
  theme: defaultTheme({
32
32
  contributors: false,
33
- logo: "/Ukraine-heart-shape-flag.png",
33
+ logo: "/ps-logo.png",
34
34
  navbar,
35
35
  sidebar: {
36
36
  "/guide/": [{ text: "Guide", children: ["/guide/README.md"] }],
@@ -70,6 +70,7 @@ export default defineUserConfig({
70
70
  "/examples/example-cascade-temperature-control.md",
71
71
  "/examples/example-visualize-on-off/example-visualize-on-off.md",
72
72
  "/examples/example-grid-tariff-capacity-part.md",
73
+ "/examples/example-stromstotte.md",
73
74
  ],
74
75
  },
75
76
  ],
@@ -7,6 +7,15 @@ sidebarDepth: 1
7
7
 
8
8
  List the most significant changes.
9
9
 
10
+ ## 4.2.1
11
+
12
+ - Bugfix version 4.2.0. Change was not effective.
13
+
14
+ ## 4.2.0
15
+
16
+ - Format time on node status with HH:MM format. No AM/PM any more.
17
+ - Remove warning for `No schedule` in debug output.
18
+
10
19
  ## 4.1.5
11
20
 
12
21
  - Fixed bug based on [this issue](https://github.com/ottopaulsen/node-red-contrib-power-saver/issues/184). Now correctly uses the value for `outputOutsidePeriod` when the planning period spans midnight, and there is no data available before midnight. In this case, the period from midnight to end time cannot be planned, so `outputIfNoSchedule` will be used until end time, and `outputOutsidePeriod` will be used from then. See the issue for more details.
@@ -6,11 +6,9 @@ sidebar: "auto"
6
6
 
7
7
  ## Donate
8
8
 
9
- Developing software is time consuming. This solution has taken the better part of all my free time for a couple of years now. Getting something back would make it easier to also spend future time on this.
9
+ Developing software is time consuming. This solution took the better part of my free time for a couple of years, and still takes a lot of time. Getting something back would make it easier to also spend future time on this.
10
10
 
11
- <VippsPlakat/>
12
-
13
- The software is open source, and you can use it for free, but if you feel it has value, you can support the development by donating or becoming a patron, paying a fee of your choice.
11
+ The software is open source, and you can use it for free, but if you feel it has value, you can support the development by donating, paying a fee of your choice.
14
12
 
15
13
  <br/>
16
14
  <br/>
@@ -37,7 +35,15 @@ It would be very nice to get more examples into the documentation. If you have m
37
35
 
38
36
  ## Bug reports
39
37
 
40
- If you find a bug, please describe it thoroughly and make a [GitHub issue](https://github.com/ottopaulsen/node-red-contrib-power-saver/issues). If the bug is related to the scheduling, **please provide the full output from output 3** on the strategy node.
38
+ If you find a bug, please describe it thoroughly and make a [GitHub issue](https://github.com/ottopaulsen/node-red-contrib-power-saver/issues).
39
+
40
+ ::: tip Bug reports for strategy nodes
41
+ If the bug is related to a strategy node, please provide:
42
+ * The full input
43
+ * The full output from output 3
44
+ :::
45
+
46
+ If you have problems with the Best Save node, you can try the [Best Save Viewer](../faq/best-save-viewer.md) to see if it makes more sense.
41
47
 
42
48
  ## Ideas
43
49
 
@@ -16,6 +16,8 @@
16
16
 
17
17
  [Capacity part of grid tariff](./example-grid-tariff-capacity-part)
18
18
 
19
+ [Strømstøtte (governmentall support)](./example-stromstotte)
20
+
19
21
  ## User provided examples
20
22
 
21
23
  [Output schedule to a sensor entity](./example-next-schedule-entity.md) (by Stefan)
@@ -0,0 +1,31 @@
1
+ # Strømstøtte
2
+
3
+ ::: tip Strømstøtte = Norwegian governental support
4
+ :::
5
+
6
+ In Norway there is currently economical support from the government when the power prices are high.
7
+ The support per December 2023 is supposed to continue until end of 2024, and is calculated as follows:
8
+
9
+ ::: tip Calculation
10
+ The government will cover 90% of the cost that is over 0.875 NOK per kWh.
11
+ :::
12
+
13
+ This will have great effect on how the PowerSaver nodes calculates the saving, especially the Best Save node.
14
+
15
+ To take the governmental support into the calculation, insert a Function node after the Price Receiver node:
16
+
17
+ ![Node med strømstøtte](../images/stromstotte.png)
18
+
19
+ And use the following code in the function node:
20
+
21
+ ```js
22
+ const LIMIT = 0.875
23
+ const OVER_LIMIT_SHARE = 0.1
24
+
25
+ msg.payload.priceData.forEach((hour) => {
26
+ if (hour.value > LIMIT) {
27
+ hour.value = LIMIT + (hour.value - LIMIT) * OVER_LIMIT_SHARE
28
+ }
29
+ })
30
+ return msg;
31
+ ```
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-power-saver",
3
- "version": "4.1.5",
3
+ "version": "4.2.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": {
@@ -55,7 +55,7 @@
55
55
  "eslint": "8.52.0",
56
56
  "expect": "29.7.0",
57
57
  "mocha": "^10.2.0",
58
- "node-red": "^3.1.0",
58
+ "node-red": "^3.1.1",
59
59
  "node-red-node-test-helper": "0.3.2",
60
60
  "sass-loader": "^13.3.2",
61
61
  "vuepress": "2.0.0-beta.67"
@@ -77,7 +77,7 @@ function runSchedule(node, schedule, time, currentSent = false) {
77
77
  node.log("Switching " + onOff + " in " + wait + " milliseconds");
78
78
  const statusMessage = `${remainingSchedule.length} changes - ${
79
79
  remainingSchedule[0].value ? "on" : "off"
80
- } at ${nextTime.toLocaleString(DateTime.TIME_SIMPLE)}`;
80
+ } at ${nextTime.toFormat("HH:mm")}`;
81
81
  node.status({ fill: "green", shape: "dot", text: statusMessage });
82
82
  return setTimeout(() => {
83
83
  sendSwitch(node, entry.value);
@@ -85,7 +85,7 @@ function runSchedule(node, schedule, time, currentSent = false) {
85
85
  }, wait);
86
86
  } else {
87
87
  const message = "No schedule";
88
- node.warn(message);
88
+ // node.warn(message);
89
89
  node.status({ fill: "yellow", shape: "dot", text: message });
90
90
  if (!currentSent) {
91
91
  sendSwitch(node, node.outputIfNoSchedule);
@@ -39,7 +39,7 @@ function mergeSchedules(node, logicFunction) {
39
39
  const savedSchedules = node.context().get("savedSchedules", node.contextStorage);
40
40
  if (!savedSchedules) {
41
41
  const msg = "No schedules";
42
- node.warn(msg);
42
+ // node.warn(msg);
43
43
  node.status({ fill: "red", shape: "dot", text: msg });
44
44
  return [];
45
45
  }
@@ -93,7 +93,6 @@ describe("send command as input to schedule merger", () => {
93
93
  expect(equalHours(someOn, msg.payload.hours, ["price", "onOff", "start"])).to.equal(true);
94
94
  n1.warn.should.not.be.called;
95
95
  n1.receive({ payload: { commands: { reset: true } } });
96
- n1.warn.should.be.calledWithExactly("No schedule");
97
96
  done();
98
97
  });
99
98
  n1.receive({ payload: makePayload("s1", someOn) });
@@ -0,0 +1,197 @@
1
+ {
2
+ "priceData": [
3
+ {
4
+ "value": 0.3417,
5
+ "start": "2023-11-30T00:00:00.000+01:00"
6
+ },
7
+ {
8
+ "value": 0.3414,
9
+ "start": "2023-11-30T01:00:00.000+01:00"
10
+ },
11
+ {
12
+ "value": 0.3387,
13
+ "start": "2023-11-30T02:00:00.000+01:00"
14
+ },
15
+ {
16
+ "value": 0.336,
17
+ "start": "2023-11-30T03:00:00.000+01:00"
18
+ },
19
+ {
20
+ "value": 0.338,
21
+ "start": "2023-11-30T04:00:00.000+01:00"
22
+ },
23
+ {
24
+ "value": 0.3435,
25
+ "start": "2023-11-30T05:00:00.000+01:00"
26
+ },
27
+ {
28
+ "value": 0.371,
29
+ "start": "2023-11-30T06:00:00.000+01:00"
30
+ },
31
+ {
32
+ "value": 0.4171,
33
+ "start": "2023-11-30T07:00:00.000+01:00"
34
+ },
35
+ {
36
+ "value": 0.478,
37
+ "start": "2023-11-30T08:00:00.000+01:00"
38
+ },
39
+ {
40
+ "value": 0.4992,
41
+ "start": "2023-11-30T09:00:00.000+01:00"
42
+ },
43
+ {
44
+ "value": 0.4818,
45
+ "start": "2023-11-30T10:00:00.000+01:00"
46
+ },
47
+ {
48
+ "value": 0.4828,
49
+ "start": "2023-11-30T11:00:00.000+01:00"
50
+ },
51
+ {
52
+ "value": 0.4493,
53
+ "start": "2023-11-30T12:00:00.000+01:00"
54
+ },
55
+ {
56
+ "value": 0.4429,
57
+ "start": "2023-11-30T13:00:00.000+01:00"
58
+ },
59
+ {
60
+ "value": 0.4491,
61
+ "start": "2023-11-30T14:00:00.000+01:00"
62
+ },
63
+ {
64
+ "value": 0.4491,
65
+ "start": "2023-11-30T15:00:00.000+01:00"
66
+ },
67
+ {
68
+ "value": 0.486,
69
+ "start": "2023-11-30T16:00:00.000+01:00"
70
+ },
71
+ {
72
+ "value": 0.5276,
73
+ "start": "2023-11-30T17:00:00.000+01:00"
74
+ },
75
+ {
76
+ "value": 0.5137,
77
+ "start": "2023-11-30T18:00:00.000+01:00"
78
+ },
79
+ {
80
+ "value": 0.4485,
81
+ "start": "2023-11-30T19:00:00.000+01:00"
82
+ },
83
+ {
84
+ "value": 0.4002,
85
+ "start": "2023-11-30T20:00:00.000+01:00"
86
+ },
87
+ {
88
+ "value": 0.375,
89
+ "start": "2023-11-30T21:00:00.000+01:00"
90
+ },
91
+ {
92
+ "value": 0.3654,
93
+ "start": "2023-11-30T22:00:00.000+01:00"
94
+ },
95
+ {
96
+ "value": 0.3524,
97
+ "start": "2023-11-30T23:00:00.000+01:00"
98
+ },
99
+ {
100
+ "value": 0.3443,
101
+ "start": "2023-12-01T00:00:00.000+01:00"
102
+ },
103
+ {
104
+ "value": 0.3392,
105
+ "start": "2023-12-01T01:00:00.000+01:00"
106
+ },
107
+ {
108
+ "value": 0.335,
109
+ "start": "2023-12-01T02:00:00.000+01:00"
110
+ },
111
+ {
112
+ "value": 0.3311,
113
+ "start": "2023-12-01T03:00:00.000+01:00"
114
+ },
115
+ {
116
+ "value": 0.3314,
117
+ "start": "2023-12-01T04:00:00.000+01:00"
118
+ },
119
+ {
120
+ "value": 0.3388,
121
+ "start": "2023-12-01T05:00:00.000+01:00"
122
+ },
123
+ {
124
+ "value": 0.3599,
125
+ "start": "2023-12-01T06:00:00.000+01:00"
126
+ },
127
+ {
128
+ "value": 0.398,
129
+ "start": "2023-12-01T07:00:00.000+01:00"
130
+ },
131
+ {
132
+ "value": 0.4591,
133
+ "start": "2023-12-01T08:00:00.000+01:00"
134
+ },
135
+ {
136
+ "value": 0.482,
137
+ "start": "2023-12-01T09:00:00.000+01:00"
138
+ },
139
+ {
140
+ "value": 0.4733,
141
+ "start": "2023-12-01T10:00:00.000+01:00"
142
+ },
143
+ {
144
+ "value": 0.4711,
145
+ "start": "2023-12-01T11:00:00.000+01:00"
146
+ },
147
+ {
148
+ "value": 0.4516,
149
+ "start": "2023-12-01T12:00:00.000+01:00"
150
+ },
151
+ {
152
+ "value": 0.4255,
153
+ "start": "2023-12-01T13:00:00.000+01:00"
154
+ },
155
+ {
156
+ "value": 0.4245,
157
+ "start": "2023-12-01T14:00:00.000+01:00"
158
+ },
159
+ {
160
+ "value": 0.4365,
161
+ "start": "2023-12-01T15:00:00.000+01:00"
162
+ },
163
+ {
164
+ "value": 0.4551,
165
+ "start": "2023-12-01T16:00:00.000+01:00"
166
+ },
167
+ {
168
+ "value": 0.4916,
169
+ "start": "2023-12-01T17:00:00.000+01:00"
170
+ },
171
+ {
172
+ "value": 0.454,
173
+ "start": "2023-12-01T18:00:00.000+01:00"
174
+ },
175
+ {
176
+ "value": 0.4176,
177
+ "start": "2023-12-01T19:00:00.000+01:00"
178
+ },
179
+ {
180
+ "value": 0.3865,
181
+ "start": "2023-12-01T20:00:00.000+01:00"
182
+ },
183
+ {
184
+ "value": 0.3659,
185
+ "start": "2023-12-01T21:00:00.000+01:00"
186
+ },
187
+ {
188
+ "value": 0.3579,
189
+ "start": "2023-12-01T22:00:00.000+01:00"
190
+ },
191
+ {
192
+ "value": 0.3457,
193
+ "start": "2023-12-01T23:00:00.000+01:00"
194
+ }
195
+ ],
196
+ "source": "Tibber"
197
+ }
@@ -0,0 +1,331 @@
1
+ {
2
+ "schedule": [
3
+ {
4
+ "time": "2023-11-30T00:00:00.000+01:00",
5
+ "value": false,
6
+ "countHours": 2
7
+ },
8
+ {
9
+ "time": "2023-11-30T02:00:00.000+01:00",
10
+ "value": true,
11
+ "countHours": 3
12
+ },
13
+ {
14
+ "time": "2023-11-30T05:00:00.000+01:00",
15
+ "value": false,
16
+ "countHours": 43
17
+ }
18
+ ],
19
+ "hours": [
20
+ {
21
+ "start": "2023-11-30T00:00:00.000+01:00",
22
+ "price": 0.3417,
23
+ "onOff": false,
24
+ "saving": null
25
+ },
26
+ {
27
+ "start": "2023-11-30T01:00:00.000+01:00",
28
+ "price": 0.3414,
29
+ "onOff": false,
30
+ "saving": null
31
+ },
32
+ {
33
+ "start": "2023-11-30T02:00:00.000+01:00",
34
+ "price": 0.3387,
35
+ "onOff": true,
36
+ "saving": null
37
+ },
38
+ {
39
+ "start": "2023-11-30T03:00:00.000+01:00",
40
+ "price": 0.336,
41
+ "onOff": true,
42
+ "saving": null
43
+ },
44
+ {
45
+ "start": "2023-11-30T04:00:00.000+01:00",
46
+ "price": 0.338,
47
+ "onOff": true,
48
+ "saving": null
49
+ },
50
+ {
51
+ "start": "2023-11-30T05:00:00.000+01:00",
52
+ "price": 0.3435,
53
+ "onOff": false,
54
+ "saving": null
55
+ },
56
+ {
57
+ "start": "2023-11-30T06:00:00.000+01:00",
58
+ "price": 0.371,
59
+ "onOff": false,
60
+ "saving": null
61
+ },
62
+ {
63
+ "start": "2023-11-30T07:00:00.000+01:00",
64
+ "price": 0.4171,
65
+ "onOff": false,
66
+ "saving": null
67
+ },
68
+ {
69
+ "start": "2023-11-30T08:00:00.000+01:00",
70
+ "price": 0.478,
71
+ "onOff": false,
72
+ "saving": null
73
+ },
74
+ {
75
+ "start": "2023-11-30T09:00:00.000+01:00",
76
+ "price": 0.4992,
77
+ "onOff": false,
78
+ "saving": null
79
+ },
80
+ {
81
+ "start": "2023-11-30T10:00:00.000+01:00",
82
+ "price": 0.4818,
83
+ "onOff": false,
84
+ "saving": null
85
+ },
86
+ {
87
+ "start": "2023-11-30T11:00:00.000+01:00",
88
+ "price": 0.4828,
89
+ "onOff": false,
90
+ "saving": null
91
+ },
92
+ {
93
+ "start": "2023-11-30T12:00:00.000+01:00",
94
+ "price": 0.4493,
95
+ "onOff": false,
96
+ "saving": null
97
+ },
98
+ {
99
+ "start": "2023-11-30T13:00:00.000+01:00",
100
+ "price": 0.4429,
101
+ "onOff": false,
102
+ "saving": null
103
+ },
104
+ {
105
+ "start": "2023-11-30T14:00:00.000+01:00",
106
+ "price": 0.4491,
107
+ "onOff": false,
108
+ "saving": null
109
+ },
110
+ {
111
+ "start": "2023-11-30T15:00:00.000+01:00",
112
+ "price": 0.4491,
113
+ "onOff": false,
114
+ "saving": null
115
+ },
116
+ {
117
+ "start": "2023-11-30T16:00:00.000+01:00",
118
+ "price": 0.486,
119
+ "onOff": false,
120
+ "saving": null
121
+ },
122
+ {
123
+ "start": "2023-11-30T17:00:00.000+01:00",
124
+ "price": 0.5276,
125
+ "onOff": false,
126
+ "saving": null
127
+ },
128
+ {
129
+ "start": "2023-11-30T18:00:00.000+01:00",
130
+ "price": 0.5137,
131
+ "onOff": false,
132
+ "saving": null
133
+ },
134
+ {
135
+ "start": "2023-11-30T19:00:00.000+01:00",
136
+ "price": 0.4485,
137
+ "onOff": false,
138
+ "saving": null
139
+ },
140
+ {
141
+ "start": "2023-11-30T20:00:00.000+01:00",
142
+ "price": 0.4002,
143
+ "onOff": false,
144
+ "saving": null
145
+ },
146
+ {
147
+ "start": "2023-11-30T21:00:00.000+01:00",
148
+ "price": 0.375,
149
+ "onOff": false,
150
+ "saving": null
151
+ },
152
+ {
153
+ "start": "2023-11-30T22:00:00.000+01:00",
154
+ "price": 0.3654,
155
+ "onOff": false,
156
+ "saving": null
157
+ },
158
+ {
159
+ "start": "2023-11-30T23:00:00.000+01:00",
160
+ "price": 0.3524,
161
+ "onOff": false,
162
+ "saving": null
163
+ },
164
+ {
165
+ "start": "2023-12-01T00:00:00.000+01:00",
166
+ "price": 0.3443,
167
+ "onOff": false,
168
+ "saving": null
169
+ },
170
+ {
171
+ "start": "2023-12-01T01:00:00.000+01:00",
172
+ "price": 0.3392,
173
+ "onOff": false,
174
+ "saving": null
175
+ },
176
+ {
177
+ "start": "2023-12-01T02:00:00.000+01:00",
178
+ "price": 0.335,
179
+ "onOff": false,
180
+ "saving": null
181
+ },
182
+ {
183
+ "start": "2023-12-01T03:00:00.000+01:00",
184
+ "price": 0.3311,
185
+ "onOff": false,
186
+ "saving": null
187
+ },
188
+ {
189
+ "start": "2023-12-01T04:00:00.000+01:00",
190
+ "price": 0.3314,
191
+ "onOff": false,
192
+ "saving": null
193
+ },
194
+ {
195
+ "start": "2023-12-01T05:00:00.000+01:00",
196
+ "price": 0.3388,
197
+ "onOff": false,
198
+ "saving": null
199
+ },
200
+ {
201
+ "start": "2023-12-01T06:00:00.000+01:00",
202
+ "price": 0.3599,
203
+ "onOff": false,
204
+ "saving": null
205
+ },
206
+ {
207
+ "start": "2023-12-01T07:00:00.000+01:00",
208
+ "price": 0.398,
209
+ "onOff": false,
210
+ "saving": null
211
+ },
212
+ {
213
+ "start": "2023-12-01T08:00:00.000+01:00",
214
+ "price": 0.4591,
215
+ "onOff": false,
216
+ "saving": null
217
+ },
218
+ {
219
+ "start": "2023-12-01T09:00:00.000+01:00",
220
+ "price": 0.482,
221
+ "onOff": false,
222
+ "saving": null
223
+ },
224
+ {
225
+ "start": "2023-12-01T10:00:00.000+01:00",
226
+ "price": 0.4733,
227
+ "onOff": false,
228
+ "saving": null
229
+ },
230
+ {
231
+ "start": "2023-12-01T11:00:00.000+01:00",
232
+ "price": 0.4711,
233
+ "onOff": false,
234
+ "saving": null
235
+ },
236
+ {
237
+ "start": "2023-12-01T12:00:00.000+01:00",
238
+ "price": 0.4516,
239
+ "onOff": false,
240
+ "saving": null
241
+ },
242
+ {
243
+ "start": "2023-12-01T13:00:00.000+01:00",
244
+ "price": 0.4255,
245
+ "onOff": false,
246
+ "saving": null
247
+ },
248
+ {
249
+ "start": "2023-12-01T14:00:00.000+01:00",
250
+ "price": 0.4245,
251
+ "onOff": false,
252
+ "saving": null
253
+ },
254
+ {
255
+ "start": "2023-12-01T15:00:00.000+01:00",
256
+ "price": 0.4365,
257
+ "onOff": false,
258
+ "saving": null
259
+ },
260
+ {
261
+ "start": "2023-12-01T16:00:00.000+01:00",
262
+ "price": 0.4551,
263
+ "onOff": false,
264
+ "saving": null
265
+ },
266
+ {
267
+ "start": "2023-12-01T17:00:00.000+01:00",
268
+ "price": 0.4916,
269
+ "onOff": false,
270
+ "saving": null
271
+ },
272
+ {
273
+ "start": "2023-12-01T18:00:00.000+01:00",
274
+ "price": 0.454,
275
+ "onOff": false,
276
+ "saving": null
277
+ },
278
+ {
279
+ "start": "2023-12-01T19:00:00.000+01:00",
280
+ "price": 0.4176,
281
+ "onOff": false,
282
+ "saving": null
283
+ },
284
+ {
285
+ "start": "2023-12-01T20:00:00.000+01:00",
286
+ "price": 0.3865,
287
+ "onOff": false,
288
+ "saving": null
289
+ },
290
+ {
291
+ "start": "2023-12-01T21:00:00.000+01:00",
292
+ "price": 0.3659,
293
+ "onOff": false,
294
+ "saving": null
295
+ },
296
+ {
297
+ "start": "2023-12-01T22:00:00.000+01:00",
298
+ "price": 0.3579,
299
+ "onOff": false,
300
+ "saving": null
301
+ },
302
+ {
303
+ "start": "2023-12-01T23:00:00.000+01:00",
304
+ "price": 0.3457,
305
+ "onOff": false,
306
+ "saving": null
307
+ }
308
+ ],
309
+ "source": "Tibber",
310
+ "config": {
311
+ "fromTime": "00",
312
+ "toTime": "00",
313
+ "hoursOn": 3,
314
+ "maxPrice": 0.35,
315
+ "doNotSplit": false,
316
+ "sendCurrentValueWhenRescheduling": true,
317
+ "outputIfNoSchedule": false,
318
+ "outputOutsidePeriod": false,
319
+ "outputValueForOn": true,
320
+ "outputValueForOff": false,
321
+ "outputValueForOntype": "bool",
322
+ "outputValueForOfftype": "bool",
323
+ "override": "auto",
324
+ "contextStorage": "memory",
325
+ "hasChanged": false
326
+ },
327
+ "time": "2023-11-30T17:29:23.336+00:00",
328
+ "version": "4.1.5",
329
+ "strategyNodeId": "n1",
330
+ "current": false
331
+ }
@@ -7,7 +7,7 @@ const { makePayload } = require("./strategy-lowest-price-test-utils.js");
7
7
 
8
8
  helper.init(require.resolve("node-red"));
9
9
 
10
- describe("ps-strategy-lowest-price-bug", function () {
10
+ describe("ps-strategy-lowest-price-bugs", function () {
11
11
  beforeEach(function (done) {
12
12
  helper.startServer(done);
13
13
  });
@@ -0,0 +1,61 @@
1
+ const { DateTime } = require("luxon");
2
+ const expect = require("chai").expect;
3
+ const helper = require("node-red-node-test-helper");
4
+ const lowestPrice = require("../src/strategy-lowest-price.js");
5
+ const { version } = require("../package.json");
6
+ const { makePayload } = require("./strategy-lowest-price-test-utils.js");
7
+
8
+ helper.init(require.resolve("node-red"));
9
+
10
+ describe("ps-strategy-lowest-price-bugs", function () {
11
+ beforeEach(function (done) {
12
+ helper.startServer(done);
13
+ });
14
+
15
+ afterEach(function (done) {
16
+ helper.unload().then(function () {
17
+ helper.stopServer(done);
18
+ });
19
+ });
20
+
21
+ it("cannot reproduce this bug", function (done) {
22
+ const input = require("./data/lowest-price-bug187-input.json");
23
+ const result = require("./data/lowest-price-bug187.json");
24
+ // result.version = version;
25
+ // result.strategyNodeId = "n1";
26
+ // result.current = false;
27
+ // const flow = [
28
+ // {
29
+ // id: "n1",
30
+ // type: "ps-strategy-lowest-price",
31
+ // name: "test name",
32
+ // fromTime: "00",
33
+ // toTime: "00",
34
+ // hoursOn: 3,
35
+ // maxPrice: 0.35,
36
+ // doNotSplit: false,
37
+ // sendCurrentValueWhenRescheduling: true,
38
+ // outputIfNoSchedule: false,
39
+ // outputOutsidePeriod: false,
40
+ // contextStorage: "memory",
41
+ // wires: [["n3"], ["n4"], ["n2"]],
42
+ // },
43
+ // { id: "n2", type: "helper" },
44
+ // { id: "n3", type: "helper" },
45
+ // { id: "n4", type: "helper" },
46
+ // ];
47
+ // helper.load(lowestPrice, flow, function () {
48
+ // const n1 = helper.getNode("n1");
49
+ // const n2 = helper.getNode("n2");
50
+ // n2.on("input", function (msg) {
51
+ // result.current = msg.payload.current;
52
+ // expect(msg).to.have.deep.property("payload", result);
53
+ // n1.warn.should.not.be.called;
54
+ done();
55
+ // });
56
+ // const time = DateTime.fromISO("2023-11-30T17:29:23.336+00:00");
57
+ // result.time = time.toISO();
58
+ // n1.receive({ payload: makePayload(input, time) });
59
+ // });
60
+ });
61
+ });