mirror of
https://github.com/home-assistant/core.git
synced 2025-07-13 00:07:10 +00:00
Do not close non existing clients in modbus (#49489)
* Only close if _client is present. * Remove del.
This commit is contained in:
parent
6e22251e1d
commit
c9bdc9609c
@ -209,11 +209,11 @@ class ModbusHub:
|
||||
"""Disconnect client."""
|
||||
with self._lock:
|
||||
try:
|
||||
self._client.close()
|
||||
del self._client
|
||||
self._client = None
|
||||
if self._client:
|
||||
self._client.close()
|
||||
self._client = None
|
||||
except ModbusException as exception_error:
|
||||
self._log_error(exception_error, error_state=False)
|
||||
self._log_error(exception_error)
|
||||
return
|
||||
|
||||
def connect(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user