Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deprecated constants which will be removed in HA Core 2025.1 #368

Merged
merged 2 commits into from
Aug 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions custom_components/xiaomi_miio_airpurifier/fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,8 @@

from homeassistant.components.fan import (
PLATFORM_SCHEMA,
SUPPORT_DIRECTION,
SUPPORT_OSCILLATE,
SUPPORT_PRESET_MODE,
SUPPORT_SET_SPEED,
FanEntity,
FanEntityFeature
)
from homeassistant.const import (
ATTR_ENTITY_ID,
Expand Down Expand Up @@ -1269,7 +1266,7 @@ def __init__(self, name, device, model, unique_id, retries=0):
@property
def supported_features(self):
"""Flag supported features."""
return SUPPORT_PRESET_MODE
return FanEntityFeature.PRESET_MODE

@property
def should_poll(self):
Expand Down Expand Up @@ -2399,10 +2396,10 @@ def __init__(self, name, device, model, unique_id, retries):
def supported_features(self) -> int:
"""Supported features."""
return (
SUPPORT_SET_SPEED
| SUPPORT_PRESET_MODE
| SUPPORT_OSCILLATE
| SUPPORT_DIRECTION
FanEntityFeature.SET_SPEED
| FanEntityFeature.PRESET_MODE
| FanEntityFeature.OSCILLATE
| FanEntityFeature.DIRECTION
)

async def async_update(self):
Expand Down Expand Up @@ -2752,7 +2749,7 @@ def __init__(self, name, device, model, unique_id, retries):
@property
def supported_features(self) -> int:
"""Supported features."""
return SUPPORT_SET_SPEED | SUPPORT_PRESET_MODE | SUPPORT_OSCILLATE
return FanEntityFeature.SET_SPEED | FanEntityFeature.PRESET_MODE | FanEntityFeature.OSCILLATE

async def async_update(self):
"""Fetch state from the device."""
Expand Down Expand Up @@ -2885,7 +2882,7 @@ def __init__(self, name, device, model, unique_id, retries):
@property
def supported_features(self) -> int:
"""Supported features."""
return SUPPORT_SET_SPEED | SUPPORT_PRESET_MODE | SUPPORT_OSCILLATE
return FanEntityFeature.SET_SPEED | FanEntityFeature.PRESET_MODE | FanEntityFeature.OSCILLATE

async def async_update(self):
"""Fetch state from the device."""
Expand Down
Loading