Add commands to Tuya Vacuum (sd) (#60351)
parent
d504c1e3e8
commit
f2e03420d1
|
@ -236,6 +236,7 @@ class DPCode(str, Enum):
|
|||
PM25_STATE = "pm25_state"
|
||||
PM25_VALUE = "pm25_value"
|
||||
POWDER_SET = "powder_set" # Powder
|
||||
POWER = "power"
|
||||
POWER_GO = "power_go"
|
||||
PRESENCE_STATE = "presence_state"
|
||||
PRESSURE_STATE = "pressure_state"
|
||||
|
|
|
@ -13,12 +13,15 @@ from homeassistant.components.vacuum import (
|
|||
STATE_RETURNING,
|
||||
SUPPORT_BATTERY,
|
||||
SUPPORT_FAN_SPEED,
|
||||
SUPPORT_LOCATE,
|
||||
SUPPORT_PAUSE,
|
||||
SUPPORT_RETURN_HOME,
|
||||
SUPPORT_START,
|
||||
SUPPORT_STATE,
|
||||
SUPPORT_STATUS,
|
||||
SUPPORT_STOP,
|
||||
SUPPORT_TURN_OFF,
|
||||
SUPPORT_TURN_ON,
|
||||
StateVacuumEntity,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
|
@ -93,9 +96,15 @@ class TuyaVacuumEntity(TuyaEntity, StateVacuumEntity):
|
|||
if DPCode.SWITCH_CHARGE in self.device.status:
|
||||
self._supported_features |= SUPPORT_RETURN_HOME
|
||||
|
||||
if DPCode.SEEK in self.device.status:
|
||||
self._supported_features |= SUPPORT_LOCATE
|
||||
|
||||
if DPCode.STATUS in self.device.status:
|
||||
self._supported_features |= SUPPORT_STATE | SUPPORT_STATUS
|
||||
|
||||
if DPCode.POWER in self.device.status:
|
||||
self._supported_features |= SUPPORT_TURN_ON | SUPPORT_TURN_OFF
|
||||
|
||||
if DPCode.POWER_GO in self.device.status:
|
||||
self._supported_features |= SUPPORT_STOP | SUPPORT_START
|
||||
|
||||
|
@ -144,12 +153,20 @@ class TuyaVacuumEntity(TuyaEntity, StateVacuumEntity):
|
|||
"""Flag supported features."""
|
||||
return self._supported_features
|
||||
|
||||
def start(self, **kwargs: Any) -> None:
|
||||
def turn_on(self, **kwargs: Any) -> None:
|
||||
"""Turn the device on."""
|
||||
self._send_command([{"code": DPCode.POWER, "value": True}])
|
||||
|
||||
def turn_off(self, **kwargs: Any) -> None:
|
||||
"""Turn the device off."""
|
||||
self._send_command([{"code": DPCode.POWER, "value": False}])
|
||||
|
||||
def start(self, **kwargs: Any) -> None:
|
||||
"""Start the device."""
|
||||
self._send_command([{"code": DPCode.POWER_GO, "value": True}])
|
||||
|
||||
def stop(self, **kwargs: Any) -> None:
|
||||
"""Turn the device off."""
|
||||
"""Stop the device."""
|
||||
self._send_command([{"code": DPCode.POWER_GO, "value": False}])
|
||||
|
||||
def pause(self, **kwargs: Any) -> None:
|
||||
|
@ -161,7 +178,7 @@ class TuyaVacuumEntity(TuyaEntity, StateVacuumEntity):
|
|||
self._send_command([{"code": DPCode.MODE, "value": "chargego"}])
|
||||
|
||||
def locate(self, **kwargs: Any) -> None:
|
||||
"""Return device to dock."""
|
||||
"""Locate the device."""
|
||||
self._send_command([{"code": DPCode.SEEK, "value": True}])
|
||||
|
||||
def set_fan_speed(self, fan_speed: str, **kwargs: Any) -> None:
|
||||
|
|
Loading…
Reference in New Issue