mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Use VacuumEntityFeature in sharkiq (#70565)
This commit is contained in:
parent
acc5c7ddf0
commit
7c3fcdee95
@ -11,16 +11,8 @@ from homeassistant.components.vacuum import (
|
|||||||
STATE_IDLE,
|
STATE_IDLE,
|
||||||
STATE_PAUSED,
|
STATE_PAUSED,
|
||||||
STATE_RETURNING,
|
STATE_RETURNING,
|
||||||
SUPPORT_BATTERY,
|
|
||||||
SUPPORT_FAN_SPEED,
|
|
||||||
SUPPORT_LOCATE,
|
|
||||||
SUPPORT_PAUSE,
|
|
||||||
SUPPORT_RETURN_HOME,
|
|
||||||
SUPPORT_START,
|
|
||||||
SUPPORT_STATE,
|
|
||||||
SUPPORT_STATUS,
|
|
||||||
SUPPORT_STOP,
|
|
||||||
StateVacuumEntity,
|
StateVacuumEntity,
|
||||||
|
VacuumEntityFeature,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
@ -31,19 +23,6 @@ from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
|||||||
from .const import DOMAIN, LOGGER, SHARK
|
from .const import DOMAIN, LOGGER, SHARK
|
||||||
from .update_coordinator import SharkIqUpdateCoordinator
|
from .update_coordinator import SharkIqUpdateCoordinator
|
||||||
|
|
||||||
# Supported features
|
|
||||||
SUPPORT_SHARKIQ = (
|
|
||||||
SUPPORT_BATTERY
|
|
||||||
| SUPPORT_FAN_SPEED
|
|
||||||
| SUPPORT_PAUSE
|
|
||||||
| SUPPORT_RETURN_HOME
|
|
||||||
| SUPPORT_START
|
|
||||||
| SUPPORT_STATE
|
|
||||||
| SUPPORT_STATUS
|
|
||||||
| SUPPORT_STOP
|
|
||||||
| SUPPORT_LOCATE
|
|
||||||
)
|
|
||||||
|
|
||||||
OPERATING_STATE_MAP = {
|
OPERATING_STATE_MAP = {
|
||||||
OperatingModes.PAUSE: STATE_PAUSED,
|
OperatingModes.PAUSE: STATE_PAUSED,
|
||||||
OperatingModes.START: STATE_CLEANING,
|
OperatingModes.START: STATE_CLEANING,
|
||||||
@ -87,6 +66,18 @@ async def async_setup_entry(
|
|||||||
class SharkVacuumEntity(CoordinatorEntity[SharkIqUpdateCoordinator], StateVacuumEntity):
|
class SharkVacuumEntity(CoordinatorEntity[SharkIqUpdateCoordinator], StateVacuumEntity):
|
||||||
"""Shark IQ vacuum entity."""
|
"""Shark IQ vacuum entity."""
|
||||||
|
|
||||||
|
_attr_supported_features = (
|
||||||
|
VacuumEntityFeature.BATTERY
|
||||||
|
| VacuumEntityFeature.FAN_SPEED
|
||||||
|
| VacuumEntityFeature.PAUSE
|
||||||
|
| VacuumEntityFeature.RETURN_HOME
|
||||||
|
| VacuumEntityFeature.START
|
||||||
|
| VacuumEntityFeature.STATE
|
||||||
|
| VacuumEntityFeature.STATUS
|
||||||
|
| VacuumEntityFeature.STOP
|
||||||
|
| VacuumEntityFeature.LOCATE
|
||||||
|
)
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self, sharkiq: SharkIqVacuum, coordinator: SharkIqUpdateCoordinator
|
self, sharkiq: SharkIqVacuum, coordinator: SharkIqUpdateCoordinator
|
||||||
) -> None:
|
) -> None:
|
||||||
@ -140,7 +131,7 @@ class SharkVacuumEntity(CoordinatorEntity[SharkIqUpdateCoordinator], StateVacuum
|
|||||||
@property
|
@property
|
||||||
def supported_features(self) -> int:
|
def supported_features(self) -> int:
|
||||||
"""Flag vacuum cleaner robot features that are supported."""
|
"""Flag vacuum cleaner robot features that are supported."""
|
||||||
return SUPPORT_SHARKIQ
|
return self._attr_supported_features
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def error_code(self) -> int | None:
|
def error_code(self) -> int | None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user