mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 21:57:51 +00:00
Bump aioautomower to 2024.5.0 (#116942)
This commit is contained in:
parent
486b8ca7c4
commit
8e66e5bb11
@ -83,7 +83,7 @@ class AutomowerLawnMowerEntity(AutomowerControlEntity, LawnMowerEntity):
|
|||||||
async def async_start_mowing(self) -> None:
|
async def async_start_mowing(self) -> None:
|
||||||
"""Resume schedule."""
|
"""Resume schedule."""
|
||||||
try:
|
try:
|
||||||
await self.coordinator.api.resume_schedule(self.mower_id)
|
await self.coordinator.api.commands.resume_schedule(self.mower_id)
|
||||||
except ApiException as exception:
|
except ApiException as exception:
|
||||||
raise HomeAssistantError(
|
raise HomeAssistantError(
|
||||||
f"Command couldn't be sent to the command queue: {exception}"
|
f"Command couldn't be sent to the command queue: {exception}"
|
||||||
@ -92,7 +92,7 @@ class AutomowerLawnMowerEntity(AutomowerControlEntity, LawnMowerEntity):
|
|||||||
async def async_pause(self) -> None:
|
async def async_pause(self) -> None:
|
||||||
"""Pauses the mower."""
|
"""Pauses the mower."""
|
||||||
try:
|
try:
|
||||||
await self.coordinator.api.pause_mowing(self.mower_id)
|
await self.coordinator.api.commands.pause_mowing(self.mower_id)
|
||||||
except ApiException as exception:
|
except ApiException as exception:
|
||||||
raise HomeAssistantError(
|
raise HomeAssistantError(
|
||||||
f"Command couldn't be sent to the command queue: {exception}"
|
f"Command couldn't be sent to the command queue: {exception}"
|
||||||
@ -101,7 +101,7 @@ class AutomowerLawnMowerEntity(AutomowerControlEntity, LawnMowerEntity):
|
|||||||
async def async_dock(self) -> None:
|
async def async_dock(self) -> None:
|
||||||
"""Parks the mower until next schedule."""
|
"""Parks the mower until next schedule."""
|
||||||
try:
|
try:
|
||||||
await self.coordinator.api.park_until_next_schedule(self.mower_id)
|
await self.coordinator.api.commands.park_until_next_schedule(self.mower_id)
|
||||||
except ApiException as exception:
|
except ApiException as exception:
|
||||||
raise HomeAssistantError(
|
raise HomeAssistantError(
|
||||||
f"Command couldn't be sent to the command queue: {exception}"
|
f"Command couldn't be sent to the command queue: {exception}"
|
||||||
|
@ -7,5 +7,5 @@
|
|||||||
"documentation": "https://www.home-assistant.io/integrations/husqvarna_automower",
|
"documentation": "https://www.home-assistant.io/integrations/husqvarna_automower",
|
||||||
"iot_class": "cloud_push",
|
"iot_class": "cloud_push",
|
||||||
"loggers": ["aioautomower"],
|
"loggers": ["aioautomower"],
|
||||||
"requirements": ["aioautomower==2024.4.4"]
|
"requirements": ["aioautomower==2024.5.0"]
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ async def async_set_work_area_cutting_height(
|
|||||||
work_area_id: int,
|
work_area_id: int,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set cutting height for work area."""
|
"""Set cutting height for work area."""
|
||||||
await coordinator.api.set_cutting_height_workarea(
|
await coordinator.api.commands.set_cutting_height_workarea(
|
||||||
mower_id, int(cheight), work_area_id
|
mower_id, int(cheight), work_area_id
|
||||||
)
|
)
|
||||||
# As there are no updates from the websocket regarding work area changes,
|
# As there are no updates from the websocket regarding work area changes,
|
||||||
@ -58,6 +58,15 @@ async def async_set_work_area_cutting_height(
|
|||||||
await coordinator.async_request_refresh()
|
await coordinator.async_request_refresh()
|
||||||
|
|
||||||
|
|
||||||
|
async def async_set_cutting_height(
|
||||||
|
session: AutomowerSession,
|
||||||
|
mower_id: str,
|
||||||
|
cheight: float,
|
||||||
|
) -> None:
|
||||||
|
"""Set cutting height."""
|
||||||
|
await session.commands.set_cutting_height(mower_id, int(cheight))
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True, kw_only=True)
|
@dataclass(frozen=True, kw_only=True)
|
||||||
class AutomowerNumberEntityDescription(NumberEntityDescription):
|
class AutomowerNumberEntityDescription(NumberEntityDescription):
|
||||||
"""Describes Automower number entity."""
|
"""Describes Automower number entity."""
|
||||||
@ -77,9 +86,7 @@ NUMBER_TYPES: tuple[AutomowerNumberEntityDescription, ...] = (
|
|||||||
native_max_value=9,
|
native_max_value=9,
|
||||||
exists_fn=lambda data: data.cutting_height is not None,
|
exists_fn=lambda data: data.cutting_height is not None,
|
||||||
value_fn=_async_get_cutting_height,
|
value_fn=_async_get_cutting_height,
|
||||||
set_value_fn=lambda session, mower_id, cheight: session.set_cutting_height(
|
set_value_fn=async_set_cutting_height,
|
||||||
mower_id, int(cheight)
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ class AutomowerSelectEntity(AutomowerControlEntity, SelectEntity):
|
|||||||
async def async_select_option(self, option: str) -> None:
|
async def async_select_option(self, option: str) -> None:
|
||||||
"""Change the selected option."""
|
"""Change the selected option."""
|
||||||
try:
|
try:
|
||||||
await self.coordinator.api.set_headlight_mode(
|
await self.coordinator.api.commands.set_headlight_mode(
|
||||||
self.mower_id, cast(HeadlightModes, option.upper())
|
self.mower_id, cast(HeadlightModes, option.upper())
|
||||||
)
|
)
|
||||||
except ApiException as exception:
|
except ApiException as exception:
|
||||||
|
@ -78,7 +78,7 @@ class AutomowerSwitchEntity(AutomowerControlEntity, SwitchEntity):
|
|||||||
async def async_turn_off(self, **kwargs: Any) -> None:
|
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||||
"""Turn the entity off."""
|
"""Turn the entity off."""
|
||||||
try:
|
try:
|
||||||
await self.coordinator.api.park_until_further_notice(self.mower_id)
|
await self.coordinator.api.commands.park_until_further_notice(self.mower_id)
|
||||||
except ApiException as exception:
|
except ApiException as exception:
|
||||||
raise HomeAssistantError(
|
raise HomeAssistantError(
|
||||||
f"Command couldn't be sent to the command queue: {exception}"
|
f"Command couldn't be sent to the command queue: {exception}"
|
||||||
@ -87,7 +87,7 @@ class AutomowerSwitchEntity(AutomowerControlEntity, SwitchEntity):
|
|||||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||||
"""Turn the entity on."""
|
"""Turn the entity on."""
|
||||||
try:
|
try:
|
||||||
await self.coordinator.api.resume_schedule(self.mower_id)
|
await self.coordinator.api.commands.resume_schedule(self.mower_id)
|
||||||
except ApiException as exception:
|
except ApiException as exception:
|
||||||
raise HomeAssistantError(
|
raise HomeAssistantError(
|
||||||
f"Command couldn't be sent to the command queue: {exception}"
|
f"Command couldn't be sent to the command queue: {exception}"
|
||||||
|
@ -201,7 +201,7 @@ aioaseko==0.1.1
|
|||||||
aioasuswrt==1.4.0
|
aioasuswrt==1.4.0
|
||||||
|
|
||||||
# homeassistant.components.husqvarna_automower
|
# homeassistant.components.husqvarna_automower
|
||||||
aioautomower==2024.4.4
|
aioautomower==2024.5.0
|
||||||
|
|
||||||
# homeassistant.components.azure_devops
|
# homeassistant.components.azure_devops
|
||||||
aioazuredevops==2.0.0
|
aioazuredevops==2.0.0
|
||||||
|
@ -180,7 +180,7 @@ aioaseko==0.1.1
|
|||||||
aioasuswrt==1.4.0
|
aioasuswrt==1.4.0
|
||||||
|
|
||||||
# homeassistant.components.husqvarna_automower
|
# homeassistant.components.husqvarna_automower
|
||||||
aioautomower==2024.4.4
|
aioautomower==2024.5.0
|
||||||
|
|
||||||
# homeassistant.components.azure_devops
|
# homeassistant.components.azure_devops
|
||||||
aioazuredevops==2.0.0
|
aioazuredevops==2.0.0
|
||||||
|
@ -90,5 +90,6 @@ def mock_automower_client() -> Generator[AsyncMock, None, None]:
|
|||||||
return ClientWebSocketResponse
|
return ClientWebSocketResponse
|
||||||
|
|
||||||
client.auth = AsyncMock(side_effect=websocket_connect)
|
client.auth = AsyncMock(side_effect=websocket_connect)
|
||||||
|
client.commands = AsyncMock()
|
||||||
|
|
||||||
yield client
|
yield client
|
||||||
|
@ -5,6 +5,22 @@
|
|||||||
'battery_percent': 100,
|
'battery_percent': 100,
|
||||||
}),
|
}),
|
||||||
'calendar': dict({
|
'calendar': dict({
|
||||||
|
'events': list([
|
||||||
|
dict({
|
||||||
|
'end': '2024-05-07T00:00:00+00:00',
|
||||||
|
'rrule': 'FREQ=WEEKLY;BYDAY=MO,WE,FR',
|
||||||
|
'start': '2024-05-06T19:00:00+00:00',
|
||||||
|
'uid': '1140_300_MO,WE,FR',
|
||||||
|
'work_area_id': None,
|
||||||
|
}),
|
||||||
|
dict({
|
||||||
|
'end': '2024-05-07T08:00:00+00:00',
|
||||||
|
'rrule': 'FREQ=WEEKLY;BYDAY=TU,TH,SA',
|
||||||
|
'start': '2024-05-07T00:00:00+00:00',
|
||||||
|
'uid': '0_480_TU,TH,SA',
|
||||||
|
'work_area_id': None,
|
||||||
|
}),
|
||||||
|
]),
|
||||||
'tasks': list([
|
'tasks': list([
|
||||||
dict({
|
dict({
|
||||||
'duration': 300,
|
'duration': 300,
|
||||||
|
@ -71,9 +71,9 @@ async def test_lawn_mower_commands(
|
|||||||
"""Test lawn_mower commands."""
|
"""Test lawn_mower commands."""
|
||||||
await setup_integration(hass, mock_config_entry)
|
await setup_integration(hass, mock_config_entry)
|
||||||
|
|
||||||
getattr(mock_automower_client, aioautomower_command).side_effect = ApiException(
|
getattr(
|
||||||
"Test error"
|
mock_automower_client.commands, aioautomower_command
|
||||||
)
|
).side_effect = ApiException("Test error")
|
||||||
|
|
||||||
with pytest.raises(HomeAssistantError) as exc_info:
|
with pytest.raises(HomeAssistantError) as exc_info:
|
||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
|
@ -35,7 +35,7 @@ async def test_number_commands(
|
|||||||
service_data={"value": "3"},
|
service_data={"value": "3"},
|
||||||
blocking=True,
|
blocking=True,
|
||||||
)
|
)
|
||||||
mocked_method = mock_automower_client.set_cutting_height
|
mocked_method = mock_automower_client.commands.set_cutting_height
|
||||||
assert len(mocked_method.mock_calls) == 1
|
assert len(mocked_method.mock_calls) == 1
|
||||||
|
|
||||||
mocked_method.side_effect = ApiException("Test error")
|
mocked_method.side_effect = ApiException("Test error")
|
||||||
@ -68,7 +68,9 @@ async def test_number_workarea_commands(
|
|||||||
values[TEST_MOWER_ID].work_areas[123456].cutting_height = 75
|
values[TEST_MOWER_ID].work_areas[123456].cutting_height = 75
|
||||||
mock_automower_client.get_status.return_value = values
|
mock_automower_client.get_status.return_value = values
|
||||||
mocked_method = AsyncMock()
|
mocked_method = AsyncMock()
|
||||||
setattr(mock_automower_client, "set_cutting_height_workarea", mocked_method)
|
setattr(
|
||||||
|
mock_automower_client.commands, "set_cutting_height_workarea", mocked_method
|
||||||
|
)
|
||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
domain="number",
|
domain="number",
|
||||||
service="set_value",
|
service="set_value",
|
||||||
|
@ -81,7 +81,7 @@ async def test_select_commands(
|
|||||||
},
|
},
|
||||||
blocking=True,
|
blocking=True,
|
||||||
)
|
)
|
||||||
mocked_method = mock_automower_client.set_headlight_mode
|
mocked_method = mock_automower_client.commands.set_headlight_mode
|
||||||
assert len(mocked_method.mock_calls) == 1
|
assert len(mocked_method.mock_calls) == 1
|
||||||
|
|
||||||
mocked_method.side_effect = ApiException("Test error")
|
mocked_method.side_effect = ApiException("Test error")
|
||||||
|
@ -76,7 +76,7 @@ async def test_switch_commands(
|
|||||||
service_data={"entity_id": "switch.test_mower_1_enable_schedule"},
|
service_data={"entity_id": "switch.test_mower_1_enable_schedule"},
|
||||||
blocking=True,
|
blocking=True,
|
||||||
)
|
)
|
||||||
mocked_method = getattr(mock_automower_client, aioautomower_command)
|
mocked_method = getattr(mock_automower_client.commands, aioautomower_command)
|
||||||
assert len(mocked_method.mock_calls) == 1
|
assert len(mocked_method.mock_calls) == 1
|
||||||
|
|
||||||
mocked_method.side_effect = ApiException("Test error")
|
mocked_method.side_effect = ApiException("Test error")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user