Add check for _client existence in modbus (#52719)

pull/52715/head^2
jan iversen 2021-07-08 11:58:51 +02:00 committed by GitHub
parent 578c897161
commit fe1f7ba316
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 0 deletions

View File

@ -633,6 +633,7 @@ omit =
homeassistant/components/mjpeg/camera.py
homeassistant/components/mochad/*
homeassistant/components/modbus/climate.py
homeassistant/components/modbus/modbus.py
homeassistant/components/modem_callerid/sensor.py
homeassistant/components/motion_blinds/__init__.py
homeassistant/components/motion_blinds/const.py

View File

@ -310,6 +310,8 @@ class ModbusHub:
"""Convert async to sync pymodbus call."""
if self._config_delay:
return None
if not self._client:
return None
if not self._client.is_socket_open():
return None
async with self._lock: