node-red-contrib-power-saver 3.2.0 → 3.3.0
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/docs/.vuepress/config.js +5 -0
- package/docs/.vuepress/dist/.nojekyll +0 -0
- package/docs/.vuepress/dist/404.html +2 -2
- package/docs/.vuepress/dist/assets/js/{app.eae70176.js → app.49ad6d54.js} +1 -1
- package/docs/.vuepress/dist/assets/js/runtime~app.547d0f4e.js +1 -0
- package/docs/.vuepress/dist/assets/js/v-0b5e3c8c.3b37457f.js +1 -0
- package/docs/.vuepress/dist/assets/js/{v-1e2b191e.50b8fa18.js → v-1e2b191e.98cc227b.js} +1 -1
- package/docs/.vuepress/dist/assets/js/v-4637f9e4.b320f5e8.js +1 -0
- package/docs/.vuepress/dist/assets/js/v-510ed0d4.3c7e0056.js +1 -0
- package/docs/.vuepress/dist/changelog/index.html +3 -3
- package/docs/.vuepress/dist/contribute/index.html +2 -2
- package/docs/.vuepress/dist/examples/example-next-schedule-entity.html +2 -2
- package/docs/.vuepress/dist/examples/example-nordpool-current-state.html +2 -2
- package/docs/.vuepress/dist/examples/example-nordpool-events-state.html +2 -2
- package/docs/.vuepress/dist/examples/example-tibber-mqtt.html +2 -2
- package/docs/.vuepress/dist/examples/index.html +2 -2
- package/docs/.vuepress/dist/faq/index.html +2 -2
- package/docs/.vuepress/dist/guide/index.html +2 -2
- package/docs/.vuepress/dist/index.html +2 -2
- package/docs/.vuepress/dist/nodes/index.html +2 -2
- package/docs/.vuepress/dist/nodes/old-power-saver-doc.html +2 -2
- package/docs/.vuepress/dist/nodes/power-saver.html +2 -2
- package/docs/.vuepress/dist/nodes/ps-elvia-add-tariff.html +2 -2
- package/docs/.vuepress/dist/nodes/ps-general-add-tariff.html +3 -3
- package/docs/.vuepress/dist/nodes/ps-receive-price.html +2 -2
- package/docs/.vuepress/dist/nodes/ps-strategy-best-save.html +4 -4
- package/docs/.vuepress/dist/nodes/ps-strategy-lowest-price.html +4 -4
- package/docs/.vuepress/dist/nodes/strategy-input.html +2 -2
- package/docs/changelog/README.md +22 -0
- package/docs/examples/example-nordpool-current-state.md +0 -1
- package/docs/examples/example-tibber-mqtt.md +0 -1
- package/docs/faq/README.md +5 -1
- package/docs/images/best-save-config.png +0 -0
- package/docs/nodes/ps-strategy-best-save.md +77 -8
- package/docs/nodes/ps-strategy-lowest-price.md +43 -0
- package/package.json +1 -1
- package/src/general-add-tariff-functions.js +0 -1
- package/src/general-add-tariff.js +2 -4
- package/src/handle-input.js +32 -13
- package/src/strategy-best-save.html +0 -21
- package/src/strategy-best-save.js +8 -11
- package/test/commands-input.test.js +47 -0
- package/test/data/best-save-result.json +1 -2
- package/test/data/current-undefined-prices.json +197 -0
- package/test/data/current-undefined-result.json +208 -0
- package/test/data/lowest-price-result-missing-end.json +2 -1
- package/test/data/reconfigResult.js +56 -294
- package/test/data/reconfigResult_old2.js +75 -0
- package/test/data/tibber-result-end-0-24h.json +1 -0
- package/test/data/tibber-result-end-0.json +1 -0
- package/test/send-config-input.test.js +3 -37
- package/test/strategy-best-save-test-utils.js +2 -1
- package/test/test-utils.js +1 -7
- package/test/utils.test.js +0 -33
- package/docs/.vuepress/dist/assets/js/runtime~app.3384c251.js +0 -1
- package/docs/.vuepress/dist/assets/js/v-0b5e3c8c.d62b30f7.js +0 -1
- package/docs/.vuepress/dist/assets/js/v-4637f9e4.b67738ed.js +0 -1
- package/docs/.vuepress/dist/assets/js/v-510ed0d4.528dd6f3.js +0 -1
- package/test/data/adjustedResult.js +0 -302
- package/test/data/adjustedResult_old.js +0 -154
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
schedule: [
|
|
3
|
+
{ time: "2021-06-20T01:50:00.000+02:00", value: false },
|
|
4
|
+
{ time: "2021-06-20T01:50:00.020+02:00", value: true },
|
|
3
5
|
{ time: "2021-06-20T01:50:00.080+02:00", value: false },
|
|
4
6
|
{ time: "2021-06-20T01:50:00.110+02:00", value: true },
|
|
5
7
|
{ time: "2021-06-20T01:50:00.180+02:00", value: false },
|
|
@@ -8,308 +10,68 @@ module.exports = {
|
|
|
8
10
|
{ time: "2021-06-20T01:50:00.250+02:00", value: true },
|
|
9
11
|
{ time: "2021-06-20T01:50:00.330+02:00", value: false },
|
|
10
12
|
{ time: "2021-06-20T01:50:00.360+02:00", value: true },
|
|
11
|
-
{ time: "2021-06-20T01:50:00.
|
|
12
|
-
{ time: "2021-06-20T01:50:00.
|
|
13
|
-
{ time: "2021-06-20T01:50:00.460+02:00", value: false },
|
|
14
|
-
{ time: "2021-06-20T01:50:00.470+02:00", value: true },
|
|
13
|
+
{ time: "2021-06-20T01:50:00.410+02:00", value: false },
|
|
14
|
+
{ time: "2021-06-20T01:50:00.440+02:00", value: true },
|
|
15
15
|
],
|
|
16
16
|
hours: [
|
|
17
|
-
{
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
price: 0.5847,
|
|
67
|
-
onOff: false,
|
|
68
|
-
start: "2021-06-20T01:50:00.080+02:00",
|
|
69
|
-
saving: 0.0723,
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
price: 0.5762,
|
|
73
|
-
onOff: false,
|
|
74
|
-
start: "2021-06-20T01:50:00.090+02:00",
|
|
75
|
-
saving: 0.0638,
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
price: 0.5391,
|
|
79
|
-
onOff: false,
|
|
80
|
-
start: "2021-06-20T01:50:00.100+02:00",
|
|
81
|
-
saving: 0.0267,
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
price: 0.5124,
|
|
85
|
-
onOff: true,
|
|
86
|
-
start: "2021-06-20T01:50:00.110+02:00",
|
|
87
|
-
saving: null,
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
price: 0.504,
|
|
91
|
-
onOff: true,
|
|
92
|
-
start: "2021-06-20T01:50:00.120+02:00",
|
|
93
|
-
saving: null,
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
price: 0.5057,
|
|
97
|
-
onOff: true,
|
|
98
|
-
start: "2021-06-20T01:50:00.130+02:00",
|
|
99
|
-
saving: null,
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
price: 0.5066,
|
|
103
|
-
onOff: true,
|
|
104
|
-
start: "2021-06-20T01:50:00.140+02:00",
|
|
105
|
-
saving: null,
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
price: 0.5136,
|
|
109
|
-
onOff: true,
|
|
110
|
-
start: "2021-06-20T01:50:00.150+02:00",
|
|
111
|
-
saving: null,
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
price: 0.5143,
|
|
115
|
-
onOff: true,
|
|
116
|
-
start: "2021-06-20T01:50:00.160+02:00",
|
|
117
|
-
saving: null,
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
price: 0.5306,
|
|
121
|
-
onOff: true,
|
|
122
|
-
start: "2021-06-20T01:50:00.170+02:00",
|
|
123
|
-
saving: null,
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
price: 0.5534,
|
|
127
|
-
onOff: false,
|
|
128
|
-
start: "2021-06-20T01:50:00.180+02:00",
|
|
129
|
-
saving: 0.0043,
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
price: 0.5511,
|
|
133
|
-
onOff: false,
|
|
134
|
-
start: "2021-06-20T01:50:00.190+02:00",
|
|
135
|
-
saving: 0.002,
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
price: 0.5491,
|
|
139
|
-
onOff: true,
|
|
140
|
-
start: "2021-06-20T01:50:00.200+02:00",
|
|
141
|
-
saving: null,
|
|
142
|
-
},
|
|
143
|
-
{
|
|
144
|
-
price: 0.5485,
|
|
145
|
-
onOff: true,
|
|
146
|
-
start: "2021-06-20T01:50:00.210+02:00",
|
|
147
|
-
saving: null,
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
price: 0.5481,
|
|
151
|
-
onOff: false,
|
|
152
|
-
start: "2021-06-20T01:50:00.220+02:00",
|
|
153
|
-
saving: 0.1285,
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
price: 0.5218,
|
|
157
|
-
onOff: false,
|
|
158
|
-
start: "2021-06-20T01:50:00.230+02:00",
|
|
159
|
-
saving: 0.1022,
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
price: 0.4533,
|
|
163
|
-
onOff: false,
|
|
164
|
-
start: "2021-06-20T01:50:00.240+02:00",
|
|
165
|
-
saving: 0.0337,
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
price: 0.4196,
|
|
169
|
-
onOff: true,
|
|
170
|
-
start: "2021-06-20T01:50:00.250+02:00",
|
|
171
|
-
saving: null,
|
|
172
|
-
},
|
|
173
|
-
{
|
|
174
|
-
price: 0.4037,
|
|
175
|
-
onOff: true,
|
|
176
|
-
start: "2021-06-20T01:50:00.260+02:00",
|
|
177
|
-
saving: null,
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
price: 0.3829,
|
|
181
|
-
onOff: true,
|
|
182
|
-
start: "2021-06-20T01:50:00.270+02:00",
|
|
183
|
-
saving: null,
|
|
184
|
-
},
|
|
185
|
-
{
|
|
186
|
-
price: 0.4555,
|
|
187
|
-
onOff: true,
|
|
188
|
-
start: "2021-06-20T01:50:00.280+02:00",
|
|
189
|
-
saving: null,
|
|
190
|
-
},
|
|
191
|
-
{
|
|
192
|
-
price: 0.4721,
|
|
193
|
-
onOff: true,
|
|
194
|
-
start: "2021-06-20T01:50:00.290+02:00",
|
|
195
|
-
saving: null,
|
|
196
|
-
},
|
|
197
|
-
{
|
|
198
|
-
price: 0.4903,
|
|
199
|
-
onOff: true,
|
|
200
|
-
start: "2021-06-20T01:50:00.300+02:00",
|
|
201
|
-
saving: null,
|
|
202
|
-
},
|
|
203
|
-
{
|
|
204
|
-
price: 0.5028,
|
|
205
|
-
onOff: true,
|
|
206
|
-
start: "2021-06-20T01:50:00.310+02:00",
|
|
207
|
-
saving: null,
|
|
208
|
-
},
|
|
209
|
-
{
|
|
210
|
-
price: 0.5163,
|
|
211
|
-
onOff: true,
|
|
212
|
-
start: "2021-06-20T01:50:00.320+02:00",
|
|
213
|
-
saving: null,
|
|
214
|
-
},
|
|
215
|
-
{
|
|
216
|
-
price: 0.5264,
|
|
217
|
-
onOff: false,
|
|
218
|
-
start: "2021-06-20T01:50:00.330+02:00",
|
|
219
|
-
saving: 0.0193,
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
price: 0.5346,
|
|
223
|
-
onOff: false,
|
|
224
|
-
start: "2021-06-20T01:50:00.340+02:00",
|
|
225
|
-
saving: 0.0275,
|
|
226
|
-
},
|
|
227
|
-
{
|
|
228
|
-
price: 0.5224,
|
|
229
|
-
onOff: false,
|
|
230
|
-
start: "2021-06-20T01:50:00.350+02:00",
|
|
231
|
-
saving: 0.0153,
|
|
232
|
-
},
|
|
233
|
-
{
|
|
234
|
-
price: 0.5071,
|
|
235
|
-
onOff: true,
|
|
236
|
-
start: "2021-06-20T01:50:00.360+02:00",
|
|
237
|
-
saving: null,
|
|
238
|
-
},
|
|
239
|
-
{
|
|
240
|
-
price: 0.5045,
|
|
241
|
-
onOff: true,
|
|
242
|
-
start: "2021-06-20T01:50:00.370+02:00",
|
|
243
|
-
saving: null,
|
|
244
|
-
},
|
|
245
|
-
{
|
|
246
|
-
price: 0.5024,
|
|
247
|
-
onOff: true,
|
|
248
|
-
start: "2021-06-20T01:50:00.380+02:00",
|
|
249
|
-
saving: null,
|
|
250
|
-
},
|
|
251
|
-
{
|
|
252
|
-
price: 0.5038,
|
|
253
|
-
onOff: true,
|
|
254
|
-
start: "2021-06-20T01:50:00.390+02:00",
|
|
255
|
-
saving: null,
|
|
256
|
-
},
|
|
257
|
-
{
|
|
258
|
-
price: 0.5118,
|
|
259
|
-
onOff: false,
|
|
260
|
-
start: "2021-06-20T01:50:00.400+02:00",
|
|
261
|
-
saving: 0.0063,
|
|
262
|
-
},
|
|
263
|
-
{
|
|
264
|
-
price: 0.5111,
|
|
265
|
-
onOff: false,
|
|
266
|
-
start: "2021-06-20T01:50:00.410+02:00",
|
|
267
|
-
saving: 0.0056,
|
|
268
|
-
},
|
|
269
|
-
{
|
|
270
|
-
price: 0.5108,
|
|
271
|
-
onOff: false,
|
|
272
|
-
start: "2021-06-20T01:50:00.420+02:00",
|
|
273
|
-
saving: 0.0053,
|
|
274
|
-
},
|
|
275
|
-
{
|
|
276
|
-
price: 0.5055,
|
|
277
|
-
onOff: true,
|
|
278
|
-
start: "2021-06-20T01:50:00.430+02:00",
|
|
279
|
-
saving: null,
|
|
280
|
-
},
|
|
281
|
-
{
|
|
282
|
-
price: 0.5042,
|
|
283
|
-
onOff: true,
|
|
284
|
-
start: "2021-06-20T01:50:00.440+02:00",
|
|
285
|
-
saving: null,
|
|
286
|
-
},
|
|
287
|
-
{
|
|
288
|
-
price: 0.5259,
|
|
289
|
-
onOff: true,
|
|
290
|
-
start: "2021-06-20T01:50:00.450+02:00",
|
|
291
|
-
saving: null,
|
|
292
|
-
},
|
|
293
|
-
{
|
|
294
|
-
price: 0.5282,
|
|
295
|
-
onOff: false,
|
|
296
|
-
start: "2021-06-20T01:50:00.460+02:00",
|
|
297
|
-
saving: 0.003,
|
|
298
|
-
},
|
|
299
|
-
{
|
|
300
|
-
price: 0.5252,
|
|
301
|
-
onOff: true,
|
|
302
|
-
start: "2021-06-20T01:50:00.470+02:00",
|
|
303
|
-
saving: null,
|
|
304
|
-
},
|
|
17
|
+
{ price: 0.2494, onOff: false, start: "2021-06-20T01:50:00.000+02:00", saving: 0.0395 },
|
|
18
|
+
{ price: 0.2209, onOff: false, start: "2021-06-20T01:50:00.010+02:00", saving: 0.011 },
|
|
19
|
+
{ price: 0.2099, onOff: true, start: "2021-06-20T01:50:00.020+02:00", saving: null },
|
|
20
|
+
{ price: 0.219, onOff: true, start: "2021-06-20T01:50:00.030+02:00", saving: null },
|
|
21
|
+
{ price: 0.2614, onOff: true, start: "2021-06-20T01:50:00.040+02:00", saving: null },
|
|
22
|
+
{ price: 0.4426, onOff: true, start: "2021-06-20T01:50:00.050+02:00", saving: null },
|
|
23
|
+
{ price: 0.5433, onOff: true, start: "2021-06-20T01:50:00.060+02:00", saving: null },
|
|
24
|
+
{ price: 0.5667, onOff: true, start: "2021-06-20T01:50:00.070+02:00", saving: null },
|
|
25
|
+
{ price: 0.5847, onOff: false, start: "2021-06-20T01:50:00.080+02:00", saving: 0.0723 },
|
|
26
|
+
{ price: 0.5762, onOff: false, start: "2021-06-20T01:50:00.090+02:00", saving: 0.0638 },
|
|
27
|
+
{ price: 0.5391, onOff: false, start: "2021-06-20T01:50:00.100+02:00", saving: 0.0267 },
|
|
28
|
+
{ price: 0.5124, onOff: true, start: "2021-06-20T01:50:00.110+02:00", saving: null },
|
|
29
|
+
{ price: 0.504, onOff: true, start: "2021-06-20T01:50:00.120+02:00", saving: null },
|
|
30
|
+
{ price: 0.5057, onOff: true, start: "2021-06-20T01:50:00.130+02:00", saving: null },
|
|
31
|
+
{ price: 0.5066, onOff: true, start: "2021-06-20T01:50:00.140+02:00", saving: null },
|
|
32
|
+
{ price: 0.5136, onOff: true, start: "2021-06-20T01:50:00.150+02:00", saving: null },
|
|
33
|
+
{ price: 0.5143, onOff: true, start: "2021-06-20T01:50:00.160+02:00", saving: null },
|
|
34
|
+
{ price: 0.5306, onOff: true, start: "2021-06-20T01:50:00.170+02:00", saving: null },
|
|
35
|
+
{ price: 0.5534, onOff: false, start: "2021-06-20T01:50:00.180+02:00", saving: 0.0043 },
|
|
36
|
+
{ price: 0.5511, onOff: false, start: "2021-06-20T01:50:00.190+02:00", saving: 0.002 },
|
|
37
|
+
{ price: 0.5491, onOff: true, start: "2021-06-20T01:50:00.200+02:00", saving: null },
|
|
38
|
+
{ price: 0.5485, onOff: true, start: "2021-06-20T01:50:00.210+02:00", saving: null },
|
|
39
|
+
{ price: 0.5481, onOff: false, start: "2021-06-20T01:50:00.220+02:00", saving: 0.1285 },
|
|
40
|
+
{ price: 0.5218, onOff: false, start: "2021-06-20T01:50:00.230+02:00", saving: 0.1022 },
|
|
41
|
+
{ price: 0.4533, onOff: false, start: "2021-06-20T01:50:00.240+02:00", saving: 0.0337 },
|
|
42
|
+
{ price: 0.4196, onOff: true, start: "2021-06-20T01:50:00.250+02:00", saving: null },
|
|
43
|
+
{ price: 0.4037, onOff: true, start: "2021-06-20T01:50:00.260+02:00", saving: null },
|
|
44
|
+
{ price: 0.3829, onOff: true, start: "2021-06-20T01:50:00.270+02:00", saving: null },
|
|
45
|
+
{ price: 0.4555, onOff: true, start: "2021-06-20T01:50:00.280+02:00", saving: null },
|
|
46
|
+
{ price: 0.4721, onOff: true, start: "2021-06-20T01:50:00.290+02:00", saving: null },
|
|
47
|
+
{ price: 0.4903, onOff: true, start: "2021-06-20T01:50:00.300+02:00", saving: null },
|
|
48
|
+
{ price: 0.5028, onOff: true, start: "2021-06-20T01:50:00.310+02:00", saving: null },
|
|
49
|
+
{ price: 0.5163, onOff: true, start: "2021-06-20T01:50:00.320+02:00", saving: null },
|
|
50
|
+
{ price: 0.5264, onOff: false, start: "2021-06-20T01:50:00.330+02:00", saving: 0.0193 },
|
|
51
|
+
{ price: 0.5346, onOff: false, start: "2021-06-20T01:50:00.340+02:00", saving: 0.0275 },
|
|
52
|
+
{ price: 0.5224, onOff: false, start: "2021-06-20T01:50:00.350+02:00", saving: 0.0153 },
|
|
53
|
+
{ price: 0.5071, onOff: true, start: "2021-06-20T01:50:00.360+02:00", saving: null },
|
|
54
|
+
{ price: 0.5045, onOff: true, start: "2021-06-20T01:50:00.370+02:00", saving: null },
|
|
55
|
+
{ price: 0.5024, onOff: true, start: "2021-06-20T01:50:00.380+02:00", saving: null },
|
|
56
|
+
{ price: 0.5038, onOff: true, start: "2021-06-20T01:50:00.390+02:00", saving: null },
|
|
57
|
+
{ price: 0.5118, onOff: true, start: "2021-06-20T01:50:00.400+02:00", saving: null },
|
|
58
|
+
{ price: 0.5111, onOff: false, start: "2021-06-20T01:50:00.410+02:00", saving: 0.0069 },
|
|
59
|
+
{ price: 0.5108, onOff: false, start: "2021-06-20T01:50:00.420+02:00", saving: 0.0066 },
|
|
60
|
+
{ price: 0.5055, onOff: false, start: "2021-06-20T01:50:00.430+02:00", saving: 0.0013 },
|
|
61
|
+
{ price: 0.5042, onOff: true, start: "2021-06-20T01:50:00.440+02:00", saving: null },
|
|
62
|
+
{ price: 0.5259, onOff: true, start: "2021-06-20T01:50:00.450+02:00", saving: null },
|
|
63
|
+
{ price: 0.5282, onOff: true, start: "2021-06-20T01:50:00.460+02:00", saving: null },
|
|
64
|
+
{ price: 0.5252, onOff: true, start: "2021-06-20T01:50:00.470+02:00", saving: null },
|
|
305
65
|
],
|
|
306
66
|
source: undefined,
|
|
307
67
|
config: {
|
|
308
68
|
maxHoursToSaveInSequence: 3,
|
|
309
|
-
minHoursOnAfterMaxSequenceSaved:
|
|
69
|
+
minHoursOnAfterMaxSequenceSaved: 5,
|
|
310
70
|
minSaving: 0.001,
|
|
311
71
|
sendCurrentValueWhenRescheduling: undefined,
|
|
312
72
|
outputIfNoSchedule: false,
|
|
313
|
-
scheduleOnlyFromCurrentTime: true,
|
|
314
73
|
},
|
|
74
|
+
time: "2021-06-20T01:50:00.045+02:00",
|
|
75
|
+
version: "3.2.3",
|
|
76
|
+
current: true,
|
|
315
77
|
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
schedule: [
|
|
3
|
+
{ time: "2021-06-20T01:50:00.080+02:00", value: false },
|
|
4
|
+
{ time: "2021-06-20T01:50:00.110+02:00", value: true },
|
|
5
|
+
{ time: "2021-06-20T01:50:00.180+02:00", value: false },
|
|
6
|
+
{ time: "2021-06-20T01:50:00.200+02:00", value: true },
|
|
7
|
+
{ time: "2021-06-20T01:50:00.220+02:00", value: false },
|
|
8
|
+
{ time: "2021-06-20T01:50:00.250+02:00", value: true },
|
|
9
|
+
{ time: "2021-06-20T01:50:00.330+02:00", value: false },
|
|
10
|
+
{ time: "2021-06-20T01:50:00.360+02:00", value: true },
|
|
11
|
+
{ time: "2021-06-20T01:50:00.400+02:00", value: false },
|
|
12
|
+
{ time: "2021-06-20T01:50:00.430+02:00", value: true },
|
|
13
|
+
{ time: "2021-06-20T01:50:00.460+02:00", value: false },
|
|
14
|
+
{ time: "2021-06-20T01:50:00.470+02:00", value: true },
|
|
15
|
+
],
|
|
16
|
+
hours: [
|
|
17
|
+
{ price: 0.2494, onOff: false, start: "2021-06-20T01:50:00.000+02:00", saving: 0.0395 },
|
|
18
|
+
{ price: 0.2209, onOff: false, start: "2021-06-20T01:50:00.010+02:00", saving: 0.011 },
|
|
19
|
+
{ price: 0.2099, onOff: true, start: "2021-06-20T01:50:00.020+02:00", saving: null },
|
|
20
|
+
{ price: 0.219, onOff: true, start: "2021-06-20T01:50:00.030+02:00", saving: null },
|
|
21
|
+
{ price: 0.2614, onOff: true, start: "2021-06-20T01:50:00.040+02:00", saving: null },
|
|
22
|
+
{ price: 0.4426, onOff: true, start: "2021-06-20T01:50:00.050+02:00", saving: null },
|
|
23
|
+
{ price: 0.5433, onOff: true, start: "2021-06-20T01:50:00.060+02:00", saving: null },
|
|
24
|
+
{ price: 0.5667, onOff: true, start: "2021-06-20T01:50:00.070+02:00", saving: null },
|
|
25
|
+
{ price: 0.5847, onOff: false, start: "2021-06-20T01:50:00.080+02:00", saving: 0.0723 },
|
|
26
|
+
{ price: 0.5762, onOff: false, start: "2021-06-20T01:50:00.090+02:00", saving: 0.0638 },
|
|
27
|
+
{ price: 0.5391, onOff: false, start: "2021-06-20T01:50:00.100+02:00", saving: 0.0267 },
|
|
28
|
+
{ price: 0.5124, onOff: true, start: "2021-06-20T01:50:00.110+02:00", saving: null },
|
|
29
|
+
{ price: 0.504, onOff: true, start: "2021-06-20T01:50:00.120+02:00", saving: null },
|
|
30
|
+
{ price: 0.5057, onOff: true, start: "2021-06-20T01:50:00.130+02:00", saving: null },
|
|
31
|
+
{ price: 0.5066, onOff: true, start: "2021-06-20T01:50:00.140+02:00", saving: null },
|
|
32
|
+
{ price: 0.5136, onOff: true, start: "2021-06-20T01:50:00.150+02:00", saving: null },
|
|
33
|
+
{ price: 0.5143, onOff: true, start: "2021-06-20T01:50:00.160+02:00", saving: null },
|
|
34
|
+
{ price: 0.5306, onOff: true, start: "2021-06-20T01:50:00.170+02:00", saving: null },
|
|
35
|
+
{ price: 0.5534, onOff: false, start: "2021-06-20T01:50:00.180+02:00", saving: 0.0043 },
|
|
36
|
+
{ price: 0.5511, onOff: false, start: "2021-06-20T01:50:00.190+02:00", saving: 0.002 },
|
|
37
|
+
{ price: 0.5491, onOff: true, start: "2021-06-20T01:50:00.200+02:00", saving: null },
|
|
38
|
+
{ price: 0.5485, onOff: true, start: "2021-06-20T01:50:00.210+02:00", saving: null },
|
|
39
|
+
{ price: 0.5481, onOff: false, start: "2021-06-20T01:50:00.220+02:00", saving: 0.1285 },
|
|
40
|
+
{ price: 0.5218, onOff: false, start: "2021-06-20T01:50:00.230+02:00", saving: 0.1022 },
|
|
41
|
+
{ price: 0.4533, onOff: false, start: "2021-06-20T01:50:00.240+02:00", saving: 0.0337 },
|
|
42
|
+
{ price: 0.4196, onOff: true, start: "2021-06-20T01:50:00.250+02:00", saving: null },
|
|
43
|
+
{ price: 0.4037, onOff: true, start: "2021-06-20T01:50:00.260+02:00", saving: null },
|
|
44
|
+
{ price: 0.3829, onOff: true, start: "2021-06-20T01:50:00.270+02:00", saving: null },
|
|
45
|
+
{ price: 0.4555, onOff: true, start: "2021-06-20T01:50:00.280+02:00", saving: null },
|
|
46
|
+
{ price: 0.4721, onOff: true, start: "2021-06-20T01:50:00.290+02:00", saving: null },
|
|
47
|
+
{ price: 0.4903, onOff: true, start: "2021-06-20T01:50:00.300+02:00", saving: null },
|
|
48
|
+
{ price: 0.5028, onOff: true, start: "2021-06-20T01:50:00.310+02:00", saving: null },
|
|
49
|
+
{ price: 0.5163, onOff: true, start: "2021-06-20T01:50:00.320+02:00", saving: null },
|
|
50
|
+
{ price: 0.5264, onOff: false, start: "2021-06-20T01:50:00.330+02:00", saving: 0.0193 },
|
|
51
|
+
{ price: 0.5346, onOff: false, start: "2021-06-20T01:50:00.340+02:00", saving: 0.0275 },
|
|
52
|
+
{ price: 0.5224, onOff: false, start: "2021-06-20T01:50:00.350+02:00", saving: 0.0153 },
|
|
53
|
+
{ price: 0.5071, onOff: true, start: "2021-06-20T01:50:00.360+02:00", saving: null },
|
|
54
|
+
{ price: 0.5045, onOff: true, start: "2021-06-20T01:50:00.370+02:00", saving: null },
|
|
55
|
+
{ price: 0.5024, onOff: true, start: "2021-06-20T01:50:00.380+02:00", saving: null },
|
|
56
|
+
{ price: 0.5038, onOff: true, start: "2021-06-20T01:50:00.390+02:00", saving: null },
|
|
57
|
+
{ price: 0.5118, onOff: false, start: "2021-06-20T01:50:00.400+02:00", saving: 0.0063 },
|
|
58
|
+
{ price: 0.5111, onOff: false, start: "2021-06-20T01:50:00.410+02:00", saving: 0.0056 },
|
|
59
|
+
{ price: 0.5108, onOff: false, start: "2021-06-20T01:50:00.420+02:00", saving: 0.0053 },
|
|
60
|
+
{ price: 0.5055, onOff: true, start: "2021-06-20T01:50:00.430+02:00", saving: null },
|
|
61
|
+
{ price: 0.5042, onOff: true, start: "2021-06-20T01:50:00.440+02:00", saving: null },
|
|
62
|
+
{ price: 0.5259, onOff: true, start: "2021-06-20T01:50:00.450+02:00", saving: null },
|
|
63
|
+
{ price: 0.5282, onOff: false, start: "2021-06-20T01:50:00.460+02:00", saving: 0.003 },
|
|
64
|
+
{ price: 0.5252, onOff: true, start: "2021-06-20T01:50:00.470+02:00", saving: null },
|
|
65
|
+
],
|
|
66
|
+
source: undefined,
|
|
67
|
+
config: {
|
|
68
|
+
maxHoursToSaveInSequence: 3,
|
|
69
|
+
minHoursOnAfterMaxSequenceSaved: 2,
|
|
70
|
+
minSaving: 0.001,
|
|
71
|
+
sendCurrentValueWhenRescheduling: undefined,
|
|
72
|
+
outputIfNoSchedule: false,
|
|
73
|
+
scheduleOnlyFromCurrentTime: true,
|
|
74
|
+
},
|
|
75
|
+
};
|
|
@@ -5,7 +5,6 @@ const { DateTime } = require("luxon");
|
|
|
5
5
|
const prices = require("./data/converted-prices.json");
|
|
6
6
|
const result = require("./data/best-save-result.json");
|
|
7
7
|
const reconfigResult = require("./data/reconfigResult");
|
|
8
|
-
const adjustedResult = require("./data/adjustedResult");
|
|
9
8
|
const { testPlan, equalPlan } = require("./test-utils");
|
|
10
9
|
const { makeFlow, makePayload } = require("./strategy-best-save-test-utils");
|
|
11
10
|
const cloneDeep = require("lodash.clonedeep");
|
|
@@ -50,9 +49,8 @@ describe("send config as input", () => {
|
|
|
50
49
|
n1.receive({ payload: makePayload(prices, testPlan.time) });
|
|
51
50
|
});
|
|
52
51
|
});
|
|
53
|
-
it("should
|
|
52
|
+
it("should use another minHoursOnAfterMaxSequenceSaved", function (done) {
|
|
54
53
|
const flow = makeFlow(3, 2);
|
|
55
|
-
flow[0].scheduleOnlyFromCurrentTime = false;
|
|
56
54
|
const changeTime = DateTime.fromISO("2021-06-20T01:50:00.045+02:00");
|
|
57
55
|
let pass = 1;
|
|
58
56
|
helper.load(bestSave, flow, function () {
|
|
@@ -65,14 +63,14 @@ describe("send config as input", () => {
|
|
|
65
63
|
expect(equalPlan(result, msg.payload)).toBeTruthy();
|
|
66
64
|
n1.receive({
|
|
67
65
|
payload: {
|
|
68
|
-
config: {
|
|
66
|
+
config: { minHoursOnAfterMaxSequenceSaved: 5 },
|
|
69
67
|
time: changeTime,
|
|
70
68
|
},
|
|
71
69
|
});
|
|
72
70
|
break;
|
|
73
71
|
case 2:
|
|
74
72
|
pass++;
|
|
75
|
-
reconfigResult.config.
|
|
73
|
+
reconfigResult.config.minHoursOnAfterMaxSequenceSaved = 5;
|
|
76
74
|
expect(equalPlan(reconfigResult, msg.payload)).toBeTruthy();
|
|
77
75
|
const payload = makePayload(prices, testPlan.time);
|
|
78
76
|
payload.time = changeTime;
|
|
@@ -87,38 +85,6 @@ describe("send config as input", () => {
|
|
|
87
85
|
n1.receive({ payload: makePayload(prices, testPlan.time) });
|
|
88
86
|
});
|
|
89
87
|
});
|
|
90
|
-
it("should correct savings for passed hours", function (done) {
|
|
91
|
-
const flow = makeFlow(3, 2);
|
|
92
|
-
const changeTime = DateTime.fromISO("2021-06-20T01:50:00.045+02:00");
|
|
93
|
-
let pass = 1;
|
|
94
|
-
helper.load(bestSave, flow, function () {
|
|
95
|
-
const n1 = helper.getNode("n1");
|
|
96
|
-
const n2 = helper.getNode("n2");
|
|
97
|
-
n2.on("input", function (msg) {
|
|
98
|
-
switch (pass) {
|
|
99
|
-
case 1:
|
|
100
|
-
pass++;
|
|
101
|
-
expect(equalPlan(result, msg.payload)).toBeTruthy();
|
|
102
|
-
n1.receive({
|
|
103
|
-
payload: {
|
|
104
|
-
config: {
|
|
105
|
-
maxHoursToSaveInSequence: 5,
|
|
106
|
-
minSaving: 0.25,
|
|
107
|
-
scheduleOnlyFromCurrentTime: true,
|
|
108
|
-
},
|
|
109
|
-
time: changeTime,
|
|
110
|
-
},
|
|
111
|
-
});
|
|
112
|
-
break;
|
|
113
|
-
case 2:
|
|
114
|
-
pass++;
|
|
115
|
-
expect(equalPlan(adjustedResult, msg.payload)).toBeTruthy();
|
|
116
|
-
done();
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
n1.receive({ payload: makePayload(prices, testPlan.time) });
|
|
120
|
-
});
|
|
121
|
-
});
|
|
122
88
|
it("should accept config and price-data together", function (done) {
|
|
123
89
|
const flow = makeFlow(3, 2);
|
|
124
90
|
let pass = 1;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const cloneDeep = require("lodash.clonedeep");
|
|
2
2
|
const { DateTime } = require("luxon");
|
|
3
3
|
|
|
4
|
-
function makeFlow(maxHoursToSaveInSequence, minHoursOnAfterMaxSequenceSaved) {
|
|
4
|
+
function makeFlow(maxHoursToSaveInSequence, minHoursOnAfterMaxSequenceSaved, sendCurrentValueWhenRescheduling = false) {
|
|
5
5
|
return [
|
|
6
6
|
{
|
|
7
7
|
id: "n1",
|
|
@@ -9,6 +9,7 @@ function makeFlow(maxHoursToSaveInSequence, minHoursOnAfterMaxSequenceSaved) {
|
|
|
9
9
|
name: "test name",
|
|
10
10
|
maxHoursToSaveInSequence,
|
|
11
11
|
minHoursOnAfterMaxSequenceSaved,
|
|
12
|
+
sendCurrentValueWhenRescheduling,
|
|
12
13
|
minSaving: 0.001,
|
|
13
14
|
wires: [["n3"], ["n4"], ["n2"]],
|
|
14
15
|
},
|
package/test/test-utils.js
CHANGED
|
@@ -81,13 +81,7 @@ function equalPlan(expected, actual) {
|
|
|
81
81
|
});
|
|
82
82
|
});
|
|
83
83
|
|
|
84
|
-
[
|
|
85
|
-
"maxHoursToSaveInSequence",
|
|
86
|
-
"minHoursOnAfterMaxSequenceSaved",
|
|
87
|
-
"minSaving",
|
|
88
|
-
"outputIfNoSchedule",
|
|
89
|
-
"scheduleOnlyFromCurrentTime",
|
|
90
|
-
].forEach((key) => {
|
|
84
|
+
["maxHoursToSaveInSequence", "minHoursOnAfterMaxSequenceSaved", "minSaving", "outputIfNoSchedule"].forEach((key) => {
|
|
91
85
|
if (expected.config[key] != actual.config[key]) {
|
|
92
86
|
console.log(
|
|
93
87
|
"Different config values for " + key + ": Expected " + expected.config[key] + ", got " + actual.config[key]
|
package/test/utils.test.js
CHANGED
|
@@ -196,37 +196,4 @@ describe("utils", () => {
|
|
|
196
196
|
};
|
|
197
197
|
expect(extractPlanForDate(plan, "2021-06-20T01:50:00.000+02:00")).toEqual(part1);
|
|
198
198
|
});
|
|
199
|
-
|
|
200
|
-
it("can get the correct startAt index", () => {
|
|
201
|
-
const config = { scheduleOnlyFromCurrentTime: true };
|
|
202
|
-
const time = DateTime.fromISO("2021-06-20T01:50:00.012+02:00");
|
|
203
|
-
const priceData = [
|
|
204
|
-
{
|
|
205
|
-
start: "2021-06-20T01:50:00.000+02:00",
|
|
206
|
-
},
|
|
207
|
-
{
|
|
208
|
-
start: "2021-06-20T01:50:00.010+02:00",
|
|
209
|
-
},
|
|
210
|
-
{
|
|
211
|
-
start: "2021-06-21T01:50:00.180+02:00",
|
|
212
|
-
},
|
|
213
|
-
{
|
|
214
|
-
start: "2021-06-21T01:50:00.190+02:00",
|
|
215
|
-
},
|
|
216
|
-
];
|
|
217
|
-
expect(
|
|
218
|
-
// Start on 0
|
|
219
|
-
getStartAtIndex({ scheduleOnlyFromCurrentTime: false }, priceData, time)
|
|
220
|
-
).toEqual(0);
|
|
221
|
-
expect(getStartAtIndex(config, priceData, time)).toEqual(2);
|
|
222
|
-
expect(
|
|
223
|
-
// Start exactly on time
|
|
224
|
-
getStartAtIndex(config, priceData, DateTime.fromISO("2021-06-20T01:50:00.010+02:00"))
|
|
225
|
-
).toEqual(1);
|
|
226
|
-
expect(getStartAtIndex(config, priceData, DateTime.fromISO("2021-06-20T01:50:00.011+02:00"))).toEqual(2);
|
|
227
|
-
expect(
|
|
228
|
-
// Start later than all data
|
|
229
|
-
getStartAtIndex(config, priceData, DateTime.fromISO("2021-06-21T01:50:00.200+02:00"))
|
|
230
|
-
).toEqual(4);
|
|
231
|
-
});
|
|
232
199
|
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(()=>{"use strict";var e,r,t,a={},o={};function n(e){var r=o[e];if(void 0!==r)return r.exports;var t=o[e]={exports:{}};return a[e].call(t.exports,t,t.exports,n),t.exports}n.m=a,e=[],n.O=(r,t,a,o)=>{if(!t){var d=1/0;for(c=0;c<e.length;c++){for(var[t,a,o]=e[c],f=!0,i=0;i<t.length;i++)(!1&o||d>=o)&&Object.keys(n.O).every((e=>n.O[e](t[i])))?t.splice(i--,1):(f=!1,o<d&&(d=o));if(f){e.splice(c--,1);var v=a();void 0!==v&&(r=v)}}return r}o=o||0;for(var c=e.length;c>0&&e[c-1][2]>o;c--)e[c]=e[c-1];e[c]=[t,a,o]},n.d=(e,r)=>{for(var t in r)n.o(r,t)&&!n.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},n.f={},n.e=e=>Promise.all(Object.keys(n.f).reduce(((r,t)=>(n.f[t](e,r),r)),[])),n.u=e=>"assets/js/"+({22:"v-1ad821fa",27:"v-0aca7ba6",35:"v-0607240a",88:"v-3706649a",283:"v-61f728ca",317:"v-5954bcb2",332:"v-08683c60",363:"v-0b5e3c8c",407:"v-b4a42144",418:"v-4637f9e4",495:"v-510ed0d4",509:"v-8daa1a0e",625:"v-5db8da3a",651:"v-e8c55052",737:"v-1e2b191e",745:"v-677dfaed",807:"v-fffb8e28",889:"v-7c87f26e",901:"v-30acb564",969:"v-7446a652"}[e]||e)+"."+{22:"6e2194d0",27:"b42fad7f",35:"661e1808",88:"d7f73384",283:"6fdbbb92",293:"5e967839",317:"182daf70",332:"a6b9cf5b",363:"d62b30f7",407:"9e5f9728",418:"b67738ed",491:"c183eba3",495:"528dd6f3",509:"dde202c9",625:"f2de6cb9",651:"8384b053",737:"50b8fa18",745:"0013f083",807:"3406fd88",889:"1127dcf5",901:"f2fcd69f",969:"d05e2648"}[e]+".js",n.miniCssF=e=>{},n.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r={},t="node-red-contrib-power-saver:",n.l=(e,a,o,d)=>{if(r[e])r[e].push(a);else{var f,i;if(void 0!==o)for(var v=document.getElementsByTagName("script"),c=0;c<v.length;c++){var s=v[c];if(s.getAttribute("src")==e||s.getAttribute("data-webpack")==t+o){f=s;break}}f||(i=!0,(f=document.createElement("script")).charset="utf-8",f.timeout=120,n.nc&&f.setAttribute("nonce",n.nc),f.setAttribute("data-webpack",t+o),f.src=e),r[e]=[a];var l=(t,a)=>{f.onerror=f.onload=null,clearTimeout(b);var o=r[e];if(delete r[e],f.parentNode&&f.parentNode.removeChild(f),o&&o.forEach((e=>e(a))),t)return t(a)},b=setTimeout(l.bind(null,void 0,{type:"timeout",target:f}),12e4);f.onerror=l.bind(null,f.onerror),f.onload=l.bind(null,f.onload),i&&document.head.appendChild(f)}},n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.p="/node-red-contrib-power-saver/",(()=>{var e={523:0,460:0};n.f.j=(r,t)=>{var a=n.o(e,r)?e[r]:void 0;if(0!==a)if(a)t.push(a[2]);else if(/^(460|523)$/.test(r))e[r]=0;else{var o=new Promise(((t,o)=>a=e[r]=[t,o]));t.push(a[2]=o);var d=n.p+n.u(r),f=new Error;n.l(d,(t=>{if(n.o(e,r)&&(0!==(a=e[r])&&(e[r]=void 0),a)){var o=t&&("load"===t.type?"missing":t.type),d=t&&t.target&&t.target.src;f.message="Loading chunk "+r+" failed.\n("+o+": "+d+")",f.name="ChunkLoadError",f.type=o,f.request=d,a[1](f)}}),"chunk-"+r,r)}},n.O.j=r=>0===e[r];var r=(r,t)=>{var a,o,[d,f,i]=t,v=0;if(d.some((r=>0!==e[r]))){for(a in f)n.o(f,a)&&(n.m[a]=f[a]);if(i)var c=i(n)}for(r&&r(t);v<d.length;v++)o=d[v],n.o(e,o)&&e[o]&&e[o][0](),e[d[v]]=0;return n.O(c)},t=self.webpackChunknode_red_contrib_power_saver=self.webpackChunknode_red_contrib_power_saver||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})()})();
|