Skip to content

Commit

Permalink
Merge pull request #3 from thecrisb/SUPPORT_depricated_vacuum
Browse files Browse the repository at this point in the history
Transition from SUPPORT_*
  • Loading branch information
thecrisb authored Sep 20, 2023
2 parents df53289 + 668e847 commit ac802a5
Showing 1 changed file with 11 additions and 19 deletions.
30 changes: 11 additions & 19 deletions custom_components/localtuya/vacuum.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,7 @@
STATE_IDLE,
STATE_PAUSED,
STATE_RETURNING,
SUPPORT_BATTERY,
SUPPORT_FAN_SPEED,
SUPPORT_LOCATE,
SUPPORT_PAUSE,
SUPPORT_RETURN_HOME,
SUPPORT_START,
SUPPORT_STATE,
SUPPORT_STATUS,
SUPPORT_STOP,
VacuumEntityFeature,
StateVacuumEntity,
)

Expand Down Expand Up @@ -135,24 +127,24 @@ def __init__(self, device, config_entry, switchid, **kwargs):
_LOGGER.debug("Initialized vacuum [%s]", self.name)

@property
def supported_features(self):
def supported_features(self) -> VacuumEntityFeature:
"""Flag supported features."""
supported_features = (
SUPPORT_START
| SUPPORT_PAUSE
| SUPPORT_STOP
| SUPPORT_STATUS
| SUPPORT_STATE
VacuumEntityFeature.START
| VacuumEntityFeature.PAUSE
| VacuumEntityFeature.STOP
| VacuumEntityFeature.STATUS
| VacuumEntityFeature.STATE
)

if self.has_config(CONF_RETURN_MODE):
supported_features = supported_features | SUPPORT_RETURN_HOME
supported_features = supported_features | VacuumEntityFeature.RETURN_HOME
if self.has_config(CONF_FAN_SPEED_DP):
supported_features = supported_features | SUPPORT_FAN_SPEED
supported_features = supported_features | VacuumEntityFeature.FAN_SPEED
if self.has_config(CONF_BATTERY_DP):
supported_features = supported_features | SUPPORT_BATTERY
supported_features = supported_features | VacuumEntityFeature.BATTERY
if self.has_config(CONF_LOCATE_DP):
supported_features = supported_features | SUPPORT_LOCATE
supported_features = supported_features | VacuumEntityFeature.LOCATE

return supported_features

Expand Down

0 comments on commit ac802a5

Please sign in to comment.