Skip to content

Commit

Permalink
fan: handle edge case where percentage is None
Browse files Browse the repository at this point in the history
Some fans may have optional dp for speed. Avoid an error initialising
by avoiding exceptions in that case.

Issue #1513
  • Loading branch information
make-all committed Mar 11, 2024
1 parent c60792c commit 66bda00
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion custom_components/tuya_local/fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def percentage(self):
return None
r = self._speed_dps.range(self._device)
val = self._speed_dps.get_value(self._device)
if r:
if r and val is not None:
val = ranged_value_to_percentage(r, val)
return val

Expand Down

0 comments on commit 66bda00

Please sign in to comment.