Use VacuumEntityFeature in roomba (#70577)

pull/70589/head
epenet 2022-04-24 12:32:16 +02:00 committed by GitHub
parent 4830b427ac
commit c342ff5da8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 22 deletions

View File

@ -1,7 +1,7 @@
"""Class for Braava devices."""
import logging
from homeassistant.components.vacuum import SUPPORT_FAN_SPEED
from homeassistant.components.vacuum import VacuumEntityFeature
from .irobot_base import SUPPORT_IROBOT, IRobotVacuum
@ -23,7 +23,7 @@ BRAAVA_MOP_BEHAVIORS = [MOP_STANDARD, MOP_DEEP, MOP_EXTENDED]
BRAAVA_SPRAY_AMOUNT = [1, 2, 3]
# Braava Jets can set mopping behavior through fanspeed
SUPPORT_BRAAVA = SUPPORT_IROBOT | SUPPORT_FAN_SPEED
SUPPORT_BRAAVA = SUPPORT_IROBOT | VacuumEntityFeature.FAN_SPEED
class BraavaJet(IRobotVacuum):

View File

@ -10,16 +10,8 @@ from homeassistant.components.vacuum import (
STATE_DOCKED,
STATE_ERROR,
STATE_RETURNING,
SUPPORT_BATTERY,
SUPPORT_LOCATE,
SUPPORT_PAUSE,
SUPPORT_RETURN_HOME,
SUPPORT_SEND_COMMAND,
SUPPORT_START,
SUPPORT_STATE,
SUPPORT_STATUS,
SUPPORT_STOP,
StateVacuumEntity,
VacuumEntityFeature,
)
from homeassistant.const import STATE_IDLE, STATE_PAUSED
import homeassistant.helpers.device_registry as dr
@ -40,15 +32,15 @@ ATTR_SOFTWARE_VERSION = "software_version"
# Commonly supported features
SUPPORT_IROBOT = (
SUPPORT_BATTERY
| SUPPORT_PAUSE
| SUPPORT_RETURN_HOME
| SUPPORT_SEND_COMMAND
| SUPPORT_START
| SUPPORT_STATE
| SUPPORT_STATUS
| SUPPORT_STOP
| SUPPORT_LOCATE
VacuumEntityFeature.BATTERY
| VacuumEntityFeature.PAUSE
| VacuumEntityFeature.RETURN_HOME
| VacuumEntityFeature.SEND_COMMAND
| VacuumEntityFeature.START
| VacuumEntityFeature.STATE
| VacuumEntityFeature.STATUS
| VacuumEntityFeature.STOP
| VacuumEntityFeature.LOCATE
)
STATE_MAP = {

View File

@ -1,7 +1,7 @@
"""Class for Roomba devices."""
import logging
from homeassistant.components.vacuum import SUPPORT_FAN_SPEED
from homeassistant.components.vacuum import VacuumEntityFeature
from .irobot_base import SUPPORT_IROBOT, IRobotVacuum
@ -16,7 +16,7 @@ FAN_SPEED_PERFORMANCE = "Performance"
FAN_SPEEDS = [FAN_SPEED_AUTOMATIC, FAN_SPEED_ECO, FAN_SPEED_PERFORMANCE]
# Only Roombas with CarpetBost can set their fanspeed
SUPPORT_ROOMBA_CARPET_BOOST = SUPPORT_IROBOT | SUPPORT_FAN_SPEED
SUPPORT_ROOMBA_CARPET_BOOST = SUPPORT_IROBOT | VacuumEntityFeature.FAN_SPEED
class RoombaVacuum(IRobotVacuum):