EPever Modbus RTU

Has anyone setup a Modbus conenction using RTU (serial port to USB) and been able to read the sensors? I have seen sucess using the WiFi01 module, but I wanted the hardwired solution. I am using Proxmox and have mapped the USB port (as I have for my Zigbee), but I am getting 2 errors:

Pymodbus: Solar: Modbus Error: [Input/Output] Modbus Error: [Invalid Message] No response received, expected at least 2 bytes (0 received)

and the error which may just be because of the first one is:

* EPEver_power_charge_month with int is not valid, trying to convert
Etc

My Config

modbus:
  - name: Solar
    delay: 5
    close_comm_on_error: true
    retry_on_empty: true
    retries: 10
    type: serial
    baudrate: 115200
    bytesize: 8
    method: rtu
    parity: N
    port: /dev/ttyACM1
    stopbits: 1
    sensors:
      - name: EPEver_Solar_Voltage #3100
        scan_interval: 30
        unit_of_measurement: V
        slave: 1
        address: 12544
        input_type: input
        scale: 0.01
        precision: 2
continued with other sensors...
1 Like

Are you sure you have the correct settings for the serial port? E.g. baudrate and parity.

EPever

I think so, this is the guide in the manual, but let me know if it doesnt look right.

Thanks,

Is /dev/ttyACM1 the correct device? Try searching for /dev/ttyACM1 in dmesg to see which device is attached to it.

Maybe try enabling debug logging for Pymodbus to see what exactly is going on.

logger:
  default: warning
  logs:
    pymodbus: debug

I do have exactly the same problem; the issue occurred with one of the last updates (I am actually on Home Assistant 2021.9.6):

2021-09-19 16:11:09 WARNING (MainThread) [homeassistant.components.modbus.validators] stie_ist_temp_fe7_501 with int is not valid, trying to convert


- name: wpc10
  type: tcp
  host: 192.xxx.yyy.zzz
  port: yyy
# 

  sensors: 
 # scan_interval: 20
    - name: stie_ist_temp_fe7_501
   #   hub: wpc10
      unit_of_measurement: °C
      slave: 1
      address: 500
      count: 1
      precision: 1
      scale: 0.1
      input_type: input
  #    data_type: int

works in old releases without any issues.

dmesg doesnt doesnt give me any results for /dev/ttyACM1 or ttyACM1. I am typing dmesg | grep ttyAMC1 is that correct?

image

I had heard there was some changes to Modbus and for other adding

    close_comm_on_error: true
    retry_on_empty: true
    retries: 10

seems to have solved their issues, but I think my issues arnt the sensors.

Out of interest, what hardware do you use to connect to it? I ideally want a wired connection.

Have you tried enabling debug log for pymodbus? That should give us a clue as to why it’s failing.

tried pymodbus debug; doesn‘t enlight anything; hardware is a stiebel eltron heatpump with modbus interface; all wired; i do get sensor values via modbus, just getting this ha warnings. tnx

I am getting similar issue also but mine is over TCP using elfin ew11.
My config

modbus:
- type: tcp
  name: ew11
  host: 192.168.5.249
  port: 502
  close_comm_on_error: false
  timeout: 9
  retry_on_empty: true
  retries: 10
  sensors:
    - name: "Solar Battery Remaining Capacity"
      address: 12570
      slave: 0
      data_type: uint
      input_type: input
      unit_of_measurement: '%'
      scale: 0.1
      precision: 2
      scan_interval: 10
    - name: "Solar Battery Status"
      address: 12800
      slave: 0
      data_type: uint
      input_type: input
      scale: 0.1
      precision: 2
      scan_interval: 10

First this appears

Logger: homeassistant.components.modbus.validators
Source: components/modbus/validators.py:97
Integration: Modbus (documentation, issues)
First occurred: 6:23:54 PM (4 occurrences)
Last logged: 6:23:54 PM

Solar Battery Remaining Capacity with uint is not valid, trying to convert
Solar Battery Status with uint is not valid, trying to convert

Then this follows

Logger: homeassistant.components.modbus.modbus
Source: components/modbus/modbus.py:250
Integration: Modbus (documentation, issues)
First occurred: 6:32:24 PM (1 occurrences)
Last logged: 6:32:24 PM

Pymodbus: ew11: Modbus Error: [Input/Output] Modbus Error: [Invalid Message] No response received, expected at least 8 bytes (0 received)

Yeah it seems like I am not getting any response back. It seems to repeat the below but here is a section of the logs:

2021-09-23 09:36:16 DEBUG (SyncWorker_32) [pymodbus.transaction] No response received, Expected 7 bytes Recieved 0 bytes !!!!
2021-09-23 09:36:16 DEBUG (SyncWorker_32) [pymodbus.transaction] Changing transaction state from 'WAITING FOR REPLY' to 'PROCESSING REPLY'
2021-09-23 09:36:16 DEBUG (SyncWorker_32) [pymodbus.transaction] RECV:
2021-09-23 09:36:16 DEBUG (SyncWorker_32) [pymodbus.transaction] Retry on empty response - 2
2021-09-23 09:36:16 DEBUG (SyncWorker_32) [pymodbus.transaction] Changing transaction state from 'WAITING_FOR_REPLY' to 'RETRYING'
2021-09-23 09:36:16 DEBUG (SyncWorker_32) [pymodbus.transaction] Sleeping 0.3
2021-09-23 09:36:16 DEBUG (SyncWorker_32) [pymodbus.transaction] SEND: 0x1 0x4 0x31 0x0 0x0 0x1 0x3f 0x36
2021-09-23 09:36:19 DEBUG (SyncWorker_32) [pymodbus.client.sync] New Transaction state 'SENDING'
2021-09-23 09:36:19 DEBUG (SyncWorker_32) [pymodbus.transaction] Changing transaction state from 'SENDING' to 'WAITING FOR REPLY'
2021-09-23 09:36:22 DEBUG (SyncWorker_32) [pymodbus.transaction] No response received, Expected 7 bytes Recieved 0 bytes !!!!
2021-09-23 09:36:22 DEBUG (SyncWorker_32) [pymodbus.transaction] Changing transaction state from 'WAITING FOR REPLY' to 'PROCESSING REPLY'
2021-09-23 09:36:22 DEBUG (SyncWorker_32) [pymodbus.transaction] RECV:
2021-09-23 09:36:22 DEBUG (SyncWorker_32) [pymodbus.transaction] Retry on empty response - 1
2021-09-23 09:36:22 DEBUG (SyncWorker_32) [pymodbus.transaction] Changing transaction state from 'WAITING_FOR_REPLY' to 'RETRYING'
2021-09-23 09:36:23 DEBUG (SyncWorker_32) [pymodbus.transaction] Sleeping 0.6
2021-09-23 09:36:23 DEBUG (SyncWorker_32) [pymodbus.transaction] SEND: 0x1 0x4 0x31 0x0 0x0 0x1 0x3f 0x36
2021-09-23 09:36:26 DEBUG (SyncWorker_32) [pymodbus.client.sync] New Transaction state 'SENDING'
2021-09-23 09:36:26 DEBUG (SyncWorker_32) [pymodbus.transaction] Changing transaction state from 'SENDING' to 'WAITING FOR REPLY'
2021-09-23 09:36:29 DEBUG (SyncWorker_32) [pymodbus.transaction] No response received, Expected 7 bytes Recieved 0 bytes !!!!
2021-09-23 09:36:29 DEBUG (SyncWorker_32) [pymodbus.transaction] Changing transaction state from 'WAITING FOR REPLY' to 'PROCESSING REPLY'
2021-09-23 09:36:29 DEBUG (SyncWorker_32) [pymodbus.transaction] RECV:
2021-09-23 09:36:29 DEBUG (SyncWorker_32) [pymodbus.framer.rtu_framer] Frame - [b''] not ready
2021-09-23 09:36:29 DEBUG (SyncWorker_32) [pymodbus.transaction] Getting transaction 1
2021-09-23 09:36:29 DEBUG (SyncWorker_32) [pymodbus.transaction] Changing transaction state from 'PROCESSING REPLY' to 'TRANSACTION_COMPLETE'
2021-09-23 09:36:43 DEBUG (SyncWorker_0) [pymodbus.transaction] Current transaction state - TRANSACTION_COMPLETE
2021-09-23 09:36:43 DEBUG (SyncWorker_0) [pymodbus.transaction] Running transaction 2019
2021-09-23 09:36:43 DEBUG (SyncWorker_0) [pymodbus.transaction] SEND: 0x1 0x4 0x31 0x0 0x0 0x1 0x3f 0x36
2021-09-23 09:36:43 DEBUG (SyncWorker_0) [pymodbus.framer.rtu_framer] Changing state to IDLE - Last Frame End - None, Current Time stamp - 1632386203.040188
2021-09-23 09:36:43 DEBUG (SyncWorker_0) [pymodbus.client.sync] New Transaction state 'SENDING'
2021-09-23 09:36:43 DEBUG (SyncWorker_0) [pymodbus.transaction] Changing transaction state from 'SENDING' to 'WAITING FOR REPLY'
2021-09-23 09:36:46 DEBUG (SyncWorker_0) [pymodbus.transaction] No response received, Expected 7 bytes Recieved 0 bytes !!!!
2021-09-23 09:36:46 DEBUG (SyncWorker_0) [pymodbus.transaction] Changing transaction state from 'WAITING FOR REPLY' to 'PROCESSING REPLY'
2021-09-23 09:36:46 DEBUG (SyncWorker_0) [pymodbus.transaction] RECV:
2021-09-23 09:36:46 DEBUG (SyncWorker_0) [pymodbus.transaction] Retry on empty response - 2
2021-09-23 09:36:46 DEBUG (SyncWorker_0) [pymodbus.transaction] Changing transaction state from 'WAITING_FOR_REPLY' to 'RETRYING'
2021-09-23 09:36:46 DEBUG (SyncWorker_0) [pymodbus.transaction] Sleeping 0.3
2021-09-23 09:36:46 DEBUG (SyncWorker_0) [pymodbus.transaction] SEND: 0x1 0x4 0x31 0x0 0x0 0x1 0x3f 0x36
2021-09-23 09:36:49 DEBUG (SyncWorker_0) [pymodbus.client.sync] New Transaction state 'SENDING'
2021-09-23 09:36:49 DEBUG (SyncWorker_0) [pymodbus.transaction] Changing transaction state from 'SENDING' to 'WAITING FOR REPLY'
2021-09-23 09:36:52 DEBUG (SyncWorker_0) [pymodbus.transaction] No response received, Expected 7 bytes Recieved 0 bytes !!!!
2021-09-23 09:36:52 DEBUG (SyncWorker_0) [pymodbus.transaction] Changing transaction state from 'WAITING FOR REPLY' to 'PROCESSING REPLY'
2021-09-23 09:36:52 DEBUG (SyncWorker_0) [pymodbus.transaction] RECV:
2021-09-23 09:36:52 DEBUG (SyncWorker_0) [pymodbus.transaction] Retry on empty response - 1
2021-09-23 09:36:52 DEBUG (SyncWorker_0) [pymodbus.transaction] Changing transaction state from 'WAITING_FOR_REPLY' to 'RETRYING'
2021-09-23 09:36:53 DEBUG (SyncWorker_0) [pymodbus.transaction] Sleeping 0.6
2021-09-23 09:36:53 DEBUG (SyncWorker_0) [pymodbus.transaction] SEND: 0x1 0x4 0x31 0x0 0x0 0x1 0x3f 0x36
2021-09-23 09:36:56 DEBUG (SyncWorker_0) [pymodbus.client.sync] New Transaction state 'SENDING'
2021-09-23 09:36:57 DEBUG (SyncWorker_0) [pymodbus.transaction] Changing transaction state from 'SENDING' to 'WAITING FOR REPLY'
2021-09-23 09:37:00 DEBUG (SyncWorker_0) [pymodbus.transaction] No response received, Expected 7 bytes Recieved 0 bytes !!!!
2021-09-23 09:37:00 DEBUG (SyncWorker_0) [pymodbus.transaction] Changing transaction state from 'WAITING FOR REPLY' to 'PROCESSING REPLY'
2021-09-23 09:37:00 DEBUG (SyncWorker_0) [pymodbus.transaction] RECV:
2021-09-23 09:37:00 DEBUG (SyncWorker_0) [pymodbus.framer.rtu_framer] Frame - [b''] not ready
2021-09-23 09:37:00 DEBUG (SyncWorker_0) [pymodbus.transaction] Getting transaction 1
2021-09-23 09:37:00 DEBUG (SyncWorker_0) [pymodbus.transaction] Changing transaction state from 'PROCESSING REPLY' to 'TRANSACTION_COMPLETE'
2021-09-23 09:37:13 DEBUG (SyncWorker_35) [pymodbus.transaction] Current transaction state - TRANSACTION_COMPLETE
2021-09-23 09:37:13 DEBUG (SyncWorker_35) [pymodbus.transaction] Running transaction 2020
2021-09-23 09:37:13 DEBUG (SyncWorker_35) [pymodbus.transaction] SEND: 0x1 0x4 0x31 0x0 0x0 0x1 0x3f 0x36
2021-09-23 09:37:13 DEBUG (SyncWorker_35) [pymodbus.framer.rtu_framer] Changing state to IDLE - Last Frame End - None, Current Time stamp - 1632386233.019098
2021-09-23 09:37:13 DEBUG (SyncWorker_35) [pymodbus.client.sync] New Transaction state 'SENDING'

I changed from:

data_type: int

to

data_type: int16

and now it’s fine.

from the documentation:
"data_type string (optional, default: int16)

Response representation (int16, int32, int64, uint16, uint32, uint64, float16, float32, float64, string). int/uintare silently converted to int16/uint16."

Maybe you guys should switch to “uint16” or “int16” whatever might be appropriate for your platform. :grinning:

Thank. this solved the problem of Solar Battery Remaining Capacity with uint is not valid, trying to convert

But it seems the major issue now is that no response in received [pymodbus.transaction] Transaction failed. (Modbus Error: [Invalid Message] No response received

2021-09-29 17:01:44 DEBUG (SyncWorker_0) [pymodbus.client.sync] Connection to Modbus server established. Socket ('192.168.5.74', 43031)
2021-09-29 17:01:56 DEBUG (SyncWorker_1) [pymodbus.transaction] Current transaction state - IDLE
2021-09-29 17:01:56 DEBUG (SyncWorker_1) [pymodbus.transaction] Running transaction 1
2021-09-29 17:01:56 DEBUG (SyncWorker_1) [pymodbus.transaction] SEND: 0x1 0x4 0x31 0x1a 0x0 0x1 0x1e 0xf1
2021-09-29 17:01:56 DEBUG (SyncWorker_1) [pymodbus.client.sync] New Transaction state 'SENDING'
2021-09-29 17:01:56 DEBUG (SyncWorker_1) [pymodbus.transaction] Changing transaction state from 'SENDING' to 'WAITING FOR REPLY'
2021-09-29 17:02:05 DEBUG (SyncWorker_1) [pymodbus.transaction] Transaction failed. (Modbus Error: [Invalid Message] No response received, expected at least 2 bytes (0 received)) 
2021-09-29 17:02:05 DEBUG (SyncWorker_1) [pymodbus.transaction] Retry on empty response - 10
2021-09-29 17:02:05 DEBUG (SyncWorker_1) [pymodbus.transaction] Changing transaction state from 'WAITING_FOR_REPLY' to 'RETRYING'

Not sure what solved it but it is working now. I unplugged the cable from the charge controller and plugged it again and it worked. Maybe some partial contact