node-red-contrib-power-saver 2.0.4 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (176) hide show
  1. package/CHANGELOG.md +1 -33
  2. package/README.md +3 -191
  3. package/docs/.vuepress/config.js +67 -0
  4. package/docs/.vuepress/dist/404.html +15 -0
  5. package/docs/.vuepress/dist/assets/css/styles.e835bef6.css +8 -0
  6. package/docs/.vuepress/dist/assets/img/back-to-top.8b37f773.svg +1 -0
  7. package/docs/.vuepress/dist/assets/img/elvia-config-no-config.b4bb972c.png +0 -0
  8. package/docs/.vuepress/dist/assets/img/elvia-config-no-tariff.3f89aba8.png +0 -0
  9. package/docs/.vuepress/dist/assets/img/elvia-config-select-tariff.0f73fd56.png +0 -0
  10. package/docs/.vuepress/dist/assets/img/elvia-config-subscription-key.8be8ab8a.png +0 -0
  11. package/docs/.vuepress/dist/assets/img/elvia-flow.bae2a4d5.png +0 -0
  12. package/docs/.vuepress/dist/assets/img/example-flow-1.3ff3e23f.png +0 -0
  13. package/docs/.vuepress/dist/assets/img/example-flow-2.b653b58d.png +0 -0
  14. package/docs/.vuepress/dist/assets/img/migrate-best-save.f73420f6.png +0 -0
  15. package/docs/.vuepress/dist/assets/img/migrate-power-saver.aae13f9d.png +0 -0
  16. package/docs/.vuepress/dist/assets/img/node-power-saver.51ff2e5d.png +0 -0
  17. package/docs/.vuepress/dist/assets/img/node-ps-elvia-add-tariff.94ea2b09.png +0 -0
  18. package/docs/.vuepress/dist/assets/img/node-ps-receive-price.76eaa418.png +0 -0
  19. package/docs/.vuepress/dist/assets/img/node-ps-strategy-best-save.392292d5.png +0 -0
  20. package/docs/.vuepress/dist/assets/img/node-ps-strategy-lowest-price.3a4ad347.png +0 -0
  21. package/docs/.vuepress/dist/assets/img/power-saver-nordpool-current-state.bf14afde.png +0 -0
  22. package/docs/.vuepress/dist/assets/img/power-saver-nordpool-events-state.8c392507.png +0 -0
  23. package/docs/.vuepress/dist/assets/img/power-saver-tibber-mqtt.16891dd2.png +0 -0
  24. package/docs/.vuepress/dist/assets/js/293.5e967839.js +1 -0
  25. package/docs/.vuepress/dist/assets/js/491.c183eba3.js +1 -0
  26. package/docs/.vuepress/dist/assets/js/812.79dad458.js +2 -0
  27. package/docs/.vuepress/dist/assets/js/812.79dad458.js.LICENSE.txt +8 -0
  28. package/docs/.vuepress/dist/assets/js/app.80d4373d.js +1 -0
  29. package/docs/.vuepress/dist/assets/js/runtime~app.665b411c.js +1 -0
  30. package/docs/.vuepress/dist/assets/js/v-08683c60.9edcaa60.js +1 -0
  31. package/docs/.vuepress/dist/assets/js/v-0aca7ba6.5eca5160.js +1 -0
  32. package/docs/.vuepress/dist/assets/js/v-0b5e3c8c.c02472fb.js +1 -0
  33. package/docs/.vuepress/dist/assets/js/v-1ad821fa.a628e907.js +1 -0
  34. package/docs/.vuepress/dist/assets/js/v-30acb564.80b4190d.js +1 -0
  35. package/docs/.vuepress/dist/assets/js/v-3706649a.d7f73384.js +1 -0
  36. package/docs/.vuepress/dist/assets/js/v-4637f9e4.df94c6ea.js +1 -0
  37. package/docs/.vuepress/dist/assets/js/v-510ed0d4.a78d8542.js +1 -0
  38. package/docs/.vuepress/dist/assets/js/v-5954bcb2.4f4712f3.js +1 -0
  39. package/docs/.vuepress/dist/assets/js/v-5db8da3a.2e49b81a.js +1 -0
  40. package/docs/.vuepress/dist/assets/js/v-61f728ca.7b545524.js +1 -0
  41. package/docs/.vuepress/dist/assets/js/v-677dfaed.756e0fb5.js +1 -0
  42. package/docs/.vuepress/dist/assets/js/v-7c87f26e.57507077.js +1 -0
  43. package/docs/.vuepress/dist/assets/js/v-8daa1a0e.1ea39527.js +1 -0
  44. package/docs/.vuepress/dist/assets/js/v-b4a42144.a812c440.js +1 -0
  45. package/docs/.vuepress/dist/assets/js/v-e8c55052.30f30acd.js +1 -0
  46. package/docs/.vuepress/dist/assets/js/v-fffb8e28.850019c1.js +1 -0
  47. package/docs/.vuepress/dist/changelog/index.html +15 -0
  48. package/docs/.vuepress/dist/contribute/index.html +15 -0
  49. package/docs/.vuepress/dist/euro.png +0 -0
  50. package/docs/.vuepress/dist/examples/example-nordpool-current-state.html +169 -0
  51. package/docs/.vuepress/dist/examples/example-nordpool-events-state.html +173 -0
  52. package/docs/.vuepress/dist/examples/example-tibber-mqtt.html +182 -0
  53. package/docs/.vuepress/dist/examples/index.html +15 -0
  54. package/docs/.vuepress/dist/guide/index.html +52 -0
  55. package/docs/.vuepress/dist/index.html +15 -0
  56. package/docs/.vuepress/dist/logo.png +0 -0
  57. package/docs/.vuepress/dist/nodes/index.html +15 -0
  58. package/docs/.vuepress/dist/nodes/old-power-saver-doc.html +97 -0
  59. package/docs/.vuepress/dist/nodes/power-saver.html +15 -0
  60. package/docs/.vuepress/dist/nodes/ps-elvia-add-tariff.html +15 -0
  61. package/docs/.vuepress/dist/nodes/ps-receive-price.html +80 -0
  62. package/docs/.vuepress/dist/nodes/ps-strategy-best-save.html +65 -0
  63. package/docs/.vuepress/dist/nodes/ps-strategy-lowest-price.html +89 -0
  64. package/docs/.vuepress/dist/nodes/strategy-input.html +40 -0
  65. package/docs/.vuepress/public/euro.png +0 -0
  66. package/docs/.vuepress/public/logo.png +0 -0
  67. package/docs/README.md +32 -0
  68. package/docs/changelog/README.md +61 -0
  69. package/docs/contribute/README.md +39 -0
  70. package/docs/examples/README.md +5 -0
  71. package/docs/examples/example-nordpool-current-state.md +166 -0
  72. package/docs/examples/example-nordpool-events-state.md +170 -0
  73. package/docs/examples/example-tibber-mqtt.md +179 -0
  74. package/docs/guide/README.md +202 -0
  75. package/docs/images/all-nodes.png +0 -0
  76. package/docs/images/best-save-config.png +0 -0
  77. package/docs/images/elvia-add-tariff-node-used.png +0 -0
  78. package/docs/images/elvia-config-no-config.png +0 -0
  79. package/docs/images/elvia-config-no-tariff.png +0 -0
  80. package/docs/images/elvia-config-select-tariff.png +0 -0
  81. package/docs/images/elvia-config-subscription-key.png +0 -0
  82. package/docs/images/elvia-flow.png +0 -0
  83. package/docs/images/elvia-tariff-config.png +0 -0
  84. package/docs/images/euro.png +0 -0
  85. package/docs/images/example-flow-1.png +0 -0
  86. package/docs/images/example-flow-2.png +0 -0
  87. package/docs/images/logo.png +0 -0
  88. package/docs/images/lowest-price-config.png +0 -0
  89. package/docs/images/migrate-best-save.png +0 -0
  90. package/docs/images/migrate-power-saver.png +0 -0
  91. package/docs/images/node-power-saver.png +0 -0
  92. package/docs/images/node-ps-elvia-add-tariff.png +0 -0
  93. package/docs/images/node-ps-elvia-tariff-types.png +0 -0
  94. package/docs/images/node-ps-elvia-tariff.png +0 -0
  95. package/docs/images/node-ps-receive-price.png +0 -0
  96. package/docs/images/node-ps-strategy-best-save.png +0 -0
  97. package/docs/images/node-ps-strategy-lowest-price.png +0 -0
  98. package/{doc → docs/images}/node-red-contrib-power-saver-flow.png +0 -0
  99. package/docs/images/power-saver-nordpool-current-state.png +0 -0
  100. package/docs/images/power-saver-nordpool-events-state.png +0 -0
  101. package/docs/images/power-saver-tibber-mqtt.png +0 -0
  102. package/docs/nodes/README.md +53 -0
  103. package/docs/nodes/old-power-saver-doc.md +231 -0
  104. package/docs/nodes/power-saver.md +23 -0
  105. package/docs/nodes/ps-elvia-add-tariff.md +52 -0
  106. package/docs/nodes/ps-receive-price.md +153 -0
  107. package/docs/nodes/ps-strategy-best-save.md +142 -0
  108. package/docs/nodes/ps-strategy-lowest-price.md +165 -0
  109. package/docs/nodes/strategy-input.md +39 -0
  110. package/package.json +19 -4
  111. package/src/elvia/elvia-add-tariff.html +70 -0
  112. package/src/elvia/elvia-add-tariff.js +47 -0
  113. package/src/elvia/elvia-api.js +61 -0
  114. package/src/elvia/elvia-config.html +46 -0
  115. package/src/elvia/elvia-config.js +19 -0
  116. package/src/elvia/elvia-tariff-types.html +34 -0
  117. package/src/elvia/elvia-tariff-types.js +25 -0
  118. package/src/elvia/elvia-tariff.html +89 -0
  119. package/src/elvia/elvia-tariff.js +22 -0
  120. package/src/elvia/icons/elvia_hvite.svg +4 -0
  121. package/src/elvia/icons/elvia_positive_4 copy.svg +4 -0
  122. package/src/handle-input.js +162 -0
  123. package/src/power-saver.html +116 -0
  124. package/{power-saver.js → src/power-saver.js} +90 -72
  125. package/src/receive-price-functions.js +99 -0
  126. package/src/receive-price.html +30 -0
  127. package/src/receive-price.js +21 -0
  128. package/src/strategy-best-save-functions.js +110 -0
  129. package/src/strategy-best-save.html +116 -0
  130. package/src/strategy-best-save.js +95 -0
  131. package/src/strategy-lowest-price-functions.js +35 -0
  132. package/src/strategy-lowest-price.html +168 -0
  133. package/src/strategy-lowest-price.js +125 -0
  134. package/{utils.js → src/utils.js} +59 -104
  135. package/test/data/adjustedResult.js +302 -0
  136. package/test/data/adjustedResult_old.js +154 -0
  137. package/test/data/best-save-result.json +357 -0
  138. package/test/data/converted-prices.json +196 -0
  139. package/test/data/elvia-input-grid-tariff.json +760 -0
  140. package/test/data/elvia-input-power-prices.json +194 -0
  141. package/test/data/elvia-output-add-tariff.json +290 -0
  142. package/test/data/lowest-price-result-cont.json +18 -0
  143. package/test/data/lowest-price-result-split-allday.json +21 -0
  144. package/test/data/lowest-price-result-split-allday10.json +20 -0
  145. package/test/data/lowest-price-result-split.json +20 -0
  146. package/test/data/nordpool-current-state-prices.json +283 -0
  147. package/test/data/nordpool-event-prices.json +574 -0
  148. package/test/data/reconfigResult.js +315 -0
  149. package/test/data/reconfigResult_old.js +141 -0
  150. package/test/data/result.js +1 -0
  151. package/test/data/tibber-prices-single-home.json +64 -0
  152. package/test/data/tibber-prices.json +124 -0
  153. package/test/data/{tibber_result.json → tibber-result.json} +2 -1
  154. package/test/elvia.test.js +26 -0
  155. package/test/mostSavedStrategy.test.js +22 -55
  156. package/test/power-saver.test.js +4 -38
  157. package/test/receive-price-functions.test.js +153 -0
  158. package/test/receive-price.test.js +122 -0
  159. package/test/send-config-input.test.js +121 -0
  160. package/test/strategy-best-save-test-utils.js +32 -0
  161. package/test/strategy-best-save.test.js +103 -0
  162. package/test/strategy-lowest-price-functions.test.js +40 -0
  163. package/test/strategy-lowest-price.test.js +472 -0
  164. package/test/test-utils.js +106 -0
  165. package/test/utils.test.js +53 -163
  166. package/doc/example-nordpool-current-state.md +0 -166
  167. package/doc/example-nordpool-events-state.md +0 -153
  168. package/doc/example-tibber-mqtt.md +0 -189
  169. package/doc/power-saver-nordpool-current-state.png +0 -0
  170. package/doc/power-saver-nordpool-events-state.png +0 -0
  171. package/doc/power-saver-tibber-mqtt.png +0 -0
  172. package/mostSavedStrategy.js +0 -84
  173. package/mostSavedStrategy_v2.js +0 -68
  174. package/power-saver.html +0 -259
  175. package/test/data/tibber_data.json +0 -412
  176. package/test/data/tibber_prices.json +0 -412
@@ -0,0 +1,315 @@
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
+ {
18
+ price: 0.2494,
19
+ onOff: false,
20
+ start: "2021-06-20T01:50:00.000+02:00",
21
+ saving: 0.0395,
22
+ },
23
+ {
24
+ price: 0.2209,
25
+ onOff: false,
26
+ start: "2021-06-20T01:50:00.010+02:00",
27
+ saving: 0.011,
28
+ },
29
+ {
30
+ price: 0.2099,
31
+ onOff: true,
32
+ start: "2021-06-20T01:50:00.020+02:00",
33
+ saving: null,
34
+ },
35
+ {
36
+ price: 0.219,
37
+ onOff: true,
38
+ start: "2021-06-20T01:50:00.030+02:00",
39
+ saving: null,
40
+ },
41
+ {
42
+ price: 0.2614,
43
+ onOff: true,
44
+ start: "2021-06-20T01:50:00.040+02:00",
45
+ saving: null,
46
+ },
47
+ {
48
+ price: 0.4426,
49
+ onOff: true,
50
+ start: "2021-06-20T01:50:00.050+02:00",
51
+ saving: null,
52
+ },
53
+ {
54
+ price: 0.5433,
55
+ onOff: true,
56
+ start: "2021-06-20T01:50:00.060+02:00",
57
+ saving: null,
58
+ },
59
+ {
60
+ price: 0.5667,
61
+ onOff: true,
62
+ start: "2021-06-20T01:50:00.070+02:00",
63
+ saving: null,
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
+ },
305
+ ],
306
+ source: undefined,
307
+ config: {
308
+ maxHoursToSaveInSequence: 3,
309
+ minHoursOnAfterMaxSequenceSaved: 2,
310
+ minSaving: 0.001,
311
+ sendCurrentValueWhenRescheduling: undefined,
312
+ outputIfNoSchedule: false,
313
+ scheduleOnlyFromCurrentTime: true,
314
+ },
315
+ };
@@ -0,0 +1,141 @@
1
+ module.exports = {
2
+ schedule: [
3
+ { time: "2021-06-20T01:50:00.050+02:00", value: true },
4
+ { time: "2021-06-20T01:50:00.060+02:00", value: false },
5
+ { time: "2021-06-20T01:50:00.080+02:00", value: true },
6
+ { time: "2021-06-20T01:50:00.090+02:00", value: false },
7
+ { time: "2021-06-20T01:50:00.120+02:00", value: true },
8
+ { time: "2021-06-20T01:50:00.150+02:00", value: false },
9
+ { time: "2021-06-20T01:50:00.180+02:00", value: true },
10
+ ],
11
+ hours: [
12
+ {
13
+ price: 0.3,
14
+ onOff: true,
15
+ start: "2021-06-20T01:50:00.000+02:00",
16
+ saving: null,
17
+ },
18
+ {
19
+ price: 0.4,
20
+ onOff: true,
21
+ start: "2021-06-20T01:50:00.010+02:00",
22
+ saving: null,
23
+ },
24
+ {
25
+ price: 0.8,
26
+ onOff: true,
27
+ start: "2021-06-20T01:50:00.020+02:00",
28
+ saving: null,
29
+ },
30
+ {
31
+ price: 0.9,
32
+ onOff: false,
33
+ start: "2021-06-20T01:50:00.030+02:00",
34
+ saving: 0.3,
35
+ },
36
+ {
37
+ price: 0.7,
38
+ onOff: false,
39
+ start: "2021-06-20T01:50:00.040+02:00",
40
+ saving: 0.1,
41
+ },
42
+ {
43
+ price: 0.6,
44
+ onOff: true,
45
+ start: "2021-06-20T01:50:00.050+02:00",
46
+ saving: null,
47
+ },
48
+ {
49
+ price: 0.5,
50
+ onOff: false,
51
+ start: "2021-06-20T01:50:00.060+02:00",
52
+ saving: 0.3,
53
+ },
54
+ {
55
+ price: 0.75,
56
+ onOff: false,
57
+ start: "2021-06-20T01:50:00.070+02:00",
58
+ saving: 0.55,
59
+ },
60
+ {
61
+ price: 0.2,
62
+ onOff: true,
63
+ start: "2021-06-20T01:50:00.080+02:00",
64
+ saving: null,
65
+ },
66
+ {
67
+ price: 0.85,
68
+ onOff: false,
69
+ start: "2021-06-20T01:50:00.090+02:00",
70
+ saving: 0.05,
71
+ },
72
+ {
73
+ price: 1.5,
74
+ onOff: false,
75
+ start: "2021-06-20T01:50:00.100+02:00",
76
+ saving: 0.7,
77
+ },
78
+ {
79
+ price: 1.4,
80
+ onOff: false,
81
+ start: "2021-06-20T01:50:00.110+02:00",
82
+ saving: 0.6,
83
+ },
84
+ {
85
+ price: 0.8,
86
+ onOff: true,
87
+ start: "2021-06-20T01:50:00.120+02:00",
88
+ saving: null,
89
+ },
90
+ {
91
+ price: 0.9,
92
+ onOff: true,
93
+ start: "2021-06-20T01:50:00.130+02:00",
94
+ saving: null,
95
+ },
96
+ {
97
+ price: 0.7,
98
+ onOff: true,
99
+ start: "2021-06-20T01:50:00.140+02:00",
100
+ saving: null,
101
+ },
102
+ {
103
+ price: 0.6,
104
+ onOff: false,
105
+ start: "2021-06-20T01:50:00.150+02:00",
106
+ saving: 0.4,
107
+ },
108
+ {
109
+ price: 0.5,
110
+ onOff: false,
111
+ start: "2021-06-20T01:50:00.160+02:00",
112
+ saving: 0.3,
113
+ },
114
+ {
115
+ price: 0.75,
116
+ onOff: false,
117
+ start: "2021-06-20T01:50:00.170+02:00",
118
+ saving: 0.55,
119
+ },
120
+ {
121
+ price: 0.2,
122
+ onOff: true,
123
+ start: "2021-06-20T01:50:00.180+02:00",
124
+ saving: null,
125
+ },
126
+ {
127
+ price: 0.85,
128
+ onOff: true,
129
+ start: "2021-06-20T01:50:00.190+02:00",
130
+ saving: null,
131
+ },
132
+ ],
133
+ source: "Other",
134
+ config: {
135
+ maxHoursToSaveInSequence: 3,
136
+ minHoursOnAfterMaxSequenceSaved: 2,
137
+ minSaving: 0.001,
138
+ outputIfNoSchedule: false,
139
+ scheduleOnlyFromCurrentTime: true,
140
+ },
141
+ };
@@ -165,5 +165,6 @@ module.exports = {
165
165
  minHoursOnAfterMaxSequenceSaved: 2,
166
166
  minSaving: 0.001,
167
167
  outputIfNoSchedule: false,
168
+ scheduleOnlyFromCurrentTime: false,
168
169
  },
169
170
  };
@@ -0,0 +1,64 @@
1
+ {
2
+ "payload": {
3
+ "viewer": {
4
+ "home": {
5
+ "currentSubscription": {
6
+ "priceInfo": {
7
+ "today": [
8
+ { "total": 0.2494, "startsAt": "2021-10-11T00:00:00.000+02:00" },
9
+ { "total": 0.2209, "startsAt": "2021-10-11T01:00:00.000+02:00" },
10
+ { "total": 0.2099, "startsAt": "2021-10-11T02:00:00.000+02:00" },
11
+ { "total": 0.219, "startsAt": "2021-10-11T03:00:00.000+02:00" },
12
+ { "total": 0.2614, "startsAt": "2021-10-11T04:00:00.000+02:00" },
13
+ { "total": 0.4426, "startsAt": "2021-10-11T05:00:00.000+02:00" },
14
+ { "total": 0.5433, "startsAt": "2021-10-11T06:00:00.000+02:00" },
15
+ { "total": 0.5667, "startsAt": "2021-10-11T07:00:00.000+02:00" },
16
+ { "total": 0.5847, "startsAt": "2021-10-11T08:00:00.000+02:00" },
17
+ { "total": 0.5762, "startsAt": "2021-10-11T09:00:00.000+02:00" },
18
+ { "total": 0.5391, "startsAt": "2021-10-11T10:00:00.000+02:00" },
19
+ { "total": 0.5124, "startsAt": "2021-10-11T11:00:00.000+02:00" },
20
+ { "total": 0.504, "startsAt": "2021-10-11T12:00:00.000+02:00" },
21
+ { "total": 0.5057, "startsAt": "2021-10-11T13:00:00.000+02:00" },
22
+ { "total": 0.5066, "startsAt": "2021-10-11T14:00:00.000+02:00" },
23
+ { "total": 0.5136, "startsAt": "2021-10-11T15:00:00.000+02:00" },
24
+ { "total": 0.5143, "startsAt": "2021-10-11T16:00:00.000+02:00" },
25
+ { "total": 0.5306, "startsAt": "2021-10-11T17:00:00.000+02:00" },
26
+ { "total": 0.5534, "startsAt": "2021-10-11T18:00:00.000+02:00" },
27
+ { "total": 0.5511, "startsAt": "2021-10-11T19:00:00.000+02:00" },
28
+ { "total": 0.5491, "startsAt": "2021-10-11T20:00:00.000+02:00" },
29
+ { "total": 0.5485, "startsAt": "2021-10-11T21:00:00.000+02:00" },
30
+ { "total": 0.5481, "startsAt": "2021-10-11T22:00:00.000+02:00" },
31
+ { "total": 0.5218, "startsAt": "2021-10-11T23:00:00.000+02:00" }
32
+ ],
33
+ "tomorrow": [
34
+ { "total": 0.4533, "startsAt": "2021-10-12T00:00:00.000+02:00" },
35
+ { "total": 0.4196, "startsAt": "2021-10-12T01:00:00.000+02:00" },
36
+ { "total": 0.4037, "startsAt": "2021-10-12T02:00:00.000+02:00" },
37
+ { "total": 0.3829, "startsAt": "2021-10-12T03:00:00.000+02:00" },
38
+ { "total": 0.4555, "startsAt": "2021-10-12T04:00:00.000+02:00" },
39
+ { "total": 0.4721, "startsAt": "2021-10-12T05:00:00.000+02:00" },
40
+ { "total": 0.4903, "startsAt": "2021-10-12T06:00:00.000+02:00" },
41
+ { "total": 0.5028, "startsAt": "2021-10-12T07:00:00.000+02:00" },
42
+ { "total": 0.5163, "startsAt": "2021-10-12T08:00:00.000+02:00" },
43
+ { "total": 0.5264, "startsAt": "2021-10-12T09:00:00.000+02:00" },
44
+ { "total": 0.5346, "startsAt": "2021-10-12T10:00:00.000+02:00" },
45
+ { "total": 0.5224, "startsAt": "2021-10-12T11:00:00.000+02:00" },
46
+ { "total": 0.5071, "startsAt": "2021-10-12T12:00:00.000+02:00" },
47
+ { "total": 0.5045, "startsAt": "2021-10-12T13:00:00.000+02:00" },
48
+ { "total": 0.5024, "startsAt": "2021-10-12T14:00:00.000+02:00" },
49
+ { "total": 0.5038, "startsAt": "2021-10-12T15:00:00.000+02:00" },
50
+ { "total": 0.5118, "startsAt": "2021-10-12T16:00:00.000+02:00" },
51
+ { "total": 0.5111, "startsAt": "2021-10-12T17:00:00.000+02:00" },
52
+ { "total": 0.5108, "startsAt": "2021-10-12T18:00:00.000+02:00" },
53
+ { "total": 0.5055, "startsAt": "2021-10-12T19:00:00.000+02:00" },
54
+ { "total": 0.5042, "startsAt": "2021-10-12T20:00:00.000+02:00" },
55
+ { "total": 0.5259, "startsAt": "2021-10-12T21:00:00.000+02:00" },
56
+ { "total": 0.5282, "startsAt": "2021-10-12T22:00:00.000+02:00" },
57
+ { "total": 0.5252, "startsAt": "2021-10-12T23:00:00.000+02:00" }
58
+ ]
59
+ }
60
+ }
61
+ }
62
+ }
63
+ }
64
+ }
@@ -0,0 +1,124 @@
1
+ {
2
+ "payload": {
3
+ "viewer": {
4
+ "homes": [
5
+ {
6
+ "currentSubscription": {
7
+ "priceInfo": {
8
+ "today": [
9
+ { "total": 0.2494, "startsAt": "2021-10-11T00:00:00.000+02:00" },
10
+ { "total": 0.2209, "startsAt": "2021-10-11T01:00:00.000+02:00" },
11
+ { "total": 0.2099, "startsAt": "2021-10-11T02:00:00.000+02:00" },
12
+ { "total": 0.219, "startsAt": "2021-10-11T03:00:00.000+02:00" },
13
+ { "total": 0.2614, "startsAt": "2021-10-11T04:00:00.000+02:00" },
14
+ { "total": 0.4426, "startsAt": "2021-10-11T05:00:00.000+02:00" },
15
+ { "total": 0.5433, "startsAt": "2021-10-11T06:00:00.000+02:00" },
16
+ { "total": 0.5667, "startsAt": "2021-10-11T07:00:00.000+02:00" },
17
+ { "total": 0.5847, "startsAt": "2021-10-11T08:00:00.000+02:00" },
18
+ { "total": 0.5762, "startsAt": "2021-10-11T09:00:00.000+02:00" },
19
+ { "total": 0.5391, "startsAt": "2021-10-11T10:00:00.000+02:00" },
20
+ { "total": 0.5124, "startsAt": "2021-10-11T11:00:00.000+02:00" },
21
+ { "total": 0.504, "startsAt": "2021-10-11T12:00:00.000+02:00" },
22
+ { "total": 0.5057, "startsAt": "2021-10-11T13:00:00.000+02:00" },
23
+ { "total": 0.5066, "startsAt": "2021-10-11T14:00:00.000+02:00" },
24
+ { "total": 0.5136, "startsAt": "2021-10-11T15:00:00.000+02:00" },
25
+ { "total": 0.5143, "startsAt": "2021-10-11T16:00:00.000+02:00" },
26
+ { "total": 0.5306, "startsAt": "2021-10-11T17:00:00.000+02:00" },
27
+ { "total": 0.5534, "startsAt": "2021-10-11T18:00:00.000+02:00" },
28
+ { "total": 0.5511, "startsAt": "2021-10-11T19:00:00.000+02:00" },
29
+ { "total": 0.5491, "startsAt": "2021-10-11T20:00:00.000+02:00" },
30
+ { "total": 0.5485, "startsAt": "2021-10-11T21:00:00.000+02:00" },
31
+ { "total": 0.5481, "startsAt": "2021-10-11T22:00:00.000+02:00" },
32
+ { "total": 0.5218, "startsAt": "2021-10-11T23:00:00.000+02:00" }
33
+ ],
34
+ "tomorrow": [
35
+ { "total": 0.4533, "startsAt": "2021-10-12T00:00:00.000+02:00" },
36
+ { "total": 0.4196, "startsAt": "2021-10-12T01:00:00.000+02:00" },
37
+ { "total": 0.4037, "startsAt": "2021-10-12T02:00:00.000+02:00" },
38
+ { "total": 0.3829, "startsAt": "2021-10-12T03:00:00.000+02:00" },
39
+ { "total": 0.4555, "startsAt": "2021-10-12T04:00:00.000+02:00" },
40
+ { "total": 0.4721, "startsAt": "2021-10-12T05:00:00.000+02:00" },
41
+ { "total": 0.4903, "startsAt": "2021-10-12T06:00:00.000+02:00" },
42
+ { "total": 0.5028, "startsAt": "2021-10-12T07:00:00.000+02:00" },
43
+ { "total": 0.5163, "startsAt": "2021-10-12T08:00:00.000+02:00" },
44
+ { "total": 0.5264, "startsAt": "2021-10-12T09:00:00.000+02:00" },
45
+ { "total": 0.5346, "startsAt": "2021-10-12T10:00:00.000+02:00" },
46
+ { "total": 0.5224, "startsAt": "2021-10-12T11:00:00.000+02:00" },
47
+ { "total": 0.5071, "startsAt": "2021-10-12T12:00:00.000+02:00" },
48
+ { "total": 0.5045, "startsAt": "2021-10-12T13:00:00.000+02:00" },
49
+ { "total": 0.5024, "startsAt": "2021-10-12T14:00:00.000+02:00" },
50
+ { "total": 0.5038, "startsAt": "2021-10-12T15:00:00.000+02:00" },
51
+ { "total": 0.5118, "startsAt": "2021-10-12T16:00:00.000+02:00" },
52
+ { "total": 0.5111, "startsAt": "2021-10-12T17:00:00.000+02:00" },
53
+ { "total": 0.5108, "startsAt": "2021-10-12T18:00:00.000+02:00" },
54
+ { "total": 0.5055, "startsAt": "2021-10-12T19:00:00.000+02:00" },
55
+ { "total": 0.5042, "startsAt": "2021-10-12T20:00:00.000+02:00" },
56
+ { "total": 0.5259, "startsAt": "2021-10-12T21:00:00.000+02:00" },
57
+ { "total": 0.5282, "startsAt": "2021-10-12T22:00:00.000+02:00" },
58
+ { "total": 0.5252, "startsAt": "2021-10-12T23:00:00.000+02:00" }
59
+ ]
60
+ }
61
+ }
62
+ },
63
+ {
64
+ "currentSubscription": {
65
+ "priceInfo": {
66
+ "today": [
67
+ { "total": 0.2494, "startsAt": "2021-10-11T00:00:00.000+02:00" },
68
+ { "total": 0.2209, "startsAt": "2021-10-11T01:00:00.000+02:00" },
69
+ { "total": 0.2099, "startsAt": "2021-10-11T02:00:00.000+02:00" },
70
+ { "total": 0.219, "startsAt": "2021-10-11T03:00:00.000+02:00" },
71
+ { "total": 0.2614, "startsAt": "2021-10-11T04:00:00.000+02:00" },
72
+ { "total": 0.4426, "startsAt": "2021-10-11T05:00:00.000+02:00" },
73
+ { "total": 0.5433, "startsAt": "2021-10-11T06:00:00.000+02:00" },
74
+ { "total": 0.5667, "startsAt": "2021-10-11T07:00:00.000+02:00" },
75
+ { "total": 0.5847, "startsAt": "2021-10-11T08:00:00.000+02:00" },
76
+ { "total": 0.5762, "startsAt": "2021-10-11T09:00:00.000+02:00" },
77
+ { "total": 0.5391, "startsAt": "2021-10-11T10:00:00.000+02:00" },
78
+ { "total": 0.5124, "startsAt": "2021-10-11T11:00:00.000+02:00" },
79
+ { "total": 0.504, "startsAt": "2021-10-11T12:00:00.000+02:00" },
80
+ { "total": 0.5057, "startsAt": "2021-10-11T13:00:00.000+02:00" },
81
+ { "total": 0.5066, "startsAt": "2021-10-11T14:00:00.000+02:00" },
82
+ { "total": 0.5136, "startsAt": "2021-10-11T15:00:00.000+02:00" },
83
+ { "total": 0.5143, "startsAt": "2021-10-11T16:00:00.000+02:00" },
84
+ { "total": 0.5306, "startsAt": "2021-10-11T17:00:00.000+02:00" },
85
+ { "total": 0.5534, "startsAt": "2021-10-11T18:00:00.000+02:00" },
86
+ { "total": 0.5511, "startsAt": "2021-10-11T19:00:00.000+02:00" },
87
+ { "total": 0.5491, "startsAt": "2021-10-11T20:00:00.000+02:00" },
88
+ { "total": 0.5485, "startsAt": "2021-10-11T21:00:00.000+02:00" },
89
+ { "total": 0.5481, "startsAt": "2021-10-11T22:00:00.000+02:00" },
90
+ { "total": 0.5218, "startsAt": "2021-10-11T23:00:00.000+02:00" }
91
+ ],
92
+ "tomorrow": [
93
+ { "total": 0.4533, "startsAt": "2021-10-12T00:00:00.000+02:00" },
94
+ { "total": 0.4196, "startsAt": "2021-10-12T01:00:00.000+02:00" },
95
+ { "total": 0.4037, "startsAt": "2021-10-12T02:00:00.000+02:00" },
96
+ { "total": 0.3829, "startsAt": "2021-10-12T03:00:00.000+02:00" },
97
+ { "total": 0.4555, "startsAt": "2021-10-12T04:00:00.000+02:00" },
98
+ { "total": 0.4721, "startsAt": "2021-10-12T05:00:00.000+02:00" },
99
+ { "total": 0.4903, "startsAt": "2021-10-12T06:00:00.000+02:00" },
100
+ { "total": 0.5028, "startsAt": "2021-10-12T07:00:00.000+02:00" },
101
+ { "total": 0.5163, "startsAt": "2021-10-12T08:00:00.000+02:00" },
102
+ { "total": 0.5264, "startsAt": "2021-10-12T09:00:00.000+02:00" },
103
+ { "total": 0.5346, "startsAt": "2021-10-12T10:00:00.000+02:00" },
104
+ { "total": 0.5224, "startsAt": "2021-10-12T11:00:00.000+02:00" },
105
+ { "total": 0.5071, "startsAt": "2021-10-12T12:00:00.000+02:00" },
106
+ { "total": 0.5045, "startsAt": "2021-10-12T13:00:00.000+02:00" },
107
+ { "total": 0.5024, "startsAt": "2021-10-12T14:00:00.000+02:00" },
108
+ { "total": 0.5038, "startsAt": "2021-10-12T15:00:00.000+02:00" },
109
+ { "total": 0.5118, "startsAt": "2021-10-12T16:00:00.000+02:00" },
110
+ { "total": 0.5111, "startsAt": "2021-10-12T17:00:00.000+02:00" },
111
+ { "total": 0.5108, "startsAt": "2021-10-12T18:00:00.000+02:00" },
112
+ { "total": 0.5055, "startsAt": "2021-10-12T19:00:00.000+02:00" },
113
+ { "total": 0.5042, "startsAt": "2021-10-12T20:00:00.000+02:00" },
114
+ { "total": 0.5259, "startsAt": "2021-10-12T21:00:00.000+02:00" },
115
+ { "total": 0.5282, "startsAt": "2021-10-12T22:00:00.000+02:00" },
116
+ { "total": 0.5252, "startsAt": "2021-10-12T23:00:00.000+02:00" }
117
+ ]
118
+ }
119
+ }
120
+ }
121
+ ]
122
+ }
123
+ }
124
+ }
@@ -352,6 +352,7 @@
352
352
  "maxHoursToSaveInSequence": 4,
353
353
  "minHoursOnAfterMaxSequenceSaved": 2,
354
354
  "minSaving": 0.001,
355
- "outputIfNoSchedule": false
355
+ "outputIfNoSchedule": false,
356
+ "scheduleOnlyFromCurrentTime": false
356
357
  }
357
358
  }
@@ -0,0 +1,26 @@
1
+ const helper = require("node-red-node-test-helper");
2
+ const elviaAddTariff = require("../src/elvia/elvia-add-tariff.js");
3
+ const expect = require("expect");
4
+
5
+ helper.init(require.resolve("node-red"));
6
+
7
+ describe("ps-elvia-add-tariff node", function () {
8
+ beforeEach(function (done) {
9
+ helper.startServer(done);
10
+ });
11
+
12
+ afterEach(function (done) {
13
+ helper.unload().then(function () {
14
+ helper.stopServer(done);
15
+ });
16
+ });
17
+
18
+ it("should be loaded", function (done) {
19
+ const flow = [{ id: "n1", type: "ps-elvia-add-tariff", name: "test name" }];
20
+ helper.load(elviaAddTariff, flow, function () {
21
+ const n1 = helper.getNode("n1");
22
+ expect(n1).toHaveProperty("name", "test name");
23
+ done();
24
+ });
25
+ });
26
+ });