solaredge-modbus-multi icon indicating copy to clipboard operation
solaredge-modbus-multi copied to clipboard

TODO: Research how async timeout context interacts with pymodbus timeout

Open WillCodeForCats opened this issue 6 months ago • 3 comments

Research how async timeout context for reads added in PR #820 interacts with pymodbus timeout and retries. Adjust the async context timeout if needed.

Feedback should be added to this issue. To adjust the timeout value, edit file const.py and adjust the value of Read = 6000 in class SolarEdgeTimeouts(IntEnum) then restart Home Assistant. If the affected entities are going unavailable too often, try a value of Read = 9000.

https://github.com/WillCodeForCats/solaredge-modbus-multi/blob/d7026ef709ca2e6efad2c358d1d8e0543266fce0/custom_components/solaredge_modbus_multi/const.py#L87

WillCodeForCats avatar Jun 07 '25 22:06 WillCodeForCats

May need to disconnect and reconnect to the modbus device if a context timeout is triggered, or enable pymodbus built in reconnect.

Reconnect in pymodbus was disabled intentionally in PR #360 but that was many versions past and it should probably be tested to see if it works with current versions of pymodbus.

WillCodeForCats avatar Jun 21 '25 19:06 WillCodeForCats

Testing with the following settings in configuration.yaml:

solaredge_modbus_multi:
  modbus:
    reconnect_delay: 1.0   # Minimum in seconds.milliseconds before reconnecting.
    reconnect_delay_max: 16.0  # Maximum in seconds.milliseconds before reconnecting.

WillCodeForCats avatar Jun 25 '25 16:06 WillCodeForCats

Pymodbus 3.9 raises ModbusIOException in an asyncio timeout context. See PR #864

WillCodeForCats avatar Jul 13 '25 05:07 WillCodeForCats