Skip to content

Commit

Permalink
Fix for not reconnecting after 'giving up'
Browse files Browse the repository at this point in the history
  • Loading branch information
rospogrigio committed Feb 7, 2023
1 parent f51d833 commit fa301d1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion custom_components/localtuya/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,10 @@ async def _make_connection(self):
self.status_updated(status)
else:
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:
self.warning("Initial state update failed (%s), trying key update", ex)
await self.update_local_key()
Expand Down

0 comments on commit fa301d1

Please sign in to comment.