Code: Alles auswählen
[
{
"id": "c412889e.c6a8c8",
"type": "ioBroker in",
"z": "fe277c80.1c626",
"name": "openWB/global/WHouseConsumption",
"topic": "mqtt.0.openWB.global.WHouseConsumption",
"payloadType": "value",
"onlyack": "",
"func": "all",
"gap": "",
"fireOnStart": "false",
"x": 200,
"y": 1260,
"wires": [
[
"79d11914.992ff8"
]
]
},
{
"id": "30a12538.02e9ea",
"type": "ioBroker get",
"z": "fe277c80.1c626",
"name": "openWB/lp/1/countPhasesInUse",
"topic": "mqtt.0.openWB.lp.1.countPhasesInUse",
"attrname": "phases",
"payloadType": "value",
"x": 810,
"y": 1260,
"wires": [
[
"62ea4206.5929fc"
]
]
},
{
"id": "79d11914.992ff8",
"type": "ioBroker get",
"z": "fe277c80.1c626",
"name": "openWB/global/ChargeMode",
"topic": "mqtt.0.openWB.global.ChargeMode",
"attrname": "mode",
"payloadType": "value",
"x": 520,
"y": 1260,
"wires": [
[
"30a12538.02e9ea"
]
]
},
{
"id": "62ea4206.5929fc",
"type": "function",
"z": "fe277c80.1c626",
"name": "calc",
"func": "var consumption = parseFloat(msg.payload)\nvar mode = parseInt(msg.mode)\nmsg.mode = mode\nvar phases = parseInt(msg.phases)\nmsg.phases = phases\n\nvar chargeWatts = 10000 - consumption\nvar chargeAmps = Math.round(chargeWatts / 225 / (phases > 0 ? phases : 3))\nmsg.chargeWatts = chargeWatts\nmsg.chargeAmps = chargeAmps\n\nvar maxChargeAmps = 16\nif (mode == 0) { // sofort\n maxChargeAmps = 16\n}\nelse if (mode == 1) { // minPV\n maxChargeAmps = chargeAmps\n}\nelse if (mode == 2) { // PV\n maxChargeAmps = chargeAmps\n}\nelse if (mode == 3) { // stop\n maxChargeAmps = 16\n}\nelse if (mode == 4) { // standby\n maxChargeAmps = 16\n}\n\nif (maxChargeAmps < 6) {\n maxChargeAmps = 6\n}\nelse if (maxChargeAmps > 16) {\n maxChargeAmps = 16\n}\n\nmsg.payload = maxChargeAmps\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 190,
"y": 1340,
"wires": [
[
"8851a46d.22cb08",
"abb883bc.404b2"
]
]
},
{
"id": "8851a46d.22cb08",
"type": "function",
"z": "fe277c80.1c626",
"name": "onChangeOnly",
"func": "var last = context.get(\"last\")\nvar current = msg.payload\ncontext.set(\"last\", current)\n\nif (last == current) {\n return null\n}\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 380,
"y": 1340,
"wires": [
[
"94837773.a0baf8",
"d99f872f.d3a4e8"
]
]
},
{
"id": "94837773.a0baf8",
"type": "ioBroker out",
"z": "fe277c80.1c626",
"name": "openWB/config/set/global/maxEVSECurrentAllowed",
"topic": "mqtt.0.openWB.config.set.global.maxEVSECurrentAllowed",
"ack": "false",
"autoCreate": "false",
"stateName": "",
"role": "",
"payloadType": "",
"readonly": "",
"stateUnit": "",
"stateMin": "",
"stateMax": "",
"x": 730,
"y": 1340,
"wires": []
}
]