NEWS
Muster Stromzähler per Modbus
-
Hallo,
anbei mein Node-Red-Flow, welches mehrere Stromzähler an einem gemeinsamen Modbus abfragt.
Der Modbus-LAN Adapter ist ein U.S.R. USR-TCP232-304Folgende Zähler hängen am Bus:
- DZG DVH4013
- EASTRON SDM72D-M
- Orno OR-WE 14
[ { "id": "c24431d8.d16be", "type": "tab", "label": "Stromzaehler", "disabled": false, "info": "" }, { "id": "eda79e7e.a523a", "type": "function", "z": "c24431d8.d16be", "name": "Faktor", "func": "var arr=msg.payload;\nconst Pfad = '0_userdata.0.Zaehler.Strom.Herd.ist.';\nvar I=0;\nvar P=0;\nvar S=0;\nif(arr.length===2){\n I=parseFloat(arr[1])/1000;\n if(!isNaN(I)){\n var PF=flow.get(\"PF\");\n var U=flow.get(\"UL1\");\n if(!isNaN(U) && !isNaN(PF)){\n P=Math.round(I*U*PF *100)/100;\n S=Math.round(I*U *100)/100;\n node.status({text:\"I:\"+I+\"A; P:\"+P+\"W; S:\"+S+\"VA\"}); \n flow.set(\"I1\",I);\n flow.set(\"P1\",P);\n flow.set(\"S1\",S);\n }\n }\n\n return [\n {\n payload: I, topic:Pfad+'I1', stateUnit: 'A'\n },\n {\n payload: P, topic:Pfad+'P1', stateUnit: 'W'\n },\n {\n payload: S, topic:Pfad+'S1', stateUnit: 'VA'\n \n }\n ];\n}\n/* {\n payload: i1, topic:Pfad+'I1', stateUnit: 'A', stateType: 'number', stateRole: 'value'\n },\n*/", "outputs": 3, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 610, "y": 300, "wires": [ [ "743b4448.e11c9c" ], [ "743b4448.e11c9c" ], [ "743b4448.e11c9c" ] ] }, { "id": "c52e1e95.b8f1f", "type": "function", "z": "c24431d8.d16be", "name": "Faktor", "func": "var arr=msg.payload;\nconst Pfad = '0_userdata.0.Zaehler.Strom.Herd.ist.';\nvar I=0;\nvar P=0;\nvar S=0;\nif(arr.length===2){\n I=parseFloat(arr[1])/1000;\n if(!isNaN(I)){\n var PF=flow.get(\"PF\");\n var U=flow.get(\"UL2\");\n if(!isNaN(U) && !isNaN(PF)){\n P=Math.round(I*U*PF *100)/100;\n S=Math.round(I*U *100)/100;\n node.status({text:\"I:\"+I+\"A; P:\"+P+\"W; S:\"+S+\"VA\"}); \n flow.set(\"I2\",I);\n flow.set(\"P2\",P);\n flow.set(\"S2\",S);\n }\n }\n\n return [\n {\n payload: I, topic:Pfad+'I2', stateUnit: 'A'\n },\n {\n payload: P, topic:Pfad+'P2', stateUnit: 'W'\n },\n {\n payload: S, topic:Pfad+'S2', stateUnit: 'VA'\n \n }\n ];\n}\n/* {\n payload: i1, topic:Pfad+'I1', stateUnit: 'A', stateType: 'number', stateRole: 'value'\n },\n*/", "outputs": 3, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 610, "y": 380, "wires": [ [ "743b4448.e11c9c" ], [ "743b4448.e11c9c" ], [ "743b4448.e11c9c" ] ] }, { "id": "9730857f.daf338", "type": "function", "z": "c24431d8.d16be", "name": "Faktor", "func": "var arr=msg.payload;\nconst Pfad = '0_userdata.0.Zaehler.Strom.Herd.ist.';\nvar I=0;\nvar P=0;\nvar S=0;\nvar Ig=0;\nif(arr.length===2){\n I=parseFloat(arr[1])/1000;\n if(!isNaN(I)){\n var PF=flow.get(\"PF\");\n var U=flow.get(\"UL3\");\n if(!isNaN(U) && !isNaN(PF)){\n P=Math.round(I*U*PF *100)/100;\n S=Math.round(I*U *100)/100;\n Ig=Math.round((flow.get(\"I1\")+flow.get(\"I2\")+I) *100)/100\n node.status({text:\"I:\"+I+\"A; P:\"+P+\"W; S:\"+S+\"VA; Ig:\"+Ig+\"A\"});\n flow.set(\"I3\",I);\n flow.set(\"P3\",P);\n flow.set(\"S3\",S);\n }\n }\n return [\n {\n payload: I, topic:Pfad+'I3', stateUnit: 'A'\n },\n {\n payload: P, topic:Pfad+'P3', stateUnit: 'W'\n },\n {\n payload: S, topic:Pfad+'S3', stateUnit: 'VA'\n \n },\n {\n payload: Ig, topic:Pfad+'I', stateUnit: 'A'\n \n }\n \n ]; \n \n}\n", "outputs": 4, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 610, "y": 460, "wires": [ [ "743b4448.e11c9c" ], [ "743b4448.e11c9c" ], [ "743b4448.e11c9c" ], [ "743b4448.e11c9c" ] ] }, { "id": "822f53a0.e1937", "type": "function", "z": "c24431d8.d16be", "name": "Faktor", "func": "var arr=msg.payload;\nconst Pfad = '0_userdata.0.Zaehler.Strom.Herd.ist.';\nif(arr.length===2){\n var wert=parseFloat(arr[1])/100;\n flow.set(\"UL1\", wert);\n node.status({text:wert+\"V\"});\n\n return [\n {\n payload: wert, topic:Pfad+'U1', stateUnit: 'V'\n }\n ];\n} ", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 610, "y": 120, "wires": [ [ "743b4448.e11c9c" ] ] }, { "id": "59509a99.453d34", "type": "function", "z": "c24431d8.d16be", "name": "Faktor", "func": "var arr=msg.payload;\nconst Pfad = '0_userdata.0.Zaehler.Strom.Herd.ist.';\nif(arr.length===2){\n var wert=parseFloat(arr[1])/100;\n flow.set(\"UL2\", wert);\n node.status({text:wert+\"V\"});\n\n return [\n {\n payload: wert, topic:Pfad+'U2', stateUnit: 'V', stateRole: 'value'\n }\n ];\n} ", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 610, "y": 180, "wires": [ [ "743b4448.e11c9c" ] ] }, { "id": "d127f414.df7908", "type": "function", "z": "c24431d8.d16be", "name": "Faktor", "func": "var arr=msg.payload;\nconst Pfad = '0_userdata.0.Zaehler.Strom.Herd.ist.';\nif(arr.length===2){\n var wert=parseFloat(arr[1])/100;\n flow.set(\"UL3\", wert);\n node.status({text:wert+\"V\"});\n\n return [\n {\n payload: wert, topic:Pfad+'U3', stateUnit: 'V'\n }\n ];\n} ", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 610, "y": 240, "wires": [ [ "743b4448.e11c9c" ] ] }, { "id": "c007e291.21884", "type": "function", "z": "c24431d8.d16be", "name": "Leistungen", "func": "var arr=msg.payload;\nconst Warngrenze = 2.5*60*60; //2,5 Stunden\nconst Pfad = '0_userdata.0.Zaehler.Strom.Herd.ist.';\nvar Pz = 0;\nif(arr.length === 2){\n Pz=parseFloat(arr[1])/10;\n}\n\nvar S1 = parseFloat(flow.get(\"S1\"));\nvar S2 = parseFloat(flow.get(\"S2\"));\nvar S3 = parseFloat(flow.get(\"S3\"));\nvar S = parseFloat(Math.round(S1+S2+S3));\nvar Zk = parseFloat(flow.get(\"Zk\"));\nvar Zg = parseFloat(flow.get(\"Zg\"));\nvar Sk = parseFloat(flow.get(\"Sk\"));\nvar Sg = parseFloat(flow.get(\"Sg\"));\nvar Warnung = false;\n\nif (S > 1){\n Zk = 60;\n Sk = Sk + 10; \n}else{ \n if (Zk>10){\n Zk = Zk - 10;\n Sk = Sk + 10;\n }else{\n Zk = 0;\n Sk = 0;\n }\n}\n\n\nif (S > 100){\n Zg = 180;\n Sg = Sg + 10; \n}else{ \n\n if (Zg>10){\n Zg = Zg -10;\n }else{\n Zg = 0;\n Sg = 0;\n }\n}\n\nflow.set(\"Zg\", Zg);\nflow.set(\"Zk\", Zk);\nflow.set(\"Sg\", Sg);\nflow.set(\"Sk\", Sk);\n\nvar Klein = new Date(Sk * 1000).toISOString().substr(11, 8);\nvar Gross = new Date(Sg * 1000).toISOString().substr(11, 8);\n\nWarnung = Zg > Warngrenze;\n\n//flow.set(\"UL1\", wert);\n\nnode.status({text:\"ausgelesen P:\"+Pz+\"W; S:\"+S+\"VA\"});\n//node.status({text:\"P1:\"+P1+\"; P2:\"+P2+\"; P3:\"+P3});\n//node.status({text:\"S1:\"+S1+\"; S2:\"+S2+\"; S3:\"+S3});\n//topic:Pfad+'CosPhi', stateUnit: '', stateType: 'number', stateRole: 'value'\nreturn [\n {\n payload: Pz, topic:Pfad+'P', stateUnit: 'W'\n },\n {\n payload: S, topic:Pfad+'S', stateUnit: 'VA'\n },\n {\n payload: Klein, topic:Pfad+'Sklein'\n },\n {\n payload: Gross, topic:Pfad+'Sgross'\n },\n {\n payload: Warnung, topic:Pfad+'Warnung'\n } \n \n];", "outputs": 5, "noerr": 0, "initialize": "// Der Code hier wird ausgeführt,\n// wenn der Node gestartet wird\nflow.set(\"Zg\", 0);\nflow.set(\"Zk\", 0);\nflow.set(\"Sg\", 0);\nflow.set(\"Sk\", 0);", "finalize": "", "libs": [], "x": 630, "y": 620, "wires": [ [ "743b4448.e11c9c" ], [ "743b4448.e11c9c" ], [ "101c66cccacac37f" ], [ "101c66cccacac37f" ], [ "66237a931617967c" ] ] }, { "id": "743b4448.e11c9c", "type": "ioBroker out", "z": "c24431d8.d16be", "name": "ioB number", "topic": "", "ack": "true", "autoCreate": "true", "stateName": "", "role": "state", "payloadType": "number", "readonly": "false", "stateUnit": "", "stateMin": "", "stateMax": "", "x": 1010, "y": 320, "wires": [] }, { "id": "a0e8c509.265ee8", "type": "function", "z": "c24431d8.d16be", "name": "extract buffer data", "func": "let voltageL1 = round(msg.payload.buffer.readFloatBE(0,4)) // 1,2\nlet voltageL2 = round(msg.payload.buffer.readFloatBE(4,4)) // 3,4\nlet voltageL3 = round(msg.payload.buffer.readFloatBE(8,4)) // 5,6\n\nlet currentL1 = round(msg.payload.buffer.readFloatBE(12,4)) // 7,8\nlet currentL2 = round(msg.payload.buffer.readFloatBE(16,4)) // 9,10\nlet currentL3 = round(msg.payload.buffer.readFloatBE(20,4)) // 11,12\n\nlet powerL1 = round(msg.payload.buffer.readFloatBE(24,4)) // 13,14\nlet powerL2 = round(msg.payload.buffer.readFloatBE(28,4)) // 15,16\nlet powerL3 = round(msg.payload.buffer.readFloatBE(32,4)) // 17,18\n\nlet spowerL1 = round(msg.payload.buffer.readFloatBE(36,4)) // 19,20\nlet spowerL2 = round(msg.payload.buffer.readFloatBE(40,4)) // 21,22\nlet spowerL3 = round(msg.payload.buffer.readFloatBE(44,4)) // 23,24\n\nlet voltageAVG = round(msg.payload.buffer.readFloatBE(84,8)) // 43-46\nlet currentAVG = round(msg.payload.buffer.readFloatBE(92,4)) // 47,48\n\nreturn [\n {\n payload: {\n L1: {\n voltage: voltageL1,\n current: currentL1,\n power: powerL1,\n spower: spowerL1\n },\n L2: {\n voltage: voltageL2,\n current: currentL2,\n power: powerL2,\n spower: spowerL2\n },\n L3: {\n voltage: voltageL3,\n current: currentL3,\n power: powerL3,\n spower: spowerL3\n },\n voltageAVG: voltageAVG,\n currentAVG: currentAVG, \n }\n }\n];\n\nfunction round(num) {\n var m = Number((Math.abs(num) * 100).toPrecision(15));\n return Math.round(m) / 100 * Math.sign(num);\n}", "outputs": "1", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 470, "y": 1300, "wires": [ [ "ab2b7f84.fff3b", "9cc4ad2e.71602", "ee889fb2.e024f" ] ] }, { "id": "ab2b7f84.fff3b", "type": "function", "z": "c24431d8.d16be", "name": "Ströme", "func": "node.status({text:\"L1:\"+msg.payload.L1.current+\"; L2:\"+msg.payload.L2.current+\"; L3:\"+msg.payload.L3.current+\"; 0:\"+msg.payload.currentAVG});\n\n\nreturn [\n {payload: msg.payload.L1.current, topic:'0_userdata.0.Wallbox.Strom.Auslese.I1'}, \n {payload: msg.payload.L2.current, topic:'0_userdata.0.Wallbox.Strom.Auslese.I2'}, \n {payload: msg.payload.L3.current, topic:'0_userdata.0.Wallbox.Strom.Auslese.I3'},\n {payload: msg.payload.currentAVG, topic:'0_userdata.0.Wallbox.Strom.Auslese.I'}\n];", "outputs": "4", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 900, "y": 1160, "wires": [ [ "38b34ea4.11e192" ], [ "38b34ea4.11e192" ], [ "38b34ea4.11e192" ], [ "38b34ea4.11e192" ] ] }, { "id": "9cc4ad2e.71602", "type": "function", "z": "c24431d8.d16be", "name": "Spannungen", "func": "node.status({text:\"L1:\"+msg.payload.L1.voltage+\"; L2:\"+msg.payload.L2.voltage+\"; L3:\"+msg.payload.L3.voltage+\"; 0:\"+msg.payload.voltageAVG});\n\n\nreturn [\n {payload: msg.payload.L1.voltage, topic:'0_userdata.0.Wallbox.Strom.Auslese.U1'}, \n {payload: msg.payload.L2.voltage, topic:'0_userdata.0.Wallbox.Strom.Auslese.U2'}, \n {payload: msg.payload.L3.voltage, topic:'0_userdata.0.Wallbox.Strom.Auslese.U3'},\n {payload: msg.payload.voltageAVG, topic:'0_userdata.0.Wallbox.Strom.Auslese.ULN'}\n];", "outputs": "4", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 910, "y": 1240, "wires": [ [ "96217b86.779a28" ], [ "96217b86.779a28" ], [ "96217b86.779a28" ], [ "96217b86.779a28" ] ] }, { "id": "ee889fb2.e024f", "type": "function", "z": "c24431d8.d16be", "name": "Leistungen", "func": "node.status({text:\"L1:\"+msg.payload.L1.power+\"; L2:\"+msg.payload.L2.power+\"; L3:\"+msg.payload.L3.power});\n\n\nreturn [\n {payload: msg.payload.L1.power, topic:'0_userdata.0.Wallbox.Strom.Auslese.P1'}, \n {payload: msg.payload.L2.power, topic:'0_userdata.0.Wallbox.Strom.Auslese.P2'}, \n {payload: msg.payload.L3.power, topic:'0_userdata.0.Wallbox.Strom.Auslese.P3'},\n {payload: msg.payload.L1.spower, topic:'0_userdata.0.Wallbox.Strom.Auslese.S1'}, \n {payload: msg.payload.L2.spower, topic:'0_userdata.0.Wallbox.Strom.Auslese.S2'}, \n {payload: msg.payload.L3.spower, topic:'0_userdata.0.Wallbox.Strom.Auslese.S3'} \n];\n", "outputs": 6, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 910, "y": 1340, "wires": [ [ "204b7607.8b4d5a" ], [ "204b7607.8b4d5a" ], [ "204b7607.8b4d5a" ], [ "204b7607.8b4d5a" ], [ "204b7607.8b4d5a" ], [ "204b7607.8b4d5a" ] ] }, { "id": "39853145.37685e", "type": "function", "z": "c24431d8.d16be", "name": "extract buffer data", "func": "let currentSum = round(msg.payload.buffer.readFloatBE(0,8))\nlet powerSum = round(msg.payload.buffer.readFloatBE(8,8))\nif(powerSum < 0){\n powerSum=0;\n}\n\nreturn [\n {\n payload: currentSum, topic:'0_userdata.0.Wallbox.Strom.Watt.StromTotal'\n },\n {\n payload: powerSum, topic:'0_userdata.0.Wallbox.Strom.Watt.LeistungTotal'\n \n }\n];\nfunction round(num) {\n var m = Number((Math.abs(num) * 100).toPrecision(15));\n return Math.round(m) / 100 * Math.sign(num);\n}\n\n", "outputs": 2, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 390, "y": 800, "wires": [ [ "7d6e2cb1.25cf94" ], [ "7d6e2cb1.25cf94" ] ] }, { "id": "525c624.e1e5b9c", "type": "function", "z": "c24431d8.d16be", "name": "extract buffer data", "func": "let frequency = round(msg.payload.buffer.readFloatBE(0,4)) // 71,72\nlet ImportActiveEnergy = round(msg.payload.buffer.readFloatBE(4,4)) // 73,74\nlet ampHourSinceLastReset = round(msg.payload.buffer.readFloatBE(24,4)) // 83,84\nlet totalSystemPowerDemand = round(msg.payload.buffer.readFloatBE(28,4)) // 85,86\nlet maxTotalSystemPowerDemand = round(msg.payload.buffer.readFloatBE(32,4)) // 87,88\n\nreturn [\n { \n payload: frequency, topic:'0_userdata.0.Wallbox.Strom.Auslese.Frequenz'\n },\n { \n payload: ImportActiveEnergy, topic:'0_userdata.0.Wallbox.Strom.Auslese.ArbeitT1'\n },\n {\n payload: ampHourSinceLastReset / 1000.0, topic:'0_userdata.0.Wallbox.Strom.Watt.ampHourSinceLastReset'\n }, \n {\n payload: totalSystemPowerDemand / 1000.0, topic:'0_userdata.0.Wallbox.Strom.Watt.totalSystemPowerDemand'\n },\n {\n payload: maxTotalSystemPowerDemand / 1000.0, topic:'0_userdata.0.Wallbox.Strom.Watt.maxTotalSystemPowerDemand'\n }\n];\nfunction round(num) {\n var m = Number((Math.abs(num) * 100).toPrecision(15));\n return Math.round(m) / 100 * Math.sign(num);\n}\n", "outputs": 5, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 390, "y": 920, "wires": [ [ "5b800497.8d630c" ], [ "5b800497.8d630c" ], [ "5b800497.8d630c" ], [ "5b800497.8d630c" ], [ "5b800497.8d630c" ] ] }, { "id": "2c8be1dc.543d2e", "type": "function", "z": "c24431d8.d16be", "name": "extract buffer data", "func": "let voltageL12 = round(msg.payload.buffer.readFloatBE(0,4)) // 1,2\nlet voltageL23 = round(msg.payload.buffer.readFloatBE(4,4)) // 3,4\nlet voltageL31 = round(msg.payload.buffer.readFloatBE(8,4)) // 5,6\nlet voltageAVG = round(msg.payload.buffer.readFloatBE(12,4)) // 7,8\n\nnode.status({text:\"L12:\"+voltageL12+\"; L23:\"+voltageL23+\"; L31:\"+voltageL31+\"; 0:\"+voltageAVG});\n\nreturn [\n {payload: voltageL12, topic:'0_userdata.0.Wallbox.Strom.Auslese.U12'}, \n {payload: voltageL23, topic:'0_userdata.0.Wallbox.Strom.Auslese.U23'}, \n {payload: voltageL31, topic:'0_userdata.0.Wallbox.Strom.Auslese.U31'},\n {payload: voltageAVG, topic:'0_userdata.0.Wallbox.Strom.Auslese.ULL'}\n];\n\n\nfunction round(num) {\n var m = Number((Math.abs(num) * 100).toPrecision(15));\n return Math.round(m) / 100 * Math.sign(num);\n}", "outputs": 4, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 390, "y": 1020, "wires": [ [ "ee04a046.d40ac" ], [ "ee04a046.d40ac" ], [ "ee04a046.d40ac" ], [ "ee04a046.d40ac" ] ] }, { "id": "a4aa7b2f.ea6278", "type": "function", "z": "c24431d8.d16be", "name": "extract buffer data", "func": "let arbeit = round(msg.payload.buffer.readFloatBE(0,4)) // 1,2\nnode.status({text:\"Arbeit:\"+arbeit+\"kWh\"});\nreturn [\n {\n payload: arbeit, topic:'0_userdata.0.Wallbox.Strom.Auslese.Arbeit'\n \n }\n];\n\nfunction round(num) {\n var m = Number((Math.abs(num) * 100).toPrecision(15));\n return Math.round(m) / 100 * Math.sign(num);\n}", "outputs": "1", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 430, "y": 1120, "wires": [ [ "2209a5e3.4e547a" ] ] }, { "id": "38b34ea4.11e192", "type": "ioBroker out", "z": "c24431d8.d16be", "name": "Ströme", "topic": "", "ack": "true", "autoCreate": "false", "stateName": "", "role": "", "payloadType": "", "readonly": "", "stateUnit": "", "stateMin": "", "stateMax": "", "x": 1160, "y": 1140, "wires": [] }, { "id": "96217b86.779a28", "type": "ioBroker out", "z": "c24431d8.d16be", "name": "Spannungen", "topic": "", "ack": "true", "autoCreate": "false", "stateName": "", "role": "", "payloadType": "", "readonly": "", "stateUnit": "", "stateMin": "", "stateMax": "", "x": 1170, "y": 1220, "wires": [] }, { "id": "204b7607.8b4d5a", "type": "ioBroker out", "z": "c24431d8.d16be", "name": "Leistungen", "topic": "", "ack": "true", "autoCreate": "false", "stateName": "", "role": "", "payloadType": "", "readonly": "", "stateUnit": "", "stateMin": "", "stateMax": "", "x": 1170, "y": 1320, "wires": [] }, { "id": "7d6e2cb1.25cf94", "type": "ioBroker out", "z": "c24431d8.d16be", "name": "I P Total", "topic": "", "ack": "true", "autoCreate": "false", "stateName": "", "role": "", "payloadType": "", "readonly": "", "stateUnit": "", "stateMin": "", "stateMax": "", "x": 580, "y": 820, "wires": [] }, { "id": "ee04a046.d40ac", "type": "ioBroker out", "z": "c24431d8.d16be", "name": "Spannungen", "topic": "", "ack": "true", "autoCreate": "false", "stateName": "", "role": "", "payloadType": "", "readonly": "", "stateUnit": "", "stateMin": "", "stateMax": "", "x": 670, "y": 1020, "wires": [] }, { "id": "2209a5e3.4e547a", "type": "ioBroker out", "z": "c24431d8.d16be", "name": "I P Total", "topic": "", "ack": "true", "autoCreate": "false", "stateName": "", "role": "", "payloadType": "", "readonly": "", "stateUnit": "", "stateMin": "", "stateMax": "", "x": 640, "y": 1120, "wires": [] }, { "id": "fa2c309d.e85bf", "type": "function", "z": "c24431d8.d16be", "name": "extract buffer data", "func": "let lf = round(msg.payload.buffer.readFloatBE(0,4)) // 1,2\nif (lf < 0 ){\n lf=0;\n}\nnode.status({text:\"LF:\"+lf});\nreturn [\n {\n payload: lf, topic:'0_userdata.0.Wallbox.Strom.Auslese.LF'\n \n }\n];\n\nfunction round(num) {\n var m = Number((Math.abs(num) * 100).toPrecision(15));\n return Math.round(m) / 100 * Math.sign(num);\n}", "outputs": "1", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 430, "y": 1180, "wires": [ [ "2209a5e3.4e547a" ] ] }, { "id": "5b800497.8d630c", "type": "ioBroker out", "z": "c24431d8.d16be", "name": "I P Total", "topic": "", "ack": "true", "autoCreate": "false", "stateName": "", "role": "", "payloadType": "", "readonly": "", "stateUnit": "", "stateMin": "", "stateMax": "", "x": 600, "y": 900, "wires": [] }, { "id": "513c1518.2442cc", "type": "catch", "z": "c24431d8.d16be", "name": "", "scope": [ "743b4448.e11c9c", "38b34ea4.11e192", "96217b86.779a28", "204b7607.8b4d5a", "7d6e2cb1.25cf94", "ee04a046.d40ac", "2209a5e3.4e547a", "5b800497.8d630c", "101c66cccacac37f", "66237a931617967c", "6b8bbc65.099ef4", "f855b57f.5901a8", "968d7a0b.0fe808", "efab8902.f736e8", "dfe61d4d.a1bfb", "e9657bb2.688a58", "cdf0c6e39f6fa40c", "ddf59ada8cf40eec", "9b3eeb1d11c036d1", "14b581abc78ba857", "c4f57b115fabadf1", "ba122be31cfb23f3", "ca5120478f8ce267", "0ef7ac1c223df769", "32187279838c66f9", "0c430f6fd725e2e9", "7e37843a9056e0ef", "f4b12dc83ea99fe7", "26670495e6e675c2" ], "uncaught": false, "x": 160, "y": 1880, "wires": [ [ "4c34a6dc.573be8" ] ] }, { "id": "4c34a6dc.573be8", "type": "debug", "z": "c24431d8.d16be", "name": "", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 370, "y": 1880, "wires": [] }, { "id": "1e4ce668f6fc1d33", "type": "function", "z": "c24431d8.d16be", "name": "Faktor", "func": "var arr=msg.payload;\nif(arr.length===2){\n var wert=parseFloat(arr[1])/1000;\n flow.set(\"PF\", wert);\n\n node.status({text:\"Cos Phi:\"+wert});\n\n return [\n {\n payload: wert, topic:'0_userdata.0.Zaehler.Strom.Herd.ist.LF'\n \n }\n ];\n} ", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 610, "y": 60, "wires": [ [ "743b4448.e11c9c" ] ] }, { "id": "101c66cccacac37f", "type": "ioBroker out", "z": "c24431d8.d16be", "name": "ioB string", "topic": "", "ack": "true", "autoCreate": "true", "stateName": "", "role": "string", "payloadType": "string", "readonly": "false", "stateUnit": "", "stateMin": "", "stateMax": "", "x": 1000, "y": 480, "wires": [] }, { "id": "66237a931617967c", "type": "ioBroker out", "z": "c24431d8.d16be", "name": "ioB boolean", "topic": "", "ack": "true", "autoCreate": "true", "stateName": "", "role": "state", "payloadType": "boolean", "readonly": "false", "stateUnit": "", "stateMin": "", "stateMax": "", "x": 1010, "y": 560, "wires": [] }, { "id": "f626796a7eedb661", "type": "delay", "z": "c24431d8.d16be", "name": "", "pauseType": "delay", "timeout": "5", "timeoutUnits": "seconds", "rate": "1", "nbRateUnits": "1", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": false, "allowrate": false, "outputs": 1, "x": 120, "y": 720, "wires": [ [ "cdf0c6e39f6fa40c" ] ] }, { "id": "777228346e35b408", "type": "inject", "z": "c24431d8.d16be", "name": "", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "10", "crontab": "", "once": true, "onceDelay": "1", "topic": "", "payload": "", "payloadType": "date", "x": 90, "y": 160, "wires": [ [ "f4b12dc83ea99fe7", "f626796a7eedb661" ] ] }, { "id": "168ad1b7fad7e8a2", "type": "function", "z": "c24431d8.d16be", "name": "Tariflos 1.8.0", "func": "const Pfad = '0_userdata.0.Zaehler.Strom.Herd.ist.';\n\nvar arr=msg.payload;\nvar T0=0;\n\nif(arr.length===2){\n var f=parseFloat(arr[0])*65536;\n f=f+parseFloat(arr[1]);\n f=f/1000;\n T0=f;\n}\nnode.status({text:\"Arbeit:\"+T0+\"kWh\"});\n\nreturn [\n {\n payload: T0, topic:Pfad+'Arbeit', stateUnit: 'kWh'\n }\n];\n\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 630, "y": 540, "wires": [ [ "743b4448.e11c9c" ] ] }, { "id": "6b8bbc65.099ef4", "type": "modbus-getter", "z": "c24431d8.d16be", "name": "U2", "showStatusActivities": false, "showErrors": true, "logIOActivities": false, "unitid": "151", "dataType": "HoldingRegister", "adr": "6", "quantity": "2", "server": "f4e69f0c.3ab6c", "useIOFile": false, "ioFile": "", "useIOForPayload": false, "emptyMsgOnFail": false, "keepMsgProperties": false, "x": 310, "y": 200, "wires": [ [ "59509a99.453d34" ], [ "f855b57f.5901a8" ] ] }, { "id": "f855b57f.5901a8", "type": "modbus-getter", "z": "c24431d8.d16be", "name": "U3", "showStatusActivities": false, "showErrors": true, "logIOActivities": false, "unitid": "151", "dataType": "HoldingRegister", "adr": "8", "quantity": "2", "server": "f4e69f0c.3ab6c", "useIOFile": false, "ioFile": "", "useIOForPayload": false, "emptyMsgOnFail": false, "keepMsgProperties": false, "x": 310, "y": 260, "wires": [ [ "d127f414.df7908" ], [ "968d7a0b.0fe808" ] ] }, { "id": "968d7a0b.0fe808", "type": "modbus-getter", "z": "c24431d8.d16be", "name": "I1", "showStatusActivities": false, "showErrors": true, "logIOActivities": false, "unitid": "151", "dataType": "HoldingRegister", "adr": "10", "quantity": "2", "server": "f4e69f0c.3ab6c", "useIOFile": false, "ioFile": "", "useIOForPayload": false, "emptyMsgOnFail": false, "keepMsgProperties": false, "x": 310, "y": 320, "wires": [ [ "eda79e7e.a523a" ], [ "efab8902.f736e8" ] ] }, { "id": "efab8902.f736e8", "type": "modbus-getter", "z": "c24431d8.d16be", "name": "I2", "showStatusActivities": false, "showErrors": true, "logIOActivities": false, "unitid": "151", "dataType": "HoldingRegister", "adr": "12", "quantity": "2", "server": "f4e69f0c.3ab6c", "useIOFile": false, "ioFile": "", "useIOForPayload": false, "emptyMsgOnFail": false, "keepMsgProperties": false, "x": 310, "y": 400, "wires": [ [ "c52e1e95.b8f1f" ], [ "dfe61d4d.a1bfb" ] ] }, { "id": "dfe61d4d.a1bfb", "type": "modbus-getter", "z": "c24431d8.d16be", "name": "I3", "showStatusActivities": false, "showErrors": true, "logIOActivities": false, "unitid": "151", "dataType": "HoldingRegister", "adr": "14", "quantity": "2", "server": "f4e69f0c.3ab6c", "useIOFile": false, "ioFile": "", "useIOForPayload": false, "emptyMsgOnFail": false, "keepMsgProperties": false, "x": 310, "y": 460, "wires": [ [ "9730857f.daf338" ], [ "26670495e6e675c2" ] ] }, { "id": "e9657bb2.688a58", "type": "modbus-getter", "z": "c24431d8.d16be", "name": "P", "showStatusActivities": false, "showErrors": true, "logIOActivities": false, "unitid": "151", "dataType": "HoldingRegister", "adr": "0", "quantity": "2", "server": "f4e69f0c.3ab6c", "useIOFile": false, "ioFile": "", "useIOForPayload": false, "emptyMsgOnFail": false, "keepMsgProperties": false, "x": 310, "y": 620, "wires": [ [ "c007e291.21884" ], [] ] }, { "id": "0ef7ac1c223df769", "type": "modbus-getter", "z": "c24431d8.d16be", "name": "U1", "showStatusActivities": false, "showErrors": true, "logIOActivities": false, "unitid": "151", "dataType": "HoldingRegister", "adr": "4", "quantity": "2", "server": "f4e69f0c.3ab6c", "useIOFile": false, "ioFile": "", "useIOForPayload": false, "emptyMsgOnFail": false, "keepMsgProperties": false, "x": 310, "y": 140, "wires": [ [ "822f53a0.e1937" ], [ "6b8bbc65.099ef4" ] ] }, { "id": "ba122be31cfb23f3", "type": "modbus-getter", "z": "c24431d8.d16be", "name": "70+42", "showStatusActivities": false, "showErrors": true, "logIOActivities": false, "unitid": "11", "dataType": "InputRegister", "adr": "70", "quantity": "42", "server": "f4e69f0c.3ab6c", "useIOFile": false, "ioFile": "", "useIOForPayload": false, "emptyMsgOnFail": false, "keepMsgProperties": false, "x": 150, "y": 860, "wires": [ [], [ "525c624.e1e5b9c", "ca5120478f8ce267" ] ] }, { "id": "ca5120478f8ce267", "type": "modbus-getter", "z": "c24431d8.d16be", "name": "200+12", "showStatusActivities": false, "showErrors": true, "logIOActivities": false, "unitid": "11", "dataType": "InputRegister", "adr": "200", "quantity": "12", "server": "f4e69f0c.3ab6c", "useIOFile": false, "ioFile": "", "useIOForPayload": false, "emptyMsgOnFail": false, "keepMsgProperties": false, "x": 160, "y": 940, "wires": [ [], [ "2c8be1dc.543d2e", "32187279838c66f9" ] ] }, { "id": "32187279838c66f9", "type": "modbus-getter", "z": "c24431d8.d16be", "name": "1280+2", "showStatusActivities": false, "showErrors": true, "logIOActivities": false, "unitid": "11", "dataType": "InputRegister", "adr": "1280", "quantity": "2", "server": "f4e69f0c.3ab6c", "useIOFile": false, "ioFile": "", "useIOForPayload": false, "emptyMsgOnFail": false, "keepMsgProperties": false, "x": 160, "y": 1060, "wires": [ [], [ "a4aa7b2f.ea6278", "0c430f6fd725e2e9" ] ] }, { "id": "0c430f6fd725e2e9", "type": "modbus-getter", "z": "c24431d8.d16be", "name": "60+2", "showStatusActivities": false, "showErrors": true, "logIOActivities": false, "unitid": "11", "dataType": "InputRegister", "adr": "60", "quantity": "2", "server": "f4e69f0c.3ab6c", "useIOFile": false, "ioFile": "", "useIOForPayload": false, "emptyMsgOnFail": false, "keepMsgProperties": false, "x": 150, "y": 1180, "wires": [ [], [ "fa2c309d.e85bf", "7e37843a9056e0ef" ] ] }, { "id": "7e37843a9056e0ef", "type": "modbus-getter", "z": "c24431d8.d16be", "name": "0+50", "showStatusActivities": false, "showErrors": true, "logIOActivities": false, "unitid": "11", "dataType": "InputRegister", "adr": "0", "quantity": "50", "server": "f4e69f0c.3ab6c", "useIOFile": false, "ioFile": "", "useIOForPayload": false, "emptyMsgOnFail": false, "keepMsgProperties": false, "x": 150, "y": 1320, "wires": [ [ "ddf59ada8cf40eec" ], [ "a0e8c509.265ee8" ] ] }, { "id": "cdf0c6e39f6fa40c", "type": "modbus-getter", "z": "c24431d8.d16be", "name": "48+8", "showStatusActivities": false, "showErrors": true, "logIOActivities": false, "unitid": "11", "dataType": "InputRegister", "adr": "48", "quantity": "8", "server": "f4e69f0c.3ab6c", "useIOFile": false, "ioFile": "", "useIOForPayload": false, "emptyMsgOnFail": false, "keepMsgProperties": false, "x": 170, "y": 780, "wires": [ [], [ "39853145.37685e", "ba122be31cfb23f3" ] ] }, { "id": "f4b12dc83ea99fe7", "type": "modbus-getter", "z": "c24431d8.d16be", "name": "Cos Phi", "showStatusActivities": false, "showErrors": true, "logIOActivities": false, "unitid": "151", "dataType": "HoldingRegister", "adr": "16", "quantity": "2", "server": "f4e69f0c.3ab6c", "useIOFile": false, "ioFile": "", "useIOForPayload": false, "emptyMsgOnFail": false, "keepMsgProperties": false, "x": 300, "y": 80, "wires": [ [ "1e4ce668f6fc1d33" ], [ "0ef7ac1c223df769" ] ] }, { "id": "26670495e6e675c2", "type": "modbus-getter", "z": "c24431d8.d16be", "name": "kWh", "showStatusActivities": false, "showErrors": false, "logIOActivities": false, "unitid": "151", "dataType": "HoldingRegister", "adr": "16384", "quantity": "2", "server": "f4e69f0c.3ab6c", "useIOFile": false, "ioFile": "", "useIOForPayload": false, "emptyMsgOnFail": false, "keepMsgProperties": false, "x": 310, "y": 540, "wires": [ [ "168ad1b7fad7e8a2" ], [ "e9657bb2.688a58" ] ] }, { "id": "ddf59ada8cf40eec", "type": "modbus-getter", "z": "c24431d8.d16be", "name": "OR-WE 14 U", "showStatusActivities": false, "showErrors": true, "logIOActivities": false, "unitid": "4", "dataType": "HoldingRegister", "adr": "305", "quantity": "1", "server": "f4e69f0c.3ab6c", "useIOFile": false, "ioFile": "", "useIOForPayload": false, "emptyMsgOnFail": false, "keepMsgProperties": false, "x": 170, "y": 1500, "wires": [ [ "82950a49f8fc4c42", "9b3eeb1d11c036d1" ], [] ] }, { "id": "bf2809c2e7ae4ffd", "type": "debug", "z": "c24431d8.d16be", "name": "debug 3", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 540, "y": 1820, "wires": [] }, { "id": "9b3eeb1d11c036d1", "type": "modbus-getter", "z": "c24431d8.d16be", "name": "OR-WE 14 I", "showStatusActivities": false, "showErrors": true, "logIOActivities": false, "unitid": "4", "dataType": "HoldingRegister", "adr": "313", "quantity": "2", "server": "f4e69f0c.3ab6c", "useIOFile": false, "ioFile": "", "useIOForPayload": false, "emptyMsgOnFail": false, "keepMsgProperties": false, "x": 170, "y": 1580, "wires": [ [ "14b581abc78ba857", "cb050a79f5f96008" ], [] ] }, { "id": "14b581abc78ba857", "type": "modbus-getter", "z": "c24431d8.d16be", "name": "OR-WE 14 P", "showStatusActivities": false, "showErrors": true, "logIOActivities": false, "unitid": "4", "dataType": "HoldingRegister", "adr": "320", "quantity": "2", "server": "f4e69f0c.3ab6c", "useIOFile": false, "ioFile": "", "useIOForPayload": false, "emptyMsgOnFail": false, "keepMsgProperties": false, "x": 170, "y": 1660, "wires": [ [ "7b030f2291475e82", "0ed251949763c827", "bf2809c2e7ae4ffd" ], [] ] }, { "id": "c4f57b115fabadf1", "type": "modbus-getter", "z": "c24431d8.d16be", "name": "OR-WE 14 kWh", "showStatusActivities": false, "showErrors": true, "showWarnings": true, "logIOActivities": false, "unitid": "4", "dataType": "HoldingRegister", "adr": "40960", "quantity": "2", "server": "f4e69f0c.3ab6c", "useIOFile": false, "ioFile": "", "useIOForPayload": false, "emptyMsgOnFail": false, "keepMsgProperties": false, "delayOnStart": false, "startDelayTime": "", "x": 180, "y": 1820, "wires": [ [ "07e78de48e963783", "dfabf7acb25b33dc" ], [] ] }, { "id": "82950a49f8fc4c42", "type": "function", "z": "c24431d8.d16be", "name": "Faktor", "func": "var arr=msg.payload;\nconst Pfad = '0_userdata.0.Zaehler.PV.ist.';\nif(arr.length===1){\n var wert=parseFloat(arr[0])/100;\n node.status({text:wert+\"V\"});\n\n return [\n {\n payload: wert, topic:Pfad+'U1', stateUnit: 'V'\n }\n ];\n} ", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 370, "y": 1500, "wires": [ [ "8b4a362dc5bd1f51" ] ] }, { "id": "cb050a79f5f96008", "type": "function", "z": "c24431d8.d16be", "name": "Faktor", "func": "var arr=msg.payload;\nconst Pfad = '0_userdata.0.Zaehler.PV.ist.';\nif(arr.length===2){\n var wert = parseFloat(arr[0]) * 65536 + parseFloat(arr[1])\n \n wert=wert/1000;\n \n node.status({text:wert+\"A\"});\n\n return [\n {\n payload: wert, topic:Pfad+'I1', stateUnit: 'A'\n }\n ];\n} ", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 370, "y": 1560, "wires": [ [ "8b4a362dc5bd1f51" ] ] }, { "id": "7b030f2291475e82", "type": "function", "z": "c24431d8.d16be", "name": "Faktor", "func": "var arr=msg.payload;\nconst Pfad = '0_userdata.0.Zaehler.PV.ist.';\nif(arr.length===2){\n var wert = parseFloat(arr[0]) * 65536 + parseFloat(arr[1])\n // wert = wert / 1000;\n node.status({text:wert+\"W\"});\n\n return [\n {\n payload: wert, topic:Pfad+'P1', stateUnit: 'W'\n }\n ];\n} ", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 370, "y": 1640, "wires": [ [ "8b4a362dc5bd1f51" ] ] }, { "id": "07e78de48e963783", "type": "function", "z": "c24431d8.d16be", "name": "Faktor", "func": "var arr=msg.payload;\nconst Pfad = '0_userdata.0.Zaehler.PV.ist.';\nif(arr.length===2){\n var wert = parseFloat(arr[0]) * 65536 + parseFloat(arr[1])\n wert = wert / 100;\n\n node.status({ text: wert + \"kWh\"});\n return [\n {\n payload: wert, topic:Pfad+'Arbeit', stateUnit: 'kWh'\n }\n ];\n} ", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 370, "y": 1780, "wires": [ [ "8b4a362dc5bd1f51" ] ] }, { "id": "8b4a362dc5bd1f51", "type": "ioBroker out", "z": "c24431d8.d16be", "name": "ioB number", "topic": "", "ack": "true", "autoCreate": "true", "stateName": "", "role": "state", "payloadType": "number", "readonly": "false", "stateUnit": "", "stateMin": "", "stateMax": "", "x": 650, "y": 1640, "wires": [] }, { "id": "0ed251949763c827", "type": "modbus-getter", "z": "c24431d8.d16be", "name": "OR-WE 14 S", "showStatusActivities": false, "showErrors": true, "showWarnings": true, "logIOActivities": false, "unitid": "4", "dataType": "HoldingRegister", "adr": "336", "quantity": "2", "server": "f4e69f0c.3ab6c", "useIOFile": false, "ioFile": "", "useIOForPayload": false, "emptyMsgOnFail": false, "keepMsgProperties": false, "delayOnStart": false, "startDelayTime": "", "x": 170, "y": 1740, "wires": [ [ "d4116f75baeadc71", "c4f57b115fabadf1" ], [] ] }, { "id": "d4116f75baeadc71", "type": "function", "z": "c24431d8.d16be", "name": "Faktor", "func": "var arr=msg.payload;\nconst Pfad = '0_userdata.0.Zaehler.PV.ist.';\nif(arr.length===2){\n var wert = parseFloat(arr[0]) * 65536 + parseFloat(arr[1])\n // wert = wert / 1000;\n node.status({text:wert+\"VA\"});\n\n return [\n {\n payload: wert, topic:Pfad+'S1', stateUnit: 'VA'\n }\n ];\n} ", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 370, "y": 1700, "wires": [ [ "8b4a362dc5bd1f51" ] ] }, { "id": "dfabf7acb25b33dc", "type": "debug", "z": "c24431d8.d16be", "name": "debug 7", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 540, "y": 1860, "wires": [] }, { "id": "f8bd2c635d269c86", "type": "comment", "z": "c24431d8.d16be", "name": "DZG DVH4013", "info": "", "x": 320, "y": 20, "wires": [] }, { "id": "59f5de91d229a142", "type": "comment", "z": "c24431d8.d16be", "name": "EASTRON SDM72D-M", "info": "EASTRON SDM72D-M", "x": 400, "y": 720, "wires": [] }, { "id": "49f1bbf094d20d2c", "type": "comment", "z": "c24431d8.d16be", "name": "Orno OR-WE 14", "info": "", "x": 180, "y": 1440, "wires": [] }, { "id": "f4e69f0c.3ab6c", "type": "modbus-client", "name": "USRIOT", "clienttype": "tcp", "bufferCommands": true, "stateLogEnabled": false, "queueLogEnabled": true, "failureLogEnabled": false, "tcpHost": "192.168.2.96", "tcpPort": "502", "tcpType": "TELNET", "serialPort": "/dev/ttyUSB", "serialType": "RTU-BUFFERD", "serialBaudrate": "9600", "serialDatabits": "8", "serialStopbits": "1", "serialParity": "none", "serialConnectionDelay": "100", "serialAsciiResponseStartDelimiter": "", "unit_id": "1", "commandDelay": "300", "clientTimeout": "1000", "reconnectOnTimeout": true, "reconnectTimeout": "5000", "parallelUnitIdsAllowed": true } ]