Skip to content

Commit

Permalink
Fan: Fix a KeyError if button_pressed isn't available (#333)
Browse files Browse the repository at this point in the history
  • Loading branch information
syssi authored Jun 5, 2018
1 parent 2e7dff0 commit 3f132b2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion miio/fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 3f132b2

Please sign in to comment.