node-red-contrib-power-saver 3.0.0 → 3.0.4

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 (76) hide show
  1. package/.github/FUNDING.yml +12 -0
  2. package/docs/.vuepress/dist/404.html +3 -3
  3. package/docs/.vuepress/dist/assets/js/app.6191e356.js +1 -0
  4. package/docs/.vuepress/dist/assets/js/runtime~app.62fa6694.js +1 -0
  5. package/docs/.vuepress/dist/assets/js/v-08683c60.07fe8291.js +1 -0
  6. package/docs/.vuepress/dist/assets/js/v-0aca7ba6.aec5ba75.js +1 -0
  7. package/docs/.vuepress/dist/assets/js/v-0b5e3c8c.d008d8bc.js +1 -0
  8. package/docs/.vuepress/dist/assets/js/v-1ad821fa.85407071.js +1 -0
  9. package/docs/.vuepress/dist/assets/js/v-30acb564.73b8e29f.js +1 -0
  10. package/docs/.vuepress/dist/assets/js/v-4637f9e4.22ab9413.js +1 -0
  11. package/docs/.vuepress/dist/assets/js/v-510ed0d4.481e9be8.js +1 -0
  12. package/docs/.vuepress/dist/assets/js/v-5954bcb2.be07962c.js +1 -0
  13. package/docs/.vuepress/dist/assets/js/v-5db8da3a.ac192f35.js +1 -0
  14. package/docs/.vuepress/dist/assets/js/v-61f728ca.802ab15e.js +1 -0
  15. package/docs/.vuepress/dist/assets/js/v-677dfaed.9bbbd037.js +1 -0
  16. package/docs/.vuepress/dist/assets/js/v-7c87f26e.457a1a60.js +1 -0
  17. package/docs/.vuepress/dist/assets/js/{v-8daa1a0e.1ea39527.js → v-8daa1a0e.db8b59c6.js} +1 -1
  18. package/docs/.vuepress/dist/assets/js/v-b4a42144.6e0c5aa0.js +1 -0
  19. package/docs/.vuepress/dist/assets/js/v-e8c55052.5f85b6cd.js +1 -0
  20. package/docs/.vuepress/dist/assets/js/v-fffb8e28.e815e852.js +1 -0
  21. package/docs/.vuepress/dist/changelog/index.html +3 -3
  22. package/docs/.vuepress/dist/contribute/index.html +3 -3
  23. package/docs/.vuepress/dist/examples/example-nordpool-current-state.html +3 -3
  24. package/docs/.vuepress/dist/examples/example-nordpool-events-state.html +3 -3
  25. package/docs/.vuepress/dist/examples/example-tibber-mqtt.html +3 -3
  26. package/docs/.vuepress/dist/examples/index.html +3 -3
  27. package/docs/.vuepress/dist/guide/index.html +3 -3
  28. package/docs/.vuepress/dist/index.html +2 -2
  29. package/docs/.vuepress/dist/nodes/index.html +3 -3
  30. package/docs/.vuepress/dist/nodes/old-power-saver-doc.html +3 -3
  31. package/docs/.vuepress/dist/nodes/power-saver.html +3 -3
  32. package/docs/.vuepress/dist/nodes/ps-elvia-add-tariff.html +3 -3
  33. package/docs/.vuepress/dist/nodes/ps-receive-price.html +3 -3
  34. package/docs/.vuepress/dist/nodes/ps-strategy-best-save.html +3 -3
  35. package/docs/.vuepress/dist/nodes/ps-strategy-lowest-price.html +3 -3
  36. package/docs/.vuepress/dist/nodes/strategy-input.html +3 -3
  37. package/docs/changelog/README.md +20 -0
  38. package/docs/contribute/README.md +1 -1
  39. package/docs/guide/README.md +10 -1
  40. package/package.json +1 -1
  41. package/src/elvia/elvia-config.html +3 -1
  42. package/src/elvia/elvia-config.js +7 -13
  43. package/src/elvia/elvia-tariff-types.js +8 -6
  44. package/src/elvia/elvia-tariff.js +1 -5
  45. package/src/handle-input.js +8 -5
  46. package/src/power-saver.html +8 -8
  47. package/src/receive-price-functions.js +14 -10
  48. package/src/receive-price.js +2 -2
  49. package/src/strategy-best-save.html +8 -8
  50. package/src/strategy-lowest-price.html +11 -11
  51. package/src/strategy-lowest-price.js +3 -3
  52. package/test/data/converted-prices.json +1 -0
  53. package/test/data/tibber-data-end-0-24h.json +197 -0
  54. package/test/data/tibber-data-end-0.json +101 -0
  55. package/test/data/tibber-result-end-0-24h.json +320 -0
  56. package/test/data/tibber-result-end-0.json +168 -0
  57. package/test/receive-price-functions.test.js +20 -0
  58. package/test/receive-price.test.js +4 -4
  59. package/test/strategy-lowest-price.test.js +200 -0
  60. package/docs/.vuepress/dist/assets/js/app.80d4373d.js +0 -1
  61. package/docs/.vuepress/dist/assets/js/runtime~app.665b411c.js +0 -1
  62. package/docs/.vuepress/dist/assets/js/v-08683c60.9edcaa60.js +0 -1
  63. package/docs/.vuepress/dist/assets/js/v-0aca7ba6.5eca5160.js +0 -1
  64. package/docs/.vuepress/dist/assets/js/v-0b5e3c8c.c02472fb.js +0 -1
  65. package/docs/.vuepress/dist/assets/js/v-1ad821fa.a628e907.js +0 -1
  66. package/docs/.vuepress/dist/assets/js/v-30acb564.80b4190d.js +0 -1
  67. package/docs/.vuepress/dist/assets/js/v-4637f9e4.df94c6ea.js +0 -1
  68. package/docs/.vuepress/dist/assets/js/v-510ed0d4.a78d8542.js +0 -1
  69. package/docs/.vuepress/dist/assets/js/v-5954bcb2.4f4712f3.js +0 -1
  70. package/docs/.vuepress/dist/assets/js/v-5db8da3a.2e49b81a.js +0 -1
  71. package/docs/.vuepress/dist/assets/js/v-61f728ca.7b545524.js +0 -1
  72. package/docs/.vuepress/dist/assets/js/v-677dfaed.756e0fb5.js +0 -1
  73. package/docs/.vuepress/dist/assets/js/v-7c87f26e.57507077.js +0 -1
  74. package/docs/.vuepress/dist/assets/js/v-b4a42144.a812c440.js +0 -1
  75. package/docs/.vuepress/dist/assets/js/v-e8c55052.30f30acd.js +0 -1
  76. package/docs/.vuepress/dist/assets/js/v-fffb8e28.850019c1.js +0 -1
@@ -0,0 +1,320 @@
1
+ {
2
+ "schedule": [
3
+ {
4
+ "time": "2021-12-14T00:00:00.000+01:00",
5
+ "value": false
6
+ },
7
+ {
8
+ "time": "2021-12-14T21:00:00.000+01:00",
9
+ "value": true
10
+ },
11
+ {
12
+ "time": "2021-12-15T00:00:00.000+01:00",
13
+ "value": false
14
+ },
15
+ {
16
+ "time": "2021-12-15T21:00:00.000+01:00",
17
+ "value": true
18
+ }
19
+ ],
20
+ "hours": [
21
+ {
22
+ "price": 0.4675,
23
+ "onOff": false,
24
+ "start": "2021-12-14T00:00:00.000+01:00",
25
+ "saving": null
26
+ },
27
+ {
28
+ "price": 0.4488,
29
+ "onOff": false,
30
+ "start": "2021-12-14T01:00:00.000+01:00",
31
+ "saving": null
32
+ },
33
+ {
34
+ "price": 0.4344,
35
+ "onOff": false,
36
+ "start": "2021-12-14T02:00:00.000+01:00",
37
+ "saving": null
38
+ },
39
+ {
40
+ "price": 0.4124,
41
+ "onOff": false,
42
+ "start": "2021-12-14T03:00:00.000+01:00",
43
+ "saving": null
44
+ },
45
+ {
46
+ "price": 0.413,
47
+ "onOff": false,
48
+ "start": "2021-12-14T04:00:00.000+01:00",
49
+ "saving": null
50
+ },
51
+ {
52
+ "price": 0.4232,
53
+ "onOff": false,
54
+ "start": "2021-12-14T05:00:00.000+01:00",
55
+ "saving": null
56
+ },
57
+ {
58
+ "price": 0.4,
59
+ "onOff": false,
60
+ "start": "2021-12-14T06:00:00.000+01:00",
61
+ "saving": null
62
+ },
63
+ {
64
+ "price": 0.4067,
65
+ "onOff": false,
66
+ "start": "2021-12-14T07:00:00.000+01:00",
67
+ "saving": null
68
+ },
69
+ {
70
+ "price": 0.504,
71
+ "onOff": false,
72
+ "start": "2021-12-14T08:00:00.000+01:00",
73
+ "saving": null
74
+ },
75
+ {
76
+ "price": 0.5341,
77
+ "onOff": false,
78
+ "start": "2021-12-14T09:00:00.000+01:00",
79
+ "saving": null
80
+ },
81
+ {
82
+ "price": 0.5179,
83
+ "onOff": false,
84
+ "start": "2021-12-14T10:00:00.000+01:00",
85
+ "saving": null
86
+ },
87
+ {
88
+ "price": 0.5375,
89
+ "onOff": false,
90
+ "start": "2021-12-14T11:00:00.000+01:00",
91
+ "saving": null
92
+ },
93
+ {
94
+ "price": 0.535,
95
+ "onOff": false,
96
+ "start": "2021-12-14T12:00:00.000+01:00",
97
+ "saving": null
98
+ },
99
+ {
100
+ "price": 0.5403,
101
+ "onOff": false,
102
+ "start": "2021-12-14T13:00:00.000+01:00",
103
+ "saving": null
104
+ },
105
+ {
106
+ "price": 0.5291,
107
+ "onOff": false,
108
+ "start": "2021-12-14T14:00:00.000+01:00",
109
+ "saving": null
110
+ },
111
+ {
112
+ "price": 0.5175,
113
+ "onOff": false,
114
+ "start": "2021-12-14T15:00:00.000+01:00",
115
+ "saving": null
116
+ },
117
+ {
118
+ "price": 0.4914,
119
+ "onOff": false,
120
+ "start": "2021-12-14T16:00:00.000+01:00",
121
+ "saving": null
122
+ },
123
+ {
124
+ "price": 0.4698,
125
+ "onOff": false,
126
+ "start": "2021-12-14T17:00:00.000+01:00",
127
+ "saving": null
128
+ },
129
+ {
130
+ "price": 0.4609,
131
+ "onOff": false,
132
+ "start": "2021-12-14T18:00:00.000+01:00",
133
+ "saving": null
134
+ },
135
+ {
136
+ "price": 0.4408,
137
+ "onOff": false,
138
+ "start": "2021-12-14T19:00:00.000+01:00",
139
+ "saving": null
140
+ },
141
+ {
142
+ "price": 0.4263,
143
+ "onOff": false,
144
+ "start": "2021-12-14T20:00:00.000+01:00",
145
+ "saving": null
146
+ },
147
+ {
148
+ "price": 0.3946,
149
+ "onOff": true,
150
+ "start": "2021-12-14T21:00:00.000+01:00",
151
+ "saving": null
152
+ },
153
+ {
154
+ "price": 0.3852,
155
+ "onOff": true,
156
+ "start": "2021-12-14T22:00:00.000+01:00",
157
+ "saving": null
158
+ },
159
+ {
160
+ "price": 0.373,
161
+ "onOff": true,
162
+ "start": "2021-12-14T23:00:00.000+01:00",
163
+ "saving": null
164
+ },
165
+ {
166
+ "price": 0.4675,
167
+ "onOff": false,
168
+ "start": "2021-12-15T00:00:00.000+01:00",
169
+ "saving": null
170
+ },
171
+ {
172
+ "price": 0.4488,
173
+ "onOff": false,
174
+ "start": "2021-12-15T01:00:00.000+01:00",
175
+ "saving": null
176
+ },
177
+ {
178
+ "price": 0.4344,
179
+ "onOff": false,
180
+ "start": "2021-12-15T02:00:00.000+01:00",
181
+ "saving": null
182
+ },
183
+ {
184
+ "price": 0.4124,
185
+ "onOff": false,
186
+ "start": "2021-12-15T03:00:00.000+01:00",
187
+ "saving": null
188
+ },
189
+ {
190
+ "price": 0.413,
191
+ "onOff": false,
192
+ "start": "2021-12-15T04:00:00.000+01:00",
193
+ "saving": null
194
+ },
195
+ {
196
+ "price": 0.4232,
197
+ "onOff": false,
198
+ "start": "2021-12-15T05:00:00.000+01:00",
199
+ "saving": null
200
+ },
201
+ {
202
+ "price": 0.4,
203
+ "onOff": false,
204
+ "start": "2021-12-15T06:00:00.000+01:00",
205
+ "saving": null
206
+ },
207
+ {
208
+ "price": 0.4067,
209
+ "onOff": false,
210
+ "start": "2021-12-15T07:00:00.000+01:00",
211
+ "saving": null
212
+ },
213
+ {
214
+ "price": 0.504,
215
+ "onOff": false,
216
+ "start": "2021-12-15T08:00:00.000+01:00",
217
+ "saving": null
218
+ },
219
+ {
220
+ "price": 0.5341,
221
+ "onOff": false,
222
+ "start": "2021-12-15T09:00:00.000+01:00",
223
+ "saving": null
224
+ },
225
+ {
226
+ "price": 0.5179,
227
+ "onOff": false,
228
+ "start": "2021-12-15T10:00:00.000+01:00",
229
+ "saving": null
230
+ },
231
+ {
232
+ "price": 0.5375,
233
+ "onOff": false,
234
+ "start": "2021-12-15T11:00:00.000+01:00",
235
+ "saving": null
236
+ },
237
+ {
238
+ "price": 0.535,
239
+ "onOff": false,
240
+ "start": "2021-12-15T12:00:00.000+01:00",
241
+ "saving": null
242
+ },
243
+ {
244
+ "price": 0.5403,
245
+ "onOff": false,
246
+ "start": "2021-12-15T13:00:00.000+01:00",
247
+ "saving": null
248
+ },
249
+ {
250
+ "price": 0.5291,
251
+ "onOff": false,
252
+ "start": "2021-12-15T14:00:00.000+01:00",
253
+ "saving": null
254
+ },
255
+ {
256
+ "price": 0.5175,
257
+ "onOff": false,
258
+ "start": "2021-12-15T15:00:00.000+01:00",
259
+ "saving": null
260
+ },
261
+ {
262
+ "price": 0.4914,
263
+ "onOff": false,
264
+ "start": "2021-12-15T16:00:00.000+01:00",
265
+ "saving": null
266
+ },
267
+ {
268
+ "price": 0.4698,
269
+ "onOff": false,
270
+ "start": "2021-12-15T17:00:00.000+01:00",
271
+ "saving": null
272
+ },
273
+ {
274
+ "price": 0.4609,
275
+ "onOff": false,
276
+ "start": "2021-12-15T18:00:00.000+01:00",
277
+ "saving": null
278
+ },
279
+ {
280
+ "price": 0.4408,
281
+ "onOff": false,
282
+ "start": "2021-12-15T19:00:00.000+01:00",
283
+ "saving": null
284
+ },
285
+ {
286
+ "price": 0.4263,
287
+ "onOff": false,
288
+ "start": "2021-12-15T20:00:00.000+01:00",
289
+ "saving": null
290
+ },
291
+ {
292
+ "price": 0.3946,
293
+ "onOff": true,
294
+ "start": "2021-12-15T21:00:00.000+01:00",
295
+ "saving": null
296
+ },
297
+ {
298
+ "price": 0.3852,
299
+ "onOff": true,
300
+ "start": "2021-12-15T22:00:00.000+01:00",
301
+ "saving": null
302
+ },
303
+ {
304
+ "price": 0.373,
305
+ "onOff": true,
306
+ "start": "2021-12-15T23:00:00.000+01:00",
307
+ "saving": null
308
+ }
309
+ ],
310
+ "source": "Tibber",
311
+ "config": {
312
+ "fromTime": "16",
313
+ "toTime": "00",
314
+ "hoursOn": 3,
315
+ "doNotSplit": false,
316
+ "sendCurrentValueWhenRescheduling": true,
317
+ "outputIfNoSchedule": false,
318
+ "outputOutsidePeriod": false
319
+ }
320
+ }
@@ -0,0 +1,168 @@
1
+ {
2
+ "schedule": [
3
+ {
4
+ "time": "2021-12-14T00:00:00.000+01:00",
5
+ "value": false
6
+ },
7
+ {
8
+ "time": "2021-12-14T21:00:00.000+01:00",
9
+ "value": true
10
+ }
11
+ ],
12
+ "hours": [
13
+ {
14
+ "price": 0.4675,
15
+ "onOff": false,
16
+ "start": "2021-12-14T00:00:00.000+01:00",
17
+ "saving": null
18
+ },
19
+ {
20
+ "price": 0.4488,
21
+ "onOff": false,
22
+ "start": "2021-12-14T01:00:00.000+01:00",
23
+ "saving": null
24
+ },
25
+ {
26
+ "price": 0.4344,
27
+ "onOff": false,
28
+ "start": "2021-12-14T02:00:00.000+01:00",
29
+ "saving": null
30
+ },
31
+ {
32
+ "price": 0.4124,
33
+ "onOff": false,
34
+ "start": "2021-12-14T03:00:00.000+01:00",
35
+ "saving": null
36
+ },
37
+ {
38
+ "price": 0.413,
39
+ "onOff": false,
40
+ "start": "2021-12-14T04:00:00.000+01:00",
41
+ "saving": null
42
+ },
43
+ {
44
+ "price": 0.4232,
45
+ "onOff": false,
46
+ "start": "2021-12-14T05:00:00.000+01:00",
47
+ "saving": null
48
+ },
49
+ {
50
+ "price": 0.4,
51
+ "onOff": false,
52
+ "start": "2021-12-14T06:00:00.000+01:00",
53
+ "saving": null
54
+ },
55
+ {
56
+ "price": 0.4067,
57
+ "onOff": false,
58
+ "start": "2021-12-14T07:00:00.000+01:00",
59
+ "saving": null
60
+ },
61
+ {
62
+ "price": 0.504,
63
+ "onOff": false,
64
+ "start": "2021-12-14T08:00:00.000+01:00",
65
+ "saving": null
66
+ },
67
+ {
68
+ "price": 0.5341,
69
+ "onOff": false,
70
+ "start": "2021-12-14T09:00:00.000+01:00",
71
+ "saving": null
72
+ },
73
+ {
74
+ "price": 0.5179,
75
+ "onOff": false,
76
+ "start": "2021-12-14T10:00:00.000+01:00",
77
+ "saving": null
78
+ },
79
+ {
80
+ "price": 0.5375,
81
+ "onOff": false,
82
+ "start": "2021-12-14T11:00:00.000+01:00",
83
+ "saving": null
84
+ },
85
+ {
86
+ "price": 0.535,
87
+ "onOff": false,
88
+ "start": "2021-12-14T12:00:00.000+01:00",
89
+ "saving": null
90
+ },
91
+ {
92
+ "price": 0.5403,
93
+ "onOff": false,
94
+ "start": "2021-12-14T13:00:00.000+01:00",
95
+ "saving": null
96
+ },
97
+ {
98
+ "price": 0.5291,
99
+ "onOff": false,
100
+ "start": "2021-12-14T14:00:00.000+01:00",
101
+ "saving": null
102
+ },
103
+ {
104
+ "price": 0.5175,
105
+ "onOff": false,
106
+ "start": "2021-12-14T15:00:00.000+01:00",
107
+ "saving": null
108
+ },
109
+ {
110
+ "price": 0.4914,
111
+ "onOff": false,
112
+ "start": "2021-12-14T16:00:00.000+01:00",
113
+ "saving": null
114
+ },
115
+ {
116
+ "price": 0.4698,
117
+ "onOff": false,
118
+ "start": "2021-12-14T17:00:00.000+01:00",
119
+ "saving": null
120
+ },
121
+ {
122
+ "price": 0.4609,
123
+ "onOff": false,
124
+ "start": "2021-12-14T18:00:00.000+01:00",
125
+ "saving": null
126
+ },
127
+ {
128
+ "price": 0.4408,
129
+ "onOff": false,
130
+ "start": "2021-12-14T19:00:00.000+01:00",
131
+ "saving": null
132
+ },
133
+ {
134
+ "price": 0.4263,
135
+ "onOff": false,
136
+ "start": "2021-12-14T20:00:00.000+01:00",
137
+ "saving": null
138
+ },
139
+ {
140
+ "price": 0.3946,
141
+ "onOff": true,
142
+ "start": "2021-12-14T21:00:00.000+01:00",
143
+ "saving": null
144
+ },
145
+ {
146
+ "price": 0.3852,
147
+ "onOff": true,
148
+ "start": "2021-12-14T22:00:00.000+01:00",
149
+ "saving": null
150
+ },
151
+ {
152
+ "price": 0.373,
153
+ "onOff": true,
154
+ "start": "2021-12-14T23:00:00.000+01:00",
155
+ "saving": null
156
+ }
157
+ ],
158
+ "source": "Tibber",
159
+ "config": {
160
+ "fromTime": "16",
161
+ "toTime": "00",
162
+ "hoursOn": 3,
163
+ "doNotSplit": false,
164
+ "sendCurrentValueWhenRescheduling": true,
165
+ "outputIfNoSchedule": false,
166
+ "outputOutsidePeriod": false
167
+ }
168
+ }
@@ -40,6 +40,22 @@ describe("receive-price-functions", () => {
40
40
  },
41
41
  },
42
42
  };
43
+ const msgNordpoolTomorrowNull = {
44
+ data: {
45
+ new_state: {
46
+ attributes: {
47
+ raw_today: [
48
+ { value: 1, start: "2021-06-21T00:00:00+02:00" },
49
+ { value: 2, start: "2021-06-21T01:00:00+02:00" },
50
+ ],
51
+ raw_tomorrow: [
52
+ { value: null, start: "2021-06-22T00:00:00+02:00" },
53
+ { value: null, start: "2021-06-22T01:00:00+02:00" },
54
+ ],
55
+ },
56
+ },
57
+ },
58
+ };
43
59
  const msgTibber = {
44
60
  payload: {
45
61
  viewer: {
@@ -145,6 +161,10 @@ describe("receive-price-functions", () => {
145
161
  source: "Nordpool",
146
162
  ...msgStdTodayOnly.payload,
147
163
  });
164
+ expect(convertMsg(msgNordpoolTomorrowNull)).toEqual({
165
+ source: "Nordpool",
166
+ ...msgStdTodayOnly.payload,
167
+ });
148
168
  expect(convertMsg(msgStdTodayOnly)).toEqual({
149
169
  source: "Other",
150
170
  ...msgStdTodayOnly.payload,
@@ -27,7 +27,7 @@ describe("receive-price node", function () {
27
27
  it("should convert tibber prices", function (done) {
28
28
  const tibberPrices = require("./data/tibber-prices.json");
29
29
  const convertedPrices = require("./data/converted-prices.json");
30
- convertedPrices.priceData.source = "Tibber";
30
+ convertedPrices.source = "Tibber";
31
31
  const flow = [
32
32
  {
33
33
  id: "n1",
@@ -51,7 +51,7 @@ describe("receive-price node", function () {
51
51
  it("should convert tibber single home prices", function (done) {
52
52
  const tibberPrices = require("./data/tibber-prices-single-home.json");
53
53
  const convertedPrices = require("./data/converted-prices.json");
54
- convertedPrices.priceData.source = "Tibber";
54
+ convertedPrices.source = "Tibber";
55
55
  const flow = [
56
56
  {
57
57
  id: "n1",
@@ -75,7 +75,7 @@ describe("receive-price node", function () {
75
75
  it("should convert nordpool event prices", function (done) {
76
76
  const nordpoolPrices = require("./data/nordpool-event-prices.json");
77
77
  const convertedPrices = require("./data/converted-prices.json");
78
- convertedPrices.priceData.source = "Nordpool";
78
+ convertedPrices.source = "Nordpool";
79
79
  const flow = [
80
80
  {
81
81
  id: "n1",
@@ -99,7 +99,7 @@ describe("receive-price node", function () {
99
99
  it("should convert nordpool current state prices", function (done) {
100
100
  const nordpoolPrices = require("./data/nordpool-current-state-prices.json");
101
101
  const convertedPrices = require("./data/converted-prices.json");
102
- convertedPrices.priceData.source = "Nordpool";
102
+ convertedPrices.source = "Nordpool";
103
103
  const flow = [
104
104
  {
105
105
  id: "n1",