From 4080455c1239694975c6df4c3bec7f948f16fa19 Mon Sep 17 00:00:00 2001 From: G Johansson Date: Sat, 28 Dec 2024 16:12:09 +0100 Subject: [PATCH] Use x,y in roborock action call (#134133) * Use x,y in roborock action call * Fix description --- homeassistant/components/roborock/services.yaml | 4 ++-- homeassistant/components/roborock/strings.json | 8 ++++---- homeassistant/components/roborock/vacuum.py | 8 ++++---- tests/components/roborock/test_vacuum.py | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/homeassistant/components/roborock/services.yaml b/homeassistant/components/roborock/services.yaml index 4d4292bedaf..eebda66fac7 100644 --- a/homeassistant/components/roborock/services.yaml +++ b/homeassistant/components/roborock/services.yaml @@ -9,13 +9,13 @@ set_vacuum_goto_position: integration: roborock domain: vacuum fields: - x_coord: + x: example: 27500 required: true selector: text: type: number - y_coord: + y: example: 32000 required: true selector: diff --git a/homeassistant/components/roborock/strings.json b/homeassistant/components/roborock/strings.json index 354206ec955..e47be119a0e 100644 --- a/homeassistant/components/roborock/strings.json +++ b/homeassistant/components/roborock/strings.json @@ -433,13 +433,13 @@ "name": "Go to position", "description": "Send the vacuum to a specific position.", "fields": { - "x_coord": { + "x": { "name": "X-coordinate", - "description": "" + "description": "Coordinates are relative to the dock. x=25500,y=25500 is the dock position." }, - "y_coord": { + "y": { "name": "Y-coordinate", - "description": "" + "description": "[%key:component::roborock::services::set_vacuum_goto_position::fields::x::description%]" } } }, diff --git a/homeassistant/components/roborock/vacuum.py b/homeassistant/components/roborock/vacuum.py index b15e961869d..7582dadad16 100644 --- a/homeassistant/components/roborock/vacuum.py +++ b/homeassistant/components/roborock/vacuum.py @@ -88,8 +88,8 @@ async def async_setup_entry( SET_VACUUM_GOTO_POSITION_SERVICE_NAME, cv.make_entity_service_schema( { - vol.Required("x_coord"): vol.Coerce(int), - vol.Required("y_coord"): vol.Coerce(int), + vol.Required("x"): vol.Coerce(int), + vol.Required("y"): vol.Coerce(int), }, ), RoborockVacuum.async_set_vacuum_goto_position.__name__, @@ -185,9 +185,9 @@ class RoborockVacuum(RoborockCoordinatedEntityV1, StateVacuumEntity): [self._device_status.get_fan_speed_code(fan_speed)], ) - async def async_set_vacuum_goto_position(self, x_coord: int, y_coord: int) -> None: + async def async_set_vacuum_goto_position(self, x: int, y: int) -> None: """Send vacuum to a specific target point.""" - await self.send(RoborockCommand.APP_GOTO_TARGET, [x_coord, y_coord]) + await self.send(RoborockCommand.APP_GOTO_TARGET, [x, y]) async def async_send_command( self, diff --git a/tests/components/roborock/test_vacuum.py b/tests/components/roborock/test_vacuum.py index e0872dca40f..449ba7bca95 100644 --- a/tests/components/roborock/test_vacuum.py +++ b/tests/components/roborock/test_vacuum.py @@ -197,7 +197,7 @@ async def test_goto( vacuum = hass.states.get(ENTITY_ID) assert vacuum - data = {ATTR_ENTITY_ID: ENTITY_ID, "x_coord": 25500, "y_coord": 25500} + data = {ATTR_ENTITY_ID: ENTITY_ID, "x": 25500, "y": 25500} with patch( "homeassistant.components.roborock.coordinator.RoborockLocalClientV1.send_command" ) as mock_send_command: