Kostal PIKO 5.5 über Node-RED Modbus Daten senden

0
22
Kostal Modbus
Kostal Modbus

Heute können fast alle PV Wechselrichter das ModBUS TCP Protokoll. Nur wenige Hersteller von Wechselrichter machen das nicht. So auch der Kostal PIKO 5.5. Hier werden die Daten wie Spannung und Leitung nur auf dem Webinterface angezeigt.
Möchte oder muss man diese Daten aber mit andere Systeme verbinden, so muss man einen anderen Weg gehen. Im aktuellen Fall benötigt das NTUITY Energiemanagementsystem ausschließlich Modbus.
Ein Weg, um die Daten dem NTUITY Energiemanagementsystem aufzubereiten ist Node-RED. Node-RED bringt alle Module mit sich, um die Daten per Webabfrage abzuholen und dann über einen eignen Modbus Server zur Verfügung zu stellen.

Unten im Beitrag ist der Code dazu. Man muss nur das Passwort im „Kostal“ Webabfrage Modul reintragen und schon sollte der Modbus Server die Daten bereitstellen.

In diesem Beispiel werden die Daten auch noch an den ioBroker gesendet. Diese sind die blauen „Kostal“ Module. Wer die Daten für den ioBroker nicht benötigt, kann alle Kostal Module aus dem Flow herauslösen.

Zu Beachten ist, dass die unteren „Kostal L1 A“, „Kostal L2 A“ „Kostal L3 A“ Daten aus dem ioBroker kommen. Die Ampere werden in der Kostal Weboberfläche nicht angezeigt. Wir rechen hier im ioBroker per Skript die Watt und Volt auf Ampere zurück und übergeben sie dann wieder über Node-RED an den Modbus Server.

Man kann die Ampere auch direkt im Node-RED umrechnen. Vorausgesetzt, dass man die Ampere überhaupt benötigt.

 

Hier der Flow zum Importieren.

Kostal Modbus
Kostal Modbus
[
    {
        "id": "309eaed8.c5d87a",
        "type": "tab",
        "label": "Kostal Walter",
        "disabled": false,
        "info": ""
    },
    {
        "id": "4ad0e46.7796d1c",
        "type": "function",
        "z": "309eaed8.c5d87a",
        "name": "parse http",
        "func": "acPowerCurrent = parseInt(msg.payload[14].replace(/([^a-z0-9]+)/gi, ''));\ntotalEnergy = parseInt(msg.payload[17].replace(/([^A-Z0-9]+)/gi, ''));\ndailyEnergy = parseInt(msg.payload[26].replace(/([^a-z0-9]+)/gi, ''))/100;\nstring1voltage = parseInt(msg.payload[56].replace(/([^a-z0-9]+)/gi, ''));\nstring1current = parseInt(msg.payload[65].replace(/([^a-z0-9]+)/gi, ''))/100;\nstring2voltage = parseInt(msg.payload[82].replace(/([^a-z0-9]+)/gi, ''));\nstring2current = parseInt(msg.payload[91].replace(/([^a-z0-9]+)/gi, ''))/100;\nline1voltage = parseInt(msg.payload[59].replace(/([^a-z0-9]+)/gi, ''));\nline1power = parseInt(msg.payload[68].replace(/([^a-z0-9]+)/gi, ''));\nline2voltage = parseInt(msg.payload[85].replace(/([^a-z0-9]+)/gi, ''));\nline2power = parseInt(msg.payload[94].replace(/([^a-z0-9]+)/gi, ''));\nline3voltage = parseInt(msg.payload[111].replace(/([^a-z0-9]+)/gi, ''));\nline3power = parseInt(msg.payload[120].replace(/([^a-z0-9]+)/gi, ''));\nstatus = msg.payload[32].replace(/\\r?\\n|\\r/g, '').replace(/\\s/g, \"\");\n\n\nif (Number.isNaN(acPowerCurrent) === true){\n    acPowerCurrent = 0;\n}\nif (Number.isNaN(totalEnergy) === true){\n    totalEnergy = -1;\n}\nif (Number.isNaN(dailyEnergy) === true){\n    dailyEnergy = 0;\n}\nif (Number.isNaN(string1voltage) === true){\n    string1voltage = 0;\n}\nif (Number.isNaN(string1current) === true){\n    string1current = 0;\n}\nif (Number.isNaN(string2voltage) === true){\n    string2voltage = 0;\n}\nif (Number.isNaN(string2current) === true){\n    string2current = 0;\n}\nif (Number.isNaN(line1voltage) === true){\n    line1voltage = 0;\n}\nif (Number.isNaN(line1power) === true){\n    line1power = 0;\n}\nif (Number.isNaN(line2voltage) === true){\n    line2voltage = 0;\n}\nif (Number.isNaN(line2power) === true){\n    line2power = 0;\n}\nif (Number.isNaN(line3voltage) === true){\n    line3voltage = 0;\n}\nif (Number.isNaN(line3power) === true){\n    line3power = 0;\n}\n\nmsg.payload = {\n    \"acPowerCurrent\" : acPowerCurrent,\n    \"totalEnergy\" : totalEnergy,\n    \"dailyEnergy\" : dailyEnergy,\n    \"status\" : status,\n    \"string1voltage\" : string1voltage,\n    \"string1current\" : string1current,\n    \"string2voltage\" : string2voltage,\n    \"string2current\" : string2current,\n    \"line1voltage\" : line1voltage,\n    \"line1power\" : line1power,\n    \"line2voltage\" : line2voltage,\n    \"line2power\" : line2power,\n    \"line3voltage\" : line3voltage,\n    \"line3power\" : line3power\n}\n\nglobal.set(\"kostal\", msg.payload);\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 550,
        "y": 80,
        "wires": [
            [
                "e6116979.d0ea78",
                "ef7fcc51.0ca14",
                "adb74027.c5cb8",
                "d784e784.3ac588",
                "a3aa7c09.9986c",
                "4d8a91ef.d03548",
                "28799a49.a27186",
                "f20aa887.d7eb3",
                "1f73e844.a294a",
                "9d2839b8.050f88",
                "28bb0643.2ba03a",
                "2349e1b1.7674a6",
                "91467231.fcc6f8",
                "dd537.544902c98"
            ]
        ]
    },
    {
        "id": "fd1711f2.7e7b4",
        "type": "http request",
        "z": "309eaed8.c5d87a",
        "name": "kostal",
        "method": "GET",
        "ret": "txt",
        "paytoqs": "ignore",
        "url": "http://192.168.1.109/index.fhtml",
        "tls": "",
        "persist": false,
        "proxy": "",
        "authType": "basic",
        "senderr": false,
        "x": 240,
        "y": 80,
        "wires": [
            [
                "3f445786.6a93b8"
            ]
        ]
    },
    {
        "id": "3f445786.6a93b8",
        "type": "html",
        "z": "309eaed8.c5d87a",
        "name": "",
        "property": "payload",
        "outproperty": "payload",
        "tag": "td",
        "ret": "text",
        "as": "single",
        "x": 390,
        "y": 80,
        "wires": [
            [
                "4ad0e46.7796d1c"
            ]
        ]
    },
    {
        "id": "b32e7821.c1dc78",
        "type": "inject",
        "z": "309eaed8.c5d87a",
        "name": "15 sec",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "15",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 90,
        "y": 80,
        "wires": [
            [
                "fd1711f2.7e7b4",
                "b026a9a6.997b4",
                "6980a6b.24dd558",
                "36346009.d2d3e"
            ]
        ]
    },
    {
        "id": "3f88c90e.beb95e",
        "type": "ioBroker out",
        "z": "309eaed8.c5d87a",
        "name": "Kostal",
        "topic": "Kostal.Kostal AC-Leistung-Aktuell-W",
        "ack": "true",
        "autoCreate": "true",
        "stateName": "",
        "role": "",
        "payloadType": "number",
        "readonly": "",
        "stateUnit": "W",
        "stateMin": "",
        "stateMax": "",
        "x": 830,
        "y": 80,
        "wires": []
    },
    {
        "id": "e6116979.d0ea78",
        "type": "change",
        "z": "309eaed8.c5d87a",
        "name": "AC-Leistung aktuell W",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.acPowerCurrent",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 540,
        "y": 160,
        "wires": [
            [
                "3f88c90e.beb95e",
                "1f4de602.c3b8fa"
            ]
        ]
    },
    {
        "id": "ef7fcc51.0ca14",
        "type": "change",
        "z": "309eaed8.c5d87a",
        "name": "Gesamtenergie kWh",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.totalEnergy",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 540,
        "y": 200,
        "wires": [
            [
                "61ed5028.73d888"
            ]
        ]
    },
    {
        "id": "adb74027.c5cb8",
        "type": "change",
        "z": "309eaed8.c5d87a",
        "name": "Tagesenergie kWh",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.dailyEnergy",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 530,
        "y": 240,
        "wires": [
            [
                "6cd3c289.12c414",
                "12d75216.ffcac6"
            ]
        ]
    },
    {
        "id": "d784e784.3ac588",
        "type": "change",
        "z": "309eaed8.c5d87a",
        "name": "Status PV",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.status",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 500,
        "y": 280,
        "wires": [
            [
                "661da3cc.3946c4"
            ]
        ]
    },
    {
        "id": "a3aa7c09.9986c",
        "type": "change",
        "z": "309eaed8.c5d87a",
        "name": "String 1 Spannung",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.string1voltage",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 530,
        "y": 320,
        "wires": [
            [
                "2811fedd.2f0eea"
            ]
        ]
    },
    {
        "id": "4d8a91ef.d03548",
        "type": "change",
        "z": "309eaed8.c5d87a",
        "name": "String 1 Strom",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.string1current",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 520,
        "y": 360,
        "wires": [
            [
                "c39ce5ce.2205b8"
            ]
        ]
    },
    {
        "id": "28799a49.a27186",
        "type": "change",
        "z": "309eaed8.c5d87a",
        "name": "String 2 Spannung",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.string2voltage",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 530,
        "y": 400,
        "wires": [
            [
                "2e5befe0.25f6b"
            ]
        ]
    },
    {
        "id": "f20aa887.d7eb3",
        "type": "change",
        "z": "309eaed8.c5d87a",
        "name": "String 2 Strom",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.string2current",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 520,
        "y": 440,
        "wires": [
            [
                "de209bd4.8174d8"
            ]
        ]
    },
    {
        "id": "1f73e844.a294a",
        "type": "change",
        "z": "309eaed8.c5d87a",
        "name": "L1 Spannung V",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.line1voltage",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 520,
        "y": 480,
        "wires": [
            [
                "869c42d4.f5cf9",
                "386f4cba.5700bc"
            ]
        ]
    },
    {
        "id": "9d2839b8.050f88",
        "type": "change",
        "z": "309eaed8.c5d87a",
        "name": "L1 Leistung W",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.line1power",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 520,
        "y": 520,
        "wires": [
            [
                "81ff6124.138e98"
            ]
        ]
    },
    {
        "id": "28bb0643.2ba03a",
        "type": "change",
        "z": "309eaed8.c5d87a",
        "name": "L2 Spannung V",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.line2voltage",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 520,
        "y": 560,
        "wires": [
            [
                "e5262fb9.ab13d",
                "cbc61193.22b7b"
            ]
        ]
    },
    {
        "id": "2349e1b1.7674a6",
        "type": "change",
        "z": "309eaed8.c5d87a",
        "name": "L2 Leistung W",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.line2power",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 520,
        "y": 600,
        "wires": [
            [
                "65fc4b0f.3f3554"
            ]
        ]
    },
    {
        "id": "91467231.fcc6f8",
        "type": "change",
        "z": "309eaed8.c5d87a",
        "name": "L3 Spannung V",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.line3voltage",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 520,
        "y": 640,
        "wires": [
            [
                "4e8c7193.ca978",
                "de8c6dee.b64ca8"
            ]
        ]
    },
    {
        "id": "dd537.544902c98",
        "type": "change",
        "z": "309eaed8.c5d87a",
        "name": "L3 Leistung W",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.line3power",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 520,
        "y": 680,
        "wires": [
            [
                "af6ef739.b15968"
            ]
        ]
    },
    {
        "id": "61ed5028.73d888",
        "type": "ioBroker out",
        "z": "309eaed8.c5d87a",
        "name": "Kostal",
        "topic": "Kostal.Gesamtenergie kWh",
        "ack": "false",
        "autoCreate": "true",
        "stateName": "",
        "role": "",
        "payloadType": "number",
        "readonly": "",
        "stateUnit": "kWh",
        "stateMin": "",
        "stateMax": "",
        "x": 890,
        "y": 200,
        "wires": []
    },
    {
        "id": "6cd3c289.12c414",
        "type": "ioBroker out",
        "z": "309eaed8.c5d87a",
        "name": "Kostal",
        "topic": "Kostal.Tagesenergie kWh",
        "ack": "false",
        "autoCreate": "true",
        "stateName": "",
        "role": "",
        "payloadType": "number",
        "readonly": "",
        "stateUnit": "kWh",
        "stateMin": "",
        "stateMax": "",
        "x": 770,
        "y": 240,
        "wires": []
    },
    {
        "id": "661da3cc.3946c4",
        "type": "ioBroker out",
        "z": "309eaed8.c5d87a",
        "name": "Kostal",
        "topic": "Kostal.Status PV",
        "ack": "true",
        "autoCreate": "true",
        "stateName": "",
        "role": "",
        "payloadType": "string",
        "readonly": "",
        "stateUnit": "",
        "stateMin": "",
        "stateMax": "",
        "x": 890,
        "y": 280,
        "wires": []
    },
    {
        "id": "2811fedd.2f0eea",
        "type": "ioBroker out",
        "z": "309eaed8.c5d87a",
        "name": "Kostal",
        "topic": "Kostal.String 1 Spannung",
        "ack": "true",
        "autoCreate": "true",
        "stateName": "",
        "role": "",
        "payloadType": "number",
        "readonly": "",
        "stateUnit": "V",
        "stateMin": "",
        "stateMax": "",
        "x": 770,
        "y": 320,
        "wires": []
    },
    {
        "id": "c39ce5ce.2205b8",
        "type": "ioBroker out",
        "z": "309eaed8.c5d87a",
        "name": "Kostal ",
        "topic": "Kostal.String 1 Strom A",
        "ack": "true",
        "autoCreate": "true",
        "stateName": "",
        "role": "",
        "payloadType": "number",
        "readonly": "",
        "stateUnit": "A",
        "stateMin": "",
        "stateMax": "",
        "x": 890,
        "y": 360,
        "wires": []
    },
    {
        "id": "2e5befe0.25f6b",
        "type": "ioBroker out",
        "z": "309eaed8.c5d87a",
        "name": "Kostal",
        "topic": "Kostal.String 2 Spannung V",
        "ack": "true",
        "autoCreate": "true",
        "stateName": "",
        "role": "",
        "payloadType": "number",
        "readonly": "",
        "stateUnit": "V",
        "stateMin": "",
        "stateMax": "",
        "x": 770,
        "y": 400,
        "wires": []
    },
    {
        "id": "de209bd4.8174d8",
        "type": "ioBroker out",
        "z": "309eaed8.c5d87a",
        "name": "Kostal",
        "topic": "Kostal.String 2 Strom",
        "ack": "false",
        "autoCreate": "true",
        "stateName": "",
        "role": "",
        "payloadType": "number",
        "readonly": "",
        "stateUnit": "V",
        "stateMin": "",
        "stateMax": "",
        "x": 890,
        "y": 440,
        "wires": []
    },
    {
        "id": "869c42d4.f5cf9",
        "type": "ioBroker out",
        "z": "309eaed8.c5d87a",
        "name": "Kostal",
        "topic": "Kostal.L1 Spannung V",
        "ack": "true",
        "autoCreate": "true",
        "stateName": "",
        "role": "",
        "payloadType": "number",
        "readonly": "",
        "stateUnit": "V",
        "stateMin": "",
        "stateMax": "",
        "x": 770,
        "y": 480,
        "wires": []
    },
    {
        "id": "81ff6124.138e98",
        "type": "ioBroker out",
        "z": "309eaed8.c5d87a",
        "name": "Kostal",
        "topic": "Kostal.L1 Leistung W",
        "ack": "true",
        "autoCreate": "true",
        "stateName": "",
        "role": "",
        "payloadType": "number",
        "readonly": "",
        "stateUnit": "W",
        "stateMin": "",
        "stateMax": "",
        "x": 890,
        "y": 520,
        "wires": []
    },
    {
        "id": "e5262fb9.ab13d",
        "type": "ioBroker out",
        "z": "309eaed8.c5d87a",
        "name": "Kostal",
        "topic": "Kostal.L2 Spannung V",
        "ack": "true",
        "autoCreate": "true",
        "stateName": "",
        "role": "",
        "payloadType": "number",
        "readonly": "",
        "stateUnit": "V",
        "stateMin": "",
        "stateMax": "",
        "x": 770,
        "y": 560,
        "wires": []
    },
    {
        "id": "65fc4b0f.3f3554",
        "type": "ioBroker out",
        "z": "309eaed8.c5d87a",
        "name": "Kostal",
        "topic": "Kostal.L2 Leistung W",
        "ack": "true",
        "autoCreate": "true",
        "stateName": "",
        "role": "",
        "payloadType": "number",
        "readonly": "",
        "stateUnit": "W",
        "stateMin": "",
        "stateMax": "",
        "x": 890,
        "y": 600,
        "wires": []
    },
    {
        "id": "4e8c7193.ca978",
        "type": "ioBroker out",
        "z": "309eaed8.c5d87a",
        "name": "Kostal",
        "topic": "Kostal.L3 Spannung V",
        "ack": "true",
        "autoCreate": "true",
        "stateName": "",
        "role": "",
        "payloadType": "number",
        "readonly": "",
        "stateUnit": "V",
        "stateMin": "",
        "stateMax": "",
        "x": 770,
        "y": 640,
        "wires": []
    },
    {
        "id": "af6ef739.b15968",
        "type": "ioBroker out",
        "z": "309eaed8.c5d87a",
        "name": "Kostal",
        "topic": "Kostal.L3 Leistung W",
        "ack": "true",
        "autoCreate": "true",
        "stateName": "",
        "role": "",
        "payloadType": "number",
        "readonly": "",
        "stateUnit": "W",
        "stateMin": "",
        "stateMax": "",
        "x": 870,
        "y": 680,
        "wires": []
    },
    {
        "id": "5a595fa.2da3f2",
        "type": "modbustcp-write",
        "z": "309eaed8.c5d87a",
        "name": "ModBus 172",
        "topic": "",
        "dataType": "HoldingRegister",
        "adr": "172",
        "server": "c47e1b8e.aa0fd",
        "x": 1790,
        "y": 40,
        "wires": []
    },
    {
        "id": "e813f2bb.21687",
        "type": "function",
        "z": "309eaed8.c5d87a",
        "name": "link",
        "func": "var newMsg = msg.payload.value[1];\n\nmsg.payload = newMsg;\nreturn msg;\n\n\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1610,
        "y": 140,
        "wires": [
            [
                "c2ce206e.25574"
            ]
        ]
    },
    {
        "id": "ddd22ffe.f5cc38",
        "type": "function",
        "z": "309eaed8.c5d87a",
        "name": "link",
        "func": "var newMsg = msg.payload.value[0];\n\nmsg.payload = newMsg;\nreturn msg;\n\n\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1610,
        "y": 60,
        "wires": [
            [
                "5a595fa.2da3f2"
            ]
        ]
    },
    {
        "id": "1f4de602.c3b8fa",
        "type": "function",
        "z": "309eaed8.c5d87a",
        "name": "To Modbus",
        "func": "function float32ToUint16(value) {  \n  var buffer = new ArrayBuffer(4);\n  var intView = new Uint16Array(buffer);\n  var floatView = new Float32Array(buffer);\n\n  floatView[0] = value;\n \n\n  return [intView[0], intView[1]];\n}\n\n//var incoming = JSON.parse(msg.payload);\n\n//Compose ModBus message (Holding Registers) READ/WRITE\nvar modbusHR = {\n payload : {\n 'value' : [\n float32ToUint16(msg.payload)[0], \n float32ToUint16(msg.payload)[1],\n ],\n 'fc' : 6,\n 'unitid' : 1,\n 'address' : 172,\n 'quantity' : 2\n }\n};\n\n\n\n\nnode.send([modbusHR]);",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1370,
        "y": 100,
        "wires": [
            [
                "ddd22ffe.f5cc38",
                "e813f2bb.21687"
            ]
        ]
    },
    {
        "id": "c2ce206e.25574",
        "type": "modbustcp-write",
        "z": "309eaed8.c5d87a",
        "name": "ModBus 173",
        "topic": "",
        "dataType": "HoldingRegister",
        "adr": "173",
        "server": "c47e1b8e.aa0fd",
        "x": 1790,
        "y": 120,
        "wires": []
    },
    {
        "id": "12d75216.ffcac6",
        "type": "function",
        "z": "309eaed8.c5d87a",
        "name": "To Modbus",
        "func": "function float32ToUint16(value) {  \n  var buffer = new ArrayBuffer(4);\n  var intView = new Uint16Array(buffer);\n  var floatView = new Float32Array(buffer);\n\n  floatView[0] = value;\n \n\n  return [intView[0], intView[1]];\n}\n\n//var incoming = JSON.parse(msg.payload);\n\n//Compose ModBus message (Holding Registers) READ/WRITE\nvar modbusHR1 = {\n payload : {\n 'value' : [\n float32ToUint16(msg.payload)[0], \n float32ToUint16(msg.payload)[1],\n ],\n 'fc' : 6,\n 'unitid' : 1,\n 'address' : 322,\n 'quantity' : 2\n }\n};\n\n\n\n\nnode.send([modbusHR1]);",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1370,
        "y": 240,
        "wires": [
            [
                "f6a2a608.45601",
                "12c0d35e.c71d4d"
            ]
        ]
    },
    {
        "id": "12c0d35e.c71d4d",
        "type": "function",
        "z": "309eaed8.c5d87a",
        "name": "link",
        "func": "var newMsg = msg.payload.value[1];\n\nmsg.payload = newMsg;\nreturn msg;\n\n\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1610,
        "y": 280,
        "wires": [
            [
                "246f2a0f.55efae"
            ]
        ]
    },
    {
        "id": "f6a2a608.45601",
        "type": "function",
        "z": "309eaed8.c5d87a",
        "name": "link",
        "func": "var newMsg = msg.payload.value[0];\n\nmsg.payload = newMsg;\nreturn msg;\n\n\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1610,
        "y": 200,
        "wires": [
            [
                "36bedf36.815068"
            ]
        ]
    },
    {
        "id": "36bedf36.815068",
        "type": "modbustcp-write",
        "z": "309eaed8.c5d87a",
        "name": "ModBus 322",
        "topic": "",
        "dataType": "HoldingRegister",
        "adr": "322",
        "server": "c47e1b8e.aa0fd",
        "x": 1790,
        "y": 180,
        "wires": []
    },
    {
        "id": "246f2a0f.55efae",
        "type": "modbustcp-write",
        "z": "309eaed8.c5d87a",
        "name": "ModBus 323",
        "topic": "",
        "dataType": "HoldingRegister",
        "adr": "323",
        "server": "c47e1b8e.aa0fd",
        "x": 1790,
        "y": 260,
        "wires": []
    },
    {
        "id": "386f4cba.5700bc",
        "type": "function",
        "z": "309eaed8.c5d87a",
        "name": "To Modbus",
        "func": "function float32ToUint16(value) {  \n  var buffer = new ArrayBuffer(4);\n  var intView = new Uint16Array(buffer);\n  var floatView = new Float32Array(buffer);\n\n  floatView[0] = value;\n \n\n  return [intView[0], intView[1]];\n}\n\n//var incoming = JSON.parse(msg.payload);\n\n//Compose ModBus message (Holding Registers) READ/WRITE\nvar modbusHR = {\n payload : {\n 'value' : [\n float32ToUint16(msg.payload)[0], \n float32ToUint16(msg.payload)[1],\n ],\n 'fc' : 6,\n 'unitid' : 1,\n 'address' : 158,\n 'quantity' : 2\n }\n};\n\n\n\n\nnode.send([modbusHR]);",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1350,
        "y": 440,
        "wires": [
            [
                "2c04140.7f9cd6c",
                "50acbeed.91793"
            ]
        ]
    },
    {
        "id": "50acbeed.91793",
        "type": "function",
        "z": "309eaed8.c5d87a",
        "name": "link",
        "func": "var newMsg = msg.payload.value[1];\n\nmsg.payload = newMsg;\nreturn msg;\n\n\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1590,
        "y": 480,
        "wires": [
            [
                "4460fe43.d30ef8"
            ]
        ]
    },
    {
        "id": "2c04140.7f9cd6c",
        "type": "function",
        "z": "309eaed8.c5d87a",
        "name": "link",
        "func": "var newMsg = msg.payload.value[0];\n\nmsg.payload = newMsg;\nreturn msg;\n\n\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1590,
        "y": 400,
        "wires": [
            [
                "9e8a4c02.76b018"
            ]
        ]
    },
    {
        "id": "4460fe43.d30ef8",
        "type": "modbustcp-write",
        "z": "309eaed8.c5d87a",
        "name": "ModBus 159",
        "topic": "",
        "dataType": "HoldingRegister",
        "adr": "159",
        "server": "c47e1b8e.aa0fd",
        "x": 1770,
        "y": 460,
        "wires": []
    },
    {
        "id": "9e8a4c02.76b018",
        "type": "modbustcp-write",
        "z": "309eaed8.c5d87a",
        "name": "ModBus 158",
        "topic": "",
        "dataType": "HoldingRegister",
        "adr": "158",
        "server": "c47e1b8e.aa0fd",
        "x": 1770,
        "y": 380,
        "wires": []
    },
    {
        "id": "cbc61193.22b7b",
        "type": "function",
        "z": "309eaed8.c5d87a",
        "name": "To Modbus",
        "func": "function float32ToUint16(value) {  \n  var buffer = new ArrayBuffer(4);\n  var intView = new Uint16Array(buffer);\n  var floatView = new Float32Array(buffer);\n\n  floatView[0] = value;\n \n\n  return [intView[0], intView[1]];\n}\n\n//var incoming = JSON.parse(msg.payload);\n\n//Compose ModBus message (Holding Registers) READ/WRITE\nvar modbusHR = {\n payload : {\n 'value' : [\n float32ToUint16(msg.payload)[0], \n float32ToUint16(msg.payload)[1],\n ],\n 'fc' : 6,\n 'unitid' : 1,\n 'address' : 164,\n 'quantity' : 2\n }\n};\n\n\n\n\nnode.send([modbusHR]);",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1390,
        "y": 580,
        "wires": [
            [
                "26b3a0fd.f0a0d8",
                "3b3bc15d.13f09e"
            ]
        ]
    },
    {
        "id": "3b3bc15d.13f09e",
        "type": "function",
        "z": "309eaed8.c5d87a",
        "name": "link",
        "func": "var newMsg = msg.payload.value[1];\n\nmsg.payload = newMsg;\nreturn msg;\n\n\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1630,
        "y": 620,
        "wires": [
            [
                "8e20d684.403508"
            ]
        ]
    },
    {
        "id": "26b3a0fd.f0a0d8",
        "type": "function",
        "z": "309eaed8.c5d87a",
        "name": "link",
        "func": "var newMsg = msg.payload.value[0];\n\nmsg.payload = newMsg;\nreturn msg;\n\n\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1630,
        "y": 540,
        "wires": [
            [
                "4faf6361.d34d74"
            ]
        ]
    },
    {
        "id": "4faf6361.d34d74",
        "type": "modbustcp-write",
        "z": "309eaed8.c5d87a",
        "name": "ModBus 164",
        "topic": "",
        "dataType": "HoldingRegister",
        "adr": "164",
        "server": "c47e1b8e.aa0fd",
        "x": 1810,
        "y": 520,
        "wires": []
    },
    {
        "id": "8e20d684.403508",
        "type": "modbustcp-write",
        "z": "309eaed8.c5d87a",
        "name": "ModBus 165",
        "topic": "",
        "dataType": "HoldingRegister",
        "adr": "165",
        "server": "c47e1b8e.aa0fd",
        "x": 1810,
        "y": 600,
        "wires": []
    },
    {
        "id": "de8c6dee.b64ca8",
        "type": "function",
        "z": "309eaed8.c5d87a",
        "name": "To Modbus",
        "func": "function float32ToUint16(value) {  \n  var buffer = new ArrayBuffer(4);\n  var intView = new Uint16Array(buffer);\n  var floatView = new Float32Array(buffer);\n\n  floatView[0] = value;\n \n\n  return [intView[0], intView[1]];\n}\n\n//var incoming = JSON.parse(msg.payload);\n\n//Compose ModBus message (Holding Registers) READ/WRITE\nvar modbusHR5 = {\n payload : {\n 'value' : [\n float32ToUint16(msg.payload)[0], \n float32ToUint16(msg.payload)[1],\n ],\n 'fc' : 6,\n 'unitid' : 1,\n 'address' : 170,\n 'quantity' : 2\n }\n};\n\n\n\n\nnode.send([modbusHR5]);",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1390,
        "y": 740,
        "wires": [
            [
                "a45583b8.5c3a8",
                "7db2b9fb.711648"
            ]
        ]
    },
    {
        "id": "7db2b9fb.711648",
        "type": "function",
        "z": "309eaed8.c5d87a",
        "name": "link",
        "func": "var newMsg = msg.payload.value[1];\n\nmsg.payload = newMsg;\nreturn msg;\n\n\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1630,
        "y": 780,
        "wires": [
            [
                "d4b09e30.029c48"
            ]
        ]
    },
    {
        "id": "a45583b8.5c3a8",
        "type": "function",
        "z": "309eaed8.c5d87a",
        "name": "link",
        "func": "var newMsg = msg.payload.value[0];\n\nmsg.payload = newMsg;\nreturn msg;\n\n\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1630,
        "y": 700,
        "wires": [
            [
                "25dc9174.0fcc66"
            ]
        ]
    },
    {
        "id": "25dc9174.0fcc66",
        "type": "modbustcp-write",
        "z": "309eaed8.c5d87a",
        "name": "ModBus 170",
        "topic": "",
        "dataType": "HoldingRegister",
        "adr": "170",
        "server": "c47e1b8e.aa0fd",
        "x": 1810,
        "y": 680,
        "wires": []
    },
    {
        "id": "d4b09e30.029c48",
        "type": "modbustcp-write",
        "z": "309eaed8.c5d87a",
        "name": "ModBus 171",
        "topic": "",
        "dataType": "HoldingRegister",
        "adr": "171",
        "server": "c47e1b8e.aa0fd",
        "x": 1810,
        "y": 760,
        "wires": []
    },
    {
        "id": "b026a9a6.997b4",
        "type": "ioBroker get",
        "z": "309eaed8.c5d87a",
        "name": "Kostal L1 A",
        "topic": "0_userdata.0.Kostal.Kostal-L1-A",
        "attrname": "payload",
        "payloadType": "value",
        "x": 650,
        "y": 900,
        "wires": [
            [
                "9e6a9011.af90c"
            ]
        ]
    },
    {
        "id": "6980a6b.24dd558",
        "type": "ioBroker get",
        "z": "309eaed8.c5d87a",
        "name": "Kostal L2 A",
        "topic": "0_userdata.0.Kostal.Kostal-L2-A",
        "attrname": "payload",
        "payloadType": "value",
        "x": 650,
        "y": 1040,
        "wires": [
            [
                "8af0f4d2.bb49c"
            ]
        ]
    },
    {
        "id": "36346009.d2d3e",
        "type": "ioBroker get",
        "z": "309eaed8.c5d87a",
        "name": "Kostal L3 A",
        "topic": "0_userdata.0.Kostal.Kostal-L3-A",
        "attrname": "payload",
        "payloadType": "value",
        "x": 650,
        "y": 1140,
        "wires": [
            [
                "e0bfcbab.01e618"
            ]
        ]
    },
    {
        "id": "9e6a9011.af90c",
        "type": "function",
        "z": "309eaed8.c5d87a",
        "name": "To Modbus",
        "func": "function float32ToUint16(value) {  \n  var buffer = new ArrayBuffer(4);\n  var intView = new Uint16Array(buffer);\n  var floatView = new Float32Array(buffer);\n\n  floatView[0] = value;\n \n\n  return [intView[0], intView[1]];\n}\n\n//var incoming = JSON.parse(msg.payload);\n\n//Compose ModBus message (Holding Registers) READ/WRITE\nvar modbusHR = {\n payload : {\n 'value' : [\n float32ToUint16(msg.payload)[0], \n float32ToUint16(msg.payload)[1],\n ],\n 'fc' : 6,\n 'unitid' : 1,\n 'address' : 154,\n 'quantity' : 2\n }\n};\n\n\n\n\nnode.send([modbusHR]);",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1050,
        "y": 900,
        "wires": [
            [
                "a329a190.de7ef",
                "f0212bfd.442f8"
            ]
        ]
    },
    {
        "id": "a329a190.de7ef",
        "type": "function",
        "z": "309eaed8.c5d87a",
        "name": "link",
        "func": "var newMsg = msg.payload.value[0];\n\nmsg.payload = newMsg;\nreturn msg;\n\n\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1290,
        "y": 860,
        "wires": [
            [
                "82b7ff53.b1936"
            ]
        ]
    },
    {
        "id": "f0212bfd.442f8",
        "type": "function",
        "z": "309eaed8.c5d87a",
        "name": "link",
        "func": "var newMsg = msg.payload.value[1];\n\nmsg.payload = newMsg;\nreturn msg;\n\n\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1290,
        "y": 940,
        "wires": [
            [
                "8ede7e53.a95b1"
            ]
        ]
    },
    {
        "id": "82b7ff53.b1936",
        "type": "modbustcp-write",
        "z": "309eaed8.c5d87a",
        "name": "ModBus 154",
        "topic": "",
        "dataType": "HoldingRegister",
        "adr": "154",
        "server": "c47e1b8e.aa0fd",
        "x": 1470,
        "y": 840,
        "wires": []
    },
    {
        "id": "8ede7e53.a95b1",
        "type": "modbustcp-write",
        "z": "309eaed8.c5d87a",
        "name": "ModBus 155",
        "topic": "",
        "dataType": "HoldingRegister",
        "adr": "155",
        "server": "c47e1b8e.aa0fd",
        "x": 1470,
        "y": 920,
        "wires": []
    },
    {
        "id": "8af0f4d2.bb49c",
        "type": "function",
        "z": "309eaed8.c5d87a",
        "name": "To Modbus",
        "func": "function float32ToUint16(value) {  \n  var buffer = new ArrayBuffer(4);\n  var intView = new Uint16Array(buffer);\n  var floatView = new Float32Array(buffer);\n\n  floatView[0] = value;\n \n\n  return [intView[0], intView[1]];\n}\n\n//var incoming = JSON.parse(msg.payload);\n\n//Compose ModBus message (Holding Registers) READ/WRITE\nvar modbusHR = {\n payload : {\n 'value' : [\n float32ToUint16(msg.payload)[0], \n float32ToUint16(msg.payload)[1],\n ],\n 'fc' : 6,\n 'unitid' : 1,\n 'address' : 160,\n 'quantity' : 2\n }\n};\n\n\n\n\nnode.send([modbusHR]);",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1010,
        "y": 1040,
        "wires": [
            [
                "affa067b.f004f8",
                "9c2d089c.ced32"
            ]
        ]
    },
    {
        "id": "affa067b.f004f8",
        "type": "function",
        "z": "309eaed8.c5d87a",
        "name": "link",
        "func": "var newMsg = msg.payload.value[0];\n\nmsg.payload = newMsg;\nreturn msg;\n\n\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1250,
        "y": 1000,
        "wires": [
            [
                "a71b6f6d.32203"
            ]
        ]
    },
    {
        "id": "9c2d089c.ced32",
        "type": "function",
        "z": "309eaed8.c5d87a",
        "name": "link",
        "func": "var newMsg = msg.payload.value[1];\n\nmsg.payload = newMsg;\nreturn msg;\n\n\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1250,
        "y": 1080,
        "wires": [
            [
                "bcaf20c1.24daa"
            ]
        ]
    },
    {
        "id": "a71b6f6d.32203",
        "type": "modbustcp-write",
        "z": "309eaed8.c5d87a",
        "name": "ModBus 160",
        "topic": "",
        "dataType": "HoldingRegister",
        "adr": "160",
        "server": "c47e1b8e.aa0fd",
        "x": 1430,
        "y": 980,
        "wires": []
    },
    {
        "id": "bcaf20c1.24daa",
        "type": "modbustcp-write",
        "z": "309eaed8.c5d87a",
        "name": "ModBus 161",
        "topic": "",
        "dataType": "HoldingRegister",
        "adr": "161",
        "server": "c47e1b8e.aa0fd",
        "x": 1430,
        "y": 1060,
        "wires": []
    },
    {
        "id": "e0bfcbab.01e618",
        "type": "function",
        "z": "309eaed8.c5d87a",
        "name": "To Modbus",
        "func": "function float32ToUint16(value) {  \n  var buffer = new ArrayBuffer(4);\n  var intView = new Uint16Array(buffer);\n  var floatView = new Float32Array(buffer);\n\n  floatView[0] = value;\n \n\n  return [intView[0], intView[1]];\n}\n\n//var incoming = JSON.parse(msg.payload);\n\n//Compose ModBus message (Holding Registers) READ/WRITE\nvar modbusHR = {\n payload : {\n 'value' : [\n float32ToUint16(msg.payload)[0], \n float32ToUint16(msg.payload)[1],\n ],\n 'fc' : 6,\n 'unitid' : 1,\n 'address' : 166,\n 'quantity' : 2\n }\n};\n\n\n\n\nnode.send([modbusHR]);",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1010,
        "y": 1160,
        "wires": [
            [
                "1adc4b2.f8add35",
                "46dd08cf.389a9"
            ]
        ]
    },
    {
        "id": "1adc4b2.f8add35",
        "type": "function",
        "z": "309eaed8.c5d87a",
        "name": "link",
        "func": "var newMsg = msg.payload.value[0];\n\nmsg.payload = newMsg;\nreturn msg;\n\n\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1250,
        "y": 1120,
        "wires": [
            [
                "a8259674.fa6ed"
            ]
        ]
    },
    {
        "id": "46dd08cf.389a9",
        "type": "function",
        "z": "309eaed8.c5d87a",
        "name": "link",
        "func": "var newMsg = msg.payload.value[1];\n\nmsg.payload = newMsg;\nreturn msg;\n\n\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1250,
        "y": 1200,
        "wires": [
            [
                "c9e98851.dd55b8"
            ]
        ]
    },
    {
        "id": "a8259674.fa6ed",
        "type": "modbustcp-write",
        "z": "309eaed8.c5d87a",
        "name": "ModBus 166",
        "topic": "",
        "dataType": "HoldingRegister",
        "adr": "166",
        "server": "c47e1b8e.aa0fd",
        "x": 1430,
        "y": 1100,
        "wires": []
    },
    {
        "id": "c9e98851.dd55b8",
        "type": "modbustcp-write",
        "z": "309eaed8.c5d87a",
        "name": "ModBus 167",
        "topic": "",
        "dataType": "HoldingRegister",
        "adr": "167",
        "server": "c47e1b8e.aa0fd",
        "x": 1430,
        "y": 1180,
        "wires": []
    },
    {
        "id": "3acb41ca.a04a0e",
        "type": "modbus-server",
        "z": "309eaed8.c5d87a",
        "name": "Modbus2022",
        "logEnabled": false,
        "hostname": "0.0.0.0",
        "serverPort": "502",
        "responseDelay": 100,
        "delayUnit": "ms",
        "coilsBufferSize": 10000,
        "holdingBufferSize": 10000,
        "inputBufferSize": 10000,
        "discreteBufferSize": 10000,
        "showErrors": false,
        "x": 1050,
        "y": 1340,
        "wires": [
            [],
            [],
            [],
            [],
            []
        ]
    },
    {
        "id": "de147d29.2ecff8",
        "type": "inject",
        "z": "309eaed8.c5d87a",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "str",
        "x": 850,
        "y": 1320,
        "wires": [
            [
                "3acb41ca.a04a0e"
            ]
        ]
    },
    {
        "id": "c47e1b8e.aa0fd",
        "type": "modbustcp-server",
        "name": "Modbus Server",
        "host": "127.0.0.1",
        "port": "502",
        "unit_id": "1",
        "reconnecttimeout": ""
    }
]

ioBroker Node-RED

Node-Red und ioBroker laufen bei uns in einem Docker Container unter Windows Server 2022 Hyper-V

HINTERLASSEN SIE EINE ANTWORT

Please enter your comment!
Please enter your name here