Skip to content

Commit

Permalink
Added context management on DysonPureLink
Browse files Browse the repository at this point in the history
  • Loading branch information
daggelpop committed Jun 30, 2018
1 parent 38e2112 commit cbf5ea2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions DysonPureLinkPlugin/dyson_pure_link_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ def __init__(self):
self.state_data = None
self._is_connected = None

def __enter__(self):
self.parse_config()
return self

def __exit__(self, exc_type, exc_val, exc_tb):
self.disconnect_device()

@property
def has_valid_data(self):
return self.sensor_data and self.sensor_data.has_data
Expand Down

0 comments on commit cbf5ea2

Please sign in to comment.