Modbus not working 0.108

finally i was able to get HA to work but all modbus lines are not working… same files of configuration

any idea???
image

1 Like

Hello everybody,

I have the same problem. Before 108 everything went smoothly.

# USB-Modbus Schnittstelle
modbus:
  name: USBHub
  type: serial
  method: rtu
  port: /dev/ttyUSB0
  baudrate: 9600
  stopbits: 1
  bytesize: 8
  parity: N

Someone a solution or is this a bug?

Best wishes
Michael

Hi same with me. Modbus seems broken in 0.108 before in worked perfectly.
There were fixes in 0.108.2

Fix modbus default delay (@janiversen - #33877) (modbus docs)

The new default delay is 0.

delay
(integer)(Optional)
Time to sleep in seconds after connecting and before sending messages. Some modbus-tcp servers need a short delay typically 1-2 seconds in order to prepare the communication. If a server accepts connecting, but there is no response to the requests send, this parameter might help.

Default value:
0

My modbus integration looked like this

modbus:
  name: sma
  type: tcp
  host: 192.168.178.101
  port: 502

Unfortunately after adding the delay parameter with 1 or 2 doesn’t help. I get the following errors:

Logger: pymodbus.factory
Source: __main__.py:342 
First occurred: 11:26:58 (6 occurrences) 
Last logged: 11:29:32

Unable to decode response Modbus Error: Unknown response 59
Unable to decode response Modbus Error: Unknown response 90
Unable to decode response Modbus Error: Unknown response 125
index out of range
Logger: homeassistant.core
Source: /usr/src/homeassistant/homeassistant/core.py:144 
First occurred: 11:26:58 (6 occurrences) 
Last logged: 11:29:32

Error doing job: Fatal error: protocol.data_received() call failed.
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/asyncio/selector_events.py", line 826, in _read_ready__data_received
    self._protocol.data_received(data)
  File "/usr/local/lib/python3.7/site-packages/pymodbus/client/asynchronous/asyncio/__init__.py", line 192, in data_received
    self._dataReceived(data)
  File "/usr/local/lib/python3.7/site-packages/pymodbus/client/asynchronous/asyncio/__init__.py", line 139, in _dataReceived
    self.framer.processIncomingPacket(data, self._handleResponse, unit=unit)
  File "/usr/local/lib/python3.7/site-packages/pymodbus/framer/socket_framer.py", line 165, in processIncomingPacket
    self._process(callback, error=True)
  File "/usr/local/lib/python3.7/site-packages/pymodbus/framer/socket_framer.py", line 175, in _process
    raise ModbusIOException("Unable to decode request")
pymodbus.exceptions.ModbusIOException: Modbus Error: [Input/Output] Unable to decode request

I have same problem from 108 release. Updated to 108.3 not helped… :frowning: Please, help!

Same here. Also invalid config with serial setup. Running 108.3

I have same problem from 108.3. I trying downgrade for 107.7

Its works!

ha core update --version=0.107.7

image

Works for me as well I am using raspbian not haos

here my error log:

2020-04-11 03:00:57 ERROR (MainThread) [homeassistant.setup] Error during setup of component modbus
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 171, in _async_setup_component
    hass, processed_config
  File "/usr/src/homeassistant/homeassistant/components/modbus/__init__.py", line 139, in async_setup
    await hass.async_add_executor_job(start_modbus)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/modbus/__init__.py", line 111, in start_modbus
    client.setup()
  File "/usr/src/homeassistant/homeassistant/components/modbus/__init__.py", line 207, in setup
    loop=self._loop,
  File "/usr/local/lib/python3.7/site-packages/pymodbus/client/asynchronous/serial.py", line 75, in __new__
    yieldable = factory_class(framer=framer, port=port, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/pymodbus/client/asynchronous/factory/serial.py", line 104, in async_io_factory
    client = AsyncioModbusSerialClient(port, proto_cls, framer, loop, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/pymodbus/client/asynchronous/asyncio/__init__.py", line 689, in __init__
    self._connected_event = asyncio.Event()
  File "/usr/local/lib/python3.7/asyncio/locks.py", line 249, in __init__
    self._loop = events.get_event_loop()
  File "/usr/local/lib/python3.7/asyncio/events.py", line 644, in get_event_loop
    % threading.current_thread().name)
RuntimeError: There is no current event loop in thread 'SyncWorker_18'.

greetings
Michael

Yes modbus is definitely broken in 0.108 1-3
I stay on 0.108.3 but I switched to NodeRed and MQTT to retrieve my modbus data.
everything works now again.

I wrote a tutorial how to do this