node-red-contrib-power-saver 3.6.2 → 4.1.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.
Files changed (109) hide show
  1. package/.eslintrc.js +15 -0
  2. package/docs/.vuepress/components/AdsenseAdd.vue +40 -0
  3. package/docs/.vuepress/components/DonateButtons.vue +26 -3
  4. package/docs/.vuepress/components/VippsPlakat.vue +20 -0
  5. package/docs/.vuepress/config.js +17 -10
  6. package/docs/.vuepress/public/ads.txt +1 -0
  7. package/docs/README.md +6 -4
  8. package/docs/changelog/README.md +61 -1
  9. package/docs/contribute/README.md +12 -3
  10. package/docs/examples/README.md +6 -0
  11. package/docs/examples/example-grid-tariff-capacity-flow.json +23 -7
  12. package/docs/examples/example-grid-tariff-capacity-part.md +657 -22
  13. package/docs/faq/README.md +5 -1
  14. package/docs/faq/best-save-viewer.md +9 -1
  15. package/docs/guide/README.md +36 -5
  16. package/docs/images/best-save-config.png +0 -0
  17. package/docs/images/combine-two-lowest-price.png +0 -0
  18. package/docs/images/fixed-schedule-config.png +0 -0
  19. package/docs/images/global-context-window.png +0 -0
  20. package/docs/images/lowest-price-config.png +0 -0
  21. package/docs/images/node-ps-schedule-merger.png +0 -0
  22. package/docs/images/node-ps-strategy-fixed-schedule.png +0 -0
  23. package/docs/images/ps-strategy-fixed-schedule-example.png +0 -0
  24. package/docs/images/schedule-merger-config.png +0 -0
  25. package/docs/images/schedule-merger-example-1.png +0 -0
  26. package/docs/images/vipps-plakat.png +0 -0
  27. package/docs/images/vipps-qr.png +0 -0
  28. package/docs/images/vipps-smiling-rgb-orange-pos.png +0 -0
  29. package/docs/nodes/README.md +24 -4
  30. package/docs/nodes/dynamic-commands.md +91 -0
  31. package/docs/nodes/dynamic-config.md +84 -0
  32. package/docs/nodes/old-power-saver-doc.md +4 -0
  33. package/docs/nodes/ps-elvia-add-tariff.md +16 -0
  34. package/docs/nodes/ps-general-add-tariff.md +22 -0
  35. package/docs/nodes/ps-receive-price.md +14 -1
  36. package/docs/nodes/ps-schedule-merger.md +231 -0
  37. package/docs/nodes/ps-strategy-best-save.md +65 -109
  38. package/docs/nodes/ps-strategy-fixed-schedule.md +113 -0
  39. package/docs/nodes/ps-strategy-heat-capacitor.md +14 -1
  40. package/docs/nodes/ps-strategy-lowest-price.md +61 -110
  41. package/docs/nodes/strategy-input.md +4 -0
  42. package/package.json +5 -2
  43. package/src/elvia/elvia-add-tariff.html +1 -2
  44. package/src/elvia/elvia-add-tariff.js +0 -1
  45. package/src/elvia/elvia-api.js +6 -0
  46. package/src/elvia/elvia-tariff.html +1 -1
  47. package/src/general-add-tariff.html +14 -8
  48. package/src/general-add-tariff.js +0 -1
  49. package/src/handle-input.js +97 -106
  50. package/src/handle-output.js +117 -0
  51. package/src/receive-price-functions.js +3 -3
  52. package/src/schedule-merger-functions.js +98 -0
  53. package/src/schedule-merger.html +135 -0
  54. package/src/schedule-merger.js +112 -0
  55. package/src/strategy-best-save.html +38 -1
  56. package/src/strategy-best-save.js +17 -63
  57. package/src/strategy-fixed-schedule.html +339 -0
  58. package/src/strategy-fixed-schedule.js +84 -0
  59. package/src/strategy-functions.js +35 -0
  60. package/src/strategy-lowest-price.html +76 -38
  61. package/src/strategy-lowest-price.js +16 -35
  62. package/src/utils.js +75 -2
  63. package/test/commands-input-best-save.test.js +142 -0
  64. package/test/commands-input-lowest-price.test.js +149 -0
  65. package/test/commands-input-schedule-merger.test.js +128 -0
  66. package/test/data/best-save-overlap-result.json +5 -1
  67. package/test/data/best-save-result.json +4 -0
  68. package/test/data/commands-result-best-save.json +383 -0
  69. package/test/data/commands-result-lowest-price.json +340 -0
  70. package/test/data/fixed-schedule-result.json +353 -0
  71. package/test/data/lowest-price-result-cont-max-fail.json +5 -1
  72. package/test/data/lowest-price-result-cont-max.json +3 -1
  73. package/test/data/lowest-price-result-cont.json +8 -1
  74. package/test/data/lowest-price-result-missing-end.json +8 -3
  75. package/test/data/lowest-price-result-neg-cont.json +27 -0
  76. package/test/data/lowest-price-result-neg-split.json +23 -0
  77. package/test/data/lowest-price-result-split-allday.json +3 -1
  78. package/test/data/lowest-price-result-split-allday10.json +1 -0
  79. package/test/data/lowest-price-result-split-max.json +3 -1
  80. package/test/data/lowest-price-result-split.json +3 -1
  81. package/test/data/merge-schedule-data.js +238 -0
  82. package/test/data/negative-prices.json +197 -0
  83. package/test/data/nordpool-event-prices.json +96 -480
  84. package/test/data/nordpool-zero-prices.json +90 -0
  85. package/test/data/reconfigResult.js +1 -0
  86. package/test/data/result.js +1 -0
  87. package/test/data/tibber-result-end-0-24h.json +12 -2
  88. package/test/data/tibber-result-end-0.json +12 -2
  89. package/test/data/tibber-result.json +1 -0
  90. package/test/receive-price.test.js +22 -0
  91. package/test/schedule-merger-functions.test.js +101 -0
  92. package/test/schedule-merger-test-utils.js +27 -0
  93. package/test/schedule-merger.test.js +130 -0
  94. package/test/send-config-input.test.js +46 -2
  95. package/test/strategy-best-save-test-utils.js +1 -1
  96. package/test/strategy-best-save.test.js +91 -0
  97. package/test/strategy-fixed-schedule.test.js +117 -0
  98. package/test/strategy-heat-capacitor.test.js +1 -1
  99. package/test/strategy-lowest-price-functions.test.js +1 -1
  100. package/test/strategy-lowest-price-test-utils.js +31 -0
  101. package/test/strategy-lowest-price.test.js +55 -45
  102. package/test/test-utils.js +43 -36
  103. package/test/utils.test.js +13 -0
  104. package/docs/images/node-power-saver.png +0 -0
  105. package/docs/nodes/power-saver.md +0 -23
  106. package/src/power-saver.html +0 -116
  107. package/src/power-saver.js +0 -260
  108. package/test/commands-input.test.js +0 -47
  109. package/test/power-saver.test.js +0 -189
@@ -0,0 +1,238 @@
1
+ module.exports = {
2
+ allOff: [
3
+ {
4
+ start: "2021-06-20T00:00:00.000+02:00",
5
+ onOff: false,
6
+ price: 0.2494,
7
+ saving: 0.0395,
8
+ },
9
+ {
10
+ start: "2021-06-20T01:00:00.000+02:00",
11
+ onOff: false,
12
+ price: 0.3214,
13
+ saving: 0.0123,
14
+ },
15
+ {
16
+ start: "2021-06-20T02:00:00.000+02:00",
17
+ onOff: false,
18
+ price: 0.3323,
19
+ saving: 0.0121,
20
+ },
21
+ {
22
+ start: "2021-06-20T03:00:00.000+02:00",
23
+ onOff: false,
24
+ price: 0.2805,
25
+ saving: 0.0143,
26
+ },
27
+ {
28
+ start: "2021-06-20T04:00:00.000+02:00",
29
+ onOff: false,
30
+ price: 0.3109,
31
+ saving: 0.0255,
32
+ },
33
+ ],
34
+
35
+ allOn: [
36
+ {
37
+ start: "2021-06-20T00:00:00.000+02:00",
38
+ onOff: true,
39
+ price: 0.2494,
40
+ saving: 0.0395,
41
+ },
42
+ {
43
+ start: "2021-06-20T01:00:00.000+02:00",
44
+ onOff: true,
45
+ price: 0.3214,
46
+ saving: 0.0123,
47
+ },
48
+ {
49
+ start: "2021-06-20T02:00:00.000+02:00",
50
+ onOff: true,
51
+ price: 0.3323,
52
+ saving: 0.0121,
53
+ },
54
+ {
55
+ start: "2021-06-20T03:00:00.000+02:00",
56
+ onOff: true,
57
+ price: 0.2805,
58
+ saving: 0.0143,
59
+ },
60
+ {
61
+ start: "2021-06-20T04:00:00.000+02:00",
62
+ onOff: true,
63
+ price: 0.3109,
64
+ saving: 0.0255,
65
+ },
66
+ ],
67
+
68
+ someOn: [
69
+ {
70
+ start: "2021-06-20T00:00:00.000+02:00",
71
+ onOff: true,
72
+ price: 0.2494,
73
+ saving: 0.0395,
74
+ },
75
+ {
76
+ start: "2021-06-20T01:00:00.000+02:00",
77
+ onOff: false,
78
+ price: 0.3214,
79
+ saving: 0.0123,
80
+ },
81
+ {
82
+ start: "2021-06-20T02:00:00.000+02:00",
83
+ onOff: true,
84
+ price: 0.3323,
85
+ saving: 0.0121,
86
+ },
87
+ {
88
+ start: "2021-06-20T03:00:00.000+02:00",
89
+ onOff: false,
90
+ price: 0.2805,
91
+ saving: 0.0143,
92
+ },
93
+ {
94
+ start: "2021-06-20T04:00:00.000+02:00",
95
+ onOff: true,
96
+ price: 0.3109,
97
+ saving: 0.0255,
98
+ },
99
+ ],
100
+
101
+ theOtherOn: [
102
+ {
103
+ start: "2021-06-20T00:00:00.000+02:00",
104
+ onOff: false,
105
+ price: 0.2494,
106
+ saving: 0.0395,
107
+ },
108
+ {
109
+ start: "2021-06-20T01:00:00.000+02:00",
110
+ onOff: true,
111
+ price: 0.3214,
112
+ saving: 0.0123,
113
+ },
114
+ {
115
+ start: "2021-06-20T02:00:00.000+02:00",
116
+ onOff: false,
117
+ price: 0.3323,
118
+ saving: 0.0121,
119
+ },
120
+ {
121
+ start: "2021-06-20T03:00:00.000+02:00",
122
+ onOff: true,
123
+ price: 0.2805,
124
+ saving: 0.0143,
125
+ },
126
+ {
127
+ start: "2021-06-20T04:00:00.000+02:00",
128
+ onOff: false,
129
+ price: 0.3109,
130
+ saving: 0.0255,
131
+ },
132
+ ],
133
+
134
+ hourLater: [
135
+ {
136
+ start: "2021-06-20T01:00:00.000+02:00",
137
+ onOff: true,
138
+ price: 0.3214,
139
+ saving: 0.0123,
140
+ },
141
+ {
142
+ start: "2021-06-20T02:00:00.000+02:00",
143
+ onOff: false,
144
+ price: 0.3323,
145
+ saving: 0.0121,
146
+ },
147
+ {
148
+ start: "2021-06-20T03:00:00.000+02:00",
149
+ onOff: false,
150
+ price: 0.2805,
151
+ saving: 0.0143,
152
+ },
153
+ {
154
+ start: "2021-06-20T04:00:00.000+02:00",
155
+ onOff: true,
156
+ price: 0.3109,
157
+ saving: 0.0255,
158
+ },
159
+ {
160
+ start: "2021-06-20T05:00:00.000+02:00",
161
+ onOff: true,
162
+ price: 0.2494,
163
+ saving: 0.0395,
164
+ },
165
+ ],
166
+
167
+ lessHours: [
168
+ {
169
+ start: "2021-06-20T00:00:00.000+02:00",
170
+ onOff: false,
171
+ price: 0.3323,
172
+ saving: 0.0121,
173
+ },
174
+ {
175
+ start: "2021-06-20T01:00:00.000+02:00",
176
+ onOff: true,
177
+ price: 0.2805,
178
+ saving: 0.0143,
179
+ },
180
+ {
181
+ start: "2021-06-20T02:00:00.000+02:00",
182
+ onOff: false,
183
+ price: 0.3109,
184
+ saving: 0.0255,
185
+ },
186
+ ],
187
+
188
+ moreHours: [
189
+ {
190
+ start: "2021-06-20T00:00:00.000+02:00",
191
+ onOff: true,
192
+ price: 0.2494,
193
+ saving: 0.0395,
194
+ },
195
+ {
196
+ start: "2021-06-20T01:00:00.000+02:00",
197
+ onOff: true,
198
+ price: 0.3214,
199
+ saving: 0.0123,
200
+ },
201
+ {
202
+ start: "2021-06-20T02:00:00.000+02:00",
203
+ onOff: false,
204
+ price: 0.3323,
205
+ saving: 0.0121,
206
+ },
207
+ {
208
+ start: "2021-06-20T03:00:00.000+02:00",
209
+ onOff: false,
210
+ price: 0.2805,
211
+ saving: 0.0143,
212
+ },
213
+ {
214
+ start: "2021-06-20T04:00:00.000+02:00",
215
+ onOff: false,
216
+ price: 0.3109,
217
+ saving: 0.0255,
218
+ },
219
+ {
220
+ start: "2021-06-20T05:00:00.000+02:00",
221
+ onOff: true,
222
+ price: 0.2494,
223
+ saving: 0.0395,
224
+ },
225
+ {
226
+ start: "2021-06-20T06:00:00.000+02:00",
227
+ onOff: true,
228
+ price: 0.2494,
229
+ saving: 0.0395,
230
+ },
231
+ {
232
+ start: "2021-06-20T07:00:00.000+02:00",
233
+ onOff: false,
234
+ price: 0.2494,
235
+ saving: 0.0395,
236
+ },
237
+ ],
238
+ };
@@ -0,0 +1,197 @@
1
+ {
2
+ "source": "Tibber",
3
+ "priceData": [
4
+ {
5
+ "value": 0.2494,
6
+ "start": "2021-10-11T00:00:00.000+02:00"
7
+ },
8
+ {
9
+ "value": 0,
10
+ "start": "2021-10-11T01:00:00.000+02:00"
11
+ },
12
+ {
13
+ "value": 0,
14
+ "start": "2021-10-11T02:00:00.000+02:00"
15
+ },
16
+ {
17
+ "value": 0.39,
18
+ "start": "2021-10-11T03:00:00.000+02:00"
19
+ },
20
+ {
21
+ "value": -0.2614,
22
+ "start": "2021-10-11T04:00:00.000+02:00"
23
+ },
24
+ {
25
+ "value": -0.4426,
26
+ "start": "2021-10-11T05:00:00.000+02:00"
27
+ },
28
+ {
29
+ "value": 0.5433,
30
+ "start": "2021-10-11T06:00:00.000+02:00"
31
+ },
32
+ {
33
+ "value": 0.5667,
34
+ "start": "2021-10-11T07:00:00.000+02:00"
35
+ },
36
+ {
37
+ "value": 0.5847,
38
+ "start": "2021-10-11T08:00:00.000+02:00"
39
+ },
40
+ {
41
+ "value": 0.5762,
42
+ "start": "2021-10-11T09:00:00.000+02:00"
43
+ },
44
+ {
45
+ "value": 0.5391,
46
+ "start": "2021-10-11T10:00:00.000+02:00"
47
+ },
48
+ {
49
+ "value": 0.5124,
50
+ "start": "2021-10-11T11:00:00.000+02:00"
51
+ },
52
+ {
53
+ "value": 0.504,
54
+ "start": "2021-10-11T12:00:00.000+02:00"
55
+ },
56
+ {
57
+ "value": 0.5057,
58
+ "start": "2021-10-11T13:00:00.000+02:00"
59
+ },
60
+ {
61
+ "value": 0.5066,
62
+ "start": "2021-10-11T14:00:00.000+02:00"
63
+ },
64
+ {
65
+ "value": 0.5136,
66
+ "start": "2021-10-11T15:00:00.000+02:00"
67
+ },
68
+ {
69
+ "value": 0.5143,
70
+ "start": "2021-10-11T16:00:00.000+02:00"
71
+ },
72
+ {
73
+ "value": 0.5306,
74
+ "start": "2021-10-11T17:00:00.000+02:00"
75
+ },
76
+ {
77
+ "value": 0.5534,
78
+ "start": "2021-10-11T18:00:00.000+02:00"
79
+ },
80
+ {
81
+ "value": 0.5511,
82
+ "start": "2021-10-11T19:00:00.000+02:00"
83
+ },
84
+ {
85
+ "value": 0.5491,
86
+ "start": "2021-10-11T20:00:00.000+02:00"
87
+ },
88
+ {
89
+ "value": 0.5485,
90
+ "start": "2021-10-11T21:00:00.000+02:00"
91
+ },
92
+ {
93
+ "value": 0.5481,
94
+ "start": "2021-10-11T22:00:00.000+02:00"
95
+ },
96
+ {
97
+ "value": 0.5218,
98
+ "start": "2021-10-11T23:00:00.000+02:00"
99
+ },
100
+ {
101
+ "value": 0.4533,
102
+ "start": "2021-10-12T00:00:00.000+02:00"
103
+ },
104
+ {
105
+ "value": 0.4196,
106
+ "start": "2021-10-12T01:00:00.000+02:00"
107
+ },
108
+ {
109
+ "value": 0.4037,
110
+ "start": "2021-10-12T02:00:00.000+02:00"
111
+ },
112
+ {
113
+ "value": 0.3829,
114
+ "start": "2021-10-12T03:00:00.000+02:00"
115
+ },
116
+ {
117
+ "value": 0.4555,
118
+ "start": "2021-10-12T04:00:00.000+02:00"
119
+ },
120
+ {
121
+ "value": 0.4721,
122
+ "start": "2021-10-12T05:00:00.000+02:00"
123
+ },
124
+ {
125
+ "value": 0.4903,
126
+ "start": "2021-10-12T06:00:00.000+02:00"
127
+ },
128
+ {
129
+ "value": 0.5028,
130
+ "start": "2021-10-12T07:00:00.000+02:00"
131
+ },
132
+ {
133
+ "value": 0.5163,
134
+ "start": "2021-10-12T08:00:00.000+02:00"
135
+ },
136
+ {
137
+ "value": 0.5264,
138
+ "start": "2021-10-12T09:00:00.000+02:00"
139
+ },
140
+ {
141
+ "value": 0.5346,
142
+ "start": "2021-10-12T10:00:00.000+02:00"
143
+ },
144
+ {
145
+ "value": 0.5224,
146
+ "start": "2021-10-12T11:00:00.000+02:00"
147
+ },
148
+ {
149
+ "value": 0.5071,
150
+ "start": "2021-10-12T12:00:00.000+02:00"
151
+ },
152
+ {
153
+ "value": 0.5045,
154
+ "start": "2021-10-12T13:00:00.000+02:00"
155
+ },
156
+ {
157
+ "value": 0.5024,
158
+ "start": "2021-10-12T14:00:00.000+02:00"
159
+ },
160
+ {
161
+ "value": 0.5038,
162
+ "start": "2021-10-12T15:00:00.000+02:00"
163
+ },
164
+ {
165
+ "value": 0.5118,
166
+ "start": "2021-10-12T16:00:00.000+02:00"
167
+ },
168
+ {
169
+ "value": 0.5111,
170
+ "start": "2021-10-12T17:00:00.000+02:00"
171
+ },
172
+ {
173
+ "value": 0.5108,
174
+ "start": "2021-10-12T18:00:00.000+02:00"
175
+ },
176
+ {
177
+ "value": 0.5055,
178
+ "start": "2021-10-12T19:00:00.000+02:00"
179
+ },
180
+ {
181
+ "value": 0.5042,
182
+ "start": "2021-10-12T20:00:00.000+02:00"
183
+ },
184
+ {
185
+ "value": 0.5259,
186
+ "start": "2021-10-12T21:00:00.000+02:00"
187
+ },
188
+ {
189
+ "value": 0.5282,
190
+ "start": "2021-10-12T22:00:00.000+02:00"
191
+ },
192
+ {
193
+ "value": 0.5252,
194
+ "start": "2021-10-12T23:00:00.000+02:00"
195
+ }
196
+ ]
197
+ }