diff --git a/wideq.py b/wideq.py index c49a8af..6be5c20 100644 --- a/wideq.py +++ b/wideq.py @@ -953,8 +953,9 @@ class ACDevice(Device): def monitor_start(self): """Start monitoring the device's status.""" - self.mon = Monitor(self.client.session, self.device.id) - self.mon.start() + mon = Monitor(self.client.session, self.device.id) + mon.start() + self.mon = mon def monitor_stop(self): """Stop monitoring the device's status.""" @@ -969,6 +970,10 @@ class ACDevice(Device): available. """ + # Abort if monitoring has not started yet. + if not hasattr(self, 'mon'): + return None + res = self.mon.poll_json() if res: return ACStatus(self, res)