Solve modbus shutdown racing condition (#55373)
This commit is contained in:
parent
13cc671844
commit
f91cc21bbd
1 changed files with 5 additions and 5 deletions
|
@ -292,8 +292,8 @@ class ModbusHub:
|
||||||
for call in self.entity_timers:
|
for call in self.entity_timers:
|
||||||
call()
|
call()
|
||||||
self.entity_timers = []
|
self.entity_timers = []
|
||||||
if self._client:
|
|
||||||
async with self._lock:
|
async with self._lock:
|
||||||
|
if self._client:
|
||||||
try:
|
try:
|
||||||
self._client.close()
|
self._client.close()
|
||||||
except ModbusException as exception_error:
|
except ModbusException as exception_error:
|
||||||
|
@ -327,9 +327,9 @@ class ModbusHub:
|
||||||
"""Convert async to sync pymodbus call."""
|
"""Convert async to sync pymodbus call."""
|
||||||
if self._config_delay:
|
if self._config_delay:
|
||||||
return None
|
return None
|
||||||
|
async with self._lock:
|
||||||
if not self._client:
|
if not self._client:
|
||||||
return None
|
return None
|
||||||
async with self._lock:
|
|
||||||
result = await self.hass.async_add_executor_job(
|
result = await self.hass.async_add_executor_job(
|
||||||
self._pymodbus_call, unit, address, value, use_call
|
self._pymodbus_call, unit, address, value, use_call
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue