node-red-contrib-power-saver 5.0.0-beta.5 → 5.0.0-beta.6

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.
@@ -7,6 +7,10 @@ sidebarDepth: 1
7
7
 
8
8
  List the most significant changes.
9
9
 
10
+ ## 5.0.0.beta.6
11
+
12
+ - Best Save Performance improvement
13
+
10
14
  ## 5.0.0.beta.5
11
15
 
12
16
  - Fix Lowest Price so on-periods are not split up if they can go together
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-power-saver",
3
- "version": "5.0.0-beta.5",
3
+ "version": "5.0.0-beta.6",
4
4
  "description": "A module for Node-RED that you can use to turn on and off a switch based on power prices",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -13,12 +13,7 @@ const { fillArray } = require("./utils");
13
13
  * @param {*} recoveryMaxMinutes Maximum recovery time in minutes
14
14
  * @returns
15
15
  */
16
- function isOnOffSequencesOk(
17
- onOff,
18
- maxMinutesOff,
19
- minMinutesOff,
20
- recoveryPercentage,
21
- recoveryMaxMinutes = null) {
16
+ function isOnOffSequencesOk(onOff, maxMinutesOff, minMinutesOff, recoveryPercentage, recoveryMaxMinutes = null) {
22
17
  let offCount = 0;
23
18
  let onCount = 0;
24
19
  let reachedMaxOff = false;
@@ -30,10 +25,10 @@ function isOnOffSequencesOk(
30
25
  if (maxMinutesOff === 0 || reachedMaxOff) {
31
26
  return false;
32
27
  }
33
- if(!reachedMinOn) {
28
+ if (!reachedMinOn) {
34
29
  return false;
35
30
  }
36
- if(reachedMinOff === null) {
31
+ if (reachedMinOff === null) {
37
32
  reachedMinOff = false;
38
33
  }
39
34
  offCount++;
@@ -44,16 +39,16 @@ function isOnOffSequencesOk(
44
39
  if (offCount >= minMinutesOff) {
45
40
  reachedMinOff = true;
46
41
  }
47
- const minRounded = Math.max(Math.round(offCount * recoveryPercentage / 100), 1)
42
+ const minRounded = Math.max(Math.round((offCount * recoveryPercentage) / 100), 1);
48
43
  const recMaxMin = recoveryMaxMinutes === "" ? null : recoveryMaxMinutes;
49
- minOnAfterOff = Math.min(minRounded, recMaxMin ?? minRounded)
50
- if(i === onOff.length - 1) {
44
+ minOnAfterOff = Math.min(minRounded, recMaxMin ?? minRounded);
45
+ if (i === onOff.length - 1) {
51
46
  // If last minute, consider min reached
52
47
  reachedMinOn = true;
53
48
  reachedMinOff = true;
54
49
  }
55
50
  } else {
56
- if(reachedMinOff === false) {
51
+ if (reachedMinOff === false) {
57
52
  return false;
58
53
  }
59
54
  onCount++;
@@ -123,12 +118,12 @@ function calculate(
123
118
  }
124
119
  }
125
120
 
126
- savingsList.sort((a, b) => b.saving === a.saving ? a.count - b.count : b.saving - a.saving);
121
+ savingsList.sort((b, a) => (b.saving === a.saving ? a.count - b.count : b.saving - a.saving));
127
122
  let onOff = values.map((v) => true); // Start with all on
128
123
 
129
124
  // Find the best possible sequences
130
125
  while (savingsList.length > 0) {
131
- const { minute, count } = savingsList[0];
126
+ const { minute, count } = savingsList[savingsList.length - 1];
132
127
  const onOffCopy = [...onOff];
133
128
  let alreadyTaken = false;
134
129
  for (let c = 0; c < count; c++) {
@@ -137,12 +132,11 @@ function calculate(
137
132
  }
138
133
  onOff[minute + c] = false;
139
134
  }
140
- if (isOnOffSequencesOk([...dayBefore, ...onOff], maxMinutesOff, minMinutesOff, recoveryPercentage,
141
- recoveryMaxMinutes) && !alreadyTaken) {
135
+ if ( isOnOffSequencesOk( [...dayBefore, ...onOff], maxMinutesOff, minMinutesOff, recoveryPercentage, recoveryMaxMinutes ) && !alreadyTaken ) {
142
136
  savingsList = savingsList.filter((s) => s.minute < minute || s.minute >= minute + count);
143
137
  } else {
144
138
  onOff = [...onOffCopy];
145
- savingsList.splice(0, 1);
139
+ savingsList.pop();
146
140
  }
147
141
  }
148
142
  return onOff;
@@ -0,0 +1,197 @@
1
+ module.exports = {
2
+ priceData: [
3
+ { value: 1.1599, start: "2026-01-10T00:00:00.000+01:00" },
4
+ { value: 1.1599, start: "2026-01-10T00:15:00.000+01:00" },
5
+ { value: 1.1599, start: "2026-01-10T00:30:00.000+01:00" },
6
+ { value: 1.1599, start: "2026-01-10T00:45:00.000+01:00" },
7
+ { value: 1.1341, start: "2026-01-10T01:00:00.000+01:00" },
8
+ { value: 1.1341, start: "2026-01-10T01:15:00.000+01:00" },
9
+ { value: 1.1341, start: "2026-01-10T01:30:00.000+01:00" },
10
+ { value: 1.1341, start: "2026-01-10T01:45:00.000+01:00" },
11
+ { value: 1.1122, start: "2026-01-10T02:00:00.000+01:00" },
12
+ { value: 1.1122, start: "2026-01-10T02:15:00.000+01:00" },
13
+ { value: 1.1122, start: "2026-01-10T02:30:00.000+01:00" },
14
+ { value: 1.1122, start: "2026-01-10T02:45:00.000+01:00" },
15
+ { value: 1.0987, start: "2026-01-10T03:00:00.000+01:00" },
16
+ { value: 1.0987, start: "2026-01-10T03:15:00.000+01:00" },
17
+ { value: 1.0987, start: "2026-01-10T03:30:00.000+01:00" },
18
+ { value: 1.0987, start: "2026-01-10T03:45:00.000+01:00" },
19
+ { value: 1.1093, start: "2026-01-10T04:00:00.000+01:00" },
20
+ { value: 1.1093, start: "2026-01-10T04:15:00.000+01:00" },
21
+ { value: 1.1093, start: "2026-01-10T04:30:00.000+01:00" },
22
+ { value: 1.1093, start: "2026-01-10T04:45:00.000+01:00" },
23
+ { value: 1.1234, start: "2026-01-10T05:00:00.000+01:00" },
24
+ { value: 1.1234, start: "2026-01-10T05:15:00.000+01:00" },
25
+ { value: 1.1234, start: "2026-01-10T05:30:00.000+01:00" },
26
+ { value: 1.1234, start: "2026-01-10T05:45:00.000+01:00" },
27
+ { value: 1.1358, start: "2026-01-10T06:00:00.000+01:00" },
28
+ { value: 1.1358, start: "2026-01-10T06:15:00.000+01:00" },
29
+ { value: 1.1358, start: "2026-01-10T06:30:00.000+01:00" },
30
+ { value: 1.1358, start: "2026-01-10T06:45:00.000+01:00" },
31
+ { value: 1.1978, start: "2026-01-10T07:00:00.000+01:00" },
32
+ { value: 1.1978, start: "2026-01-10T07:15:00.000+01:00" },
33
+ { value: 1.1978, start: "2026-01-10T07:30:00.000+01:00" },
34
+ { value: 1.1978, start: "2026-01-10T07:45:00.000+01:00" },
35
+ { value: 1.2682, start: "2026-01-10T08:00:00.000+01:00" },
36
+ { value: 1.2682, start: "2026-01-10T08:15:00.000+01:00" },
37
+ { value: 1.2682, start: "2026-01-10T08:30:00.000+01:00" },
38
+ { value: 1.2682, start: "2026-01-10T08:45:00.000+01:00" },
39
+ { value: 1.3567, start: "2026-01-10T09:00:00.000+01:00" },
40
+ { value: 1.3567, start: "2026-01-10T09:15:00.000+01:00" },
41
+ { value: 1.3567, start: "2026-01-10T09:30:00.000+01:00" },
42
+ { value: 1.3567, start: "2026-01-10T09:45:00.000+01:00" },
43
+ { value: 1.4249, start: "2026-01-10T10:00:00.000+01:00" },
44
+ { value: 1.4249, start: "2026-01-10T10:15:00.000+01:00" },
45
+ { value: 1.4249, start: "2026-01-10T10:30:00.000+01:00" },
46
+ { value: 1.4249, start: "2026-01-10T10:45:00.000+01:00" },
47
+ { value: 1.4814, start: "2026-01-10T11:00:00.000+01:00" },
48
+ { value: 1.4814, start: "2026-01-10T11:15:00.000+01:00" },
49
+ { value: 1.4814, start: "2026-01-10T11:30:00.000+01:00" },
50
+ { value: 1.4814, start: "2026-01-10T11:45:00.000+01:00" },
51
+ { value: 1.4815, start: "2026-01-10T12:00:00.000+01:00" },
52
+ { value: 1.4815, start: "2026-01-10T12:15:00.000+01:00" },
53
+ { value: 1.4815, start: "2026-01-10T12:30:00.000+01:00" },
54
+ { value: 1.4815, start: "2026-01-10T12:45:00.000+01:00" },
55
+ { value: 1.5304, start: "2026-01-10T13:00:00.000+01:00" },
56
+ { value: 1.5304, start: "2026-01-10T13:15:00.000+01:00" },
57
+ { value: 1.5304, start: "2026-01-10T13:30:00.000+01:00" },
58
+ { value: 1.5304, start: "2026-01-10T13:45:00.000+01:00" },
59
+ { value: 1.6047, start: "2026-01-10T14:00:00.000+01:00" },
60
+ { value: 1.6047, start: "2026-01-10T14:15:00.000+01:00" },
61
+ { value: 1.6047, start: "2026-01-10T14:30:00.000+01:00" },
62
+ { value: 1.6047, start: "2026-01-10T14:45:00.000+01:00" },
63
+ { value: 1.703, start: "2026-01-10T15:00:00.000+01:00" },
64
+ { value: 1.703, start: "2026-01-10T15:15:00.000+01:00" },
65
+ { value: 1.703, start: "2026-01-10T15:30:00.000+01:00" },
66
+ { value: 1.703, start: "2026-01-10T15:45:00.000+01:00" },
67
+ { value: 1.8582, start: "2026-01-10T16:00:00.000+01:00" },
68
+ { value: 1.8582, start: "2026-01-10T16:15:00.000+01:00" },
69
+ { value: 1.8582, start: "2026-01-10T16:30:00.000+01:00" },
70
+ { value: 1.8582, start: "2026-01-10T16:45:00.000+01:00" },
71
+ { value: 2.0223, start: "2026-01-10T17:00:00.000+01:00" },
72
+ { value: 2.0223, start: "2026-01-10T17:15:00.000+01:00" },
73
+ { value: 2.0223, start: "2026-01-10T17:30:00.000+01:00" },
74
+ { value: 2.0223, start: "2026-01-10T17:45:00.000+01:00" },
75
+ { value: 1.985, start: "2026-01-10T18:00:00.000+01:00" },
76
+ { value: 1.985, start: "2026-01-10T18:15:00.000+01:00" },
77
+ { value: 1.985, start: "2026-01-10T18:30:00.000+01:00" },
78
+ { value: 1.985, start: "2026-01-10T18:45:00.000+01:00" },
79
+ { value: 1.8633, start: "2026-01-10T19:00:00.000+01:00" },
80
+ { value: 1.8633, start: "2026-01-10T19:15:00.000+01:00" },
81
+ { value: 1.8633, start: "2026-01-10T19:30:00.000+01:00" },
82
+ { value: 1.8633, start: "2026-01-10T19:45:00.000+01:00" },
83
+ { value: 1.7377, start: "2026-01-10T20:00:00.000+01:00" },
84
+ { value: 1.7377, start: "2026-01-10T20:15:00.000+01:00" },
85
+ { value: 1.7377, start: "2026-01-10T20:30:00.000+01:00" },
86
+ { value: 1.7377, start: "2026-01-10T20:45:00.000+01:00" },
87
+ { value: 1.6171, start: "2026-01-10T21:00:00.000+01:00" },
88
+ { value: 1.6171, start: "2026-01-10T21:15:00.000+01:00" },
89
+ { value: 1.6171, start: "2026-01-10T21:30:00.000+01:00" },
90
+ { value: 1.6171, start: "2026-01-10T21:45:00.000+01:00" },
91
+ { value: 1.4753, start: "2026-01-10T22:00:00.000+01:00" },
92
+ { value: 1.4753, start: "2026-01-10T22:15:00.000+01:00" },
93
+ { value: 1.4753, start: "2026-01-10T22:30:00.000+01:00" },
94
+ { value: 1.4753, start: "2026-01-10T22:45:00.000+01:00" },
95
+ { value: 1.328, start: "2026-01-10T23:00:00.000+01:00" },
96
+ { value: 1.328, start: "2026-01-10T23:15:00.000+01:00" },
97
+ { value: 1.328, start: "2026-01-10T23:30:00.000+01:00" },
98
+ { value: 1.328, start: "2026-01-10T23:45:00.000+01:00" },
99
+ { value: 1.2678, start: "2026-01-11T00:00:00.000+01:00" },
100
+ { value: 1.2678, start: "2026-01-11T00:15:00.000+01:00" },
101
+ { value: 1.2678, start: "2026-01-11T00:30:00.000+01:00" },
102
+ { value: 1.2678, start: "2026-01-11T00:45:00.000+01:00" },
103
+ { value: 1.2745, start: "2026-01-11T01:00:00.000+01:00" },
104
+ { value: 1.2745, start: "2026-01-11T01:15:00.000+01:00" },
105
+ { value: 1.2745, start: "2026-01-11T01:30:00.000+01:00" },
106
+ { value: 1.2745, start: "2026-01-11T01:45:00.000+01:00" },
107
+ { value: 1.1884, start: "2026-01-11T02:00:00.000+01:00" },
108
+ { value: 1.1884, start: "2026-01-11T02:15:00.000+01:00" },
109
+ { value: 1.1884, start: "2026-01-11T02:30:00.000+01:00" },
110
+ { value: 1.1884, start: "2026-01-11T02:45:00.000+01:00" },
111
+ { value: 1.1922, start: "2026-01-11T03:00:00.000+01:00" },
112
+ { value: 1.1922, start: "2026-01-11T03:15:00.000+01:00" },
113
+ { value: 1.1922, start: "2026-01-11T03:30:00.000+01:00" },
114
+ { value: 1.1922, start: "2026-01-11T03:45:00.000+01:00" },
115
+ { value: 1.1889, start: "2026-01-11T04:00:00.000+01:00" },
116
+ { value: 1.1889, start: "2026-01-11T04:15:00.000+01:00" },
117
+ { value: 1.1889, start: "2026-01-11T04:30:00.000+01:00" },
118
+ { value: 1.1889, start: "2026-01-11T04:45:00.000+01:00" },
119
+ { value: 1.2024, start: "2026-01-11T05:00:00.000+01:00" },
120
+ { value: 1.2024, start: "2026-01-11T05:15:00.000+01:00" },
121
+ { value: 1.2024, start: "2026-01-11T05:30:00.000+01:00" },
122
+ { value: 1.2024, start: "2026-01-11T05:45:00.000+01:00" },
123
+ { value: 1.1888, start: "2026-01-11T06:00:00.000+01:00" },
124
+ { value: 1.1888, start: "2026-01-11T06:15:00.000+01:00" },
125
+ { value: 1.1888, start: "2026-01-11T06:30:00.000+01:00" },
126
+ { value: 1.1888, start: "2026-01-11T06:45:00.000+01:00" },
127
+ { value: 1.2164, start: "2026-01-11T07:00:00.000+01:00" },
128
+ { value: 1.2164, start: "2026-01-11T07:15:00.000+01:00" },
129
+ { value: 1.2164, start: "2026-01-11T07:30:00.000+01:00" },
130
+ { value: 1.2164, start: "2026-01-11T07:45:00.000+01:00" },
131
+ { value: 1.2953, start: "2026-01-11T08:00:00.000+01:00" },
132
+ { value: 1.2953, start: "2026-01-11T08:15:00.000+01:00" },
133
+ { value: 1.2953, start: "2026-01-11T08:30:00.000+01:00" },
134
+ { value: 1.2953, start: "2026-01-11T08:45:00.000+01:00" },
135
+ { value: 1.4772, start: "2026-01-11T09:00:00.000+01:00" },
136
+ { value: 1.4772, start: "2026-01-11T09:15:00.000+01:00" },
137
+ { value: 1.4772, start: "2026-01-11T09:30:00.000+01:00" },
138
+ { value: 1.4772, start: "2026-01-11T09:45:00.000+01:00" },
139
+ { value: 1.467, start: "2026-01-11T10:00:00.000+01:00" },
140
+ { value: 1.467, start: "2026-01-11T10:15:00.000+01:00" },
141
+ { value: 1.467, start: "2026-01-11T10:30:00.000+01:00" },
142
+ { value: 1.467, start: "2026-01-11T10:45:00.000+01:00" },
143
+ { value: 1.4597, start: "2026-01-11T11:00:00.000+01:00" },
144
+ { value: 1.4597, start: "2026-01-11T11:15:00.000+01:00" },
145
+ { value: 1.4597, start: "2026-01-11T11:30:00.000+01:00" },
146
+ { value: 1.4597, start: "2026-01-11T11:45:00.000+01:00" },
147
+ { value: 1.4224, start: "2026-01-11T12:00:00.000+01:00" },
148
+ { value: 1.4224, start: "2026-01-11T12:15:00.000+01:00" },
149
+ { value: 1.4224, start: "2026-01-11T12:30:00.000+01:00" },
150
+ { value: 1.4224, start: "2026-01-11T12:45:00.000+01:00" },
151
+ { value: 1.4143, start: "2026-01-11T13:00:00.000+01:00" },
152
+ { value: 1.4143, start: "2026-01-11T13:15:00.000+01:00" },
153
+ { value: 1.4143, start: "2026-01-11T13:30:00.000+01:00" },
154
+ { value: 1.4143, start: "2026-01-11T13:45:00.000+01:00" },
155
+ { value: 1.448, start: "2026-01-11T14:00:00.000+01:00" },
156
+ { value: 1.448, start: "2026-01-11T14:15:00.000+01:00" },
157
+ { value: 1.448, start: "2026-01-11T14:30:00.000+01:00" },
158
+ { value: 1.448, start: "2026-01-11T14:45:00.000+01:00" },
159
+ { value: 1.4894, start: "2026-01-11T15:00:00.000+01:00" },
160
+ { value: 1.4894, start: "2026-01-11T15:15:00.000+01:00" },
161
+ { value: 1.4894, start: "2026-01-11T15:30:00.000+01:00" },
162
+ { value: 1.4894, start: "2026-01-11T15:45:00.000+01:00" },
163
+ { value: 1.6688, start: "2026-01-11T16:00:00.000+01:00" },
164
+ { value: 1.6688, start: "2026-01-11T16:15:00.000+01:00" },
165
+ { value: 1.6688, start: "2026-01-11T16:30:00.000+01:00" },
166
+ { value: 1.6688, start: "2026-01-11T16:45:00.000+01:00" },
167
+ { value: 1.7748, start: "2026-01-11T17:00:00.000+01:00" },
168
+ { value: 1.7748, start: "2026-01-11T17:15:00.000+01:00" },
169
+ { value: 1.7748, start: "2026-01-11T17:30:00.000+01:00" },
170
+ { value: 1.7748, start: "2026-01-11T17:45:00.000+01:00" },
171
+ { value: 1.7433, start: "2026-01-11T18:00:00.000+01:00" },
172
+ { value: 1.7433, start: "2026-01-11T18:15:00.000+01:00" },
173
+ { value: 1.7433, start: "2026-01-11T18:30:00.000+01:00" },
174
+ { value: 1.7433, start: "2026-01-11T18:45:00.000+01:00" },
175
+ { value: 1.8114, start: "2026-01-11T19:00:00.000+01:00" },
176
+ { value: 1.8114, start: "2026-01-11T19:15:00.000+01:00" },
177
+ { value: 1.8114, start: "2026-01-11T19:30:00.000+01:00" },
178
+ { value: 1.8114, start: "2026-01-11T19:45:00.000+01:00" },
179
+ { value: 1.5806, start: "2026-01-11T20:00:00.000+01:00" },
180
+ { value: 1.5806, start: "2026-01-11T20:15:00.000+01:00" },
181
+ { value: 1.5806, start: "2026-01-11T20:30:00.000+01:00" },
182
+ { value: 1.5806, start: "2026-01-11T20:45:00.000+01:00" },
183
+ { value: 1.5828, start: "2026-01-11T21:00:00.000+01:00" },
184
+ { value: 1.5828, start: "2026-01-11T21:15:00.000+01:00" },
185
+ { value: 1.5828, start: "2026-01-11T21:30:00.000+01:00" },
186
+ { value: 1.5828, start: "2026-01-11T21:45:00.000+01:00" },
187
+ { value: 1.3596, start: "2026-01-11T22:00:00.000+01:00" },
188
+ { value: 1.3596, start: "2026-01-11T22:15:00.000+01:00" },
189
+ { value: 1.3596, start: "2026-01-11T22:30:00.000+01:00" },
190
+ { value: 1.3596, start: "2026-01-11T22:45:00.000+01:00" },
191
+ { value: 1.2489, start: "2026-01-11T23:00:00.000+01:00" },
192
+ { value: 1.2489, start: "2026-01-11T23:15:00.000+01:00" },
193
+ { value: 1.2489, start: "2026-01-11T23:30:00.000+01:00" },
194
+ { value: 1.2489, start: "2026-01-11T23:45:00.000+01:00", end: "2026-01-12T00:00:00.000+01:00" },
195
+ ],
196
+ source: "Tibber",
197
+ };
@@ -0,0 +1,79 @@
1
+ const cloneDeep = require("lodash.clonedeep");
2
+ const { DateTime } = require("luxon");
3
+ const expect = require("chai").expect;
4
+ const helper = require("node-red-node-test-helper");
5
+ const bestSave = require("../src/strategy-best-save.js");
6
+ const payload = require("./data/best-save-performance-price-data.js");
7
+
8
+ const { testPlan: plan, equalPlan } = require("./test-utils.js");
9
+ const { makeFlow } = require("./strategy-best-save-test-utils.js");
10
+
11
+ helper.init(require.resolve("node-red"));
12
+
13
+ describe("ps-strategy-best-save performance", function () {
14
+ beforeEach(function (done) {
15
+ helper.startServer(done);
16
+ });
17
+
18
+ afterEach(function (done) {
19
+ helper.unload().then(function () {
20
+ helper.stopServer(done);
21
+ });
22
+ });
23
+
24
+ it("short intervals should be quick", function (done) {
25
+ this.timeout(500);
26
+ const maxMinutesOff = 6
27
+ const minMinutesOff = 6
28
+ const recoveryPercentage = 20
29
+ const recoveryMaxMinutes = 180
30
+ const flow = makeFlow(maxMinutesOff, minMinutesOff, recoveryPercentage, recoveryMaxMinutes);
31
+ helper.load(bestSave, flow, function () {
32
+ const n1 = helper.getNode("n1");
33
+ const n2 = helper.getNode("n2");
34
+ n2.on("input", function (msg) {
35
+ n1.warn.should.not.be.called;
36
+ done();
37
+ });
38
+ n1.receive({ payload });
39
+ });
40
+ });
41
+
42
+ it("medium intervals should be quick enough", function (done) {
43
+ this.timeout(4000);
44
+ const maxMinutesOff = 300
45
+ const minMinutesOff = 60
46
+ const recoveryPercentage = 20
47
+ const recoveryMaxMinutes = 180
48
+ const flow = makeFlow(maxMinutesOff, minMinutesOff, recoveryPercentage, recoveryMaxMinutes);
49
+ helper.load(bestSave, flow, function () {
50
+ const n1 = helper.getNode("n1");
51
+ const n2 = helper.getNode("n2");
52
+ n2.on("input", function (msg) {
53
+ n1.warn.should.not.be.called;
54
+ done();
55
+ });
56
+ n1.receive({ payload });
57
+ });
58
+ });
59
+
60
+ it("long intervals should be fairly quick", function (done) {
61
+ this.timeout(10000);
62
+ const maxMinutesOff = 840
63
+ const minMinutesOff = 60
64
+ const recoveryPercentage = 20
65
+ const recoveryMaxMinutes = 180
66
+ const flow = makeFlow(maxMinutesOff, minMinutesOff, recoveryPercentage, recoveryMaxMinutes);
67
+ helper.load(bestSave, flow, function () {
68
+ const n1 = helper.getNode("n1");
69
+ const n2 = helper.getNode("n2");
70
+ n2.on("input", function (msg) {
71
+ n1.warn.should.not.be.called;
72
+ done();
73
+ });
74
+ n1.receive({ payload });
75
+ });
76
+ });
77
+
78
+
79
+ });
@@ -400,7 +400,7 @@ describe("ps-strategy-lowest-price node", function () {
400
400
 
401
401
  it("should work with data for only current day", function (done) {
402
402
  const oneDayPrices = {};
403
- oneDayPrices.priceData = prices.priceData.filter((d) => d.start.startsWith("2021-10-11"));
403
+ oneDayPrices.priceData = cloneDeep(prices.priceData).filter((d) => d.start.startsWith("2021-10-11"));
404
404
  oneDayPrices.priceData[oneDayPrices.priceData.length - 1].end = "2021-10-12T00:00:00.000+02:00";
405
405
  const result = [
406
406
  { time: "2021-10-11T00:00:00.000+02:00", value: false, countMinutes: 12 * 60 },
package/= DELETED
File without changes