|
1 | 1 | """Ecovacs mower entity.""" |
2 | 2 |
|
3 | 3 | import logging |
| 4 | +from typing import Any |
4 | 5 |
|
5 | 6 | from deebot_client.capabilities import Capabilities, DeviceType |
6 | 7 | from deebot_client.device import Device |
|
14 | 15 | LawnMowerEntityFeature, |
15 | 16 | ) |
16 | 17 | from homeassistant.core import HomeAssistant |
| 18 | +from homeassistant.exceptions import ServiceValidationError |
17 | 19 | from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback |
18 | 20 |
|
19 | 21 | from . import EcovacsConfigEntry |
| 22 | +from .const import DOMAIN |
20 | 23 | from .entity import EcovacsEntity |
21 | 24 |
|
22 | 25 | _LOGGER = logging.getLogger(__name__) |
@@ -92,3 +95,27 @@ async def async_pause(self) -> None: |
92 | 95 | async def async_dock(self) -> None: |
93 | 96 | """Parks the mower until next schedule.""" |
94 | 97 | await self._device.execute_command(self._capability.charge.execute()) |
| 98 | + |
| 99 | + async def async_raw_get_positions( |
| 100 | + self, |
| 101 | + ) -> dict[str, Any]: |
| 102 | + """Get the raw positions response for the mower and its charging dock. |
| 103 | +
|
| 104 | + Mirrors the modern vacuum implementation so service |
| 105 | + `ecovacs.raw_get_positions` works on `lawn_mower.*` ecovacs entities. |
| 106 | + Useful for inspecting additional payload fields the cloud may return |
| 107 | + for RTK GOAT mowers (e.g. satellite counts, fix quality, signal |
| 108 | + strength), which can then be parsed and exposed by deebot-client and |
| 109 | + this integration in follow-up changes. |
| 110 | + """ |
| 111 | + _LOGGER.debug("async_raw_get_positions") |
| 112 | + |
| 113 | + if not (map_cap := self._capability.map) or not ( |
| 114 | + position_commands := map_cap.position.get |
| 115 | + ): |
| 116 | + raise ServiceValidationError( |
| 117 | + translation_domain=DOMAIN, |
| 118 | + translation_key="raw_get_positions_not_supported", |
| 119 | + ) |
| 120 | + |
| 121 | + return await self._device.execute_command(position_commands[0]) |
0 commit comments