diff --git a/miio/powerstrip.py b/miio/powerstrip.py index 6672c3a47..5ea707a4a 100644 --- a/miio/powerstrip.py +++ b/miio/powerstrip.py @@ -43,10 +43,12 @@ def load_power(self) -> Optional[float]: return None @property - def mode(self) -> PowerMode: - return PowerMode(self.data["mode"]) + def mode(self) -> Optional[PowerMode]: + if self.data["mode"] is not None: + return PowerMode(self.data["mode"]) + return None - def __str__(self) -> str: + def __repr__(self) -> str: s = "" % \ (self.power,