NEWS
Muster Stromzähler RS232
-
Hallo,
anbei mein Node-Red-Flow, welches per optischem Lesekopf den Stromzähler vom EVU abfragt.
Der RS232-LAN-Adapter ist ein USRIOT USR-TCP232-T 2
Der Stromzähler ist ein LOGAREX LK13BE, welcher per PIN geschwätziger geschaltet wurde.
Der optische Lesekopf ist ein günstig bei eBay als Bausatz geschossener NoName.[ { "id": "c587122ec79a200c", "type": "tab", "label": "Strom EVU", "disabled": false, "info": "" }, { "id": "1ce291586779796c", "type": "catch", "z": "c587122ec79a200c", "name": "", "scope": [ "61dd23b258b802e6", "bd2f6fb84b795289", "472af7c34b784cef", "8425fef0bf9f3b09", "7e6496b30f82a733", "8725b4dd7db48627", "6bd2ac13e94179f9" ], "uncaught": false, "x": 90, "y": 680, "wires": [ [ "bc4e1c204c90a1a0" ] ] }, { "id": "bc4e1c204c90a1a0", "type": "debug", "z": "c587122ec79a200c", "name": "", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 300, "y": 680, "wires": [] }, { "id": "61dd23b258b802e6", "type": "tcp in", "z": "c587122ec79a200c", "name": "Empfang EVU", "server": "server", "host": "", "port": "28234", "datamode": "stream", "datatype": "utf8", "newline": "", "topic": "", "base64": false, "tls": "", "x": 130, "y": 60, "wires": [ [ "8425fef0bf9f3b09" ] ] }, { "id": "8425fef0bf9f3b09", "type": "split", "z": "c587122ec79a200c", "name": "", "splt": "!", "spltType": "str", "arraySplt": 1, "arraySpltType": "len", "stream": true, "addname": "", "x": 270, "y": 60, "wires": [ [ "472af7c34b784cef", "15844dfdf721c9c4" ] ] }, { "id": "472af7c34b784cef", "type": "function", "z": "c587122ec79a200c", "name": "Werte", "func": "var text = msg.payload;\ntext = text.replace(\"\\r\",\"\");\nconst myArray = text.split(\"\\n\");\nconst Pfad = '0_userdata.0.Zaehler.Strom.EVU.ist.';\nvar wertholen = function(datensatz) {\n var beginn=text.indexOf(datensatz);\n if(beginn > 0){\n beginn=text.indexOf('(',beginn+1)+1;\n var ende = text.indexOf('*',beginn);\n if(ende > 0){\n return parseFloat(text.substring(beginn,ende)); \n }else{\n return -99999;\n }\n }else{\n return -99999;\n }\n}\n\nvar kwhTotal = wertholen(':1.8.0*255');\nvar kwh = wertholen(':1.8.0*100');\nvar kwh1 = wertholen(':1.8.0*96'); //1 Tag\nvar kwh7 = wertholen(':1.8.0*97'); //7 Tage\nvar kwh30 = wertholen(':1.8.0*98'); //30 Tage\nvar kwh365 = wertholen(':1.8.0*99'); //365 Tage\nvar kwhPVTotal = wertholen(':2.8.0*255');\n\nvar u1 = wertholen(':32.7');\nvar u2 = wertholen(':52.7');\nvar u3 = wertholen(':72.7');\nvar i1 = wertholen(':31.7');\nvar i2 = wertholen(':51.7');\nvar i3 = wertholen(':71.7');\nvar w = wertholen(':16.7');\nvar f = wertholen(':14.7');\nvar w1 = (wertholen(':81.7.4')); //Winkel L1\nvar w2 = (wertholen(':81.7.15')); //Winkel L2\nvar w3 = (wertholen(':81.7.26')); //Winkel L3\n\n\nvar p1 = Math.round(u1*i1*Math.cos(w1 * Math.PI / 180)*10)/10;\nvar p2 = Math.round(u2*i2*Math.cos(w2 * Math.PI / 180)*10)/10;\nvar p3 = Math.round(u3*i3*Math.cos(w3 * Math.PI / 180)*10)/10;\n\nvar s1 = Math.round(u1*i1*10)/10;\nvar s2 = Math.round(u2*i2*10)/10;\nvar s3 = Math.round(u3*i3*10)/10;\n\nvar q1 = Math.round(u1*i1*Math.sin(w1 * Math.PI / 180)*10)/10;\nvar q2 = Math.round(u2*i2*Math.sin(w2 * Math.PI / 180)*10)/10;\nvar q3 = Math.round(u3*i3*Math.sin(w3 * Math.PI / 180)*10)/10;\n\nvar i4 = Math.round((i1+i2+i3)*10)/10; //Runden notwendig, da teilweise Werte mit zig Stellen rauskamen\nvar s4 = Math.round((s1+s2+s3)*10)/10;\nvar q4 = Math.round((q1+q2+q3)*10)/10;\nvar p4 = Math.round((p1+p2+p3)*10)/10;\n\nvar summe = Math.round(p1+p2+p3);\nsumme = w-summe;\n/*\nif (summe < -0){\n p1 = p1 * (-1);\n} \n*/\n\n/*\nvar w4 = (wertholen(':81.7.1*')); //Winkel Spannung U2 U1\nvar w5 = (wertholen(':81.7.2*')); //Winkel Spannung U3 U1\nw4 = 360 / w4; //L2\nw5 = 360 / (w5-120); //L3\n\nvar u12 = ((u1*Math.sqrt(3)+u2*Math.sqrt(w4))/2);\nvar u23 = ((u2*Math.sqrt(w4)+u3*Math.sqrt(w5))/2);\nvar u31 = ((u1*Math.sqrt(3)+u3*Math.sqrt(w5))/2);\n\nu12 = Math.round(u12*10)/10;\nu23 = Math.round(u23*10)/10;\nu31 = Math.round(u31*10)/10;\n\nnode.status({text:u12+\";\"+u23+\";\"+u31});\n*/\nvar cP1 = Math.round((p1/s1)*1000)/1000;\nvar cP2 = Math.round((p2/s2)*1000)/1000;\nvar cP3 = Math.round((p3/s3)*1000)/1000;\nvar cP4 = Math.round((p4/s4)*1000)/1000;\n\nnode.status({ text: \"Summe:\" + summe + \"; P:\" + w + \"; P0:\" + p4});\n\nreturn [\n {\n payload: kwhTotal, topic:Pfad+'Arbeit_Total', stateUnit: 'kWh', stateType: 'number', stateRole: 'value'\n },\n {\n payload: kwh, topic:Pfad+'Arbeit', stateUnit: 'kWh', stateType: 'number', stateRole: 'value'\n },\n {\n payload: kwh1, topic:Pfad+'Arbeit_001Tag', stateUnit: 'kWh', stateType: 'number', stateRole: 'value'\n },\n {\n payload: kwh7, topic:Pfad+'Arbeit_007Tage', stateUnit: 'kWh', stateType: 'number', stateRole: 'value'\n },\n {\n payload: kwh30, topic:Pfad+'Arbeit_030Tage', stateUnit: 'kWh', stateType: 'number', stateRole: 'value'\n },\n {\n payload: kwh365, topic:Pfad+'Arbeit_365Tage', stateUnit: 'kWh', stateType: 'number', stateRole: 'value'\n },\n {\n payload: w, topic:Pfad+'P', stateUnit: 'W', stateType: 'number', stateRole: 'value'\n },\n {\n payload: f, topic:Pfad+'F', stateUnit: 'Hz', stateType: 'number', stateRole: 'value'\n },\n {\n payload: u1, topic:Pfad+'U1', stateUnit: 'V', stateType: 'number', stateRole: 'value'\n },\n {\n payload: u2, topic:Pfad+'U2', stateUnit: 'V', stateType: 'number', stateRole: 'value'\n },\n {\n payload: u3, topic:Pfad+'U3', stateUnit: 'V', stateType: 'number', stateRole: 'value'\n },\n {\n payload: i1, topic:Pfad+'I1', stateUnit: 'A', stateType: 'number', stateRole: 'value'\n },\n {\n payload: i2, topic:Pfad+'I2', stateUnit: 'A', stateType: 'number', stateRole: 'value'\n },\n {\n payload: i3, topic:Pfad+'I3', stateUnit: 'A', stateType: 'number', stateRole: 'value'\n },\n {\n payload: i4, topic:Pfad+'I', stateUnit: 'A', stateType: 'number', stateRole: 'value'\n },\n {\n payload: p1, topic:Pfad+'P1', stateUnit: 'W', stateType: 'number', stateRole: 'value'\n },\n {\n payload: p2, topic:Pfad+'P2', stateUnit: 'W', stateType: 'number', stateRole: 'value'\n },\n {\n payload: p3, topic:Pfad+'P3', stateUnit: 'W', stateType: 'number', stateRole: 'value'\n },\n {\n payload: p4, topic:Pfad+'P0', stateUnit: 'W', stateType: 'number', stateRole: 'value'\n },\n {\n payload: s1, topic:Pfad+'S1', stateUnit: 'VA', stateType: 'number', stateRole: 'value'\n },\n {\n payload: s2, topic:Pfad+'S2', stateUnit: 'VA', stateType: 'number', stateRole: 'value'\n },\n {\n payload: s3, topic:Pfad+'S3', stateUnit: 'VA', stateType: 'number', stateRole: 'value'\n },\n {\n payload: s4, topic:Pfad+'S', stateUnit: 'VA', stateType: 'number', stateRole: 'value'\n },\n {\n payload: q1, topic:Pfad+'Q1', stateUnit: 'var', stateType: 'number', stateRole: 'value'\n },\n {\n payload: q2, topic:Pfad+'Q2', stateUnit: 'var', stateType: 'number', stateRole: 'value'\n },\n {\n payload: q3, topic:Pfad+'Q3', stateUnit: 'var', stateType: 'number', stateRole: 'value'\n },\n {\n payload: q4, topic:Pfad+'Q', stateUnit: 'var', stateType: 'number', stateRole: 'value'\n },\n {\n payload: cP1, topic:Pfad+'cosPhi1', stateUnit: '', stateType: 'number', stateRole: 'value'\n },\n {\n payload: cP2, topic:Pfad+'cosPhi2', stateUnit: '', stateType: 'number', stateRole: 'value'\n },\n {\n payload: cP3, topic:Pfad+'cosPhi3', stateUnit: '', stateType: 'number', stateRole: 'value'\n },\n {\n payload: cP4, topic:Pfad+'cosPhi', stateUnit: '', stateType: 'number', stateRole: 'value'\n },\n {\n payload: kwhPVTotal, topic: Pfad + 'PV_Total', stateUnit: 'kWh', stateType: 'number', stateRole: 'value'\n }\n];\n\n\n\n", "outputs": 32, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 450, "y": 300, "wires": [ [ "8725b4dd7db48627" ], [ "8725b4dd7db48627" ], [ "8725b4dd7db48627" ], [ "8725b4dd7db48627" ], [ "8725b4dd7db48627" ], [ "8725b4dd7db48627" ], [ "8725b4dd7db48627" ], [ "8725b4dd7db48627" ], [ "8725b4dd7db48627" ], [ "8725b4dd7db48627" ], [ "8725b4dd7db48627" ], [ "8725b4dd7db48627" ], [ "8725b4dd7db48627" ], [ "8725b4dd7db48627" ], [ "8725b4dd7db48627" ], [ "8725b4dd7db48627" ], [ "8725b4dd7db48627" ], [ "8725b4dd7db48627" ], [ "8725b4dd7db48627" ], [ "8725b4dd7db48627" ], [ "8725b4dd7db48627" ], [ "8725b4dd7db48627" ], [ "8725b4dd7db48627" ], [ "8725b4dd7db48627" ], [ "8725b4dd7db48627" ], [ "8725b4dd7db48627" ], [ "8725b4dd7db48627" ], [ "8725b4dd7db48627" ], [ "8725b4dd7db48627" ], [ "8725b4dd7db48627" ], [ "8725b4dd7db48627" ], [ "8725b4dd7db48627" ] ] }, { "id": "7e6496b30f82a733", "type": "ioBroker out", "z": "c587122ec79a200c", "name": "", "topic": "", "ack": "true", "autoCreate": "true", "stateName": "", "role": "", "payloadType": "number", "readonly": "false", "stateUnit": "", "stateMin": "", "stateMax": "", "x": 1120, "y": 200, "wires": [] }, { "id": "8725b4dd7db48627", "type": "switch", "z": "c587122ec79a200c", "name": "Zahlen", "property": "payload", "propertyType": "msg", "rules": [ { "t": "istype", "v": "number", "vt": "number" }, { "t": "else" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 710, "y": 200, "wires": [ [ "6bd2ac13e94179f9" ], [] ] }, { "id": "6bd2ac13e94179f9", "type": "switch", "z": "c587122ec79a200c", "name": "Gültig", "property": "payload", "propertyType": "msg", "rules": [ { "t": "lt", "v": "-99990", "vt": "num" }, { "t": "gt", "v": "99999999", "vt": "num" }, { "t": "else" } ], "checkall": "true", "repair": false, "outputs": 3, "x": 890, "y": 200, "wires": [ [], [], [ "7e6496b30f82a733", "da60cc6f5913df09" ] ] }, { "id": "15844dfdf721c9c4", "type": "debug", "z": "c587122ec79a200c", "name": "", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 850, "y": 40, "wires": [] }, { "id": "af6725d8ac794375", "type": "ioBroker out", "z": "c587122ec79a200c", "name": "", "topic": "0_userdata.0.Zaehler.Strom.Timeout", "ack": "true", "autoCreate": "false", "stateName": "", "role": "", "payloadType": "", "readonly": "", "stateUnit": "", "stateMin": "", "stateMax": "", "x": 1350, "y": 300, "wires": [] }, { "id": "da60cc6f5913df09", "type": "timeout", "z": "c587122ec79a200c", "name": "Timeout", "outtopic": "", "outsafe": "Stromzähler OK", "outwarning": "Warnung Verbindung Stromzähler", "outunsafe": "Fehler Verbindung Stromzähler", "warning": "60", "timer": "300", "repeat": false, "again": true, "x": 1080, "y": 320, "wires": [ [ "af6725d8ac794375" ] ] }, { "id": "1d80687864318675", "type": "comment", "z": "c587122ec79a200c", "name": "LOGAREX LK13BE", "info": "", "x": 150, "y": 20, "wires": [] } ]
Hey! Du scheinst an dieser Unterhaltung interessiert zu sein, hast aber noch kein Konto.
Hast du es satt, bei jedem Besuch durch die gleichen Beiträge zu scrollen? Wenn du dich für ein Konto anmeldest, kommst du immer genau dorthin zurück, wo du zuvor warst, und kannst dich über neue Antworten benachrichtigen lassen (entweder per E-Mail oder Push-Benachrichtigung). Du kannst auch Lesezeichen speichern und Beiträge positiv bewerten, um anderen Community-Mitgliedern deine Wertschätzung zu zeigen.
Mit deinem Input könnte dieser Beitrag noch besser werden 💗
Registrieren Anmelden