mirror of
https://github.com/home-assistant/core.git
synced 2025-07-28 15:47:12 +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):
|
if self.find_dpcode(DPCode.PAUSE, prefer_function=True):
|
||||||
self._attr_supported_features |= VacuumEntityFeature.PAUSE
|
self._attr_supported_features |= VacuumEntityFeature.PAUSE
|
||||||
|
|
||||||
if self.find_dpcode(DPCode.SWITCH_CHARGE, prefer_function=True) or (
|
self._return_home_use_switch_charge = False
|
||||||
(
|
if self.find_dpcode(DPCode.SWITCH_CHARGE, prefer_function=True):
|
||||||
enum_type := self.find_dpcode(
|
self._attr_supported_features |= VacuumEntityFeature.RETURN_HOME
|
||||||
DPCode.MODE, dptype=DPType.ENUM, prefer_function=True
|
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
|
self._attr_supported_features |= VacuumEntityFeature.RETURN_HOME
|
||||||
|
|
||||||
if self.find_dpcode(DPCode.SEEK, prefer_function=True):
|
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:
|
def return_to_base(self, **kwargs: Any) -> None:
|
||||||
"""Return device to dock."""
|
"""Return device to dock."""
|
||||||
self._send_command(
|
if self._return_home_use_switch_charge:
|
||||||
[
|
self._send_command([{"code": DPCode.SWITCH_CHARGE, "value": True}])
|
||||||
{"code": DPCode.SWITCH_CHARGE, "value": True},
|
else:
|
||||||
{"code": DPCode.MODE, "value": TUYA_MODE_RETURN_HOME},
|
self._send_command([{"code": DPCode.MODE, "value": TUYA_MODE_RETURN_HOME}])
|
||||||
]
|
|
||||||
)
|
|
||||||
|
|
||||||
def locate(self, **kwargs: Any) -> None:
|
def locate(self, **kwargs: Any) -> None:
|
||||||
"""Locate the device."""
|
"""Locate the device."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user