mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 04:07:08 +00:00
Use VacuumEntityFeature in neato (#70561)
This commit is contained in:
parent
ca337b54a3
commit
c1888ce559
@ -15,16 +15,8 @@ from homeassistant.components.vacuum import (
|
|||||||
STATE_DOCKED,
|
STATE_DOCKED,
|
||||||
STATE_ERROR,
|
STATE_ERROR,
|
||||||
STATE_RETURNING,
|
STATE_RETURNING,
|
||||||
SUPPORT_BATTERY,
|
|
||||||
SUPPORT_CLEAN_SPOT,
|
|
||||||
SUPPORT_LOCATE,
|
|
||||||
SUPPORT_MAP,
|
|
||||||
SUPPORT_PAUSE,
|
|
||||||
SUPPORT_RETURN_HOME,
|
|
||||||
SUPPORT_START,
|
|
||||||
SUPPORT_STATE,
|
|
||||||
SUPPORT_STOP,
|
|
||||||
StateVacuumEntity,
|
StateVacuumEntity,
|
||||||
|
VacuumEntityFeature,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import ATTR_MODE, STATE_IDLE, STATE_PAUSED
|
from homeassistant.const import ATTR_MODE, STATE_IDLE, STATE_PAUSED
|
||||||
@ -51,18 +43,6 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
|
|
||||||
SCAN_INTERVAL = timedelta(minutes=SCAN_INTERVAL_MINUTES)
|
SCAN_INTERVAL = timedelta(minutes=SCAN_INTERVAL_MINUTES)
|
||||||
|
|
||||||
SUPPORT_NEATO = (
|
|
||||||
SUPPORT_BATTERY
|
|
||||||
| SUPPORT_PAUSE
|
|
||||||
| SUPPORT_RETURN_HOME
|
|
||||||
| SUPPORT_STOP
|
|
||||||
| SUPPORT_START
|
|
||||||
| SUPPORT_CLEAN_SPOT
|
|
||||||
| SUPPORT_STATE
|
|
||||||
| SUPPORT_MAP
|
|
||||||
| SUPPORT_LOCATE
|
|
||||||
)
|
|
||||||
|
|
||||||
ATTR_CLEAN_START = "clean_start"
|
ATTR_CLEAN_START = "clean_start"
|
||||||
ATTR_CLEAN_STOP = "clean_stop"
|
ATTR_CLEAN_STOP = "clean_stop"
|
||||||
ATTR_CLEAN_AREA = "clean_area"
|
ATTR_CLEAN_AREA = "clean_area"
|
||||||
@ -114,6 +94,18 @@ async def async_setup_entry(
|
|||||||
class NeatoConnectedVacuum(StateVacuumEntity):
|
class NeatoConnectedVacuum(StateVacuumEntity):
|
||||||
"""Representation of a Neato Connected Vacuum."""
|
"""Representation of a Neato Connected Vacuum."""
|
||||||
|
|
||||||
|
_attr_supported_features = (
|
||||||
|
VacuumEntityFeature.BATTERY
|
||||||
|
| VacuumEntityFeature.PAUSE
|
||||||
|
| VacuumEntityFeature.RETURN_HOME
|
||||||
|
| VacuumEntityFeature.STOP
|
||||||
|
| VacuumEntityFeature.START
|
||||||
|
| VacuumEntityFeature.CLEAN_SPOT
|
||||||
|
| VacuumEntityFeature.STATE
|
||||||
|
| VacuumEntityFeature.MAP
|
||||||
|
| VacuumEntityFeature.LOCATE
|
||||||
|
)
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
neato: NeatoHub,
|
neato: NeatoHub,
|
||||||
@ -276,7 +268,7 @@ class NeatoConnectedVacuum(StateVacuumEntity):
|
|||||||
@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_NEATO
|
return self._attr_supported_features
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def battery_level(self) -> int | None:
|
def battery_level(self) -> int | None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user