Skip to content

Commit

Permalink
Use x,y in roborock action call (#134133)
Browse files Browse the repository at this point in the history
* Use x,y in roborock action call

* Fix description
  • Loading branch information
gjohansson-ST authored Dec 28, 2024
1 parent df7d518 commit 4080455
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions homeassistant/components/roborock/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 4 additions & 4 deletions homeassistant/components/roborock/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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%]"
}
}
},
Expand Down
8 changes: 4 additions & 4 deletions homeassistant/components/roborock/vacuum.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__,
Expand Down Expand Up @@ -185,9 +185,9 @@ async def async_set_fan_speed(self, fan_speed: str, **kwargs: Any) -> None:
[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,
Expand Down
2 changes: 1 addition & 1 deletion tests/components/roborock/test_vacuum.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 4080455

Please sign in to comment.