diff --git a/miio/fan.py b/miio/fan.py index be8720a1d..be031fd5a 100644 --- a/miio/fan.py +++ b/miio/fan.py @@ -175,7 +175,7 @@ def use_time(self) -> int: @property def button_pressed(self) -> Optional[str]: """Last pressed button.""" - if self.data["button_pressed"] is not None: + if "button_pressed" in self.data and self.data["button_pressed"] is not None: return self.data["button_pressed"] return None