[ { "id": "6ee7f287b865ed28", "type": "tab", "label": "Flow 1", "disabled": false, "info": "", "env": [] }, { "id": "de934b9b9bd5bcc2", "type": "modbus-read", "z": "6ee7f287b865ed28", "name": "Strom Bezug vom KSEM gemessen", "topic": "", "showStatusActivities": false, "logIOActivities": false, "showErrors": false, "showWarnings": true, "unitid": "", "dataType": "HoldingRegister", "adr": "0", "quantity": "4", "rate": "15", "rateUnit": "s", "delayOnStart": true, "startDelayTime": "10", "server": "430f7a8550ec7b44", "useIOFile": false, "ioFile": "", "useIOForPayload": false, "emptyMsgOnFail": false, "x": 240, "y": 180, "wires": [ [], [ "6fe4e0d47936e242" ] ] }, { "id": "84f20816579a23d3", "type": "modbus-read", "z": "6ee7f287b865ed28", "name": "Strom EInspeisung vom KSEM", "topic": "", "showStatusActivities": false, "logIOActivities": false, "showErrors": false, "showWarnings": true, "unitid": "", "dataType": "HoldingRegister", "adr": "2", "quantity": "2", "rate": "15", "rateUnit": "s", "delayOnStart": true, "startDelayTime": "10", "server": "430f7a8550ec7b44", "useIOFile": false, "ioFile": "", "useIOForPayload": false, "emptyMsgOnFail": false, "x": 230, "y": 240, "wires": [ [], [ "c36160366df5f0d4" ] ] }, { "id": "a3a7f297ad1347a7", "type": "modbus-read", "z": "6ee7f287b865ed28", "name": "Stromverbrauch WP Lambda", "topic": "", "showStatusActivities": false, "logIOActivities": false, "showErrors": false, "showWarnings": true, "unitid": "", "dataType": "HoldingRegister", "adr": "103", "quantity": "2", "rate": "15", "rateUnit": "s", "delayOnStart": true, "startDelayTime": "10", "server": "50da85b918c8c0ba", "useIOFile": false, "ioFile": "", "useIOForPayload": false, "emptyMsgOnFail": false, "x": 220, "y": 320, "wires": [ [ "e519e10cf58ab3ee" ], [] ] }, { "id": "6fe4e0d47936e242", "type": "buffer-parser", "z": "6ee7f287b865ed28", "name": "", "data": "payload.data", "dataType": "msg", "specification": "spec", "specificationType": "ui", "items": [ { "type": "int32le", "name": "item1", "offset": 0, "length": 1, "offsetbit": 0, "scale": "/100000000", "mask": "" }, { "type": "uint32be", "name": "item2", "offset": 0, "length": 1, "offsetbit": 0, "scale": "/10", "mask": "" } ], "swap1": "", "swap2": "", "swap3": "", "swap1Type": "swap", "swap2Type": "swap", "swap3Type": "swap", "msgProperty": "payload", "msgPropertyType": "str", "resultType": "value", "resultTypeType": "return", "multipleResult": false, "fanOutMultipleResult": false, "setTopic": true, "outputs": 1, "x": 510, "y": 180, "wires": [ [ "6652013bcb5f08ed" ] ] }, { "id": "c36160366df5f0d4", "type": "buffer-parser", "z": "6ee7f287b865ed28", "name": "", "data": "payload.data", "dataType": "msg", "specification": "spec", "specificationType": "ui", "items": [ { "type": "int32le", "name": "item1", "offset": 0, "length": 1, "offsetbit": 0, "scale": "/100000000", "mask": "" }, { "type": "uint32be", "name": "item2", "offset": 0, "length": 1, "offsetbit": 0, "scale": "/10", "mask": "" } ], "swap1": "", "swap2": "", "swap3": "", "swap1Type": "swap", "swap2Type": "swap", "swap3Type": "swap", "msgProperty": "payload", "msgPropertyType": "str", "resultType": "value", "resultTypeType": "return", "multipleResult": false, "fanOutMultipleResult": false, "setTopic": true, "outputs": 1, "x": 490, "y": 240, "wires": [ [ "f2bc5249d1d2386b" ] ] }, { "id": "6652013bcb5f08ed", "type": "function", "z": "6ee7f287b865ed28", "name": "Nur Arraywert [Bezug]", "func": "//var x = msg.payload[1]\nvar x = msg.payload[1]\nmsg.payload = x\nmsg.topic = 'Bezug'\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 740, "y": 180, "wires": [ [ "0da91d11bf1025b6" ] ] }, { "id": "f2bc5249d1d2386b", "type": "function", "z": "6ee7f287b865ed28", "name": "Nur Arraywert [Einspeisung]", "func": "// var x = msg.payload [1]\nvar x = msg.payload[1]\nmsg.payload = -(x)\nmsg.topic = 'Einspeisung'\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 760, "y": 240, "wires": [ [ "0da91d11bf1025b6" ] ] }, { "id": "e519e10cf58ab3ee", "type": "function", "z": "6ee7f287b865ed28", "name": "Nur [WP Verbrauch]", "func": "var x = msg.payload[0]\nmsg.payload = x\nnode.status({fill:\"blue\",shape:\"ring\",text:msg.payload + \"W\"});\nmsg.topic = 'WP'\nreturn msg;\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 1120, "y": 320, "wires": [ [ "b98a6a1603529ff8" ] ] }, { "id": "0da91d11bf1025b6", "type": "function", "z": "6ee7f287b865ed28", "name": "Calculate Energieverbauch am KSEM", "func": "context.node = context.node || 0;\ncontext.node1 = context.node1 || 0;\n\nif(msg.topic == 'Bezug'){\n context.node = msg.payload\n} else if (msg.topic == 'Einspeisung'){\n context.node1 = msg.payload\n}\n\nif (context.node >0){\n msg.payload = context.node\n msg.topic = 'KSEM'\n node.status({fill:\"blue\",shape:\"ring\",text:msg.payload + \"W\"});\n return msg\n}\nelse{\n msg.payload = context.node1\n msg.topic = 'KSEM'\n node.status({fill:\"blue\",shape:\"ring\",text:msg.payload + \"W\"});\n return msg\n}", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 1110, "y": 180, "wires": [ [ "b98a6a1603529ff8" ] ] }, { "id": "b98a6a1603529ff8", "type": "function", "z": "6ee7f287b865ed28", "name": "wenn WP, P Batterie 400W weniger als 0 netzbezug (für WP Optimierung). Positive Zahl ist Netzbezug", "func": "var x = 500\ncontext.node = context.node || 0;\ncontext.node1 = context.node1 || 0;\n\nif(msg.topic == 'KSEM'){\n context.node = msg.payload\n} else if (msg.topic == 'WP'){\n context.node1 = msg.payload\n}\n\nif (context.node1 >0 && context.node >0){\n msg.payload = context.node-x\n node.status({fill:\"blue\",shape:\"ring\",text:msg.payload + \"W\"}); \n return msg\n}\nelse {\n msg.payload = context.node\n node.status({fill:\"blue\",shape:\"ring\",text:msg.payload + \"W\"}); \n return msg\n}", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 1650, "y": 180, "wires": [ [ "46e7b87f911de4ed" ] ] }, { "id": "6ee9486a922f3568", "type": "victron-output-ess", "z": "6ee7f287b865ed28", "service": "com.victronenergy.settings", "path": "/Settings/CGwacs/AcPowerSetPoint", "serviceObj": { "service": "com.victronenergy.settings", "name": "Venus settings" }, "pathObj": { "path": "/Settings/CGwacs/AcPowerSetPoint", "type": "integer", "name": "Grid set-point (W)", "writable": true }, "name": "", "onlyChanges": false, "x": 2640, "y": 180, "wires": [] }, { "id": "46e7b87f911de4ed", "type": "function", "z": "6ee7f287b865ed28", "name": "Invertieren für MP2", "func": "var x = -msg.payload\nmsg.payload = x\nnode.status({fill:\"red\",shape:\"ring\",text:msg.payload + \"W\"})\nreturn msg\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 2130, "y": 180, "wires": [ [ "95955673dd0ab50f" ] ] }, { "id": "95955673dd0ab50f", "type": "function", "z": "6ee7f287b865ed28", "name": "neuer Setpunkt", "func": "// Input: msg.payload (new sensor value)\n// Output: msg.payload (updated sensor value)\n\n// Retrieve the previous sensor value from context\nvar previousValue = context.flow.get('previousSensorValue');\n\n// Current sensor value\nvar currentValue = msg.payload;\n\ncurrentValue = currentValue/2 + previousValue;\n\nif (currentValue < -2500){currentValue = -2500}\nif (currentValue > 3200){currentValue = 3200}\n\ncontext.flow.set('previousSensorValue', currentValue);\nmsg.payload = currentValue\nnode.status({fill:\"red\",shape:\"ring\",text:msg.payload + \"W\"});\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 2340, "y": 180, "wires": [ [ "6ee9486a922f3568" ] ] }, { "id": "68900410a38a9aaf", "type": "function", "z": "6ee7f287b865ed28", "name": "function 1", "func": "if (msg.payload === \"start\") {\n context.flow.set('previousSensorValue', 1);\n var f = context.flow.get('previousSensorValue');\nmsg.payload = f}\n// Pass the message along\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "// Code added here will be run once\n// whenever the node is started.\n;", "finalize": "", "libs": [], "x": 2440, "y": 260, "wires": [ [] ] }, { "id": "6e86ebdc967ae2c7", "type": "inject", "z": "6ee7f287b865ed28", "name": "", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": true, "onceDelay": "0", "topic": "", "payload": "start", "payloadType": "str", "x": 2250, "y": 260, "wires": [ [ "68900410a38a9aaf" ] ] }, { "id": "430f7a8550ec7b44", "type": "modbus-client", "name": "KSEM", "clienttype": "tcp", "bufferCommands": true, "stateLogEnabled": false, "queueLogEnabled": false, "failureLogEnabled": true, "tcpHost": "192.168.0.11", "tcpPort": "502", "tcpType": "DEFAULT", "serialPort": "/dev/ttyUSB", "serialType": "RTU-BUFFERD", "serialBaudrate": "9600", "serialDatabits": "8", "serialStopbits": "1", "serialParity": "none", "serialConnectionDelay": "100", "serialAsciiResponseStartDelimiter": "0x3A", "unit_id": "1", "commandDelay": "1", "clientTimeout": "1000", "reconnectOnTimeout": true, "reconnectTimeout": "2000", "parallelUnitIdsAllowed": true, "showWarnings": true, "showLogs": true }, { "id": "50da85b918c8c0ba", "type": "modbus-client", "name": "Lambda WP", "clienttype": "tcp", "bufferCommands": true, "stateLogEnabled": false, "queueLogEnabled": false, "failureLogEnabled": true, "tcpHost": "192.168.0.5", "tcpPort": "502", "tcpType": "DEFAULT", "serialPort": "/dev/ttyUSB", "serialType": "RTU-BUFFERD", "serialBaudrate": "9600", "serialDatabits": "8", "serialStopbits": "1", "serialParity": "none", "serialConnectionDelay": "100", "serialAsciiResponseStartDelimiter": "0x3A", "unit_id": "1", "commandDelay": "1", "clientTimeout": "1000", "reconnectOnTimeout": true, "reconnectTimeout": "2000", "parallelUnitIdsAllowed": true, "showWarnings": true, "showLogs": true } ]