-
Notifications
You must be signed in to change notification settings - Fork 0
/
flows.json
535 lines (535 loc) · 16.4 KB
/
flows.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
[
{
"id": "9c8d5dd92d377ae7",
"type": "change",
"z": "9170653ac436c1aa",
"name": "",
"rules": [
{
"t": "set",
"p": "soc",
"pt": "flow",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 390,
"y": 60,
"wires": [
[]
]
},
{
"id": "de417502891bb773",
"type": "change",
"z": "9170653ac436c1aa",
"name": "",
"rules": [
{
"t": "set",
"p": "setpoint",
"pt": "flow",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 400,
"y": 20,
"wires": [
[]
]
},
{
"id": "c2b63f42dafb3a2c",
"type": "inject",
"z": "9170653ac436c1aa",
"name": "Battery Maintenance",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "*/1 20-22 * * *",
"once": false,
"onceDelay": "",
"topic": "",
"payload": "-50",
"payloadType": "num",
"x": 180,
"y": 160,
"wires": [
[
"728bdd3a1f9ea839"
]
]
},
{
"id": "8fe1fa924d62aa4c",
"type": "victron-output-ess",
"z": "9170653ac436c1aa",
"service": "com.victronenergy.settings",
"path": "/Settings/CGwacs/AcPowerSetPoint",
"serviceObj": {
"service": "com.victronenergy.settings",
"name": "Venus settings"
},
"pathObj": {
"path": "/Settings/CGwacs/AcPowerSetPoint",
"type": "integer",
"name": "Grid set-point (W)",
"writable": true
},
"initial": "",
"name": "",
"onlyChanges": false,
"x": 640,
"y": 300,
"wires": []
},
{
"id": "2d95a991de2b7e0b",
"type": "victron-output-settings",
"z": "9170653ac436c1aa",
"service": "com.victronenergy.settings",
"path": "/Settings/SystemSetup/MaxChargeCurrent",
"serviceObj": {
"service": "com.victronenergy.settings",
"name": "Venus settings"
},
"pathObj": {
"path": "/Settings/SystemSetup/MaxChargeCurrent",
"type": "float",
"name": "DVCC system max charge current (A DC)",
"writable": true
},
"name": "",
"onlyChanges": false,
"x": 710,
"y": 360,
"wires": []
},
{
"id": "a7b035271bc15404",
"type": "victron-input-battery",
"z": "9170653ac436c1aa",
"service": "com.victronenergy.battery/512",
"path": "/Soc",
"serviceObj": {
"service": "com.victronenergy.battery/512",
"name": "Pylontech battery"
},
"pathObj": {
"path": "/Soc",
"type": "float",
"name": "State of charge (%)"
},
"name": "",
"onlyChanges": true,
"x": 170,
"y": 100,
"wires": [
[
"9c8d5dd92d377ae7"
]
]
},
{
"id": "8e12cbf0a01bb1f8",
"type": "victron-input-ess",
"z": "9170653ac436c1aa",
"service": "com.victronenergy.settings",
"path": "/Settings/CGwacs/AcPowerSetPoint",
"serviceObj": {
"service": "com.victronenergy.settings",
"name": "Venus settings"
},
"pathObj": {
"path": "/Settings/CGwacs/AcPowerSetPoint",
"type": "integer",
"name": "Grid set-point (W)"
},
"name": "",
"onlyChanges": true,
"x": 160,
"y": 40,
"wires": [
[
"de417502891bb773"
]
]
},
{
"id": "2439ebfd5043fba6",
"type": "pushover",
"z": "9170653ac436c1aa",
"name": "",
"device": "",
"title": "Battery Maintenance Discharge Finished",
"priority": "0",
"sound": "falling",
"url": "",
"url_title": "",
"html": false,
"x": 840,
"y": 260,
"wires": []
},
{
"id": "46cdf9e331b954e7",
"type": "pushover",
"z": "9170653ac436c1aa",
"name": "",
"device": "",
"title": "Battery Maintenance Discharge Start Stage 1",
"priority": "0",
"sound": "falling",
"url": "",
"url_title": "",
"html": false,
"x": 850,
"y": 100,
"wires": []
},
{
"id": "4b0f56724399bf55",
"type": "switch",
"z": "9170653ac436c1aa",
"name": "",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "-1800",
"vt": "num"
}
],
"checkall": "false",
"repair": false,
"outputs": 1,
"x": 410,
"y": 100,
"wires": [
[
"9df6deac9419600a"
]
]
},
{
"id": "9df6deac9419600a",
"type": "delay",
"z": "9170653ac436c1aa",
"name": "Delay Message",
"pauseType": "rate",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "day",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": true,
"allowrate": false,
"outputs": 1,
"x": 580,
"y": 80,
"wires": [
[
"46cdf9e331b954e7"
]
]
},
{
"id": "87daf83456aa8845",
"type": "inject",
"z": "9170653ac436c1aa",
"name": "Fail Safe Grid Setpoint",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "01 23 * * *",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "-50",
"payloadType": "num",
"x": 190,
"y": 340,
"wires": [
[
"8fe1fa924d62aa4c"
]
]
},
{
"id": "a83960f2c22de712",
"type": "switch",
"z": "9170653ac436c1aa",
"name": "",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "-6000",
"vt": "num"
}
],
"checkall": "false",
"repair": false,
"outputs": 1,
"x": 410,
"y": 180,
"wires": [
[
"6919d157fda0296c"
]
]
},
{
"id": "6919d157fda0296c",
"type": "delay",
"z": "9170653ac436c1aa",
"name": "Delay Message",
"pauseType": "rate",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "day",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": true,
"allowrate": false,
"outputs": 1,
"x": 580,
"y": 160,
"wires": [
[
"fa81d688fb1e502f"
]
]
},
{
"id": "fa81d688fb1e502f",
"type": "pushover",
"z": "9170653ac436c1aa",
"name": "",
"device": "",
"title": "Battery Maintenance Discharge Stage 3",
"priority": "0",
"sound": "falling",
"url": "",
"url_title": "",
"html": false,
"x": 840,
"y": 180,
"wires": []
},
{
"id": "ce60512c0589e51f",
"type": "change",
"z": "9170653ac436c1aa",
"name": "Change to Text",
"rules": [
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "-1",
"fromt": "num",
"to": "Charge Current set to Max, Battery Maintenance Discharge Finished",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 580,
"y": 240,
"wires": [
[
"2439ebfd5043fba6"
]
]
},
{
"id": "30a90f2191e389e7",
"type": "switch",
"z": "9170653ac436c1aa",
"name": "",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "-3000",
"vt": "num"
}
],
"checkall": "false",
"repair": false,
"outputs": 1,
"x": 410,
"y": 140,
"wires": [
[
"e173c5dd7b432825"
]
]
},
{
"id": "e173c5dd7b432825",
"type": "delay",
"z": "9170653ac436c1aa",
"name": "Delay Message",
"pauseType": "rate",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "day",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": true,
"allowrate": false,
"outputs": 1,
"x": 580,
"y": 120,
"wires": [
[
"9ed99878628094ac"
]
]
},
{
"id": "9ed99878628094ac",
"type": "pushover",
"z": "9170653ac436c1aa",
"name": "",
"device": "",
"title": "Battery Maintenance Discharge Stage 2",
"priority": "0",
"sound": "falling",
"url": "",
"url_title": "",
"html": false,
"x": 840,
"y": 140,
"wires": []
},
{
"id": "728bdd3a1f9ea839",
"type": "function",
"z": "9170653ac436c1aa",
"name": "SOC alpha",
"func": "// Initialize soc and gridsetpoint with system values\nvar soc = flow.get(\"soc\");\nvar currentTime = new Date();\nvar currentHour = currentTime.getHours();\nvar currentMinute = currentTime.getMinutes();\nvar gridsetpoint = -flow.get(\"setpoint\");\nvar dvcc = 0; // Variable for DVCC output\n\n// Initialize output object\nvar output = {};\n\n// Continuous checking from 20:00 to 20:59\nif (currentHour === 20) {\n if (soc > 40) {\n output.gridsetpoint = -1800; // SOC above 40%\n } else {\n output.gridsetpoint = -50; // SOC 40% or below\n }\n}\n\n// Check for 21:00\nif (currentHour === 21 && currentMinute === 0) {\n if (soc >= 50) {\n output.gridsetpoint = -3000; // SOC 50% or above\n } else if (soc === 40) {\n output.gridsetpoint = -50; // SOC exactly 40%\n } else {\n output.gridsetpoint = -50; // SOC below 40%\n }\n}\n\n// Continuous checking from 21:01 to 21:59\nif (currentHour === 21 && currentMinute > 0) {\n if (soc >= 50) {\n output.gridsetpoint = -3000; // SOC 50% or above\n } else if (soc === 40) {\n output.gridsetpoint = -50; // SOC exactly 40%\n } else {\n output.gridsetpoint = -50; // SOC below 40%\n }\n}\n\n// Continuous checking from 22:00 to 22:29\nif (currentHour === 22) {\n if (soc > 40) {\n output.gridsetpoint = -6000; // SOC above 40%\n } else {\n output.gridsetpoint = -50; // SOC 40% or below\n }\n\n // Check for 22:30\n if (currentMinute === 30) {\n if (soc >= 40) {\n output.gridsetpoint = -6900; // SOC 40% or above, discharge to 38%\n }\n }\n\n // Continuous checking from 22:30 to 22:59\n if (currentMinute >= 30 && currentMinute < 60) {\n if (soc <= 38) {\n output.gridsetpoint = -50; // SOC 38% or below, reset to -50\n }\n // Reset to -50 at 22:59\n if (currentMinute === 59) {\n output.gridsetpoint = -50; // Reset at 22:59\n }\n }\n}\n\n// At 23:00, reset to -50 and set DVCC\nif (currentHour === 23 && currentMinute === 0) {\n output.gridsetpoint = -50;\n output.dvcc = -1;\n}\n\n// Prepare output to send\nvar messages = [];\nif (output.gridsetpoint !== undefined) {\n messages.push({ payload: output.gridsetpoint, topic: \"gridsetpoint\" });\n}\nif (output.dvcc !== undefined) {\n messages.push({ payload: output.dvcc, topic: \"dvcc\" });\n}\n\n// Return messages or null if empty\nreturn messages.length > 0 ? messages : null;\n",
"outputs": 2,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 230,
"y": 260,
"wires": [
[
"14cd096a18e82179",
"a83960f2c22de712",
"30a90f2191e389e7",
"4b0f56724399bf55",
"8fe1fa924d62aa4c"
],
[
"2d95a991de2b7e0b",
"ce60512c0589e51f"
]
],
"info": "How the Updated Code Works\n\n Initialization:\n The code initializes the SOC (State of Charge) and the current time.\n It sets up an output object to store values for gridsetpoint and dvcc.\n\n Continuous Checking Logic:\n 20:00 to 20:59:\n If the current hour is 20, it checks the SOC:\n If SOC > 40%, set gridsetpoint to -1800.\n If SOC ≤ 40%, set gridsetpoint to -50.\n 21:00:\n At exactly 21:00, it checks the SOC:\n If SOC ≥ 50%, set gridsetpoint to -3000.\n If SOC = 40%, set gridsetpoint to -50.\n For SOC < 40%, also set gridsetpoint to -50.\n 21:01 to 21:59:\n Continues checking the SOC during this period:\n If SOC ≥ 50%, set gridsetpoint to -3000.\n If SOC = 40%, set gridsetpoint to -50.\n For SOC < 40%, also set gridsetpoint to -50.\n 22:00 to 22:29:\n The SOC is continuously checked:\n If SOC > 40%, set gridsetpoint to -6000.\n If SOC ≤ 40%, set gridsetpoint to -50.\n 22:30:\n At exactly 22:30, it checks if SOC is 40% or above:\n If yes, set gridsetpoint to -6900.\n 22:30 to 22:59:\n Continues checking the SOC:\n If SOC ≤ 38%, reset gridsetpoint to -50.\n Also resets to -50 at 22:59.\n 23:00:\n At exactly 23:00, resets gridsetpoint to -50 and sets dvcc to -1.\n\n Output Preparation:\n The code prepares messages based on the values set in the output object, sending them out as needed.\n\n"
},
{
"id": "14cd096a18e82179",
"type": "switch",
"z": "9170653ac436c1aa",
"name": "",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "-6900",
"vt": "num"
}
],
"checkall": "false",
"repair": false,
"outputs": 1,
"x": 410,
"y": 220,
"wires": [
[
"cd1b83acb7950a01"
]
]
},
{
"id": "cd1b83acb7950a01",
"type": "delay",
"z": "9170653ac436c1aa",
"name": "Delay Message",
"pauseType": "rate",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "day",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": true,
"allowrate": false,
"outputs": 1,
"x": 580,
"y": 200,
"wires": [
[
"a7b6bb0a01e771a0"
]
]
},
{
"id": "a7b6bb0a01e771a0",
"type": "pushover",
"z": "9170653ac436c1aa",
"name": "",
"device": "",
"title": "Battery Maintenance Discharge Stage 4",
"priority": "0",
"sound": "falling",
"url": "",
"url_title": "",
"html": false,
"x": 840,
"y": 220,
"wires": []
}
]