Skip to content

Commit

Permalink
add TURN_ON & TURN_OFF FanEntityFeature
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertD502 authored Aug 5, 2024
1 parent c386f20 commit 116a299
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion custom_components/petkit/fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ async def async_setup_entry(
class Purifier(CoordinatorEntity, FanEntity):
"""Representation of a PetKit air purifier."""

# Need to remove this in 2025.2 once setting it manually
# isn't required anymore.
_enable_turn_on_off_backwards_compatibility = False

def __init__(self, coordinator, purifier_id):
super().__init__(coordinator)
self.purifier_id = purifier_id
Expand Down Expand Up @@ -120,7 +124,11 @@ def preset_mode(self) -> str:
def supported_features(self) -> int:
"""Return supported features."""

return FanEntityFeature.PRESET_MODE
return (
FanEntityFeature.PRESET_MODE
| FanEntityFeature.TURN_ON
| FanEntityFeature.TURN_OFF
)

async def async_turn_on(self, **kwargs) -> None:
"""Turn the air purifier on."""
Expand Down

0 comments on commit 116a299

Please sign in to comment.