Follow along with the video below to see how to install our site as a web app on your home screen.
Anmerkung: This feature may not be available in some browsers.
[
{
"id": "5271edcc.89b374",
"type": "tab",
"label": "SMA Smart Meter",
"disabled": false,
"info": ""
},
{
"id": "211a500.a3a4ab",
"type": "udp in",
"z": "5271edcc.89b374",
"name": "SMA",
"iface": "",
"port": "9522",
"ipv": "udp4",
"multicast": "true",
"group": "239.12.255.254",
"datatype": "buffer",
"x": 170,
"y": 280,
"wires": [
[
"f4515978.3ce8f",
"6ffaa9d3.ca4688"
]
]
},
{
"id": "f4515978.3ce8f",
"type": "debug",
"z": "5271edcc.89b374",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 430,
"y": 520,
"wires": []
},
{
"id": "6ffaa9d3.ca4688",
"type": "function",
"z": "5271edcc.89b374",
"name": "Ausgabe",
"func": "var count = context.get('count')||0;\ncount += 1;\n\n/*\nIF you do not want to update HA every second you can set the fuction to pass\nthe data less often - see below\n*/\n\n\nif (count < 30) { /* process data only every 30 seconds */\n context.set('count',count);\n return null;\n}\n\ncount = 0;\ncontext.set('count',count);\n\nvar msg1 = { payload:\"actual consumption\" };\nvar msg2 = { payload:\"actual gridfeed\" };\nvar msg3 = { payload:\"consumption counter\" };\nvar msg4 = { payload:\"gridfeed counter\" };\n\n\n/* to get the actual grid consumption in W we need the offset 0.1.4.0 */\noffset = msg.payload.indexOf(\"00010400\", 0, \"hex\")+ 4;\nvar consumption = parseInt((msg.payload[offset+0]*0x1000000 + \n msg.payload[offset+1]*0x10000 + \n msg.payload[offset+2]*0x100 +\n msg.payload[offset+3]) / 10);\n\n/* to get the actual grid consumption counter in Wh we need the offset 0.1.8.0 */\noffset = msg.payload.indexOf(\"00010800\", 0, \"hex\")+ 4;\nvar consumption_c = parseInt((msg.payload[offset+0]*0x100000000000000 + \n msg.payload[offset+1]*0x1000000000000 + \n msg.payload[offset+2]*0x10000000000 +\n msg.payload[offset+3]*0x100000000 +\n msg.payload[offset+4]*0x1000000 + \n msg.payload[offset+5]*0x10000 + \n msg.payload[offset+6]*0x100 +\n msg.payload[offset+7]) / 3600);\n\n/* to get the actual grid feed in W we need the offset 0.2.4.0 */\noffset = msg.payload.indexOf(\"00020400\", 0, \"hex\")+ 4;\nvar gridfeed = parseInt((msg.payload[offset+0]*0x1000000 + \n msg.payload[offset+1]*0x10000 + \n msg.payload[offset+2]*0x100 +\n msg.payload[offset+3]) / 10);\n\n/* to get the actual grid feed counter in Wh we need the offset 0.2.8.0 */\noffset = msg.payload.indexOf(\"00020800\", 0, \"hex\")+ 4;\nvar gridfeed_c = parseInt((msg.payload[offset+0]*0x100000000000000 + \n msg.payload[offset+1]*0x1000000000000 + \n msg.payload[offset+2]*0x10000000000 +\n msg.payload[offset+3]*0x100000000 +\n msg.payload[offset+4]*0x1000000 + \n msg.payload[offset+5]*0x10000 + \n msg.payload[offset+6]*0x100 +\n msg.payload[offset+7]) / 3600);\n\n\nif (consumption >= 0 && consumption < 100000 ) {\n msg1.payload = consumption.toString(); \n} else msg1 = null;\n\nif (consumption_c >= 0 && consumption_c < 50000000 ) {\n msg2.payload = consumption_c.toString(); \n} else msg2 = null;\n\nif (gridfeed >= 0 && gridfeed < 100000 ) {\n msg3.payload = gridfeed.toString(); \n} else msg3 = null;\n\nif (gridfeed_c >= 0 && gridfeed_c < 5000000 ) {\n msg4.payload = gridfeed_c.toString(); \n} else msg4 = null;\n\n\nreturn [msg1, msg2, msg3, msg4 ];\n",
"outputs": 4,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 380,
"y": 260,
"wires": [
[
"3e4d12a2.458276",
"389d07fc.c16cc8"
],
[
"e9939b12.af802",
"4dd1dc53.de83d4"
],
[
"97d02733.87cc68",
"112f13bf.93f80c"
],
[
"3592858e.74628a",
"fd85bfdc.7e2a5"
]
]
},
{
"id": "3e4d12a2.458276",
"type": "debug",
"z": "5271edcc.89b374",
"name": "Act. grid consumption [W]",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"x": 650,
"y": 140,
"wires": []
},
{
"id": "e9939b12.af802",
"type": "debug",
"z": "5271edcc.89b374",
"name": "Grid consumption [Wh]",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 650,
"y": 260,
"wires": []
},
{
"id": "97d02733.87cc68",
"type": "debug",
"z": "5271edcc.89b374",
"name": "Act. grid feed [W]",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"x": 630,
"y": 360,
"wires": []
},
{
"id": "3592858e.74628a",
"type": "debug",
"z": "5271edcc.89b374",
"name": "Grid feed counter [Wh]",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"x": 650,
"y": 460,
"wires": []
},
{
"id": "389d07fc.c16cc8",
"type": "mqtt out",
"z": "5271edcc.89b374",
"name": "Aktueller Stromverbrauch [W]",
"topic": "sma/act-grid-cons",
"qos": "2",
"retain": "true",
"broker": "31baadcd.bc5f12",
"x": 670,
"y": 80,
"wires": []
},
{
"id": "4dd1dc53.de83d4",
"type": "mqtt out",
"z": "5271edcc.89b374",
"name": "Gesamt Stromverbrauch [Wh]",
"topic": "sma/total-grid-cons",
"qos": "2",
"retain": "true",
"broker": "31baadcd.bc5f12",
"x": 670,
"y": 200,
"wires": []
},
{
"id": "112f13bf.93f80c",
"type": "mqtt out",
"z": "5271edcc.89b374",
"name": "Aktuelle Stromeinspeisung [W]",
"topic": "sma/act-grid-feed",
"qos": "2",
"retain": "true",
"broker": "31baadcd.bc5f12",
"x": 670,
"y": 300,
"wires": []
},
{
"id": "fd85bfdc.7e2a5",
"type": "mqtt out",
"z": "5271edcc.89b374",
"name": "Gesamt Einspeisung [Wh]",
"topic": "sma/total-grid-feed",
"qos": "2",
"retain": "true",
"broker": "31baadcd.bc5f12",
"x": 650,
"y": 400,
"wires": []
},
{
"id": "31baadcd.bc5f12",
"type": "mqtt-broker",
"name": "NAS-MQTT",
"broker": "192.168.120.10",
"port": "1883",
"tls": "",
"clientid": "pi-node-red",
"usetls": false,
"compatmode": false,
"keepalive": "60",
"cleansession": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"willTopic": "",
"willQos": "0",
"willPayload": ""
}
]