Skip to content

Commit

Permalink
Handle AttributeError from request_environmental_data() (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
oggust authored Feb 27, 2022
1 parent 53dfc10 commit b9feb15
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@ def _timer_callback(self):
if self.is_connected:
logging.debug(
'Requesting updated environmental data from %s', self.serial)
self.libdyson.request_environmental_data()
try:
self.libdyson.request_environmental_data()
except AttributeError:
logging.error('Race with a disconnect? Skipping an iteration.')
self._refresh_timer()
else:
logging.debug('Device %s is disconnected.', self.serial)
Expand Down

0 comments on commit b9feb15

Please sign in to comment.