mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 10:47:10 +00:00
Add service send command in Tuya Vacuum (#63417)
Co-authored-by: Franck Nijhof <git@frenck.dev>
This commit is contained in:
parent
58555954ab
commit
b3a8ac8932
@ -14,6 +14,7 @@ from homeassistant.components.vacuum import (
|
|||||||
SUPPORT_LOCATE,
|
SUPPORT_LOCATE,
|
||||||
SUPPORT_PAUSE,
|
SUPPORT_PAUSE,
|
||||||
SUPPORT_RETURN_HOME,
|
SUPPORT_RETURN_HOME,
|
||||||
|
SUPPORT_SEND_COMMAND,
|
||||||
SUPPORT_START,
|
SUPPORT_START,
|
||||||
SUPPORT_STATE,
|
SUPPORT_STATE,
|
||||||
SUPPORT_STATUS,
|
SUPPORT_STATUS,
|
||||||
@ -89,6 +90,7 @@ class TuyaVacuumEntity(TuyaEntity, StateVacuumEntity):
|
|||||||
"""Init Tuya vacuum."""
|
"""Init Tuya vacuum."""
|
||||||
super().__init__(device, device_manager)
|
super().__init__(device, device_manager)
|
||||||
|
|
||||||
|
self._supported_features |= SUPPORT_SEND_COMMAND
|
||||||
if self.find_dpcode(DPCode.PAUSE, prefer_function=True):
|
if self.find_dpcode(DPCode.PAUSE, prefer_function=True):
|
||||||
self._supported_features |= SUPPORT_PAUSE
|
self._supported_features |= SUPPORT_PAUSE
|
||||||
|
|
||||||
@ -185,3 +187,9 @@ class TuyaVacuumEntity(TuyaEntity, StateVacuumEntity):
|
|||||||
def set_fan_speed(self, fan_speed: str, **kwargs: Any) -> None:
|
def set_fan_speed(self, fan_speed: str, **kwargs: Any) -> None:
|
||||||
"""Set fan speed."""
|
"""Set fan speed."""
|
||||||
self._send_command([{"code": DPCode.SUCTION, "value": fan_speed}])
|
self._send_command([{"code": DPCode.SUCTION, "value": fan_speed}])
|
||||||
|
|
||||||
|
def send_command(self, command: str, params: str = None, **kwargs: Any) -> None:
|
||||||
|
"""Send raw command."""
|
||||||
|
if params is None:
|
||||||
|
raise ValueError("Params cannot be omitted for Tuya vacuum commands")
|
||||||
|
self._send_command([{"code": command, "value": params}])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user