node-red-contrib-power-saver 3.0.5 → 3.0.9

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.
Files changed (38) hide show
  1. package/docs/.vuepress/config.js +1 -1
  2. package/docs/.vuepress/dist/404.html +3 -3
  3. package/docs/.vuepress/dist/assets/js/app.190d977f.js +1 -0
  4. package/docs/.vuepress/dist/assets/js/runtime~app.36bc5048.js +1 -0
  5. package/docs/.vuepress/dist/assets/js/{v-510ed0d4.129ef915.js → v-510ed0d4.01d07aab.js} +1 -1
  6. package/docs/.vuepress/dist/changelog/index.html +4 -4
  7. package/docs/.vuepress/dist/contribute/index.html +3 -3
  8. package/docs/.vuepress/dist/examples/example-nordpool-current-state.html +3 -3
  9. package/docs/.vuepress/dist/examples/example-nordpool-events-state.html +3 -3
  10. package/docs/.vuepress/dist/examples/example-tibber-mqtt.html +3 -3
  11. package/docs/.vuepress/dist/examples/index.html +3 -3
  12. package/docs/.vuepress/dist/guide/index.html +3 -3
  13. package/docs/.vuepress/dist/index.html +3 -3
  14. package/docs/.vuepress/dist/nodes/index.html +3 -3
  15. package/docs/.vuepress/dist/nodes/old-power-saver-doc.html +3 -3
  16. package/docs/.vuepress/dist/nodes/power-saver.html +3 -3
  17. package/docs/.vuepress/dist/nodes/ps-elvia-add-tariff.html +3 -3
  18. package/docs/.vuepress/dist/nodes/ps-receive-price.html +3 -3
  19. package/docs/.vuepress/dist/nodes/ps-strategy-best-save.html +3 -3
  20. package/docs/.vuepress/dist/nodes/ps-strategy-lowest-price.html +3 -3
  21. package/docs/.vuepress/dist/nodes/strategy-input.html +3 -3
  22. package/docs/changelog/README.md +17 -0
  23. package/docs/examples/example-nordpool-current-state.md +172 -152
  24. package/docs/nodes/ps-receive-price.md +4 -0
  25. package/package.json +2 -3
  26. package/src/handle-input.js +1 -7
  27. package/src/power-saver.js +1 -5
  28. package/src/receive-price-functions.js +9 -17
  29. package/src/strategy-lowest-price.js +2 -1
  30. package/src/utils.js +6 -0
  31. package/test/data/lowest-price-input-missing-end.json +197 -0
  32. package/test/data/lowest-price-result-missing-end.json +319 -0
  33. package/test/data/nordpool-events-state-2.json +288 -0
  34. package/test/data/nordpool-prices-in-payload.json +287 -0
  35. package/test/receive-price.test.js +27 -4
  36. package/test/strategy-lowest-price.test.js +33 -0
  37. package/docs/.vuepress/dist/assets/js/app.342dc054.js +0 -1
  38. package/docs/.vuepress/dist/assets/js/runtime~app.0d53f24f.js +0 -1
@@ -0,0 +1,288 @@
1
+ {
2
+ "_msgid": "584656e8b6b08fc4",
3
+ "payload": "1.523",
4
+ "topic": "",
5
+ "data": {
6
+ "entity_id": "sensor.nordpool_kwh_krsand",
7
+ "state": "1.523",
8
+ "attributes": {
9
+ "current_price": 1.523,
10
+ "average": 2.602,
11
+ "off peak 1": 1.768,
12
+ "off peak 2": 1.633,
13
+ "peak": 3.977,
14
+ "min": 1.523,
15
+ "max": 4.582,
16
+ "unit": "kWh",
17
+ "currency": "NOK",
18
+ "country": "Norway",
19
+ "region": "Kr.sand",
20
+ "low price": true,
21
+ "tomorrow_valid": true,
22
+ "today": [
23
+ 1.633, 1.584, 1.581, 1.583, 1.596, 1.661, 1.746, 2.763, 3.803, 3.921, 3.551, 4.172, 3.683, 3.742, 3.847, 4.315,
24
+ 4.582, 2.202, 2.153, 1.803, 1.722, 1.716, 1.569, 1.523
25
+ ],
26
+ "tomorrow": [
27
+ 1.588, 1.521, 1.492, 1.487, 1.497, 1.514, 1.583, 1.667, 1.729, 1.724, 1.707, 1.703, 1.692, 1.692, 1.692, 1.717,
28
+ 1.72, 1.718, 1.679, 1.661, 1.629, 1.652, 1.612, 1.587
29
+ ],
30
+ "raw_today": [
31
+ {
32
+ "start": "2021-12-14T00:00:00+01:00",
33
+ "end": "2021-12-14T01:00:00+01:00",
34
+ "value": 1.633
35
+ },
36
+ {
37
+ "start": "2021-12-14T01:00:00+01:00",
38
+ "end": "2021-12-14T02:00:00+01:00",
39
+ "value": 1.584
40
+ },
41
+ {
42
+ "start": "2021-12-14T02:00:00+01:00",
43
+ "end": "2021-12-14T03:00:00+01:00",
44
+ "value": 1.581
45
+ },
46
+ {
47
+ "start": "2021-12-14T03:00:00+01:00",
48
+ "end": "2021-12-14T04:00:00+01:00",
49
+ "value": 1.583
50
+ },
51
+ {
52
+ "start": "2021-12-14T04:00:00+01:00",
53
+ "end": "2021-12-14T05:00:00+01:00",
54
+ "value": 1.596
55
+ },
56
+ {
57
+ "start": "2021-12-14T05:00:00+01:00",
58
+ "end": "2021-12-14T06:00:00+01:00",
59
+ "value": 1.661
60
+ },
61
+ {
62
+ "start": "2021-12-14T06:00:00+01:00",
63
+ "end": "2021-12-14T07:00:00+01:00",
64
+ "value": 1.746
65
+ },
66
+ {
67
+ "start": "2021-12-14T07:00:00+01:00",
68
+ "end": "2021-12-14T08:00:00+01:00",
69
+ "value": 2.763
70
+ },
71
+ {
72
+ "start": "2021-12-14T08:00:00+01:00",
73
+ "end": "2021-12-14T09:00:00+01:00",
74
+ "value": 3.803
75
+ },
76
+ {
77
+ "start": "2021-12-14T09:00:00+01:00",
78
+ "end": "2021-12-14T10:00:00+01:00",
79
+ "value": 3.921
80
+ },
81
+ {
82
+ "start": "2021-12-14T10:00:00+01:00",
83
+ "end": "2021-12-14T11:00:00+01:00",
84
+ "value": 3.551
85
+ },
86
+ {
87
+ "start": "2021-12-14T11:00:00+01:00",
88
+ "end": "2021-12-14T12:00:00+01:00",
89
+ "value": 4.172
90
+ },
91
+ {
92
+ "start": "2021-12-14T12:00:00+01:00",
93
+ "end": "2021-12-14T13:00:00+01:00",
94
+ "value": 3.683
95
+ },
96
+ {
97
+ "start": "2021-12-14T13:00:00+01:00",
98
+ "end": "2021-12-14T14:00:00+01:00",
99
+ "value": 3.742
100
+ },
101
+ {
102
+ "start": "2021-12-14T14:00:00+01:00",
103
+ "end": "2021-12-14T15:00:00+01:00",
104
+ "value": 3.847
105
+ },
106
+ {
107
+ "start": "2021-12-14T15:00:00+01:00",
108
+ "end": "2021-12-14T16:00:00+01:00",
109
+ "value": 4.315
110
+ },
111
+ {
112
+ "start": "2021-12-14T16:00:00+01:00",
113
+ "end": "2021-12-14T17:00:00+01:00",
114
+ "value": 4.582
115
+ },
116
+ {
117
+ "start": "2021-12-14T17:00:00+01:00",
118
+ "end": "2021-12-14T18:00:00+01:00",
119
+ "value": 2.202
120
+ },
121
+ {
122
+ "start": "2021-12-14T18:00:00+01:00",
123
+ "end": "2021-12-14T19:00:00+01:00",
124
+ "value": 2.153
125
+ },
126
+ {
127
+ "start": "2021-12-14T19:00:00+01:00",
128
+ "end": "2021-12-14T20:00:00+01:00",
129
+ "value": 1.803
130
+ },
131
+ {
132
+ "start": "2021-12-14T20:00:00+01:00",
133
+ "end": "2021-12-14T21:00:00+01:00",
134
+ "value": 1.722
135
+ },
136
+ {
137
+ "start": "2021-12-14T21:00:00+01:00",
138
+ "end": "2021-12-14T22:00:00+01:00",
139
+ "value": 1.716
140
+ },
141
+ {
142
+ "start": "2021-12-14T22:00:00+01:00",
143
+ "end": "2021-12-14T23:00:00+01:00",
144
+ "value": 1.569
145
+ },
146
+ {
147
+ "start": "2021-12-14T23:00:00+01:00",
148
+ "end": "2021-12-15T00:00:00+01:00",
149
+ "value": 1.523
150
+ }
151
+ ],
152
+ "raw_tomorrow": [
153
+ {
154
+ "start": "2021-12-15T00:00:00+01:00",
155
+ "end": "2021-12-15T01:00:00+01:00",
156
+ "value": 1.588
157
+ },
158
+ {
159
+ "start": "2021-12-15T01:00:00+01:00",
160
+ "end": "2021-12-15T02:00:00+01:00",
161
+ "value": 1.521
162
+ },
163
+ {
164
+ "start": "2021-12-15T02:00:00+01:00",
165
+ "end": "2021-12-15T03:00:00+01:00",
166
+ "value": 1.492
167
+ },
168
+ {
169
+ "start": "2021-12-15T03:00:00+01:00",
170
+ "end": "2021-12-15T04:00:00+01:00",
171
+ "value": 1.487
172
+ },
173
+ {
174
+ "start": "2021-12-15T04:00:00+01:00",
175
+ "end": "2021-12-15T05:00:00+01:00",
176
+ "value": 1.497
177
+ },
178
+ {
179
+ "start": "2021-12-15T05:00:00+01:00",
180
+ "end": "2021-12-15T06:00:00+01:00",
181
+ "value": 1.514
182
+ },
183
+ {
184
+ "start": "2021-12-15T06:00:00+01:00",
185
+ "end": "2021-12-15T07:00:00+01:00",
186
+ "value": 1.583
187
+ },
188
+ {
189
+ "start": "2021-12-15T07:00:00+01:00",
190
+ "end": "2021-12-15T08:00:00+01:00",
191
+ "value": 1.667
192
+ },
193
+ {
194
+ "start": "2021-12-15T08:00:00+01:00",
195
+ "end": "2021-12-15T09:00:00+01:00",
196
+ "value": 1.729
197
+ },
198
+ {
199
+ "start": "2021-12-15T09:00:00+01:00",
200
+ "end": "2021-12-15T10:00:00+01:00",
201
+ "value": 1.724
202
+ },
203
+ {
204
+ "start": "2021-12-15T10:00:00+01:00",
205
+ "end": "2021-12-15T11:00:00+01:00",
206
+ "value": 1.707
207
+ },
208
+ {
209
+ "start": "2021-12-15T11:00:00+01:00",
210
+ "end": "2021-12-15T12:00:00+01:00",
211
+ "value": 1.703
212
+ },
213
+ {
214
+ "start": "2021-12-15T12:00:00+01:00",
215
+ "end": "2021-12-15T13:00:00+01:00",
216
+ "value": 1.692
217
+ },
218
+ {
219
+ "start": "2021-12-15T13:00:00+01:00",
220
+ "end": "2021-12-15T14:00:00+01:00",
221
+ "value": 1.692
222
+ },
223
+ {
224
+ "start": "2021-12-15T14:00:00+01:00",
225
+ "end": "2021-12-15T15:00:00+01:00",
226
+ "value": 1.692
227
+ },
228
+ {
229
+ "start": "2021-12-15T15:00:00+01:00",
230
+ "end": "2021-12-15T16:00:00+01:00",
231
+ "value": 1.717
232
+ },
233
+ {
234
+ "start": "2021-12-15T16:00:00+01:00",
235
+ "end": "2021-12-15T17:00:00+01:00",
236
+ "value": 1.72
237
+ },
238
+ {
239
+ "start": "2021-12-15T17:00:00+01:00",
240
+ "end": "2021-12-15T18:00:00+01:00",
241
+ "value": 1.718
242
+ },
243
+ {
244
+ "start": "2021-12-15T18:00:00+01:00",
245
+ "end": "2021-12-15T19:00:00+01:00",
246
+ "value": 1.679
247
+ },
248
+ {
249
+ "start": "2021-12-15T19:00:00+01:00",
250
+ "end": "2021-12-15T20:00:00+01:00",
251
+ "value": 1.661
252
+ },
253
+ {
254
+ "start": "2021-12-15T20:00:00+01:00",
255
+ "end": "2021-12-15T21:00:00+01:00",
256
+ "value": 1.629
257
+ },
258
+ {
259
+ "start": "2021-12-15T21:00:00+01:00",
260
+ "end": "2021-12-15T22:00:00+01:00",
261
+ "value": 1.652
262
+ },
263
+ {
264
+ "start": "2021-12-15T22:00:00+01:00",
265
+ "end": "2021-12-15T23:00:00+01:00",
266
+ "value": 1.612
267
+ },
268
+ {
269
+ "start": "2021-12-15T23:00:00+01:00",
270
+ "end": "2021-12-16T00:00:00+01:00",
271
+ "value": 1.587
272
+ }
273
+ ],
274
+ "unit_of_measurement": "NOK/kWh",
275
+ "friendly_name": "nordpool_kwh_krsand_nok_3_10_025",
276
+ "icon": "mdi:flash"
277
+ },
278
+ "last_changed": "2021-12-14T22:00:00.034750+00:00",
279
+ "last_updated": "2021-12-14T22:00:00.034750+00:00",
280
+ "context": {
281
+ "id": "1c81d6655547e2889f0347188f45cf58",
282
+ "parent_id": null,
283
+ "user_id": null
284
+ },
285
+ "timeSinceChangedMs": 1286197,
286
+ "original_state": "1.523"
287
+ }
288
+ }
@@ -0,0 +1,287 @@
1
+ {
2
+ "_msgid": "45d6a7a32390154a",
3
+ "payload": {
4
+ "entity_id": "sensor.nordpool_kwh_oslo_nok_3_10_025",
5
+ "state": "2.171",
6
+ "attributes": {
7
+ "current_price": 2.171,
8
+ "average": 1.868,
9
+ "off peak 1": 1.619,
10
+ "off peak 2": 2.199,
11
+ "peak": 1.849,
12
+ "min": 1.605,
13
+ "max": 2.22,
14
+ "unit": "kWh",
15
+ "currency": "NOK",
16
+ "country": "Norway",
17
+ "region": "Oslo",
18
+ "low price": false,
19
+ "tomorrow_valid": true,
20
+ "today": [
21
+ 1.639, 1.619, 1.609, 1.605, 1.605, 1.61, 1.641, 1.627, 1.685, 1.772, 1.794, 1.778, 1.812, 1.846, 1.873, 1.943,
22
+ 1.972, 2.171, 2.22, 2.21, 2.22, 2.213, 2.192, 2.168
23
+ ],
24
+ "tomorrow": [
25
+ 2.086, 1.992, 1.951, 1.911, 2.058, 2.221, 2.875, 4.838, 5.338, 5.05, 4.603, 4.186, 3.567, 4.335, 4.987, 5.281,
26
+ 5.424, 5.672, 5.739, 5.418, 3.303, 4.581, 3.114, 2.751
27
+ ],
28
+ "raw_today": [
29
+ {
30
+ "start": "2021-12-19T00:00:00+01:00",
31
+ "end": "2021-12-19T01:00:00+01:00",
32
+ "value": 1.639
33
+ },
34
+ {
35
+ "start": "2021-12-19T01:00:00+01:00",
36
+ "end": "2021-12-19T02:00:00+01:00",
37
+ "value": 1.619
38
+ },
39
+ {
40
+ "start": "2021-12-19T02:00:00+01:00",
41
+ "end": "2021-12-19T03:00:00+01:00",
42
+ "value": 1.609
43
+ },
44
+ {
45
+ "start": "2021-12-19T03:00:00+01:00",
46
+ "end": "2021-12-19T04:00:00+01:00",
47
+ "value": 1.605
48
+ },
49
+ {
50
+ "start": "2021-12-19T04:00:00+01:00",
51
+ "end": "2021-12-19T05:00:00+01:00",
52
+ "value": 1.605
53
+ },
54
+ {
55
+ "start": "2021-12-19T05:00:00+01:00",
56
+ "end": "2021-12-19T06:00:00+01:00",
57
+ "value": 1.61
58
+ },
59
+ {
60
+ "start": "2021-12-19T06:00:00+01:00",
61
+ "end": "2021-12-19T07:00:00+01:00",
62
+ "value": 1.641
63
+ },
64
+ {
65
+ "start": "2021-12-19T07:00:00+01:00",
66
+ "end": "2021-12-19T08:00:00+01:00",
67
+ "value": 1.627
68
+ },
69
+ {
70
+ "start": "2021-12-19T08:00:00+01:00",
71
+ "end": "2021-12-19T09:00:00+01:00",
72
+ "value": 1.685
73
+ },
74
+ {
75
+ "start": "2021-12-19T09:00:00+01:00",
76
+ "end": "2021-12-19T10:00:00+01:00",
77
+ "value": 1.772
78
+ },
79
+ {
80
+ "start": "2021-12-19T10:00:00+01:00",
81
+ "end": "2021-12-19T11:00:00+01:00",
82
+ "value": 1.794
83
+ },
84
+ {
85
+ "start": "2021-12-19T11:00:00+01:00",
86
+ "end": "2021-12-19T12:00:00+01:00",
87
+ "value": 1.778
88
+ },
89
+ {
90
+ "start": "2021-12-19T12:00:00+01:00",
91
+ "end": "2021-12-19T13:00:00+01:00",
92
+ "value": 1.812
93
+ },
94
+ {
95
+ "start": "2021-12-19T13:00:00+01:00",
96
+ "end": "2021-12-19T14:00:00+01:00",
97
+ "value": 1.846
98
+ },
99
+ {
100
+ "start": "2021-12-19T14:00:00+01:00",
101
+ "end": "2021-12-19T15:00:00+01:00",
102
+ "value": 1.873
103
+ },
104
+ {
105
+ "start": "2021-12-19T15:00:00+01:00",
106
+ "end": "2021-12-19T16:00:00+01:00",
107
+ "value": 1.943
108
+ },
109
+ {
110
+ "start": "2021-12-19T16:00:00+01:00",
111
+ "end": "2021-12-19T17:00:00+01:00",
112
+ "value": 1.972
113
+ },
114
+ {
115
+ "start": "2021-12-19T17:00:00+01:00",
116
+ "end": "2021-12-19T18:00:00+01:00",
117
+ "value": 2.171
118
+ },
119
+ {
120
+ "start": "2021-12-19T18:00:00+01:00",
121
+ "end": "2021-12-19T19:00:00+01:00",
122
+ "value": 2.22
123
+ },
124
+ {
125
+ "start": "2021-12-19T19:00:00+01:00",
126
+ "end": "2021-12-19T20:00:00+01:00",
127
+ "value": 2.21
128
+ },
129
+ {
130
+ "start": "2021-12-19T20:00:00+01:00",
131
+ "end": "2021-12-19T21:00:00+01:00",
132
+ "value": 2.22
133
+ },
134
+ {
135
+ "start": "2021-12-19T21:00:00+01:00",
136
+ "end": "2021-12-19T22:00:00+01:00",
137
+ "value": 2.213
138
+ },
139
+ {
140
+ "start": "2021-12-19T22:00:00+01:00",
141
+ "end": "2021-12-19T23:00:00+01:00",
142
+ "value": 2.192
143
+ },
144
+ {
145
+ "start": "2021-12-19T23:00:00+01:00",
146
+ "end": "2021-12-20T00:00:00+01:00",
147
+ "value": 2.168
148
+ }
149
+ ],
150
+ "raw_tomorrow": [
151
+ {
152
+ "start": "2021-12-20T00:00:00+01:00",
153
+ "end": "2021-12-20T01:00:00+01:00",
154
+ "value": 2.086
155
+ },
156
+ {
157
+ "start": "2021-12-20T01:00:00+01:00",
158
+ "end": "2021-12-20T02:00:00+01:00",
159
+ "value": 1.992
160
+ },
161
+ {
162
+ "start": "2021-12-20T02:00:00+01:00",
163
+ "end": "2021-12-20T03:00:00+01:00",
164
+ "value": 1.951
165
+ },
166
+ {
167
+ "start": "2021-12-20T03:00:00+01:00",
168
+ "end": "2021-12-20T04:00:00+01:00",
169
+ "value": 1.911
170
+ },
171
+ {
172
+ "start": "2021-12-20T04:00:00+01:00",
173
+ "end": "2021-12-20T05:00:00+01:00",
174
+ "value": 2.058
175
+ },
176
+ {
177
+ "start": "2021-12-20T05:00:00+01:00",
178
+ "end": "2021-12-20T06:00:00+01:00",
179
+ "value": 2.221
180
+ },
181
+ {
182
+ "start": "2021-12-20T06:00:00+01:00",
183
+ "end": "2021-12-20T07:00:00+01:00",
184
+ "value": 2.875
185
+ },
186
+ {
187
+ "start": "2021-12-20T07:00:00+01:00",
188
+ "end": "2021-12-20T08:00:00+01:00",
189
+ "value": 4.838
190
+ },
191
+ {
192
+ "start": "2021-12-20T08:00:00+01:00",
193
+ "end": "2021-12-20T09:00:00+01:00",
194
+ "value": 5.338
195
+ },
196
+ {
197
+ "start": "2021-12-20T09:00:00+01:00",
198
+ "end": "2021-12-20T10:00:00+01:00",
199
+ "value": 5.05
200
+ },
201
+ {
202
+ "start": "2021-12-20T10:00:00+01:00",
203
+ "end": "2021-12-20T11:00:00+01:00",
204
+ "value": 4.603
205
+ },
206
+ {
207
+ "start": "2021-12-20T11:00:00+01:00",
208
+ "end": "2021-12-20T12:00:00+01:00",
209
+ "value": 4.186
210
+ },
211
+ {
212
+ "start": "2021-12-20T12:00:00+01:00",
213
+ "end": "2021-12-20T13:00:00+01:00",
214
+ "value": 3.567
215
+ },
216
+ {
217
+ "start": "2021-12-20T13:00:00+01:00",
218
+ "end": "2021-12-20T14:00:00+01:00",
219
+ "value": 4.335
220
+ },
221
+ {
222
+ "start": "2021-12-20T14:00:00+01:00",
223
+ "end": "2021-12-20T15:00:00+01:00",
224
+ "value": 4.987
225
+ },
226
+ {
227
+ "start": "2021-12-20T15:00:00+01:00",
228
+ "end": "2021-12-20T16:00:00+01:00",
229
+ "value": 5.281
230
+ },
231
+ {
232
+ "start": "2021-12-20T16:00:00+01:00",
233
+ "end": "2021-12-20T17:00:00+01:00",
234
+ "value": 5.424
235
+ },
236
+ {
237
+ "start": "2021-12-20T17:00:00+01:00",
238
+ "end": "2021-12-20T18:00:00+01:00",
239
+ "value": 5.672
240
+ },
241
+ {
242
+ "start": "2021-12-20T18:00:00+01:00",
243
+ "end": "2021-12-20T19:00:00+01:00",
244
+ "value": 5.739
245
+ },
246
+ {
247
+ "start": "2021-12-20T19:00:00+01:00",
248
+ "end": "2021-12-20T20:00:00+01:00",
249
+ "value": 5.418
250
+ },
251
+ {
252
+ "start": "2021-12-20T20:00:00+01:00",
253
+ "end": "2021-12-20T21:00:00+01:00",
254
+ "value": 3.303
255
+ },
256
+ {
257
+ "start": "2021-12-20T21:00:00+01:00",
258
+ "end": "2021-12-20T22:00:00+01:00",
259
+ "value": 4.581
260
+ },
261
+ {
262
+ "start": "2021-12-20T22:00:00+01:00",
263
+ "end": "2021-12-20T23:00:00+01:00",
264
+ "value": 3.114
265
+ },
266
+ {
267
+ "start": "2021-12-20T23:00:00+01:00",
268
+ "end": "2021-12-21T00:00:00+01:00",
269
+ "value": 2.751
270
+ }
271
+ ],
272
+ "unit_of_measurement": "NOK/kWh",
273
+ "icon": "mdi:flash",
274
+ "friendly_name": "nordpool_kwh_oslo_nok_3_10_025"
275
+ },
276
+ "last_changed": "2021-12-19T16:00:00.099173+00:00",
277
+ "last_updated": "2021-12-19T16:00:00.099173+00:00",
278
+ "context": {
279
+ "id": "bd31b337e9271ec5ee5b8c1c170840c2",
280
+ "parent_id": null,
281
+ "user_id": null
282
+ },
283
+ "timeSinceChangedMs": 815634,
284
+ "original_state": "2.171"
285
+ },
286
+ "topic": ""
287
+ }
@@ -96,8 +96,8 @@ describe("receive-price node", function () {
96
96
  });
97
97
  });
98
98
 
99
- it("should convert nordpool current state prices", function (done) {
100
- const nordpoolPrices = require("./data/nordpool-current-state-prices.json");
99
+ it("should convert nordpool complete current state data set", function (done) {
100
+ const nordpoolPrices = require("./data/nordpool-events-state-2.json");
101
101
  const convertedPrices = require("./data/converted-prices.json");
102
102
  convertedPrices.source = "Nordpool";
103
103
  const flow = [
@@ -113,10 +113,33 @@ describe("receive-price node", function () {
113
113
  const n1 = helper.getNode("n1");
114
114
  const n2 = helper.getNode("n2");
115
115
  n2.on("input", function (msg) {
116
- expect(msg).toHaveProperty("payload", convertedPrices);
116
+ expect(msg.payload.priceData.length).toEqual(48);
117
+ expect(msg.payload.source).toEqual("Nordpool");
118
+ done();
119
+ });
120
+ n1.receive({ payload: nordpoolPrices.payload, data: nordpoolPrices.data });
121
+ });
122
+ });
123
+ it("should convert nordpool data in payload", function (done) {
124
+ const nordpoolPrices = require("./data/nordpool-prices-in-payload.json");
125
+ const flow = [
126
+ {
127
+ id: "n1",
128
+ type: "ps-receive-price",
129
+ name: "Receive prices",
130
+ wires: [["n2"]],
131
+ },
132
+ { id: "n2", type: "helper" },
133
+ ];
134
+ helper.load(receivePrices, flow, function () {
135
+ const n1 = helper.getNode("n1");
136
+ const n2 = helper.getNode("n2");
137
+ n2.on("input", function (msg) {
138
+ expect(msg.payload.priceData.length).toEqual(48);
139
+ expect(msg.payload.source).toEqual("Nordpool");
117
140
  done();
118
141
  });
119
- n1.receive({ payload: nordpoolPrices });
142
+ n1.receive({ payload: nordpoolPrices.payload });
120
143
  });
121
144
  });
122
145
  });
@@ -504,6 +504,39 @@ describe("ps-strategy-lowest-price node", function () {
504
504
  n1.receive({ payload: makePayload(input, time) });
505
505
  });
506
506
  });
507
+ it("fix bug", function (done) {
508
+ const input = require("./data/lowest-price-input-missing-end.json");
509
+ const result = require("./data/lowest-price-result-missing-end.json");
510
+ const flow = [
511
+ {
512
+ id: "n1",
513
+ type: "ps-strategy-lowest-price",
514
+ name: "test name",
515
+ fromTime: "22",
516
+ toTime: "08",
517
+ hoursOn: 3,
518
+ doNotSplit: true,
519
+ sendCurrentValueWhenRescheduling: true,
520
+ outputIfNoSchedule: false,
521
+ outputOutsidePeriod: false,
522
+ wires: [["n3"], ["n4"], ["n2"]],
523
+ },
524
+ { id: "n2", type: "helper" },
525
+ { id: "n3", type: "helper" },
526
+ { id: "n4", type: "helper" },
527
+ ];
528
+ helper.load(lowestPrice, flow, function () {
529
+ const n1 = helper.getNode("n1");
530
+ const n2 = helper.getNode("n2");
531
+ n2.on("input", function (msg) {
532
+ expect(msg).toHaveProperty("payload", result.payload);
533
+ n1.warn.should.not.be.called;
534
+ done();
535
+ });
536
+ const time = DateTime.fromISO(prices.priceData[10].start);
537
+ n1.receive({ payload: makePayload(input, time) });
538
+ });
539
+ });
507
540
  });
508
541
 
509
542
  function makeFlow(hoursOn) {
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunknode_red_contrib_power_saver=self.webpackChunknode_red_contrib_power_saver||[]).push([[143],{3131:(e,t,n)=>{n.d(t,{g:()=>s});var a=n(2009),d=n(6971),o=n(1598);const s=[a.Z,d.Z,o.Z]},9947:(e,t,n)=>{n.d(t,{p:()=>a});const a=[n(3051).Z]},4611:(e,t,n)=>{n.d(t,{l:()=>s});var a=n(8866),d=n(1263),o=n(6243);const s=[a.Z,d.Z,o.Z]},4150:(e,t,n)=>{n.d(t,{Z:()=>d});var a=n(6252);const d={404:(0,a.RC)((()=>n.e(491).then(n.bind(n,8491)))),Layout:(0,a.RC)((()=>n.e(293).then(n.bind(n,3293))))}},6056:(e,t,n)=>{n.d(t,{b:()=>d});var a=n(6252);const d={"v-8daa1a0e":(0,a.RC)((()=>n.e(509).then(n.bind(n,1829)))),"v-510ed0d4":(0,a.RC)((()=>n.e(495).then(n.bind(n,3619)))),"v-7c87f26e":(0,a.RC)((()=>n.e(889).then(n.bind(n,1787)))),"v-0aca7ba6":(0,a.RC)((()=>n.e(27).then(n.bind(n,1701)))),"v-61f728ca":(0,a.RC)((()=>n.e(283).then(n.bind(n,8156)))),"v-30acb564":(0,a.RC)((()=>n.e(901).then(n.bind(n,2870)))),"v-5db8da3a":(0,a.RC)((()=>n.e(625).then(n.bind(n,3350)))),"v-fffb8e28":(0,a.RC)((()=>n.e(807).then(n.bind(n,4595)))),"v-e8c55052":(0,a.RC)((()=>n.e(651).then(n.bind(n,4493)))),"v-b4a42144":(0,a.RC)((()=>n.e(407).then(n.bind(n,3838)))),"v-1ad821fa":(0,a.RC)((()=>n.e(22).then(n.bind(n,8718)))),"v-08683c60":(0,a.RC)((()=>n.e(332).then(n.bind(n,6250)))),"v-677dfaed":(0,a.RC)((()=>n.e(745).then(n.bind(n,1253)))),"v-0b5e3c8c":(0,a.RC)((()=>n.e(363).then(n.bind(n,6112)))),"v-4637f9e4":(0,a.RC)((()=>n.e(418).then(n.bind(n,1255)))),"v-5954bcb2":(0,a.RC)((()=>n.e(317).then(n.bind(n,8638)))),"v-3706649a":(0,a.RC)((()=>n.e(88).then(n.bind(n,8109))))}},9706:(e,t,n)=>{n.d(t,{T:()=>a});const a={"v-8daa1a0e":()=>n.e(509).then(n.bind(n,6464)).then((({data:e})=>e)),"v-510ed0d4":()=>n.e(495).then(n.bind(n,3707)).then((({data:e})=>e)),"v-7c87f26e":()=>n.e(889).then(n.bind(n,9459)).then((({data:e})=>e)),"v-0aca7ba6":()=>n.e(27).then(n.bind(n,7726)).then((({data:e})=>e)),"v-61f728ca":()=>n.e(283).then(n.bind(n,4773)).then((({data:e})=>e)),"v-30acb564":()=>n.e(901).then(n.bind(n,8835)).then((({data:e})=>e)),"v-5db8da3a":()=>n.e(625).then(n.bind(n,8682)).then((({data:e})=>e)),"v-fffb8e28":()=>n.e(807).then(n.bind(n,9570)).then((({data:e})=>e)),"v-e8c55052":()=>n.e(651).then(n.bind(n,3029)).then((({data:e})=>e)),"v-b4a42144":()=>n.e(407).then(n.bind(n,7952)).then((({data:e})=>e)),"v-1ad821fa":()=>n.e(22).then(n.bind(n,2336)).then((({data:e})=>e)),"v-08683c60":()=>n.e(332).then(n.bind(n,5845)).then((({data:e})=>e)),"v-677dfaed":()=>n.e(745).then(n.bind(n,7951)).then((({data:e})=>e)),"v-0b5e3c8c":()=>n.e(363).then(n.bind(n,3594)).then((({data:e})=>e)),"v-4637f9e4":()=>n.e(418).then(n.bind(n,3959)).then((({data:e})=>e)),"v-5954bcb2":()=>n.e(317).then(n.bind(n,1535)).then((({data:e})=>e)),"v-3706649a":()=>n.e(88).then(n.bind(n,1801)).then((({data:e})=>e))}},4634:(e,t,n)=>{n.d(t,{g:()=>d});var a=n(4802);const d=[["v-8daa1a0e","/","",["/index.html","/README.md"]],["v-510ed0d4","/changelog/","Change Log",["/changelog/index.html","/changelog/README.md"]],["v-7c87f26e","/contribute/","Contribute",["/contribute/index.html","/contribute/README.md"]],["v-0aca7ba6","/examples/","Examples",["/examples/index.html","/examples/README.md"]],["v-61f728ca","/examples/example-nordpool-current-state.html","Nord Pool and current state node",["/examples/example-nordpool-current-state","/examples/example-nordpool-current-state.md"]],["v-30acb564","/examples/example-nordpool-events-state.html","Nord Pool and events: state node",["/examples/example-nordpool-events-state","/examples/example-nordpool-events-state.md"]],["v-5db8da3a","/examples/example-tibber-mqtt.html","Tibber, a switch and MQTT",["/examples/example-tibber-mqtt","/examples/example-tibber-mqtt.md"]],["v-fffb8e28","/guide/","Guide",["/guide/index.html","/guide/README.md"]],["v-e8c55052","/nodes/","Nodes",["/nodes/index.html","/nodes/README.md"]],["v-b4a42144","/nodes/old-power-saver-doc.html","node-red-contrib-power-saver v2 (deprecated)",["/nodes/old-power-saver-doc","/nodes/old-power-saver-doc.md"]],["v-1ad821fa","/nodes/power-saver.html","power-saver",["/nodes/power-saver","/nodes/power-saver.md"]],["v-08683c60","/nodes/ps-elvia-add-tariff.html","ps-elvia-add-tariff",["/nodes/ps-elvia-add-tariff","/nodes/ps-elvia-add-tariff.md"]],["v-677dfaed","/nodes/ps-receive-price.html","ps-receive-price",["/nodes/ps-receive-price","/nodes/ps-receive-price.md"]],["v-0b5e3c8c","/nodes/ps-strategy-best-save.html","ps-strategy-best-save",["/nodes/ps-strategy-best-save","/nodes/ps-strategy-best-save.md"]],["v-4637f9e4","/nodes/ps-strategy-lowest-price.html","ps-strategy-lowest-price",["/nodes/ps-strategy-lowest-price","/nodes/ps-strategy-lowest-price.md"]],["v-5954bcb2","/nodes/strategy-input.html","Strategy input format",["/nodes/strategy-input","/nodes/strategy-input.md"]],["v-3706649a","/404.html","",["/404"]]].reduce(((e,[t,n,d,o])=>(e.push({name:t,path:n,component:a.Y,meta:{title:d}},...o.map((e=>({path:e,redirect:n})))),e)),[{name:"404",path:"/:catchAll(.*)",component:a.Y}])},5220:(e,t,n)=>{n.d(t,{H:()=>a});const a={base:"/node-red-contrib-power-saver/",lang:"en-US",title:"Power Saver",description:"A Node-RED note to save money on hourly changing power prices",head:[["script",{src:"https://c6.patreon.com/becomePatronButton.bundle.js"}],["link",{rel:"icon",href:"/euro.png"}]],locales:{}}},2232:(e,t,n)=>{n.d(t,{f:()=>a});const a={navbar:[{text:"Guide",link:"/guide/"},{text:"Nodes",link:"/nodes/"},{text:"Examples",link:"/examples/"},{text:"Contribute",link:"/contribute/"},{text:"Changes",link:"/changelog/"}],sidebar:{"/guide/":[{text:"Guide",children:["/guide/README.md"]}],"/nodes/":[{text:"Nodes",children:[{text:"Power Saver",link:"/nodes/power-saver.md"},{text:"Strategy nodes",children:["/nodes/ps-strategy-best-save.md","/nodes/ps-strategy-lowest-price.md"]},{text:"Utility nodes",children:["/nodes/ps-receive-price.md"]},{text:"Grid tariff nodes",children:["/nodes/ps-elvia-add-tariff.md"]}]},{text:"Data format",children:["/nodes/strategy-input.md"]}],"/examples/":[{text:"Examples",children:["/examples/example-nordpool-current-state.md","/examples/example-nordpool-events-state.md","/examples/example-tibber-mqtt.md"]}],"/contribute/":"auto","/changelog/":"auto"},locales:{"/":{selectLanguageName:"English"}},logo:null,darkMode:!0,repo:null,selectLanguageText:"Languages",selectLanguageAriaLabel:"Select language",sidebarDepth:2,editLink:!0,editLinkText:"Edit this page",lastUpdated:!0,lastUpdatedText:"Last Updated",contributors:!0,contributorsText:"Contributors",notFound:["There's nothing here.","How did we get here?","That's a Four-Oh-Four.","Looks like we've got some broken links."],backToHome:"Take me home",openInNewWindow:"open in new window",toggleDarkMode:"toggle dark mode",toggleSidebar:"toggle sidebar"}}},e=>{e.O(0,[460,812],(()=>(5698,e(e.s=5698)))),e.O()}]);