Modbus Issues in NodeRed

Greetings!
I am having trouble with my NodeRed Modbus connections - it says it’s active and one of them works but others don’t - the issue appears at the energy meter usage part which is id “4168b5817e8c8409” and on. It succesfully reads the output from the Modbus for the first energy meter but each one after doesn’t seem to function and im not sure why… The module for the ethernet connection is GW-2215i from ICPDAS.

MY CODE:

I recently had similar issues with modbus sensors created in home assistant. I have created a flow to call the modbus.reload action.

Modbus can only have connection with one server. You may also try change the IP address for your module.

You can try download the ModbusPoll software and check if it connects and pings.

I am not sure how to change the IP - so i’m reading energy meters as shown in this picture:


And the data incoming are slave id’s which i THINK are 10,20,30,40,50 as was preset by the student before me.

Now the issue is that the first one actually loads the usage, voltage, amperage but it updates very slowly - whilst the 2nd energy meter it shows only voltage and amperage every 10mins+~, the 3-5 meters don’t even show up anything…

The program was left the same, ethernet cables are the same, nothing was changed except the PC in the server room & the program where i added home assistant sensor nodes.

I also seem to not have the “MODBUS:RELOAD” option under developer tools… Is that because it’s disconnected right now (using the Tiny Lenovo it doesn’t have dual ETHERNET input - we are waiting on an ordered ETH->USB)

Edit: I’ve also tried removing the sensors from the node-red program (home assistant ones) and it didn’t impact it, just kept being buggy. Since i’m using bit older equipment i am only able to change the device’s ip (the icpdas gw2215i for example) and they have some weird way of setting up the slave id’s

To change the Device IP, that would be done in your router.

Seeming you are getting readings from the device I would suggest that one of your nodes has established a Modbus connection.

Can you share a screen shot of your NodeRED flow.

You can only establish one Modbus Connection at a time with the same device. i.e. One Modbus node. The Slave Sensor Data will be extracted from the Modbus connection.

I have not used Modbus in NodeRED but have a Modbus sensor configured in configuation.yaml the service modbus.reload probably shows up in my instance.

My sensor configuration is below.

# Modbus LinknLink
modbus:
  - name: "modbus_tcp"
    type: tcp
    host: 192.168.1.207
    port: 502
    delay: 2
    timeout: 60

    sensors:
# First TH Sensor (Add 13 to Address)
      - name: "Master Bedroom eTHs2 Temperature"
        unique_id: 03a7f129-6f1c-45fd-913b-eea2e7134b9f
        device_class: temperature
        state_class: measurement
        slave: 1
        address: 3008
        input_type: holding
        data_type: int16
        scale: 0.01
        precision: 1
        unit_of_measurement: '°C'
        scan_interval: 30

      - name: "Master Bedroom eTHs2 Humidity"
        unique_id: acc8eb6b-149f-4470-b8c4-1f5e3fa062b0
        device_class: humidity
        state_class: measurement
        slave: 1
        address: 3009
        input_type: holding
        data_type: int16
        scale: 0.01
        precision: 1
        unit_of_measurement: '%'
        scan_interval: 35

      - name: "Master Bedroom eTHS2 Battery"
        unique_id: 914e3ea6-4ce4-413b-8656-4ab4600dc04c
        device_class: battery
        slave: 1
        address: 3010
        input_type: holding
        data_type: int16
        unit_of_measurement: '%'
        scan_interval: 40

      - name: "Master Bedroom eTHS2 Status"
        unique_id: d048adb6-0799-409b-be15-37cebb7769e0
        slave: 1
        address: 3012
        input_type: holding
        data_type: int16
        scan_interval: 60

# Second TH Sensor (Add 13 to Address)
      - name: "Master Bathroom eTHs2 Temperature"
        unique_id: 1ee44874-70e6-4555-9bfe-eefa13f7d5ba
        device_class: temperature
        state_class: measurement
        slave: 1
        address: 3021
        input_type: holding
        data_type: int16
        scale: 0.01
        precision: 1
        unit_of_measurement: "°C"
        scan_interval: 30

      - name: "Master Bathroom eTHs2 Humidity"
        unique_id: 576eb858-031f-4303-8bd9-3a6fea45a40f
        device_class: humidity
        state_class: measurement
        slave: 1
        address: 3022
        input_type: holding
        data_type: int16
        scale: 0.01
        precision: 1
        unit_of_measurement: "%"
        scan_interval: 35

      - name: "Master Bathroom eTHs2 Battery"
        unique_id: 3b2f5314-cf26-4c01-bcc1-857b775df75f
        device_class: battery
        slave: 1
        address: 3023
        input_type: holding
        data_type: int16
        unit_of_measurement: "%"
        scan_interval: 40

      - name: "Master Bathroom eTHs2 Status"
        unique_id: 02f7cb43-b53e-4370-b0f7-e5764996cffc
        slave: 1
        address: 3025
        input_type: holding
        data_type: int16
        scan_interval: 60

# Second TH Sensor (Add 13 to Address)
      - name: "Roof eTHs2 Temperature"
        unique_id: f6413747-7fc7-41ba-a3fc-db35fddcc510
        device_class: temperature
        state_class: measurement
        slave: 1
        address: 3034
        input_type: holding
        data_type: int16
        scale: 0.01
        precision: 1
        unit_of_measurement: "°C"
        scan_interval: 30

      - name: "Roof eTHs2 Humidity"
        unique_id: e43162a7-f285-4dc7-82ca-67c3a1ad10fd
        device_class: humidity
        state_class: measurement
        slave: 1
        address: 3035
        input_type: holding
        data_type: int16
        scale: 0.01
        precision: 1
        unit_of_measurement: "%"
        scan_interval: 35

      - name: "Roof eTHs2 Battery"
        unique_id: b37f60fe-90b5-4a99-9516-7f5cbd9fc0fa
        device_class: battery
        slave: 1
        address: 3036
        input_type: holding
        data_type: int16
        unit_of_measurement: "%"
        scan_interval: 40

      - name: "Roof eTHs2 Status"
        unique_id: ca2ec55e-89d9-43db-904b-09847403b24c
        slave: 1
        address: 3038
        input_type: holding
        data_type: int16
        scan_interval: 60

If, as your post suggests, you are indeed a student undertaking an exercise last done by a previous student, I would like to suggest that you don’t assume that it was all left / is now in a working state, and also that the whole point of a student exercise is for the student to do the work so as to learn.

Your ICPDAS GW2215i is an industrial grade TCP-RS485 Modbus gateway. The ISKRA WM3x6 are industrial grade three-phase meters with Modbus and M-bus connectivity.

It took me less than five minutes to find the user manuals for both online. I grant you that these are in English, but nevertheless reading the user manual will give you much of the information you require.

The ICPDAS is a powerful device, and the manufacturer provides an eSearch tool that finds any device on the local network, and provides access to the web setting page, in which the gateway IP address can be checked/set to static. I have used the ‘tiny’ version of this device, and the settings page is comprehensive and it is worth checking all the settings. There is typically a ‘caching’ option, which internally buffers Modbus reads so as to reduce traffic on the bus.

The meters are intended to be configured when connected directly to a PC, however most devices of this nature have a simple menu accessible from the setting button and lcd screen that enables checking and setting the Modbus device ID. You should naturally ensure also that the serial settings for both gateway and meters match (bits, stop bit, baud rate).

For myself, I would also check the Modbus wiring and terminating/biasing resistors. These are not essential for short runs, but in an electrically noisy system terminating resistors are a very sensible idea.

Node-RED and Modbus generally work together very well. You require a (one) Modbus-client configuration node to connect to the gateway. Unlike HA, in Node-RED you can have more than one client node connected to different gateways. Your provided Node-RED flow appears to be the entire dump of all flow tabs. Analysis shows 194 configuration nodes, and loading your flow into my Node-RED would bring all of these, unwelcome additions. Configuration nodes can really mess with existing systems, and usually have to be manually removed (they are not automatically removed when flow nodes are deleted) so importing your flow would not be a good idea. I would like to suggest that you tidy the existing Node-RED arrangement, and when future sharing please extract only the relevant sequence of nodes. Removing the Home Assistant server configuration node first is also highly beneficial to anyone attempting to upload your flow. Duplicating Home Assistant server configuration nodes causes problems. The scrubber tool is easy to use.

Yes, your entire flow-set has six Modbus-client nodes [and none of which I want added to my existing Node-RED by importing your flow] each with a different IP address. Perhaps the result of student after student doing a bit more each time, without anyone have the inclination to remove old unwanted stuff first/after. Sometimes you really do have to just remove old stuff or start again from a blank canvas.

The meter manuals give the full register map. It takes very little effort to send a simple Modbus read to get the Serial Number from any meter, and not much to write a simple array-split that sends reads to all 1-255 device addresses. Anything not there will timeout and anything that is should respond - hence easy to scan for all meters to see if they are indeed there and responding.

After that you can check that you can retrieve the meter values required from the correct registers using each meter Modbus ID, and then you can start to think how best to consolidate and move the data to Home Assistant.

Good luck with your assignment.

1 Like