[vz-users] Auslesen eines SMA Tripower X 15-50 über Modbus TCP

Daniel Lauckner vz at jahp.de
So Jan 28 13:14:01 CET 2024


Erforderliche Nodes:

node-red-contrib-modbus
node-red-contrib-volkszaehler
node-red-dashboard

Mein Flow (inkl. globaler Nodes):

[
    {
        "id": "ee4b78d6.df65e8",
        "type": "tab",
        "label": "PV-WR 2 VZ",
        "disabled": false,
        "info": ""
    },
    {
        "id": "84fa735.4713b1",
        "type": "function",
        "z": "ee4b78d6.df65e8",
        "name": "Leistung",
        "func": "var rawData = new ArrayBuffer(4);\nvar intView = new Uint16Array(rawData);\n\nif (msg.payload[0] === 65535) { return null; }\n\nintView[0] =  //low\nintView[1] = msg.payload[4]; //high\n\nmsg.amps = msg.payload[1]/1000;\nmsg.volt = msg.payload[3]/100;\nmsg.power = msg.payload[5];\nmsg.topic = \"W\";\n\nnode.status({fill:\"blue\",shape:\"ring\",text:msg.topic + \":\" + msg.power});    \n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 280,
        "y": 180,
        "wires": [
            [
                "ec86511dbe1ece22",
                "4e759b3ff98eba54",
                "c53b051831fcabec",
                "70f7975826cb139b",
                "3a8ee35886335435"
            ]
        ]
    },
    {
        "id": "c6858c7a.7b8de",
        "type": "modbus-read",
        "z": "ee4b78d6.df65e8",
        "name": "PV DC1",
        "topic": "",
        "showStatusActivities": false,
        "logIOActivities": false,
        "showErrors": false,
        "showWarnings": true,
        "unitid": "3",
        "dataType": "HoldingRegister",
        "adr": "30769",
        "quantity": "6",
        "rate": "60",
        "rateUnit": "s",
        "delayOnStart": false,
        "startDelayTime": "",
        "server": "a2edbd96.be9be8",
        "useIOFile": false,
        "ioFile": "",
        "useIOForPayload": false,
        "emptyMsgOnFail": false,
        "x": 100,
        "y": 180,
        "wires": [
            [
                "84fa735.4713b1"
            ],
            []
        ]
    },
    {
        "id": "18743483.f3a09b",
        "type": "modbus-read",
        "z": "ee4b78d6.df65e8",
        "name": "PV DC2",
        "topic": "",
        "showStatusActivities": false,
        "logIOActivities": false,
        "showErrors": false,
        "showWarnings": true,
        "unitid": "3",
        "dataType": "InputRegister",
        "adr": "30957",
        "quantity": "6",
        "rate": "60",
        "rateUnit": "s",
        "delayOnStart": false,
        "startDelayTime": "",
        "server": "a2edbd96.be9be8",
        "useIOFile": false,
        "ioFile": "",
        "useIOForPayload": false,
        "emptyMsgOnFail": false,
        "x": 100,
        "y": 300,
        "wires": [
            [
                "8a6a774dc271bea2"
            ],
            []
        ]
    },
    {
        "id": "ec86511dbe1ece22",
        "type": "debug",
        "z": "ee4b78d6.df65e8",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 470,
        "y": 120,
        "wires": []
    },
    {
        "id": "6b8e622facd7e547",
        "type": "modbus-read",
        "z": "ee4b78d6.df65e8",
        "name": "PV DC3",
        "topic": "",
        "showStatusActivities": false,
        "logIOActivities": false,
        "showErrors": false,
        "showWarnings": true,
        "unitid": "3",
        "dataType": "InputRegister",
        "adr": "30963",
        "quantity": "6",
        "rate": "60",
        "rateUnit": "s",
        "delayOnStart": false,
        "startDelayTime": "",
        "server": "a2edbd96.be9be8",
        "useIOFile": false,
        "ioFile": "",
        "useIOForPayload": false,
        "emptyMsgOnFail": false,
        "x": 100,
        "y": 420,
        "wires": [
            [
                "e1f2f1606dde834a"
            ],
            []
        ]
    },
    {
        "id": "8a6a774dc271bea2",
        "type": "function",
        "z": "ee4b78d6.df65e8",
        "name": "Leistung",
        "func": "var rawData = new ArrayBuffer(4);\nvar intView = new Uint16Array(rawData);\n\nif (msg.payload[0] === 65535) { return null; }\n\nintView[0] =  //low\nintView[1] = msg.payload[4]; //high\n\nmsg.amps = msg.payload[1]/1000;\nmsg.volt = msg.payload[3]/100;\nmsg.power = msg.payload[5];\nmsg.topic = \"W\";\n\nnode.status({fill:\"blue\",shape:\"ring\",text:msg.topic + \":\" + msg.power});    \n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 280,
        "y": 300,
        "wires": [
            [
                "3ed40b78f7aa1879",
                "06a2d6c5bf7cb36b",
                "65eefd87760ff217",
                "cc38592e679356e3"
            ]
        ]
    },
    {
        "id": "e1f2f1606dde834a",
        "type": "function",
        "z": "ee4b78d6.df65e8",
        "name": "Leistung",
        "func": "var rawData = new ArrayBuffer(4);\nvar intView = new Uint16Array(rawData);\n\nif (msg.payload[0] === 65535) { return null; }\n\nintView[0] =  //low\nintView[1] = msg.payload[4]; //high\n\nmsg.amps = msg.payload[1]/1000;\nmsg.volt = msg.payload[3]/100;\nmsg.power = msg.payload[5];\nmsg.topic = \"W\";\n\nnode.status({fill:\"blue\",shape:\"ring\",text:msg.topic + \":\" + msg.power});    \n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 280,
        "y": 420,
        "wires": [
            [
                "9a434274356337cf",
                "a83230ad69e7df56",
                "072061dc9db3d297",
                "2eb71089f35cceed"
            ]
        ]
    },
    {
        "id": "3ce92724d948fb70",
        "type": "json",
        "z": "ee4b78d6.df65e8",
        "name": "",
        "property": "payload",
        "action": "",
        "pretty": false,
        "x": 970,
        "y": 180,
        "wires": [
            [
                "8293ba8bfb4546dd"
            ]
        ]
    },
    {
        "id": "f09fda918ed43fc6",
        "type": "http request",
        "z": "ee4b78d6.df65e8",
        "name": "volkszaehler post",
        "method": "POST",
        "ret": "obj",
        "url": "",
        "tls": "",
        "x": 1030,
        "y": 280,
        "wires": [
            [
                "93127dcd07596aee"
            ]
        ]
    },
    {
        "id": "93127dcd07596aee",
        "type": "debug",
        "z": "ee4b78d6.df65e8",
        "name": "post response",
        "active": false,
        "console": "false",
        "complete": "true",
        "x": 1240,
        "y": 280,
        "wires": []
    },
    {
        "id": "4e759b3ff98eba54",
        "type": "change",
        "z": "ee4b78d6.df65e8",
        "name": "PV String1 W uuid / timestamp",
        "rules": [
            {
                "t": "set",
                "p": "uuid",
                "pt": "msg",
                "to": "f2e145a0-84d5-11e4-86e3-3587832d7a7",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "timestamp",
                "pt": "msg",
                "to": "",
                "tot": "date"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 510,
        "y": 180,
        "wires": [
            [
                "86a5917aeccb2fcd"
            ]
        ]
    },
    {
        "id": "8293ba8bfb4546dd",
        "type": "template",
        "z": "ee4b78d6.df65e8",
        "name": "PV-WR url",
        "field": "url",
        "fieldType": "msg",
        "format": "handlebars",
        "syntax": "mustache",
        "template": "http://demo.volkszaehler.org/middleware.php/data/{{uuid}}.json?ts={{timestamp}}&value={{power}}",
        "x": 830,
        "y": 280,
        "wires": [
            [
                "f09fda918ed43fc6"
            ]
        ]
    },
    {
        "id": "3ed40b78f7aa1879",
        "type": "change",
        "z": "ee4b78d6.df65e8",
        "name": "PV String2 W uuid / timestamp",
        "rules": [
            {
                "t": "set",
                "p": "uuid",
                "pt": "msg",
                "to": "57acbef0-88a9-11e4-934f-6b0f9ecd95a8",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "timestamp",
                "pt": "msg",
                "to": "",
                "tot": "date"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 510,
        "y": 300,
        "wires": [
            [
                "86a5917aeccb2fcd"
            ]
        ]
    },
    {
        "id": "9a434274356337cf",
        "type": "change",
        "z": "ee4b78d6.df65e8",
        "name": "PV String3 W uuid / timestamp",
        "rules": [
            {
                "t": "set",
                "p": "uuid",
                "pt": "msg",
                "to": "e640a820-7a2a-11e8-b04b-0fe628c3aa8d",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "timestamp",
                "pt": "msg",
                "to": "",
                "tot": "date"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 510,
        "y": 420,
        "wires": [
            [
                "86a5917aeccb2fcd"
            ]
        ]
    },
    {
        "id": "86a5917aeccb2fcd",
        "type": "change",
        "z": "ee4b78d6.df65e8",
        "name": "delete payloads",
        "rules": [
            {
                "t": "delete",
                "p": "payload",
                "pt": "msg"
            },
            {
                "t": "delete",
                "p": "topic",
                "pt": "msg"
            },
            {
                "t": "delete",
                "p": "responseBuffer",
                "pt": "msg"
            },
            {
                "t": "delete",
                "p": "input",
                "pt": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 800,
        "y": 180,
        "wires": [
            [
                "3ce92724d948fb70"
            ]
        ]
    },
    {
        "id": "c53b051831fcabec",
        "type": "ui_text",
        "z": "ee4b78d6.df65e8",
        "group": "1a6c854d9868aacc",
        "order": 2,
        "width": "0",
        "height": "0",
        "name": "Volt",
        "label": "V",
        "format": "{{msg.volt | number: 0}}",
        "layout": "row-spread",
        "className": "",
        "x": 570,
        "y": 240,
        "wires": []
    },
    {
        "id": "06a2d6c5bf7cb36b",
        "type": "ui_text",
        "z": "ee4b78d6.df65e8",
        "group": "03da68267112b8ab",
        "order": 2,
        "width": "0",
        "height": "0",
        "name": "Volt",
        "label": "V",
        "format": "{{msg.volt | number: 0}}",
        "layout": "row-spread",
        "className": "",
        "x": 570,
        "y": 360,
        "wires": []
    },
    {
        "id": "a83230ad69e7df56",
        "type": "ui_text",
        "z": "ee4b78d6.df65e8",
        "group": "42ba0a0878f7e6a5",
        "order": 2,
        "width": "0",
        "height": "0",
        "name": "Volt",
        "label": "V",
        "format": "{{msg.volt | number: 0}}",
        "layout": "row-spread",
        "className": "",
        "x": 570,
        "y": 480,
        "wires": []
    },
    {
        "id": "70f7975826cb139b",
        "type": "ui_text",
        "z": "ee4b78d6.df65e8",
        "group": "1a6c854d9868aacc",
        "order": 1,
        "width": "0",
        "height": "0",
        "name": "Watt",
        "label": "W",
        "format": "{{msg.power}}",
        "layout": "row-spread",
        "className": "",
        "x": 450,
        "y": 220,
        "wires": []
    },
    {
        "id": "3a8ee35886335435",
        "type": "ui_text",
        "z": "ee4b78d6.df65e8",
        "group": "1a6c854d9868aacc",
        "order": 2,
        "width": "0",
        "height": "0",
        "name": "Amp",
        "label": "A",
        "format": "{{msg.amps | number: 2}}",
        "layout": "row-spread",
        "className": "",
        "x": 450,
        "y": 260,
        "wires": []
    },
    {
        "id": "65eefd87760ff217",
        "type": "ui_text",
        "z": "ee4b78d6.df65e8",
        "group": "03da68267112b8ab",
        "order": 1,
        "width": "0",
        "height": "0",
        "name": "Watt",
        "label": "W",
        "format": "{{msg.power}}",
        "layout": "row-spread",
        "className": "",
        "x": 450,
        "y": 340,
        "wires": []
    },
    {
        "id": "072061dc9db3d297",
        "type": "ui_text",
        "z": "ee4b78d6.df65e8",
        "group": "42ba0a0878f7e6a5",
        "order": 1,
        "width": "0",
        "height": "0",
        "name": "Watt",
        "label": "W",
        "format": "{{msg.power}}",
        "layout": "row-spread",
        "className": "",
        "x": 450,
        "y": 460,
        "wires": []
    },
    {
        "id": "cc38592e679356e3",
        "type": "ui_text",
        "z": "ee4b78d6.df65e8",
        "group": "03da68267112b8ab",
        "order": 2,
        "width": "0",
        "height": "0",
        "name": "Amp",
        "label": "A",
        "format": "{{msg.amps | number: 2}}",
        "layout": "row-spread",
        "className": "",
        "x": 450,
        "y": 380,
        "wires": []
    },
    {
        "id": "2eb71089f35cceed",
        "type": "ui_text",
        "z": "ee4b78d6.df65e8",
        "group": "42ba0a0878f7e6a5",
        "order": 2,
        "width": "0",
        "height": "0",
        "name": "Amp",
        "label": "A",
        "format": "{{msg.amps | number: 2}}",
        "layout": "row-spread",
        "className": "",
        "x": 450,
        "y": 500,
        "wires": []
    },
    {
        "id": "d8464cc1af73b0ed",
        "type": "modbus-read",
        "z": "ee4b78d6.df65e8",
        "name": "PV AC",
        "topic": "",
        "showStatusActivities": false,
        "logIOActivities": false,
        "showErrors": false,
        "showWarnings": true,
        "unitid": "3",
        "dataType": "HoldingRegister",
        "adr": "30775",
        "quantity": "30",
        "rate": "120",
        "rateUnit": "s",
        "delayOnStart": false,
        "startDelayTime": "",
        "server": "a2edbd96.be9be8",
        "useIOFile": false,
        "ioFile": "",
        "useIOForPayload": false,
        "emptyMsgOnFail": false,
        "x": 90,
        "y": 560,
        "wires": [
            [
                "a4a9b2daaa58402d"
            ],
            []
        ]
    },
    {
        "id": "a4a9b2daaa58402d",
        "type": "function",
        "z": "ee4b78d6.df65e8",
        "name": "Netz",
        "func": "var rawData = new ArrayBuffer(40);\nvar intView = new Uint16Array(rawData);\n\nif (msg.payload[0] === 65535) { return null; }\n\nintView[0] =  //low\nintView[1] = msg.payload[4]; //high\n\nmsg.W = msg.payload[1];\nmsg.W1 = msg.payload[3];\nmsg.W2 = msg.payload[5];\nmsg.W3 = msg.payload[7];\nmsg.V1 = msg.payload[9]/100;\nmsg.V2 = msg.payload[11]/100;\nmsg.V3 = msg.payload[13]/100;\nmsg.A = msg.payload[21]/1000;\nmsg.A1 = msg.payload[23]/1000;\nmsg.A2 = msg.payload[25]/1000;\nmsg.A3 = msg.payload[27]/1000;\nmsg.Hz = msg.payload[29]/100;\nmsg.topic = \"W\";\n\nnode.status({fill:\"blue\",shape:\"ring\",text:msg.topic + \":\" + msg.W});\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 270,
        "y": 560,
        "wires": [
            [
                "5f868df01c8dc3ec",
                "7928d6609b3b3cbb",
                "3405231a26277646",
                "591b0bc3f5a4a08f",
                "c32361c9e816c42b",
                "5a7cf3175e7c3a22",
                "9bc3052213a17939",
                "ad7c731330b0e8b6",
                "2c37d86689e148df"
            ]
        ]
    },
    {
        "id": "5f868df01c8dc3ec",
        "type": "ui_text",
        "z": "ee4b78d6.df65e8",
        "group": "50e99a6a143f4e11",
        "order": 2,
        "width": "0",
        "height": "0",
        "name": "L1 V",
        "label": "L1 V",
        "format": "{{msg.V1 | number: 0}}",
        "layout": "row-spread",
        "className": "",
        "x": 450,
        "y": 560,
        "wires": []
    },
    {
        "id": "7928d6609b3b3cbb",
        "type": "ui_text",
        "z": "ee4b78d6.df65e8",
        "group": "50e99a6a143f4e11",
        "order": 3,
        "width": "0",
        "height": "0",
        "name": "L2 V",
        "label": "L2 V",
        "format": "{{msg.V2 | number: 0}}",
        "layout": "row-spread",
        "className": "",
        "x": 450,
        "y": 600,
        "wires": []
    },
    {
        "id": "3405231a26277646",
        "type": "ui_text",
        "z": "ee4b78d6.df65e8",
        "group": "50e99a6a143f4e11",
        "order": 4,
        "width": "0",
        "height": "0",
        "name": "L3 V",
        "label": "L3 V",
        "format": "{{msg.V3 | number: 0}}",
        "layout": "row-spread",
        "className": "",
        "x": 450,
        "y": 640,
        "wires": []
    },
    {
        "id": "591b0bc3f5a4a08f",
        "type": "ui_text",
        "z": "ee4b78d6.df65e8",
        "group": "50e99a6a143f4e11",
        "order": 5,
        "width": "0",
        "height": "0",
        "name": "Freq",
        "label": "Hz",
        "format": "{{msg.Hz | number: 1}}",
        "layout": "row-spread",
        "className": "",
        "x": 450,
        "y": 680,
        "wires": []
    },
    {
        "id": "c32361c9e816c42b",
        "type": "debug",
        "z": "ee4b78d6.df65e8",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 450,
        "y": 780,
        "wires": []
    },
    {
        "id": "5a7cf3175e7c3a22",
        "type": "ui_text",
        "z": "ee4b78d6.df65e8",
        "group": "a561eb19b9a8e6bf",
        "order": 2,
        "width": "0",
        "height": "0",
        "name": "L1 A",
        "label": "L1 A",
        "format": "{{msg.A1 | number: 2}}",
        "layout": "row-spread",
        "className": "",
        "x": 570,
        "y": 620,
        "wires": []
    },
    {
        "id": "9bc3052213a17939",
        "type": "ui_text",
        "z": "ee4b78d6.df65e8",
        "group": "a561eb19b9a8e6bf",
        "order": 3,
        "width": "0",
        "height": "0",
        "name": "L2 A",
        "label": "L2 A",
        "format": "{{msg.A2 | number: 2}}",
        "layout": "row-spread",
        "className": "",
        "x": 570,
        "y": 660,
        "wires": []
    },
    {
        "id": "ad7c731330b0e8b6",
        "type": "ui_text",
        "z": "ee4b78d6.df65e8",
        "group": "a561eb19b9a8e6bf",
        "order": 4,
        "width": "0",
        "height": "0",
        "name": "L3 A",
        "label": "L3 A",
        "format": "{{msg.A3 | number: 2}}",
        "layout": "row-spread",
        "className": "",
        "x": 570,
        "y": 700,
        "wires": []
    },
    {
        "id": "2c37d86689e148df",
        "type": "ui_text",
        "z": "ee4b78d6.df65e8",
        "group": "a561eb19b9a8e6bf",
        "order": 1,
        "width": "0",
        "height": "0",
        "name": "PV W",
        "label": "W",
        "format": "{{msg.W | number: 0}}",
        "layout": "row-spread",
        "className": "",
        "x": 570,
        "y": 580,
        "wires": []
    },
    {
        "id": "a2edbd96.be9be8",
        "type": "modbus-client",
        "name": "PV-WR",
        "clienttype": "tcp",
        "bufferCommands": true,
        "stateLogEnabled": false,
        "queueLogEnabled": false,
        "failureLogEnabled": false,
        "tcpHost": "192.168.1.116",
        "tcpPort": "502",
        "tcpType": "DEFAULT",
        "serialPort": "/dev/ttyUSB",
        "serialType": "RTU-BUFFERD",
        "serialBaudrate": "9600",
        "serialDatabits": "8",
        "serialStopbits": "1",
        "serialParity": "none",
        "serialConnectionDelay": "100",
        "serialAsciiResponseStartDelimiter": "",
        "unit_id": "3",
        "commandDelay": "1",
        "clientTimeout": "1000",
        "reconnectOnTimeout": true,
        "reconnectTimeout": "2000",
        "parallelUnitIdsAllowed": true
    },
    {
        "id": "1a6c854d9868aacc",
        "type": "ui_group",
        "name": "DC 1",
        "tab": "8d223fe8c91863a3",
        "order": 3,
        "disp": true,
        "width": "3",
        "collapse": false,
        "className": ""
    },
    {
        "id": "03da68267112b8ab",
        "type": "ui_group",
        "name": "DC 2",
        "tab": "8d223fe8c91863a3",
        "order": 4,
        "disp": true,
        "width": "3",
        "collapse": false,
        "className": ""
    },
    {
        "id": "42ba0a0878f7e6a5",
        "type": "ui_group",
        "name": "DC 3",
        "tab": "8d223fe8c91863a3",
        "order": 5,
        "disp": true,
        "width": "3",
        "collapse": false,
        "className": ""
    },
    {
        "id": "50e99a6a143f4e11",
        "type": "ui_group",
        "name": "Netz",
        "tab": "8d223fe8c91863a3",
        "order": 1,
        "disp": true,
        "width": "3",
        "collapse": false,
        "className": ""
    },
    {
        "id": "a561eb19b9a8e6bf",
        "type": "ui_group",
        "name": "AC",
        "tab": "8d223fe8c91863a3",
        "order": 2,
        "disp": true,
        "width": "3",
        "collapse": false,
        "className": ""
    },
    {
        "id": "8d223fe8c91863a3",
        "type": "ui_tab",
        "name": "PV",
        "icon": "dashboard",
        "order": 2,
        "disabled": false,
        "hidden": false
    }
]



Mehr Informationen über die Mailingliste volkszaehler-users