ESP8266 with RS485 - read ModBus registry

I’m a beginner and after multiple tries, I was able to read Modbus registry from an energy meter.

How I can read a “double registry” ?

The yaml extras is:
uart:

rx_pin: GPIO3
tx_pin: GPIO1
baud_rate: 115200
stop_bits: 1
data_bits: 8
parity: EVEN
modbus:
flow_control_pin: GPIO16
id: modbus1
modbus_controller:

  • id: sbc
    address: 0x1
    modbus_id: modbus1
    setup_priority: -10
    sensor:
  • platform: modbus_controller
    modbus_controller_id: sbc
    name: “Energy_Total”
    id: sbc_meter_et
    register_type: holding
    address: 28
    unit_of_measurement: “kWh”
    value_type: S_DWORD_R
    filters:
    - multiply: 0.1

  - platform: modbus_controller
    name: "${dev} Active Power Import"
    address: 0x0079
    register_type: read
    value_type: U_DWORD
    register_count: 2
    response_size: 4
    accuracy_decimals: 0
    device_class: power
    unit_of_measurement: "W"

Thanks, but still a I get an error. See below.
In the meter spec is mentionet: address 28-29. For double registers (4 – 5, 16 – 17, 28 – 29, 30 – 31) the high register is sent first (big_Endian).

For the rest of the registry, I need to have in yaml file the adress -1, seems that is starting the counting from 1. To read the voltage o phase_1 (reg:36) I have specified in yaml file 35

28 decimal or hex?

Input or holding?

S_DWORD_R ?
S_DWORD ?

Signed or unSingned?

You need to adapt my example above

01 04 xx is input/read

01 03 xx is holding


Show me a working example

this is working, is reading the Phase 1 voltage

I have changed to holding. Something is reading / returning values now.

Thank you for the support / help

1 Like