mirror of
https://github.com/XiaoMi/ha_xiaomi_home.git
synced 2025-08-23 23:43:27 +08:00
fix: add RETURN_HOME functionality for new vacuum cleaner model (#1344)
Some checks failed
Some checks failed
This commit is contained in:
@ -170,6 +170,11 @@ SPEC_DEVICE_TRANS_MAP: dict = {
|
|||||||
'properties': {
|
'properties': {
|
||||||
'battery-level': {'read'}
|
'battery-level': {'read'}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
'optional': {
|
||||||
|
'actions': {
|
||||||
|
'start-charge'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -203,6 +203,16 @@ class Vacuum(MIoTServiceEntity, StateVacuumEntity):
|
|||||||
self._attr_supported_features |= VacuumEntityFeature.LOCATE
|
self._attr_supported_features |= VacuumEntityFeature.LOCATE
|
||||||
self._action_identify = action
|
self._action_identify = action
|
||||||
|
|
||||||
|
# Use start-charge from battery service as fallback
|
||||||
|
# if stop-and-gocharge is not available
|
||||||
|
if self._action_stop_and_gocharge is None:
|
||||||
|
for action in entity_data.actions:
|
||||||
|
if action.name == 'start-charge':
|
||||||
|
self._attr_supported_features |= (
|
||||||
|
VacuumEntityFeature.RETURN_HOME)
|
||||||
|
self._action_stop_and_gocharge = action
|
||||||
|
break
|
||||||
|
|
||||||
async def async_start(self) -> None:
|
async def async_start(self) -> None:
|
||||||
"""Start or resume the cleaning task."""
|
"""Start or resume the cleaning task."""
|
||||||
if self._prop_status is not None:
|
if self._prop_status is not None:
|
||||||
|
Reference in New Issue
Block a user