Skip to content

Commit

Permalink
fix: fix 'ValueError: The item "2" is not in "[<DeyeFanSpeed.LOW: 1>,…
Browse files Browse the repository at this point in the history
… <DeyeFanSpeed.HIGH: 3>]"' for some devices
  • Loading branch information
stackia committed Jan 3, 2025
1 parent 7d5ba37 commit b419b31
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions custom_components/deye_dehumidifier/fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,12 @@ def oscillating(self) -> bool:
@property
def percentage(self) -> int:
"""Return the current speed as a percentage."""
if self.device_state.fan_speed == DeyeFanSpeed.STOPPED:
try:
return ordered_list_item_to_percentage(
self._named_fan_speeds, self.device_state.fan_speed
)
except ValueError:
return 0
return ordered_list_item_to_percentage(
self._named_fan_speeds, self.device_state.fan_speed
)

async def async_oscillate(self, oscillating: bool) -> None:
"""Oscillate the fan."""
Expand Down

0 comments on commit b419b31

Please sign in to comment.