Use x,y in roborock action call (#134133)

* Use x,y in roborock action call

* Fix description
This commit is contained in:
G Johansson 2024-12-28 16:12:09 +01:00 committed by GitHub
parent df7d518f38
commit 4080455c12
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 11 additions and 11 deletions

View File

@ -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:

View File

@ -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%]"
}
}
},

View File

@ -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,

View File

@ -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: