Reading registers from electricity meters with modbus

Hello everyone,

I need help with the following issue.

I am trying to read data from a Modbus (RTU) electricity meter with a Raspberry Pi.

So far everything is working fine, I can read almost all values, but I am having problems with the data that starts with high byte 4. I cannot read this data.

Parser nodes are not helpful here, I can display or put the data together, the problem starts earlier when I trying to read from the meter.

Can anyone tell me how I can pass the register addresses to the Modbus node so that I can read the correct data?


In the pictures you can see the extract from the Modbus protocol, I am trying to read the data point (Total import active energy - kWh) that I have marked in red.

This is the first one that starts with high byte = 04. I can read all the data before that without any problems because I specify the address from the low byte.

If anyone can help me to solve this, I would be very grateful.

Here is my flow:

[
    {
        "id": "ff75782aa08979e0",
        "type": "tab",
        "label": "SolarEnergy",
        "disabled": true,
        "info": "",
        "env": []
    },
    {
        "id": "9051f5dae57370cd",
        "type": "calculator",
        "z": "ff75782aa08979e0",
        "name": "",
        "inputMsgField": "payload",
        "outputMsgField": "payload",
        "operation": "div",
        "constant": "100",
        "round": true,
        "truncate": false,
        "decimals": "1",
        "decimals2": "0",
        "x": 990,
        "y": 140,
        "wires": [
            [
                "a5cd1b2b390d5434"
            ]
        ]
    },
    {
        "id": "3a45d53b5996d4cf",
        "type": "change",
        "z": "ff75782aa08979e0",
        "name": "U L1-N",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload[1]",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 830,
        "y": 140,
        "wires": [
            [
                "9051f5dae57370cd"
            ]
        ]
    },
    {
        "id": "98f3b2ce4b960396",
        "type": "modbus-flex-getter",
        "z": "ff75782aa08979e0",
        "name": "",
        "showStatusActivities": false,
        "showErrors": false,
        "showWarnings": true,
        "logIOActivities": false,
        "server": "962209853e7d677b",
        "useIOFile": false,
        "ioFile": "",
        "useIOForPayload": false,
        "emptyMsgOnFail": false,
        "keepMsgProperties": false,
        "delayOnStart": false,
        "startDelayTime": "",
        "x": 410,
        "y": 140,
        "wires": [
            [
                "67d2a2a003d5cdc9"
            ],
            []
        ]
    },
    {
        "id": "5ed8e9a85ae5de3b",
        "type": "inject",
        "z": "ff75782aa08979e0",
        "name": "U L1-N",
        "props": [
            {
                "p": "payload.fc",
                "v": "3",
                "vt": "num"
            },
            {
                "p": "payload.address",
                "v": "0",
                "vt": "str"
            },
            {
                "p": "payload.quantity",
                "v": "2",
                "vt": "str"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "1",
        "crontab": "",
        "once": true,
        "onceDelay": 0.1,
        "topic": "U L1-N",
        "x": 160,
        "y": 140,
        "wires": [
            [
                "98f3b2ce4b960396"
            ]
        ]
    },
    {
        "id": "67d2a2a003d5cdc9",
        "type": "switch",
        "z": "ff75782aa08979e0",
        "name": "",
        "property": "topic",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "Frequence",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "U L1-N",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "U L2-N",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "U L3-N",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "U L1-L2",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "U L2-L3",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "U L3-L1",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "I L1",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "I L2",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "I L3",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "P Total kW",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "P Total kWh",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 12,
        "x": 590,
        "y": 180,
        "wires": [
            [
                "15a4989d8d524bb4"
            ],
            [
                "3a45d53b5996d4cf"
            ],
            [
                "986eb19e56a922ec"
            ],
            [
                "463460eeae0bb5f7"
            ],
            [],
            [],
            [],
            [
                "65ef76be200453a0"
            ],
            [
                "2f57bb8451e1db52"
            ],
            [
                "7d117361ad639ca3"
            ],
            [
                "473c10b1a03ee3f4"
            ],
            [
                "a00435790d614fe1"
            ]
        ]
    },
    {
        "id": "12bc9bc833183e3e",
        "type": "inject",
        "z": "ff75782aa08979e0",
        "name": "U L2-N",
        "props": [
            {
                "p": "payload.fc",
                "v": "3",
                "vt": "num"
            },
            {
                "p": "payload.address",
                "v": "2",
                "vt": "str"
            },
            {
                "p": "payload.quantity",
                "v": "2",
                "vt": "str"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "1",
        "crontab": "",
        "once": true,
        "onceDelay": 0.1,
        "topic": "U L2-N",
        "x": 160,
        "y": 180,
        "wires": [
            [
                "98f3b2ce4b960396"
            ]
        ]
    },
    {
        "id": "233b3b9ee7c20322",
        "type": "inject",
        "z": "ff75782aa08979e0",
        "name": "U L3-N",
        "props": [
            {
                "p": "payload.fc",
                "v": "3",
                "vt": "num"
            },
            {
                "p": "payload.address",
                "v": "4",
                "vt": "str"
            },
            {
                "p": "payload.quantity",
                "v": "2",
                "vt": "str"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "1",
        "crontab": "",
        "once": true,
        "onceDelay": 0.1,
        "topic": "U L3-N",
        "x": 160,
        "y": 220,
        "wires": [
            [
                "98f3b2ce4b960396"
            ]
        ]
    },
    {
        "id": "986eb19e56a922ec",
        "type": "change",
        "z": "ff75782aa08979e0",
        "name": "U L2-N",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload[1]",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 830,
        "y": 180,
        "wires": [
            [
                "d009a1e467322de3"
            ]
        ]
    },
    {
        "id": "463460eeae0bb5f7",
        "type": "change",
        "z": "ff75782aa08979e0",
        "name": "U L3-N",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload[1]",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 830,
        "y": 220,
        "wires": [
            [
                "ac76f4f7ba9b05d8"
            ]
        ]
    },
    {
        "id": "0901326aac54e170",
        "type": "inject",
        "z": "ff75782aa08979e0",
        "name": "Frequence",
        "props": [
            {
                "p": "payload.fc",
                "v": "3",
                "vt": "num"
            },
            {
                "p": "payload.address",
                "v": "42",
                "vt": "str"
            },
            {
                "p": "payload.quantity",
                "v": "1",
                "vt": "str"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "60",
        "crontab": "",
        "once": true,
        "onceDelay": 0.1,
        "topic": "Frequence",
        "x": 170,
        "y": 80,
        "wires": [
            [
                "98f3b2ce4b960396"
            ]
        ]
    },
    {
        "id": "15a4989d8d524bb4",
        "type": "calculator",
        "z": "ff75782aa08979e0",
        "name": "",
        "inputMsgField": "payload",
        "outputMsgField": "payload",
        "operation": "div",
        "constant": "100",
        "round": true,
        "truncate": false,
        "decimals": "1",
        "decimals2": "0",
        "x": 990,
        "y": 80,
        "wires": [
            [
                "d158c7e95eabff97"
            ]
        ]
    },
    {
        "id": "d009a1e467322de3",
        "type": "calculator",
        "z": "ff75782aa08979e0",
        "name": "",
        "inputMsgField": "payload",
        "outputMsgField": "payload",
        "operation": "div",
        "constant": "100",
        "round": true,
        "truncate": false,
        "decimals": "1",
        "decimals2": "0",
        "x": 990,
        "y": 180,
        "wires": [
            [
                "164a159f9fc54d5f"
            ]
        ]
    },
    {
        "id": "ac76f4f7ba9b05d8",
        "type": "calculator",
        "z": "ff75782aa08979e0",
        "name": "",
        "inputMsgField": "payload",
        "outputMsgField": "payload",
        "operation": "div",
        "constant": "100",
        "round": true,
        "truncate": false,
        "decimals": "1",
        "decimals2": "0",
        "x": 990,
        "y": 220,
        "wires": [
            [
                "e80fa33c2d7ef985"
            ]
        ]
    },
    {
        "id": "6392457acb8ea696",
        "type": "inject",
        "z": "ff75782aa08979e0",
        "name": "I L1",
        "props": [
            {
                "p": "payload.fc",
                "v": "3",
                "vt": "num"
            },
            {
                "p": "payload.address",
                "v": "6",
                "vt": "str"
            },
            {
                "p": "payload.quantity",
                "v": "2",
                "vt": "str"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "1",
        "crontab": "",
        "once": true,
        "onceDelay": 0.1,
        "topic": "I L1",
        "x": 150,
        "y": 420,
        "wires": [
            [
                "98f3b2ce4b960396"
            ]
        ]
    },
    {
        "id": "22f64db37abaa2ed",
        "type": "inject",
        "z": "ff75782aa08979e0",
        "name": "I L2",
        "props": [
            {
                "p": "payload.fc",
                "v": "3",
                "vt": "num"
            },
            {
                "p": "payload.address",
                "v": "8",
                "vt": "str"
            },
            {
                "p": "payload.quantity",
                "v": "2",
                "vt": "str"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "1",
        "crontab": "",
        "once": true,
        "onceDelay": 0.1,
        "topic": "I L2",
        "x": 150,
        "y": 460,
        "wires": [
            [
                "98f3b2ce4b960396"
            ]
        ]
    },
    {
        "id": "9fc03fa637f62783",
        "type": "inject",
        "z": "ff75782aa08979e0",
        "name": "I L3",
        "props": [
            {
                "p": "payload.fc",
                "v": "3",
                "vt": "num"
            },
            {
                "p": "payload.address",
                "v": "10",
                "vt": "str"
            },
            {
                "p": "payload.quantity",
                "v": "2",
                "vt": "str"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "1",
        "crontab": "",
        "once": true,
        "onceDelay": 0.1,
        "topic": "I L3",
        "x": 150,
        "y": 500,
        "wires": [
            [
                "98f3b2ce4b960396"
            ]
        ]
    },
    {
        "id": "65ef76be200453a0",
        "type": "change",
        "z": "ff75782aa08979e0",
        "name": "I L1",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload[1]",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 830,
        "y": 540,
        "wires": [
            [
                "6c9bc202e252705b"
            ]
        ]
    },
    {
        "id": "2f57bb8451e1db52",
        "type": "change",
        "z": "ff75782aa08979e0",
        "name": "I L2",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload[1]",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 830,
        "y": 580,
        "wires": [
            [
                "887a8b2b9530bce8"
            ]
        ]
    },
    {
        "id": "7d117361ad639ca3",
        "type": "change",
        "z": "ff75782aa08979e0",
        "name": "I L3",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload[1]",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 830,
        "y": 620,
        "wires": [
            [
                "2d1d9debe54d556f"
            ]
        ]
    },
    {
        "id": "6c9bc202e252705b",
        "type": "calculator",
        "z": "ff75782aa08979e0",
        "name": "",
        "inputMsgField": "payload",
        "outputMsgField": "payload",
        "operation": "div",
        "constant": "1000",
        "round": true,
        "truncate": false,
        "decimals": "2",
        "decimals2": "0",
        "x": 990,
        "y": 540,
        "wires": [
            [
                "ad5f1f1642be57e0"
            ]
        ]
    },
    {
        "id": "887a8b2b9530bce8",
        "type": "calculator",
        "z": "ff75782aa08979e0",
        "name": "",
        "inputMsgField": "payload",
        "outputMsgField": "payload",
        "operation": "div",
        "constant": "1000",
        "round": true,
        "truncate": false,
        "decimals": "2",
        "decimals2": "0",
        "x": 990,
        "y": 580,
        "wires": [
            [
                "589da2be429d143e"
            ]
        ]
    },
    {
        "id": "2d1d9debe54d556f",
        "type": "calculator",
        "z": "ff75782aa08979e0",
        "name": "",
        "inputMsgField": "payload",
        "outputMsgField": "payload",
        "operation": "div",
        "constant": "1000",
        "round": true,
        "truncate": false,
        "decimals": "2",
        "decimals2": "0",
        "x": 990,
        "y": 620,
        "wires": [
            [
                "8ed1978b95e93119"
            ]
        ]
    },
    {
        "id": "8e5b0d5645345a24",
        "type": "inject",
        "z": "ff75782aa08979e0",
        "name": "P Total kW",
        "props": [
            {
                "p": "payload.fc",
                "v": "3",
                "vt": "num"
            },
            {
                "p": "payload.address",
                "v": "44",
                "vt": "str"
            },
            {
                "p": "payload.quantity",
                "v": "2",
                "vt": "str"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "1",
        "crontab": "",
        "once": true,
        "onceDelay": 0.1,
        "topic": "P Total kW",
        "x": 130,
        "y": 560,
        "wires": [
            [
                "98f3b2ce4b960396"
            ]
        ]
    },
    {
        "id": "473c10b1a03ee3f4",
        "type": "change",
        "z": "ff75782aa08979e0",
        "name": "P Total kW",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload[1]",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 850,
        "y": 680,
        "wires": [
            [
                "28abad2e73c5a98c"
            ]
        ]
    },
    {
        "id": "28abad2e73c5a98c",
        "type": "calculator",
        "z": "ff75782aa08979e0",
        "name": "",
        "inputMsgField": "payload",
        "outputMsgField": "payload",
        "operation": "div",
        "constant": "1000",
        "round": true,
        "truncate": false,
        "decimals": "3",
        "decimals2": "0",
        "x": 990,
        "y": 680,
        "wires": [
            [
                "3a3d65cb7245a748"
            ]
        ]
    },
    {
        "id": "c6cd39a84d9ec8ce",
        "type": "inject",
        "z": "ff75782aa08979e0",
        "name": "P Total kWh",
        "props": [
            {
                "p": "payload.fc",
                "v": "3",
                "vt": "num"
            },
            {
                "p": "payload.address",
                "v": "0",
                "vt": "str"
            },
            {
                "p": "payload.quantity",
                "v": "4",
                "vt": "str"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": true,
        "onceDelay": 0.1,
        "topic": "P Total kWh",
        "x": 130,
        "y": 620,
        "wires": [
            [
                "98f3b2ce4b960396"
            ]
        ]
    },
    {
        "id": "a00435790d614fe1",
        "type": "change",
        "z": "ff75782aa08979e0",
        "name": "P Total kWh",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload[1]",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 850,
        "y": 740,
        "wires": [
            [
                "75e1236e34a0de17"
            ]
        ]
    },
    {
        "id": "75e1236e34a0de17",
        "type": "calculator",
        "z": "ff75782aa08979e0",
        "name": "",
        "inputMsgField": "payload",
        "outputMsgField": "payload",
        "operation": "div",
        "constant": "100",
        "round": true,
        "truncate": false,
        "decimals": "2",
        "decimals2": "0",
        "x": 990,
        "y": 740,
        "wires": [
            [
                "07091b4e2233fb2b"
            ]
        ]
    },
    {
        "id": "d158c7e95eabff97",
        "type": "debug",
        "z": "ff75782aa08979e0",
        "name": "debug 1",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1160,
        "y": 80,
        "wires": []
    },
    {
        "id": "a5cd1b2b390d5434",
        "type": "debug",
        "z": "ff75782aa08979e0",
        "name": "debug 2",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1160,
        "y": 140,
        "wires": []
    },
    {
        "id": "164a159f9fc54d5f",
        "type": "debug",
        "z": "ff75782aa08979e0",
        "name": "debug 3",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1160,
        "y": 180,
        "wires": []
    },
    {
        "id": "e80fa33c2d7ef985",
        "type": "debug",
        "z": "ff75782aa08979e0",
        "name": "debug 4",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1160,
        "y": 220,
        "wires": []
    },
    {
        "id": "ad5f1f1642be57e0",
        "type": "debug",
        "z": "ff75782aa08979e0",
        "name": "debug 8",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1160,
        "y": 540,
        "wires": []
    },
    {
        "id": "589da2be429d143e",
        "type": "debug",
        "z": "ff75782aa08979e0",
        "name": "debug 9",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1160,
        "y": 580,
        "wires": []
    },
    {
        "id": "8ed1978b95e93119",
        "type": "debug",
        "z": "ff75782aa08979e0",
        "name": "debug 10",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1160,
        "y": 620,
        "wires": []
    },
    {
        "id": "3a3d65cb7245a748",
        "type": "debug",
        "z": "ff75782aa08979e0",
        "name": "debug 11",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1160,
        "y": 680,
        "wires": []
    },
    {
        "id": "07091b4e2233fb2b",
        "type": "debug",
        "z": "ff75782aa08979e0",
        "name": "debug 12",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1160,
        "y": 740,
        "wires": []
    },
    {
        "id": "962209853e7d677b",
        "type": "modbus-client",
        "name": "MainEnergy",
        "clienttype": "serial",
        "bufferCommands": true,
        "stateLogEnabled": false,
        "queueLogEnabled": false,
        "failureLogEnabled": true,
        "tcpHost": "127.0.0.1",
        "tcpPort": "502",
        "tcpType": "DEFAULT",
        "serialPort": "/dev/ttyAMA0",
        "serialType": "RTU",
        "serialBaudrate": "9600",
        "serialDatabits": "8",
        "serialStopbits": "1",
        "serialParity": "none",
        "serialConnectionDelay": "100",
        "serialAsciiResponseStartDelimiter": "0x3A",
        "unit_id": 2,
        "commandDelay": 1,
        "clientTimeout": 1000,
        "reconnectOnTimeout": true,
        "reconnectTimeout": 2000,
        "parallelUnitIdsAllowed": true,
        "showErrors": false,
        "showWarnings": true,
        "showLogs": true
    }
]

WIthout Importing your Flow

04x00 (Hex) transtlates to 1024 in Decimal

Are you specifiying Hex or decimals registers when making the call ?

Its quite unusual for meters (although a lot of chinese manufacturers do not follow norms) to start at register Zero - usually they are in the 3000 or 30000 range

Can you post a picture of the modbus flexgetter config ?

Craig

Hello Craig,

thanks so much for the answer.
1024 was the correct setting. Now is working and I understand much more about Modbus.

Here is the Flex Getter setting.

Agian, thanks a lot.

Have a nice week.

Luis

Excellent thanks for letting up know - please mark as the solution so others can find it if required

Craig

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.