-
Notifications
You must be signed in to change notification settings - Fork 14
Description
Still looking into why I often have an instable connection, not sure if it's related to modbus connection or something else.
Constantly getting below errors:
2026-01-08 22:16:11.863 ERROR (MainThread) [custom_components.alfen_modbus] [2026-01-08 22:16:11,863] [ERROR] custom_components.alfen_modbus > Error reading modbus data
Traceback (most recent call last):
File "/config/custom_components/alfen_modbus/init.py", line 190, in async_refresh_modbus_data
update_result = self.read_modbus_data()
File "/config/custom_components/alfen_modbus/init.py", line 248, in read_modbus_data
self.read_modbus_data_product()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/config/custom_components/alfen_modbus/init.py", line 387, in read_modbus_data_product
identification_data = self.read_holding_registers(self._address, 100, 79)
File "/config/custom_components/alfen_modbus/init.py", line 228, in read_holding_registers
return self._client.read_holding_registers(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
address=address, count=count, device_id=unit
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/usr/local/lib/python3.13/site-packages/pymodbus/client/mixin.py", line 113, in read_holding_registers
return self.execute(no_response_expected, pdu_reg.ReadHoldingRegistersRequest(address=address, count=count, dev_id=device_id))
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/pymodbus/client/base.py", line 202, in execute
return self.transaction.sync_execute(no_response_expected, request)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/pymodbus/transaction/transaction.py", line 128, in sync_execute
self.pdu_send(request)
~~~~~~~~~~~~~^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/pymodbus/transaction/transaction.py", line 211, in pdu_send
self.low_level_send(self.trace_packet(True, packet), addr=addr)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/pymodbus/client/tcp.py", line 221, in send
return self.socket.send(request)
~~~~~~~~~~~~~~~~^^^^^^^^^
BrokenPipeError: [Errno 32] Broken pipe
Anything that could be done to handle such exceptions? eg re-init full connection?
Would also be great to have some sensor with the connection status of modbus. It's now not always clear if connection is stable or not.