Fix frontend freeze due to modbus device not responding (#49651)

Changing the timeout from package default, secures SENDING will
timeout, and after 3 retries break off.

Remark: this commit is tested with pymodbus v2.5.1 the old version
v2.3.0 have several problems in this area.
self._value = await self.async_get_last_state()

pymodbus v2.5.1 is active on DEV (bumped in an earlier PR).
This commit is contained in:
jan iversen
2021-04-25 23:11:01 +02:00
committed by GitHub
parent 9689e06d3c
commit 33e8553d92

View File

@@ -3,6 +3,7 @@ import logging
import threading import threading
from pymodbus.client.sync import ModbusSerialClient, ModbusTcpClient, ModbusUdpClient from pymodbus.client.sync import ModbusSerialClient, ModbusTcpClient, ModbusUdpClient
from pymodbus.constants import Defaults
from pymodbus.exceptions import ModbusException from pymodbus.exceptions import ModbusException
from pymodbus.transaction import ModbusRtuFramer from pymodbus.transaction import ModbusRtuFramer
@@ -138,6 +139,7 @@ class ModbusHub:
self._config_timeout = client_config[CONF_TIMEOUT] self._config_timeout = client_config[CONF_TIMEOUT]
self._config_delay = 0 self._config_delay = 0
Defaults.Timeout = 10
if self._config_type == "serial": if self._config_type == "serial":
# serial configuration # serial configuration
self._config_method = client_config[CONF_METHOD] self._config_method = client_config[CONF_METHOD]