Problem 1: Der Shelly (Messpunkt Wärmepumpe) ist als SmartHome Gerät eingerichtet. Für eine korrekte Darstellung muss dem EVU-Modul in oWB die Gesamtenergie bekannt sein (keine Teilmengen aus Haus, Wärmepumpe...).
Problem 2: Aufgrund einer Zähler Kaskade, kann ich den realen Messpunkt nicht versetzen(verplombt).
Ziel: virtueller Messpunkt am Übergabepunkt EVU
Vorgehen:
- Shelly 3EM - MQTT aktivieren
- Updatezyklus anpassen: http://[IP_address_Shelly]/settings?mqtt_update_period=5
- Zyklus kontrollieren: http://[IP_address_Shelly]/settings?
- oWB EVU Kit: Protoss PE11 ins lokales Netzwerk integrieren
- IP bei Auslieferung: 192.168.193.xxx, UnitID: 115
- Default Login:admin PW:admin
- Hinweis: um parallel Daten abzufragen hatte ich einen zweiten TCP Server auf Port 8900 angelegt und im Flow verwendet
- node-RED - Flow SDM360: Werte aus EVU Kit holen (Modbus TCP, UnitID:115)
Code: Alles auswählen
[{"id":"8ca660a0.79874","type":"tab","label":"Haus - SDM630","disabled":false,"info":""},{"id":"6bf7fb6a.5138a4","type":"modbus-read","z":"8ca660a0.79874","name":"SDM630 - Modbus-Read","topic":"","showStatusActivities":false,"logIOActivities":false,"showErrors":false,"unitid":"","dataType":"InputRegister","adr":"0","quantity":"76","rate":"5","rateUnit":"s","delayOnStart":false,"startDelayTime":"","server":"8d22bae7.f4d3e8","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"x":170,"y":120,"wires":[[],["734cef5c.fe7ee"]]},{"id":"734cef5c.fe7ee","type":"function","z":"8ca660a0.79874","name":"extract energy values","func":"let voltageL1 = msg.payload.buffer.readFloatBE(0,4); // 1,2\nlet voltageL2 = msg.payload.buffer.readFloatBE(4,4); // 3,4\nlet voltageL3 = msg.payload.buffer.readFloatBE(8,4); // 5,6\n\nlet currentL1 = msg.payload.buffer.readFloatBE(12,4); // 7,8\nlet currentL2 = msg.payload.buffer.readFloatBE(16,4); // 9,10\nlet currentL3 = msg.payload.buffer.readFloatBE(20,4); // 11,12\n\nlet powerL1 = msg.payload.buffer.readFloatBE(24,4); // 13,14\nlet powerL2 = msg.payload.buffer.readFloatBE(28,4); // 15,16\nlet powerL3 = msg.payload.buffer.readFloatBE(32,4); // 17,18\n\nlet pfL1 = msg.payload.buffer.readFloatBE(60,4); // 31,32\nlet pfL2 = msg.payload.buffer.readFloatBE(64,4); // 33,34\nlet pfL3 = msg.payload.buffer.readFloatBE(68,4); // 35,36\n\nlet powerSum = msg.payload.buffer.readFloatBE(104,8); //53-56\nlet frequency = msg.payload.buffer.readFloatBE(140,4); // 71,72\nlet importtotal = msg.payload.buffer.readFloatBE(144,4); // 73,74\nlet exporttotal = msg.payload.buffer.readFloatBE(148,4); // 75-76\n\nreturn [\n {\n payload: {\n L1: {\n voltage: voltageL1,\n current: currentL1,\n power: powerL1,\n pf: pfL1\n },\n L2: {\n voltage: voltageL2,\n current: currentL2,\n power: powerL2,\n pf: pfL2\n },\n L3: {\n voltage: voltageL3,\n current: currentL3,\n power: powerL3,\n pf: pfL3\n },\n power: parseInt(powerSum),\n frequency: frequency,\n importtotal: importtotal,\n exporttotal: exporttotal,\n }\n }\n];","outputs":"1","noerr":0,"initialize":"","finalize":"","libs":[],"x":400,"y":120,"wires":[["c44f268b.4e6c18","c544f7a4.9e6a88"]]},{"id":"c44f268b.4e6c18","type":"debug","z":"8ca660a0.79874","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":620,"y":170,"wires":[]},{"id":"c544f7a4.9e6a88","type":"change","z":"8ca660a0.79874","name":"SetzeGlobal","rules":[{"t":"set","p":"EM.SDM630","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":630,"y":120,"wires":[[]]},{"id":"59967adca7352c46","type":"comment","z":"8ca660a0.79874","name":"Used Modbus Register SDM630","info":"Register aus dem Handbuch:\nEastron SDM630_MODBUS_Protocol.pdf: \nhttps://www.eastroneurope.com/images/uploads/products/protocol/SDM630_MODBUS_Protocol.pdf\n\nRegister | Number | Description | Unit\n30001 1 Phase 1 line to neutral volts Volts\n30003 2 Phase 2 line to neutral volts Volts \n30005 3 Phase 3 line to neutral volts Volts \n30007 4 Phase 1 current Amps \n30009 5 Phase 2 current Amps\n30011 6 Phase 3 current Amps\n30013 7 Phase 1 power Watts\n30015 8 Phase 2 power Watts\n30017 9 Phase 3 power Watts \n\n30031 16 Phase 1 power factor \n30033 17 Phase 2 power factor \n30035 18 Phase 3 power factor \n\n30053 27 Total system power Watts \n30071 36 Frequency of supply voltages Hz \n30073 37 Total Import kWh kWh \n30075 38 Total Export kWh kWh \n\nAls Modbus Server wurde Protoss PE11 (Bestandteil openWB EVU-Kit) verwendet - erforderliche Einstellungen:\n- ins Netzwerk integrieren default IP: 192.168.193.xxx\n- Default Login: admin/admin\n- Communication Settings: TCP Server vorhanden oder erstellen - UnitID: 115 hier wurde Port 8900 verwendet","x":210,"y":240,"wires":[]},{"id":"a17b9f17871b0a52","type":"comment","z":"8ca660a0.79874","name":"used code","info":"SDM630 Test Flow\nhttps://flows.nodered.org/flow/ee2213f68fea86729e03c222d7cbd89b\n","x":480,"y":240,"wires":[]},{"id":"8d22bae7.f4d3e8","type":"modbus-client","z":"8ca660a0.79874","name":"SDM630 Modbus Gateway","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":false,"queueLogEnabled":false,"tcpHost":"192.168.178.166","tcpPort":"8900","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","serialAsciiResponseStartDelimiter":"","unit_id":115,"commandDelay":1,"clientTimeout":2000,"reconnectOnTimeout":true,"reconnectTimeout":4000,"parallelUnitIdsAllowed":false}]
- node-RED - Flow Shelly3EM:Werte aus Shelly 3EM (MQTT) holen
Code: Alles auswählen
[{"id":"8bf6718a.bee688","type":"tab","label":"WP-Shelly-3EM","disabled":false,"info":""},{"id":"8d5cddda.20f838","type":"mqtt in","z":"8bf6718a.bee688","name":"","topic":"shellies/shelly3EM-WP/emeter/#","qos":"2","datatype":"auto","broker":"d90572d7.8365e8","nl":false,"rap":false,"inputs":0,"x":170,"y":140,"wires":[["e803a96d.b5b018","10cf12e00b31ab83"]]},{"id":"e803a96d.b5b018","type":"json","z":"8bf6718a.bee688","name":"","property":"payload","action":"","pretty":false,"x":410,"y":220,"wires":[["7d2b1d47.afcf44"]]},{"id":"7d2b1d47.afcf44","type":"function","z":"8bf6718a.bee688","name":"Shelly 3EM - Messwerte speichern","func":"// create the EM object if it doesn't exist\nif (typeof global.get(\"EM\") == 'undefined') global.set(\"EM\", {})\n\nvar EM = global.get(\"EM\") // get light fixtures object from memory\nvar deviceID = msg.topic.split(\"/\")[1]; // get the shelly device ID (or MQTT prefix if set)\n\nif (EM.hasOwnProperty(deviceID)) { // if device exists in Node RED memory\n\n // IP address\n if (msg.topic.split(\"/\")[2] == \"announce\") {\n EM[deviceID].ip = msg.payload.ip\n EM[deviceID].mac = msg.payload.mac\n //EM[deviceID].new_fw = msg.payload.new_fw\n EM[deviceID].fw_ver = msg.payload.fw_ver\n }\n\n // Shelly EM - register the device in Node-RED as an Electricity Meter (EM)\n if (msg.topic.split(\"/\")[2] == \"emeter\") {\n // Shelly EM - power\n if (msg.topic.split(\"/\")[3] == \"0\" && msg.topic.split(\"/\")[4] == \"power\") EM[deviceID].power_L1 = parseInt(msg.payload);\n if (msg.topic.split(\"/\")[3] == \"1\" && msg.topic.split(\"/\")[4] == \"power\") EM[deviceID].power_L2 = parseInt(msg.payload);\n if (msg.topic.split(\"/\")[3] == \"2\" && msg.topic.split(\"/\")[4] == \"power\") EM[deviceID].power_L3 = parseInt(msg.payload);\n EM[deviceID].power_sum = EM[deviceID].power_L1 + EM[deviceID].power_L2 + EM[deviceID].power_L3;\n // Shelly EM - voltage\n if (msg.topic.split(\"/\")[3] == \"0\" && msg.topic.split(\"/\")[4] == \"voltage\") EM[deviceID].voltage_L1 = msg.payload;\n if (msg.topic.split(\"/\")[3] == \"1\" && msg.topic.split(\"/\")[4] == \"voltage\") EM[deviceID].voltage_L2 = msg.payload;\n if (msg.topic.split(\"/\")[3] == \"1\" && msg.topic.split(\"/\")[4] == \"voltage\") EM[deviceID].voltage_L2 = msg.payload;\n // Shelly EM - current\n if (msg.topic.split(\"/\")[3] == \"0\" && msg.topic.split(\"/\")[4] == \"current\") EM[deviceID].current_L1 = msg.payload;\n if (msg.topic.split(\"/\")[3] == \"1\" && msg.topic.split(\"/\")[4] == \"current\") EM[deviceID].current_L2 = msg.payload;\n if (msg.topic.split(\"/\")[3] == \"2\" && msg.topic.split(\"/\")[4] == \"current\") EM[deviceID].current_L3 = msg.payload;\n // Shelly EM - total\n if (msg.topic.split(\"/\")[3] == \"0\" && msg.topic.split(\"/\")[4] == \"total\") EM[deviceID].total_L1 = msg.payload;\n if (msg.topic.split(\"/\")[3] == \"1\" && msg.topic.split(\"/\")[4] == \"total\") EM[deviceID].total_L2 = msg.payload;\n if (msg.topic.split(\"/\")[3] == \"2\" && msg.topic.split(\"/\")[4] == \"total\") EM[deviceID].total_L3 = msg.payload;\n // Shelly EM - total returned\n if (msg.topic.split(\"/\")[3] == \"0\" && msg.topic.split(\"/\")[4] == \"total_returned\") EM[deviceID].total_returned_L1 = msg.payload;\n if (msg.topic.split(\"/\")[3] == \"1\" && msg.topic.split(\"/\")[4] == \"total_returned\") EM[deviceID].total_returned_L2 = msg.payload;\n if (msg.topic.split(\"/\")[3] == \"2\" && msg.topic.split(\"/\")[4] == \"total_returned\") EM[deviceID].total_returned_L3 = msg.payload;\n\n \n }\n} else { // device didn't exist\n // create object for first time\n EM[deviceID] = {\n \n }\n}\n\nglobal.set(\"EM\",EM)\n// NB if device doesn't exist in mem, the other function will create it and we'll get measurements next time\nreturn msg\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":640,"y":220,"wires":[[]]},{"id":"9b60f2db.baab4","type":"mqtt in","z":"8bf6718a.bee688","name":"","topic":"shellies/shelly3EM-WP/announce/#","qos":"2","datatype":"auto","broker":"d90572d7.8365e8","nl":false,"rap":false,"inputs":0,"x":180,"y":220,"wires":[["e803a96d.b5b018"]]},{"id":"85a5df64227fac3b","type":"comment","z":"8bf6718a.bee688","name":"used Code","info":"Shelly Command Centre\nhttps://flows.nodered.org/flow/a427f6038507775b755d33165cf14f45","x":980,"y":160,"wires":[]},{"id":"f6f422a361ee7d55","type":"comment","z":"8bf6718a.bee688","name":"Shelly 3EM - MQTT - API","info":"https://shelly-api-docs.shelly.cloud/gen1/#shelly-3em-overview\nShelly 3EM: MQTT\n\nWhen configured for MQTT Shelly 3EM reports data on:\n\n shellies/shellyem3-<deviceid>/emeter/<i>/energy energy counter in Watt-minute\n shellies/shellyem3-<deviceid>/emeter/<i>/returned_energy energy returned to the grid in Watt-minute\n shellies/shellyem3-<deviceid>/emeter/<i>/total total energy in Wh (accumulated in device's non-volatile memory)\n shellies/shellyem3-<deviceid>/emeter/<i>/total_returned total energy returned to the grid in Wh (accumulated in device's non-volatile memory)\n shellies/shellyem3-<deviceid>/emeter/<i>/power instantaneous active power in Watts\n shellies/shellyem3-<deviceid>/emeter/<i>/voltage grid voltage in Volts\n shellies/shellyem3-<deviceid>/emeter/<i>/current current in Amps\n shellies/shellyem3-<deviceid>/emeter/<i>/pf power factor (dimensionless)\n shellies/shellyem3-<deviceid>/relay/0 reports status: on, off or overpower\n\nNote, that energy and returned_energy do not survive power cycle or reboot -- this is how the value is implemented on other Shellies. Shelly 3EM features a persisted version which is not affected by power cycling or lack of connectivity. To get the persisted counters use total and total_returned.\n\nCommands are accepted on:\n\n shellies/shellyem3-<deviceid>/relay/0/command accepts on, off or toggle\n shellies/shellyem3-<deviceid>/emeter/<i>/command accepts message reset_totals to reset total and total_returned energy counters to 0\n shellies/shellyem3-<deviceid>/command accepts message reset_data to reset all device data\n \nModify Update cycle shelly:\nhttp://[IP_address]/settings?mqtt_update_period=5\n\nView settings:\nhttp://[IP_address]/settings?\n","x":950,"y":220,"wires":[]},{"id":"10cf12e00b31ab83","type":"debug","z":"8bf6718a.bee688","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":390,"y":100,"wires":[]},{"id":"d90572d7.8365e8","type":"mqtt-broker","name":"oWB","broker":"192.168.178.165","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closeRetain":"false","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willRetain":"false","willPayload":"","willMsg":{},"sessionExpiry":""}]
- node-RED - Flow virtuellerMesspunktEVU: virtuellen Messpunkt berechnen und per MQTT an openWB senden
Code: Alles auswählen
[{"id":"e18e2e5f.84ace8","type":"tab","label":"EVU-virtuellerMesspunkt","disabled":false,"info":""},{"id":"4c59aa53.7b3e54","type":"comment","z":"e18e2e5f.84ace8","name":"openWB - EVU Strombezugsmodul - MQTT","info":"MQTT Topics openWB:\nopenWB/set/evu/W Bezugsleistung in Watt,\nint, positiv Bezug, negativ Einspeisung\n\nopenWB/set/evu/APhase1 Strom in Ampere für Phase 1,\nfloat, Punkt als Trenner, positiv Bezug, negativ Einspeisung\n\nopenWB/set/evu/APhase2 Strom in Ampere für Phase 2,\nfloat, Punkt als Trenner, positiv Bezug, negativ Einspeisung\n\nopenWB/set/evu/APhase3 Strom in Ampere für Phase 3,\nfloat, Punkt als Trenner, positiv Bezug, negativ Einspeisung\n\nopenWB/set/evu/WhImported Bezogene Energie in Wh,\nfloat, Punkt als Trenner, nur positiv\n\nopenWB/set/evu/WhExported Eingespeiste Energie in Wh,\nfloat, Punkt als Trenner, nur positiv\n\nopenWB/set/evu/VPhase1 Spannung in Volt für Phase 1,\nfloat, Punkt als Trenner\n\nopenWB/set/evu/VPhase2 Spannung in Volt für Phase 2,\nfloat, Punkt als Trenner\n\nopenWB/set/evu/VPhase3 Spannung in Volt für Phase 3,\nfloat, Punkt als Trenner\n\nopenWB/set/evu/HzFrequenz Netzfrequenz in Hz, float, Punkt als Trenner ","x":210,"y":880,"wires":[]},{"id":"f68058271ca52937","type":"watt2kwh","z":"e18e2e5f.84ace8","format":"wh","maximum":"5","maximumunit":"mins","name":"EVU_total_import","x":650,"y":200,"wires":[["e2f0b81e82398099"]]},{"id":"5f95fda8063a67ed","type":"function","z":"e18e2e5f.84ace8","name":"Trenne Leistung in Ex- oder Import ","func":"var EM = global.get(\"EM\");\nvar EVU_power = EM.SDM630.power + (EM[\"shelly3EM-WP\"].power_sum || 0);\nvar power_export;\nvar power_import;\nvar Init_Wh_Import = Number(flow.get(\"Total_Wh_Import\"))||0;\nvar Init_Wh_Export = Number(flow.get(\"Total_Wh_Export\"))||0;\n\n// Falls Zähler genullt, hole alten oWB Wert\nif (Init_Wh_Import == 0) {\n flow.set(\"Total_Wh_Import\", Number(flow.get(\"oWB_WhImport\")));\n} \n \n// Falls Zähler genullt, hole alten oWB Wert\nif (Init_Wh_Export == 0) {\n flow.set(\"Total_Wh_Export\", Number(flow.get(\"oWB_WhExport\")));\n}\n\n// Trenne Leistung [W] in Export oder Import \nif (EVU_power > 0) {\n power_import = EVU_power,\n power_export = 0\n} else if (EVU_power < 0) {\n power_import = 0,\n power_export = EVU_power* (-1)\n} else {\n power_import = 0,\n power_export = 0\n}\n\n//Weitergabe zur Wh ermittlung\nreturn [\n {payload: power_import, topic:\"import\"},\n {payload: power_export, topic:\"export\"}\n ];\n\n","outputs":2,"noerr":0,"initialize":"// Der Code hier wird ausgeführt,\n// wenn der Node gestartet wird\n// Falls node-red neugestartet hole letzten Wert aus der oWB\n//flow.set(\"Total_Wh_Import\", Number(flow.get(\"oWB_WhImport\")));\n//flow.set(\"Total_Wh_Export\", Number(flow.get(\"oWB_WhExport\")));","finalize":"","libs":[],"x":380,"y":220,"wires":[["f68058271ca52937"],["1b52502680d501e7"]]},{"id":"a66373d1a8608e95","type":"inject","z":"e18e2e5f.84ace8","name":"Energiezähler","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"5","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":140,"y":220,"wires":[["5f95fda8063a67ed"]]},{"id":"1b52502680d501e7","type":"watt2kwh","z":"e18e2e5f.84ace8","format":"wh","maximum":"5","maximumunit":"mins","name":"EVU_total_export","x":650,"y":240,"wires":[["92e84adc.45c5e8"]]},{"id":"92e84adc.45c5e8","type":"function","z":"e18e2e5f.84ace8","name":"Zähler: Export [Wh]","func":"var inputVal = msg.payload;\nif (inputVal == \"reset\"){\n flow.set(\"Total_Wh_Export\",0); \n } else {\nvar savedVal = flow.get('Total_Wh_Export')||0;\nsavedVal += inputVal;\nflow.set(\"Total_Wh_Export\",savedVal);\nmsg.payload = savedVal;\nreturn msg;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":870,"y":240,"wires":[["486cc458.d7051c"]]},{"id":"486cc458.d7051c","type":"debug","z":"e18e2e5f.84ace8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1050,"y":240,"wires":[]},{"id":"e2f0b81e82398099","type":"function","z":"e18e2e5f.84ace8","name":"Zähler: Import [Wh] ","func":"var inputVal = msg.payload;\nif (inputVal == \"reset\"){\n flow.set(\"Total_Wh_Import\",0); \n } else {\nvar savedVal = flow.get('Total_Wh_Import')||0;\nsavedVal += inputVal;\nflow.set(\"Total_Wh_Import\",savedVal);\nmsg.payload = savedVal;\nreturn msg;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":870,"y":200,"wires":[["349784a3b90cc7f3"]]},{"id":"349784a3b90cc7f3","type":"debug","z":"e18e2e5f.84ace8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1050,"y":200,"wires":[]},{"id":"0ac07e9bdf75f76a","type":"comment","z":"e18e2e5f.84ace8","name":"usedCode","info":"https://flows.nodered.org/node/node-red-contrib-watt2kwh","x":100,"y":920,"wires":[]},{"id":"6a75c8e5.1ee598","type":"inject","z":"e18e2e5f.84ace8","name":"reset","props":[{"p":"payload","v":"reset","vt":"str"},{"p":"topic","v":"","vt":"str"}],"repeat":"","crontab":"00 00 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"reset","payloadType":"str","x":690,"y":280,"wires":[["92e84adc.45c5e8"]]},{"id":"e628a473673c0c44","type":"inject","z":"e18e2e5f.84ace8","name":"reset","props":[{"p":"payload","v":"reset","vt":"str"},{"p":"topic","v":"","vt":"str"}],"repeat":"","crontab":"00 00 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"reset","payloadType":"str","x":690,"y":160,"wires":[["e2f0b81e82398099"]]},{"id":"36a2cd9618afdbac","type":"mqtt in","z":"e18e2e5f.84ace8","name":"","topic":"openWB/evu/WhImported","qos":"0","datatype":"auto","broker":"d90572d7.8365e8","nl":false,"rap":true,"rh":0,"inputs":0,"x":170,"y":100,"wires":[["e59869ef6a9e39e0"]]},{"id":"2afe6dc3c495b719","type":"mqtt in","z":"e18e2e5f.84ace8","name":"","topic":"openWB/evu/WhExported","qos":"0","datatype":"auto","broker":"d90572d7.8365e8","nl":false,"rap":true,"rh":0,"inputs":0,"x":170,"y":40,"wires":[["52f41f22890a7d4f"]]},{"id":"52f41f22890a7d4f","type":"change","z":"e18e2e5f.84ace8","name":"oWB_WhExport","rules":[{"t":"set","p":"oWB_WhExport","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":40,"wires":[["fa150beed250aa40"]]},{"id":"e59869ef6a9e39e0","type":"change","z":"e18e2e5f.84ace8","name":"oWB_WhImport","rules":[{"t":"set","p":"oWB_WhImport","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":100,"wires":[["fa150beed250aa40"]]},{"id":"fa150beed250aa40","type":"debug","z":"e18e2e5f.84ace8","name":"aktuelle Werte aus oWB","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":750,"y":80,"wires":[]},{"id":"97b1ea06b5c16b97","type":"mqtt out","z":"e18e2e5f.84ace8","name":"Leistung [W]","topic":"openWB/set/evu/W","qos":"0","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"d90572d7.8365e8","x":770,"y":360,"wires":[]},{"id":"e3864720b0cfe70f","type":"mqtt out","z":"e18e2e5f.84ace8","name":"Strom L1 [A]","topic":"openWB/set/evu/APhase1","qos":"2","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"d90572d7.8365e8","x":770,"y":400,"wires":[]},{"id":"123c1732c0ab3474","type":"mqtt out","z":"e18e2e5f.84ace8","name":"Strom L2 [A]","topic":"openWB/set/evu/APhase2","qos":"2","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"d90572d7.8365e8","x":770,"y":440,"wires":[]},{"id":"3c4e0b36c087952e","type":"mqtt out","z":"e18e2e5f.84ace8","name":"Bezogene Energie Wh","topic":"openWB/set/evu/WhImported","qos":"2","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"d90572d7.8365e8","x":800,"y":520,"wires":[]},{"id":"c46ef7d605656058","type":"mqtt out","z":"e18e2e5f.84ace8","name":"Eingespeiste Energie [Wh]","topic":"openWB/set/evu/WhExported","qos":"2","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"d90572d7.8365e8","x":820,"y":560,"wires":[]},{"id":"44f882a1db456a12","type":"mqtt out","z":"e18e2e5f.84ace8","name":"Spannung L1 [V]","topic":"openWB/set/evu/VPhase1","qos":"2","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"d90572d7.8365e8","x":790,"y":600,"wires":[]},{"id":"8081ea6d0981805a","type":"mqtt out","z":"e18e2e5f.84ace8","name":"Strom L3 [A]","topic":"openWB/set/evu/APhase3","qos":"2","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"d90572d7.8365e8","x":770,"y":480,"wires":[]},{"id":"715656cc3c3614f3","type":"mqtt out","z":"e18e2e5f.84ace8","name":"Spannung L2 [V]","topic":"openWB/set/evu/VPhase2","qos":"2","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"d90572d7.8365e8","x":790,"y":640,"wires":[]},{"id":"b75d0ca0871bee00","type":"mqtt out","z":"e18e2e5f.84ace8","name":"Spannung L3 [V]","topic":"openWB/set/evu/VPhase3","qos":"2","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"d90572d7.8365e8","x":790,"y":680,"wires":[]},{"id":"3a9810c956e98864","type":"mqtt out","z":"e18e2e5f.84ace8","name":"Frequenz [Hz]","topic":"openWB/set/evu/HzFrequenz","qos":"2","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"d90572d7.8365e8","x":780,"y":720,"wires":[]},{"id":"53e87796933a4e8b","type":"catch","z":"e18e2e5f.84ace8","name":"","scope":null,"uncaught":false,"x":640,"y":880,"wires":[["e4d11ed2cd1e7490"]]},{"id":"e4d11ed2cd1e7490","type":"debug","z":"e18e2e5f.84ace8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":830,"y":880,"wires":[]},{"id":"5fb2040551cc31fd","type":"inject","z":"e18e2e5f.84ace8","name":"Intervall: Set openWB","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"10","crontab":"","once":true,"onceDelay":"5","topic":"","payload":"","payloadType":"date","x":230,"y":560,"wires":[["66e655b372f06aea","cd0d1e0c4fc05677","316c9dd47c331658","d965423e83a3589b","2a8df0820bc01e65"]]},{"id":"66e655b372f06aea","type":"function","z":"e18e2e5f.84ace8","name":"Leistung [W]","func":"// virtueller Messpunkt EVU \n\n// Zugriff auf globale Werte SDM und Shelly\nvar EM = global.get(\"EM\");\n\n// EVU Leistung = SDM + Shelly\nvar EVU_power = EM.SDM630.power + (EM[\"shelly3EM-WP\"].power_sum || 0);\n\nflow.set(\"EVU_power\", parseInt(EVU_power));\nglobal.set(\"EM.EVU.power\", parseInt(EVU_power));\nmsg.payload = parseInt(EVU_power);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":490,"y":440,"wires":[["97b1ea06b5c16b97"]]},{"id":"cd0d1e0c4fc05677","type":"function","z":"e18e2e5f.84ace8","name":"Energie [Wh]","func":"// virtueller Messpunkt EVU \n\n// EVU Energiezähler Wh\nvar EVU_Wh = flow.get([\"Total_Wh_Export\", \"Total_Wh_Import\"]);\nvar openWB_Wh = flow.get([\"oWB_WhExport\", \"oWB_WhImport\"]); \n\n// EVU eingespeiste Energie\nvar EVU_WhExport = EVU_Wh[0];\nif (EVU_WhExport == 0 || EVU_WhExport == \"NAN\") { //falls der Wert ungültig ist,\n EVU_WhExport = openWB_Wh[0]; // Ersatzwert aus openWB verwenden\n}\n\n// EVU bezogene Energie\nvar EVU_WhImport = EVU_Wh[1];\nif (EVU_WhImport == 0 || EVU_WhImport == \"NAN\") { //falls der Wert ungültig ist, \n EVU_WhImport = openWB_Wh[1]; // Ersatzwert aus openWB verwenden\n}\n\nflow.set([\"EVU_WhExport\", \"EVU_WhImport\"], [parseFloat(EVU_WhExport), parseFloat(EVU_WhImport)])\nglobal.set([\"EM.EVU.WhExport\", \"EM.EVU.WhImport\"], [parseFloat(EVU_WhExport), parseFloat(EVU_WhImport)])\n\nif(EVU_WhExport != 0 & EVU_WhImport != 0 ) {\nreturn [\n {payload: parseFloat(EVU_WhImport)},\n {payload: parseFloat(EVU_WhExport)}\n];\n}","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":490,"y":560,"wires":[["3c4e0b36c087952e"],["c46ef7d605656058"]]},{"id":"316c9dd47c331658","type":"function","z":"e18e2e5f.84ace8","name":"Strom [A]","func":"// virtueller Messpunkt EVU \n\n// Zugriff auf globale Werte SDM und Shelly\nvar EM = global.get(\"EM\");\n\n// Leistungsfaktor aus SDM verwendet\nvar pf1 = EM.SDM630.L1.pf;\nvar pf2 = EM.SDM630.L2.pf;\nvar pf3 = EM.SDM630.L3.pf;\n\n// EVU Strom: Summe der Ströme aus Shelly und SDM (inkl. Vorzeichen)\nvar EVU_current_L1 = EM.SDM630.L1.current + (EM[\"shelly3EM-WP\"].current_L1 || 0 ); \nvar EVU_current_L2 = EM.SDM630.L2.current + (EM[\"shelly3EM-WP\"].current_L2 || 0 );\nvar EVU_current_L3 = EM.SDM630.L3.current + (EM[\"shelly3EM-WP\"].current_L3 || 0 ); \n\nif(pf1 < 0 ) {\n EVU_current_L1 = Math.abs((EM.SDM630.L1.current * -1) + (EM[\"shelly3EM-WP\"].current_L1 || 0 ));\n} \nif(pf2 < 0 ) {\n EVU_current_L2 = Math.abs((EM.SDM630.L2.current * -1) + (EM[\"shelly3EM-WP\"].current_L2 || 0 ));\n}\nif(pf3 < 0 ) {\n EVU_current_L3 = Math.abs((EM.SDM630.L3.current * -1) + (EM[\"shelly3EM-WP\"].current_L3 || 0 ));\n}\n\nflow.set([\"EVU_current_L1\", \"EVU_current_L2\", \"EVU_current_L3\"], [parseFloat(EVU_current_L1), parseFloat(EVU_current_L2), parseFloat(EVU_current_L3)]);\nglobal.set([\"EM.EVU.L1.current\", \"EM.EVU.L2.current\", \"EM.EVU.L3.current\"], [parseFloat(EVU_current_L1), parseFloat(EVU_current_L2), parseFloat(EVU_current_L3)]);\n\nreturn [\n {payload: parseFloat(EVU_current_L1)},\n {payload: parseFloat(EVU_current_L2)},\n {payload: parseFloat(EVU_current_L3)}\n];","outputs":3,"noerr":0,"initialize":"","finalize":"","libs":[],"x":480,"y":500,"wires":[["e3864720b0cfe70f"],["123c1732c0ab3474"],["8081ea6d0981805a"]]},{"id":"d965423e83a3589b","type":"function","z":"e18e2e5f.84ace8","name":"Spannung [V]","func":"// virtueller Messpunkt EVU \n\n// Zugriff auf globale Werte SDM\nvar EM = global.get(\"EM\");\n\n// EVU Spannung: SDM verwendet\nvar EVU_voltage_L1 = EM.SDM630.L1.voltage;\nvar EVU_voltage_L2 = EM.SDM630.L2.voltage;\nvar EVU_voltage_L3 = EM.SDM630.L3.voltage;\n\nflow.set([\"EVU_voltage_L1\", \"EVU_voltage_L2\", \"EVU_voltage_L3\"], [parseFloat(EVU_voltage_L1), parseFloat(EVU_voltage_L2), parseFloat(EVU_voltage_L3)]);\nglobal.set([\"EM.EVU.L1.voltage\", \"EM.EVU.L2.voltage\", \"EM.EVU.L3.voltage\"], [parseFloat(EVU_voltage_L1), parseFloat(EVU_voltage_L2), parseFloat(EVU_voltage_L3)]);\n\nreturn [\n {payload: parseFloat(EVU_voltage_L1)},\n {payload: parseFloat(EVU_voltage_L2)},\n {payload: parseFloat(EVU_voltage_L3)}\n];\n","outputs":3,"noerr":0,"initialize":"","finalize":"","libs":[],"x":500,"y":620,"wires":[["44f882a1db456a12"],["715656cc3c3614f3"],["b75d0ca0871bee00"]]},{"id":"2a8df0820bc01e65","type":"function","z":"e18e2e5f.84ace8","name":"Frequenz [Hz]","func":"// virtueller Messpunkt EVU\n\n// Zugriff auf globale Werte SDM \nvar EM = global.get(\"EM\");\n\n// EVU Frequenz: SDM verwendet\nvar EVU_frequency = EM.SDM630.frequency;\n\nflow.set(\"EVU_frequency\", parseFloat(EVU_frequency));\nglobal.set(\"EM.EVU.frequency\", parseFloat(EVU_frequency));\n\nreturn [\n {payload: parseFloat(EVU_frequency)},\n ];\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":500,"y":680,"wires":[["3a9810c956e98864"]]},{"id":"a6be3f18d12cb406","type":"mqtt in","z":"e18e2e5f.84ace8","name":"","topic":"openWB/pv/W","qos":"2","datatype":"auto","broker":"d90572d7.8365e8","nl":false,"rap":true,"rh":0,"inputs":0,"x":470,"y":800,"wires":[["4d6102d9b1088d65"]]},{"id":"4d6102d9b1088d65","type":"change","z":"e18e2e5f.84ace8","name":"PV_setzeGlobal","rules":[{"t":"set","p":"EM.PV","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":640,"y":800,"wires":[[]]},{"id":"d90572d7.8365e8","type":"mqtt-broker","name":"oWB","broker":"192.168.178.165","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closeRetain":"false","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willRetain":"false","willPayload":"","willMsg":{},"sessionExpiry":""}]