Skip to content

Commit

Permalink
Reconnect on connection failure.
Browse files Browse the repository at this point in the history
  • Loading branch information
syssi committed Jul 17, 2017
1 parent b3bc762 commit 399f8a7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions xiaomiplug/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,10 @@ def send(self, command: str, parameters: Any=None) -> Any:
m.data.value["id"],
m.data.value))
return m.data.value["result"]
except OSError as ex:
except Exception as ex:
_LOGGER.error("got error when receiving: %s", ex)
raise DeviceException from ex
self.__enter__()
raise

@property
def _id(self) -> int:
Expand Down

0 comments on commit 399f8a7

Please sign in to comment.