ESPHome ModBus decoding

hello,
I want to retrieve data from an Imeon inverter with ESPHome32 by the Modbus rtu protocol, the manufacturer has provided me with the documentation.
with this one I can see my frames and view the data with the software "Qmodmaster’

two examples:
with manufacturer doc > frames sent and received by qmodmaster and ESPHome logs
serial number recovery

1 serial number recovery

Frames I retrieve with qmodmaster
[RTU]>Tx > 18:45:38:609 - 01 03 00 01 00 04 15 C9
[RTU]>Rx > 18:45:38:857 - 01 03 08 00 00 50 5D 2D 3C 7F EF DC 96

Frames by ESPHome with custom_command
[21:51:27][D][uart_debug:114]: >>> 01:03:00:01:00:04:15:C9:00
[21:51:27][D][modbus_controller:032]: Modbus command to device=1 register=0xE828 countdown=0 no response received - removed from send queue

Voltage recovery:

Frames I retrieve with qmodmaster
[RTU]>Tx > 18:46:04:110 - 01 03 01 00 00 01 85 F6
[RTU]>Rx > 18:46:04:110 - 01 03 02 09 41 7E 24

Frames by ESPHome: with custom_command
[14:35:01][D][uart_debug:114]: >>> 01:03:01:00:00:01:85:F6:00
[14:35:01][D][modbus_controller:032]: Modbus command to device=1 register=0xAB13 countdown=0 no response received - removed from send queue

we see that ESPHome sends: 00 more at the end of the frame
I don’t know if this is normal!

here is my ESPHome code:

uart:
  id: mod_bus
  tx_pin: 17
  rx_pin: 16
  
  baud_rate: 9600
  stop_bits: 1
  debug:
  
modbus:
  
  flow_control_pin: 5
  id: modbus1

modbus_controller:
  - id: imeon
    ## the Modbus device addr
    address: 0x01
    modbus_id: modbus1
    setup_priority: -10

sensor:
  - platform: modbus_controller
    modbus_controller_id: imeon
    name: "serial number"
    id: serial_number
    custom_command: [ 0x01, 0x03, 0x00, 0x01, 0x00, 0x04, 0x15 ]
    value_type: U_QWORD_R
    
  - platform: modbus_controller
    modbus_controller_id: imeon
    name: "Voltage"
    id: voltage
    custom_command: [ 0x01, 0x03, 0x01, 0x00, 0x00, 0x01, 0x85 ]
    value_type: U_WORD
    unit_of_measurement: V

value_type: I don’t know if it’s good but somehow I don’t get a response from the inverter
I hope I was clear in my request.
Thank you for your answers

be indulgent towards my English I do the French / English translation with google translate

Hi, I just solved the same error (no response received - removed from send queue) and finally changing the send_wait_time parameter helped me.

modbus:
  send_wait_time: 500ms
  flow_control_pin: 5
  id: modbus1

But your case will probably be different. I think you’re sending the modbus query the wrong way.
Do you realy need to send custom_command? I’ve modified the code I’m using, so hopefully it will work for you.

sensor:
  - platform: modbus_controller
    modbus_controller_id: imeon
    id: voltage
    name: "AC Grid voltage"
    address: 0x0100
    unit_of_measurement: "V"
    icon: mdi:sine-wave
    register_type: holding #or register_type: read
    value_type: U_WORD
    accuracy_decimals: 1
    filters:
      - multiply: 0.01

Also look at the modbus specification in esphome.

Hello;
Thank you for your reply
I try your code and let you know
thank you

1 Like

Hello,
your code works
thank you

Is it possible to recive data from Modbus TCP with esphome?

Hi Imornet,

It is possible to share with me the Modbus rtu protocol documentation that IMEON provided you ?

With best regards,
Dan