mirror of
https://github.com/home-assistant/core.git
synced 2025-07-28 07:37:34 +00:00
Fix tuya vacuum return_to_base function (#144362)
Co-authored-by: Franck Nijhof <git@frenck.dev>
This commit is contained in:
parent
ac5d4f4a81
commit
0dc145aee3
@ -91,14 +91,15 @@ class TuyaVacuumEntity(TuyaEntity, StateVacuumEntity):
|
||||
if self.find_dpcode(DPCode.PAUSE, prefer_function=True):
|
||||
self._attr_supported_features |= VacuumEntityFeature.PAUSE
|
||||
|
||||
if self.find_dpcode(DPCode.SWITCH_CHARGE, prefer_function=True) or (
|
||||
(
|
||||
enum_type := self.find_dpcode(
|
||||
DPCode.MODE, dptype=DPType.ENUM, prefer_function=True
|
||||
)
|
||||
self._return_home_use_switch_charge = False
|
||||
if self.find_dpcode(DPCode.SWITCH_CHARGE, prefer_function=True):
|
||||
self._attr_supported_features |= VacuumEntityFeature.RETURN_HOME
|
||||
self._return_home_use_switch_charge = True
|
||||
elif (
|
||||
enum_type := self.find_dpcode(
|
||||
DPCode.MODE, dptype=DPType.ENUM, prefer_function=True
|
||||
)
|
||||
and TUYA_MODE_RETURN_HOME in enum_type.range
|
||||
):
|
||||
) and TUYA_MODE_RETURN_HOME in enum_type.range:
|
||||
self._attr_supported_features |= VacuumEntityFeature.RETURN_HOME
|
||||
|
||||
if self.find_dpcode(DPCode.SEEK, prefer_function=True):
|
||||
@ -159,12 +160,10 @@ class TuyaVacuumEntity(TuyaEntity, StateVacuumEntity):
|
||||
|
||||
def return_to_base(self, **kwargs: Any) -> None:
|
||||
"""Return device to dock."""
|
||||
self._send_command(
|
||||
[
|
||||
{"code": DPCode.SWITCH_CHARGE, "value": True},
|
||||
{"code": DPCode.MODE, "value": TUYA_MODE_RETURN_HOME},
|
||||
]
|
||||
)
|
||||
if self._return_home_use_switch_charge:
|
||||
self._send_command([{"code": DPCode.SWITCH_CHARGE, "value": True}])
|
||||
else:
|
||||
self._send_command([{"code": DPCode.MODE, "value": TUYA_MODE_RETURN_HOME}])
|
||||
|
||||
def locate(self, **kwargs: Any) -> None:
|
||||
"""Locate the device."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user