Add check for _client existence in modbus (#52719)

This commit is contained in:
jan iversen 2021-07-08 11:58:51 +02:00 committed by Franck Nijhof
parent a4c563106d
commit 3b5c6039bb
No known key found for this signature in database
GPG Key ID: D62583BA8AB11CA3
2 changed files with 3 additions and 0 deletions

View File

@ -634,6 +634,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: