Das schiebt die Werte vom SMA HM in openWB, mit "node-red-contrib-cron-plus" als Trigger.
Code: Alles auswählen
[
{
"id": "6649fcadf54f90a8",
"type": "change",
"z": "4726af68.c62a98",
"name": "I L1",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "payload.I1",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 250,
"y": 620,
"wires": [
[
"92a46e3c400a2c08"
]
]
},
{
"id": "7450ae6c25a5b14a",
"type": "function",
"z": "4726af68.c62a98",
"name": "Bezug",
"func": "Bez = msg.payload.P_bez;\nEin = msg.payload.P_ein;\nvar P;\nif(Bez > 0 && Ein == 0 ) {\n P = Bez;\n}\nelse if(Bez == 0 && Ein > 0 ) {\n P = Ein *-1;\n}\nelse {\n P = 0;\n}\nmsg.payload = Math.round(P);\nmsg.topic = \"P\";\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 250,
"y": 560,
"wires": [
[
"50cd715bd0d6434e"
]
]
},
{
"id": "50cd715bd0d6434e",
"type": "mqtt out",
"z": "4726af68.c62a98",
"name": "Bezugsleistung",
"topic": "openWB/set/evu/W",
"qos": "0",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "d1369cc14791a2de",
"x": 480,
"y": 560,
"wires": []
},
{
"id": "92a46e3c400a2c08",
"type": "mqtt out",
"z": "4726af68.c62a98",
"name": "Strom L1",
"topic": "openWB/set/evu/APhase1",
"qos": "0",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "d1369cc14791a2de",
"x": 460,
"y": 620,
"wires": []
},
{
"id": "c78b17308a57e51a",
"type": "mqtt out",
"z": "4726af68.c62a98",
"name": "Strom L2",
"topic": "openWB/set/evu/APhase2",
"qos": "0",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "d1369cc14791a2de",
"x": 460,
"y": 680,
"wires": []
},
{
"id": "e4d55f0f1b537d52",
"type": "mqtt out",
"z": "4726af68.c62a98",
"name": "Strom L3",
"topic": "openWB/set/evu/APhase3",
"qos": "0",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "d1369cc14791a2de",
"x": 460,
"y": 740,
"wires": []
},
{
"id": "0941e47dfd2b1ae0",
"type": "change",
"z": "4726af68.c62a98",
"name": "I L2",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "payload.I2",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 250,
"y": 680,
"wires": [
[
"c78b17308a57e51a"
]
]
},
{
"id": "82f7ee1e368ab8f7",
"type": "change",
"z": "4726af68.c62a98",
"name": "I L3",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "payload.I3",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 250,
"y": 740,
"wires": [
[
"e4d55f0f1b537d52"
]
]
},
{
"id": "dc51bdeddba52baf",
"type": "mqtt out",
"z": "4726af68.c62a98",
"name": "Bezogene Energie in Wh",
"topic": "openWB/set/evu/WhImported",
"qos": "0",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "d1369cc14791a2de",
"x": 510,
"y": 1040,
"wires": []
},
{
"id": "b4caa3281ec39a1e",
"type": "change",
"z": "4726af68.c62a98",
"name": "W Bezug",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "payload.W_bez2",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 260,
"y": 1040,
"wires": [
[
"dc51bdeddba52baf"
]
]
},
{
"id": "e0cc9585588ab29e",
"type": "change",
"z": "4726af68.c62a98",
"name": "W Einsp",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "payload.W_ein2",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 260,
"y": 1100,
"wires": [
[
"718ebd8162de0e76"
]
]
},
{
"id": "ecdeb310366ddb58",
"type": "mqtt out",
"z": "4726af68.c62a98",
"name": "Spannung L1",
"topic": "openWB/set/evu/VPhase1",
"qos": "0",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "d1369cc14791a2de",
"x": 480,
"y": 800,
"wires": []
},
{
"id": "17ee85d34a8a3823",
"type": "mqtt out",
"z": "4726af68.c62a98",
"name": "Spannung L2",
"topic": "openWB/set/evu/VPhase2",
"qos": "0",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "d1369cc14791a2de",
"x": 480,
"y": 860,
"wires": []
},
{
"id": "97bc1c1d40c7d49d",
"type": "mqtt out",
"z": "4726af68.c62a98",
"name": "Spannung L3",
"topic": "openWB/set/evu/VPhase3",
"qos": "0",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "d1369cc14791a2de",
"x": 480,
"y": 920,
"wires": []
},
{
"id": "8d8825484130fb79",
"type": "change",
"z": "4726af68.c62a98",
"name": "U L1",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "payload.U1",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 250,
"y": 800,
"wires": [
[
"ecdeb310366ddb58"
]
]
},
{
"id": "02f331bc84d51997",
"type": "change",
"z": "4726af68.c62a98",
"name": "U L2",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "payload.U2",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 250,
"y": 860,
"wires": [
[
"17ee85d34a8a3823"
]
]
},
{
"id": "08a20444e8ddff72",
"type": "change",
"z": "4726af68.c62a98",
"name": "U L3",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "payload.U3",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 250,
"y": 920,
"wires": [
[
"97bc1c1d40c7d49d"
]
]
},
{
"id": "185c8682f5c99586",
"type": "change",
"z": "4726af68.c62a98",
"name": "Hz",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "payload.Hz",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 250,
"y": 980,
"wires": [
[
"764780e0cd8deed0"
]
]
},
{
"id": "764780e0cd8deed0",
"type": "mqtt out",
"z": "4726af68.c62a98",
"name": "Frequenz",
"topic": "openWB/set/evu/HzFrequenz",
"qos": "0",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "d1369cc14791a2de",
"x": 460,
"y": 980,
"wires": []
},
{
"id": "16dac3a97063128b",
"type": "comment",
"z": "4726af68.c62a98",
"name": "für das openWB EVU Modul",
"info": "alle 10 Sekunden",
"x": 320,
"y": 500,
"wires": []
},
{
"id": "74dc463f9bb55ecc",
"type": "cronplus",
"z": "4726af68.c62a98",
"name": "alle 5s",
"outputField": "payload",
"timeZone": "",
"persistDynamic": false,
"commandResponseMsgOutput": "output1",
"outputs": 1,
"options": [
{
"name": "P Bezug",
"topic": "P_bez",
"payloadType": "global",
"payload": "P-Bezug",
"expressionType": "cron",
"expression": "*/5 * * * * *",
"location": "",
"offset": "0",
"solarType": "all",
"solarEvents": "sunrise,sunset"
},
{
"name": "P Einspeisung",
"topic": "P_ein",
"payloadType": "global",
"payload": "P-Einsp",
"expressionType": "cron",
"expression": "*/5 * * * * *",
"location": "",
"offset": "0",
"solarType": "all",
"solarEvents": "sunrise,sunset"
},
{
"name": "I L1",
"topic": "I1",
"payloadType": "global",
"payload": "I1",
"expressionType": "cron",
"expression": "*/5 * * * * *",
"location": "",
"offset": "0",
"solarType": "all",
"solarEvents": "sunrise,sunset"
},
{
"name": "I L2",
"topic": "I2",
"payloadType": "global",
"payload": "I2",
"expressionType": "cron",
"expression": "*/5 * * * * *",
"location": "",
"offset": "0",
"solarType": "all",
"solarEvents": "sunrise,sunset"
},
{
"name": "I L3",
"topic": "I3",
"payloadType": "global",
"payload": "I3",
"expressionType": "cron",
"expression": "*/5 * * * * *",
"location": "",
"offset": "0",
"solarType": "all",
"solarEvents": "sunrise,sunset"
},
{
"name": "U L1",
"topic": "U1",
"payloadType": "global",
"payload": "U1",
"expressionType": "cron",
"expression": "*/5 * * * * *",
"location": "",
"offset": "0",
"solarType": "all",
"solarEvents": "sunrise,sunset"
},
{
"name": "U L2",
"topic": "U2",
"payloadType": "global",
"payload": "U2",
"expressionType": "cron",
"expression": "*/5 * * * * *",
"location": "",
"offset": "0",
"solarType": "all",
"solarEvents": "sunrise,sunset"
},
{
"name": "U L3",
"topic": "U3",
"payloadType": "global",
"payload": "U3",
"expressionType": "cron",
"expression": "*/5 * * * * *",
"location": "",
"offset": "0",
"solarType": "all",
"solarEvents": "sunrise,sunset"
},
{
"name": "Frequenz",
"topic": "Hz",
"payloadType": "global",
"payload": "Hz",
"expressionType": "cron",
"expression": "*/5 * * * * *",
"location": "",
"offset": "0",
"solarType": "all",
"solarEvents": "sunrise,sunset"
},
{
"name": "W Bezug",
"topic": "W_bez2",
"payloadType": "flow",
"payload": "W_bez2",
"expressionType": "cron",
"expression": "*/5 * * * * *",
"location": "",
"offset": "0",
"solarType": "all",
"solarEvents": "sunrise,sunset"
},
{
"name": "W Einspeisung",
"topic": "W_ein2",
"payloadType": "flow",
"payload": "W_ein2",
"expressionType": "cron",
"expression": "*/5 * * * * *",
"location": "",
"offset": "0",
"solarType": "all",
"solarEvents": "sunrise,sunset"
}
],
"x": 70,
"y": 500,
"wires": [
[
"cb6535591c6baa00"
]
]
},
{
"id": "cb6535591c6baa00",
"type": "join",
"z": "4726af68.c62a98",
"name": "Objekt",
"mode": "custom",
"build": "object",
"property": "payload",
"propertyType": "msg",
"key": "topic",
"joiner": "\\n",
"joinerType": "str",
"accumulate": false,
"timeout": "",
"count": "11",
"reduceRight": false,
"reduceExp": "",
"reduceInit": "",
"reduceInitType": "",
"reduceFixup": "",
"x": 70,
"y": 560,
"wires": [
[
"7450ae6c25a5b14a",
"6649fcadf54f90a8",
"82f7ee1e368ab8f7",
"02f331bc84d51997",
"08a20444e8ddff72",
"185c8682f5c99586",
"b4caa3281ec39a1e",
"e0cc9585588ab29e",
"0941e47dfd2b1ae0",
"8d8825484130fb79"
]
]
},
{
"id": "d1369cc14791a2de",
"type": "mqtt-broker",
"name": "openWB",
"broker": "192.168.168.51",
"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": {},
"sessionExpiry": ""
}
]