Changing the Return to home in Tuya vacuum (#64810)
Co-authored-by: Franck Nijhof <frenck@frenck.nl>pull/64896/head
parent
44946f662e
commit
3af3d9414d
|
@ -33,6 +33,7 @@ from . import HomeAssistantTuyaData
|
|||
from .base import EnumTypeData, IntegerTypeData, TuyaEntity
|
||||
from .const import DOMAIN, TUYA_DISCOVERY_NEW, DPCode, DPType
|
||||
|
||||
TUYA_MODE_RETURN_HOME = "chargego"
|
||||
TUYA_STATUS_TO_HA = {
|
||||
"charge_done": STATE_DOCKED,
|
||||
"chargecompleted": STATE_DOCKED,
|
||||
|
@ -96,6 +97,12 @@ class TuyaVacuumEntity(TuyaEntity, StateVacuumEntity):
|
|||
|
||||
if self.find_dpcode(DPCode.SWITCH_CHARGE, prefer_function=True):
|
||||
self._supported_features |= SUPPORT_RETURN_HOME
|
||||
elif (
|
||||
enum_type := self.find_dpcode(
|
||||
DPCode.MODE, dptype=DPType.ENUM, prefer_function=True
|
||||
)
|
||||
) and TUYA_MODE_RETURN_HOME in enum_type.range:
|
||||
self._supported_features |= SUPPORT_RETURN_HOME
|
||||
|
||||
if self.find_dpcode(DPCode.SEEK, prefer_function=True):
|
||||
self._supported_features |= SUPPORT_LOCATE
|
||||
|
@ -178,7 +185,12 @@ class TuyaVacuumEntity(TuyaEntity, StateVacuumEntity):
|
|||
|
||||
def return_to_base(self, **kwargs: Any) -> None:
|
||||
"""Return device to dock."""
|
||||
self._send_command([{"code": DPCode.MODE, "value": "chargego"}])
|
||||
self._send_command(
|
||||
[
|
||||
{"code": DPCode.SWITCH_CHARGE, "value": True},
|
||||
{"code": DPCode.MODE, "value": TUYA_MODE_RETURN_HOME},
|
||||
]
|
||||
)
|
||||
|
||||
def locate(self, **kwargs: Any) -> None:
|
||||
"""Locate the device."""
|
||||
|
|
Loading…
Reference in New Issue