-
Notifications
You must be signed in to change notification settings - Fork 0
/
dynamic_power_limiter.json
277 lines (277 loc) · 7.42 KB
/
dynamic_power_limiter.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
[
{
"id": "8a1442584b5c9904",
"type": "tab",
"label": "Dynamic Power Limiter",
"disabled": false,
"info": "",
"env": []
},
{
"id": "8ff4394bc7143c86",
"type": "function",
"z": "8a1442584b5c9904",
"name": "Transform",
"func": "var soc = global.get('state.opendtu.soc') || 0;\n\nvar epex_current_price = global.get('epex.current_price');\nif (typeof epex_current_price == \"undefined\") { epex_current_price = 0}\n\nvar dpl_X_price = global.get('ui.opendtu.dpl_X_price') / 100;\nif (typeof dpl_X_price == \"undefined\") { dpl_X_price = 0.1 }\n\nvar car_X_price = global.get('ui.opendtu.car_X_price') / 100 || 0.3;\nif (typeof car_X_price == \"undefined\") { car_X_price = 0.05 }\n\nvar battery_full_soc = global.get('ui.opendtu.battery_full_soc');\nif (typeof battery_full_soc == \"undefined\") { battery_full_soc = 90 }\n\nvar carState = global.get('state.car') || false;\n\nvar msg = {};\nmsg.payload = 0\n\n// Enable if battery is full\nif (soc >= battery_full_soc) {\n msg.payload = 0; // Fully enable\n msg.text = \"Aktiv - Batterie voll\";\n return msg;\n}\n\nnode.warn(\"price\" + epex_current_price);\nnode.warn(\"dpl\" + dpl_X_price);\n// Disable if price low\nif (epex_current_price < dpl_X_price) {\n msg.payload = 1; // Fully disable\n msg.text = \"Inaktiv / Strompreis niedrig\";\n return msg;\n}\n\nif (carState == \"charging\") {\n // Disable if price below crossover for car and car is charging\n if (epex_current_price < car_X_price) {\n msg.payload = 1; // Fully disable\n msg.text = \"Inaktiv / Auto läd / Strompreis niedrig\";\n } else {\n msg.payload = 2; // Enable solar passthrough\n msg.text = \"Solar Passthrough zum Auto\";\n }\n return msg;\n}\n\nmsg.payload = 0; // Normal operation\nmsg.text = \"Aktiv\";\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 960,
"y": 120,
"wires": [
[
"bff9a5dd3d451de1",
"53096ea9d7083ef1",
"b505dea9d6112b4b"
]
]
},
{
"id": "bff9a5dd3d451de1",
"type": "mqtt out",
"z": "8a1442584b5c9904",
"name": "",
"topic": "solar/powerlimiter/cmd/mode",
"qos": "",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "aa30341bcc52e33c",
"x": 1180,
"y": 120,
"wires": []
},
{
"id": "6ef0e8c829fc673f",
"type": "inject",
"z": "8a1442584b5c9904",
"name": "periodic trigger",
"props": [
{
"p": "payload"
}
],
"repeat": "60",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 800,
"y": 120,
"wires": [
[
"8ff4394bc7143c86"
]
]
},
{
"id": "53096ea9d7083ef1",
"type": "debug",
"z": "8a1442584b5c9904",
"name": "debug 18",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 1120,
"y": 240,
"wires": []
},
{
"id": "d6ae3af4d53574d0",
"type": "change",
"z": "8a1442584b5c9904",
"name": "store",
"rules": [
{
"t": "set",
"p": "ui.opendtu.dpl_X_price",
"pt": "global",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 510,
"y": 120,
"wires": [
[]
]
},
{
"id": "c3b8dccef33a484a",
"type": "change",
"z": "8a1442584b5c9904",
"name": "store",
"rules": [
{
"t": "set",
"p": "ui.opendtu.car_X_price",
"pt": "global",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 510,
"y": 160,
"wires": [
[]
]
},
{
"id": "b505dea9d6112b4b",
"type": "ui_text",
"z": "8a1442584b5c9904",
"group": "55d02026703d8522",
"order": 1,
"width": 0,
"height": 0,
"name": "",
"label": "Status:",
"format": "{{msg.text}}",
"layout": "row-spread",
"className": "",
"x": 1120,
"y": 180,
"wires": []
},
{
"id": "ae6d65948cd7e076",
"type": "ui_numeric",
"z": "8a1442584b5c9904",
"name": "",
"label": "DPL aktiv ab",
"tooltip": "Liegt der Strompreis unter dieser Grenze wird der Power limiter abgeschaltet",
"group": "55d02026703d8522",
"order": 3,
"width": 0,
"height": 0,
"wrap": false,
"passthru": true,
"topic": "topic",
"topicType": "msg",
"format": "{{value}}",
"min": "-10",
"max": "30",
"step": "0.1",
"className": "",
"x": 370,
"y": 120,
"wires": [
[
"d6ae3af4d53574d0"
]
]
},
{
"id": "4325ec05ae13ac80",
"type": "ui_numeric",
"z": "8a1442584b5c9904",
"name": "",
"label": "Solar PT zum Auto ab",
"tooltip": "Liegt der Strompreis über dem eingestellten Wert wird Solarstrom (Solar Passthrough) zum Auto laden verwendet. Darunter wird die Solarenergie im Hausakku gespeichert",
"group": "55d02026703d8522",
"order": 4,
"width": 0,
"height": 0,
"wrap": false,
"passthru": true,
"topic": "topic",
"topicType": "msg",
"format": "{{value}}",
"min": "-10",
"max": "30",
"step": "0.1",
"className": "",
"x": 340,
"y": 160,
"wires": [
[
"c3b8dccef33a484a"
]
]
},
{
"id": "ff2111eb145eab38",
"type": "ui_text",
"z": "8a1442584b5c9904",
"group": "55d02026703d8522",
"order": 2,
"width": 0,
"height": 0,
"name": "",
"label": "Strompreisgrenzen",
"format": "{{msg.payload}}",
"layout": "row-spread",
"className": "",
"x": 350,
"y": 80,
"wires": []
},
{
"id": "aa30341bcc52e33c",
"type": "mqtt-broker",
"name": "Raspberry",
"broker": "localhost",
"port": "1883",
"clientid": "",
"autoConnect": true,
"usetls": false,
"protocolVersion": "4",
"keepalive": "60",
"cleansession": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"birthMsg": {},
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"closeMsg": {},
"willTopic": "",
"willQos": "0",
"willPayload": "",
"willMsg": {},
"userProps": "",
"sessionExpiry": ""
},
{
"id": "55d02026703d8522",
"type": "ui_group",
"name": "Dynamic Power Limiter",
"tab": "e5b1aeb5977e428a",
"order": 3,
"disp": true,
"width": "6",
"collapse": false,
"className": ""
},
{
"id": "e5b1aeb5977e428a",
"type": "ui_tab",
"name": "Home",
"icon": "dashboard",
"order": 1,
"disabled": false,
"hidden": false
}
]