Fix for not reconnecting after 'giving up'
This commit is contained in:
@@ -234,7 +234,10 @@ class TuyaDevice(pytuya.TuyaListener, pytuya.ContextualLogger):
|
|||||||
self.status_updated(status)
|
self.status_updated(status)
|
||||||
else:
|
else:
|
||||||
self.error("Initial state update failed, giving up: %r", ex)
|
self.error("Initial state update failed, giving up: %r", ex)
|
||||||
# return
|
if self._interface is not None:
|
||||||
|
await self._interface.close()
|
||||||
|
self._interface = None
|
||||||
|
|
||||||
except (UnicodeDecodeError, json.decoder.JSONDecodeError) as ex:
|
except (UnicodeDecodeError, json.decoder.JSONDecodeError) as ex:
|
||||||
self.warning("Initial state update failed (%s), trying key update", ex)
|
self.warning("Initial state update failed (%s), trying key update", ex)
|
||||||
await self.update_local_key()
|
await self.update_local_key()
|
||||||
|
Reference in New Issue
Block a user