From 49299a6bf07d10f0c5e78cf496e08fe88edee29c Mon Sep 17 00:00:00 2001 From: Thomas55555 <59625598+Thomas55555@users.noreply.github.com> Date: Sat, 26 Apr 2025 23:07:14 +0200 Subject: [PATCH] Bump aioautomower to 2025.4.4 (#143533) * Bump aioautomower to 2025.4.1 * Update split_tests.py * revert b3222b9be994d39e9e5b28d8e06abeb36bbda6ca Co-authored-by: Shay Levy * aioautomower==2025.4.2 * fix * aioautomower==2025.4.30b0 * revert * some try * aioautomower==2025.4.0 * aioautomower==2025.4.3b0 * aioautomower==2025.4.4 --------- Co-authored-by: Michael <35783820+mib1185@users.noreply.github.com> Co-authored-by: Shay Levy --- .../components/husqvarna_automower/manifest.json | 2 +- homeassistant/components/husqvarna_automower/number.py | 4 ++-- homeassistant/components/husqvarna_automower/switch.py | 8 ++++---- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- tests/components/husqvarna_automower/conftest.py | 6 +++--- tests/components/husqvarna_automower/test_number.py | 6 +++--- tests/components/husqvarna_automower/test_switch.py | 6 +++--- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/homeassistant/components/husqvarna_automower/manifest.json b/homeassistant/components/husqvarna_automower/manifest.json index d26cc18c127..8e4be4c71f3 100644 --- a/homeassistant/components/husqvarna_automower/manifest.json +++ b/homeassistant/components/husqvarna_automower/manifest.json @@ -8,5 +8,5 @@ "iot_class": "cloud_push", "loggers": ["aioautomower"], "quality_scale": "silver", - "requirements": ["aioautomower==2025.4.0"] + "requirements": ["aioautomower==2025.4.4"] } diff --git a/homeassistant/components/husqvarna_automower/number.py b/homeassistant/components/husqvarna_automower/number.py index 9ed00113d4b..4a57c48e66f 100644 --- a/homeassistant/components/husqvarna_automower/number.py +++ b/homeassistant/components/husqvarna_automower/number.py @@ -44,8 +44,8 @@ async def async_set_work_area_cutting_height( ) -> None: """Set cutting height for work area.""" await coordinator.api.commands.workarea_settings( - mower_id, work_area_id, cutting_height=int(cheight) - ) + mower_id, work_area_id + ).cutting_height(cutting_height=int(cheight)) async def async_set_cutting_height( diff --git a/homeassistant/components/husqvarna_automower/switch.py b/homeassistant/components/husqvarna_automower/switch.py index 69a3e670eda..1cfc79d5a71 100644 --- a/homeassistant/components/husqvarna_automower/switch.py +++ b/homeassistant/components/husqvarna_automower/switch.py @@ -206,12 +206,12 @@ class WorkAreaSwitchEntity(WorkAreaControlEntity, SwitchEntity): async def async_turn_off(self, **kwargs: Any) -> None: """Turn the switch off.""" await self.coordinator.api.commands.workarea_settings( - self.mower_id, self.work_area_id, enabled=False - ) + self.mower_id, self.work_area_id + ).enabled(enabled=False) @handle_sending_exception(poll_after_sending=True) async def async_turn_on(self, **kwargs: Any) -> None: """Turn the switch on.""" await self.coordinator.api.commands.workarea_settings( - self.mower_id, self.work_area_id, enabled=True - ) + self.mower_id, self.work_area_id + ).enabled(enabled=True) diff --git a/requirements_all.txt b/requirements_all.txt index 8129e566a3d..1c83b254d6a 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -201,7 +201,7 @@ aioaseko==1.0.0 aioasuswrt==1.4.0 # homeassistant.components.husqvarna_automower -aioautomower==2025.4.0 +aioautomower==2025.4.4 # homeassistant.components.azure_devops aioazuredevops==2.2.1 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index f08fbc6da1a..2394de103ed 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -189,7 +189,7 @@ aioaseko==1.0.0 aioasuswrt==1.4.0 # homeassistant.components.husqvarna_automower -aioautomower==2025.4.0 +aioautomower==2025.4.4 # homeassistant.components.azure_devops aioazuredevops==2.2.1 diff --git a/tests/components/husqvarna_automower/conftest.py b/tests/components/husqvarna_automower/conftest.py index 49994e4f3ae..871f108bfd0 100644 --- a/tests/components/husqvarna_automower/conftest.py +++ b/tests/components/husqvarna_automower/conftest.py @@ -6,7 +6,7 @@ import time from unittest.mock import AsyncMock, patch from aioautomower.model import MowerAttributes -from aioautomower.session import AutomowerSession, _MowerCommands +from aioautomower.session import AutomowerSession, MowerCommands from aioautomower.utils import mower_list_to_dictionary_dataclass from aiohttp import ClientWebSocketResponse import pytest @@ -119,7 +119,7 @@ def mock_automower_client(values) -> Generator[AsyncMock]: mock = AsyncMock(spec=AutomowerSession) mock.auth = AsyncMock(side_effect=ClientWebSocketResponse) - mock.commands = AsyncMock(spec_set=_MowerCommands) + mock.commands = AsyncMock(spec_set=MowerCommands) mock.get_status.return_value = values mock.start_listening = AsyncMock(side_effect=listen) @@ -142,7 +142,7 @@ def mock_automower_client_one_mower(values) -> Generator[AsyncMock]: mock = AsyncMock(spec=AutomowerSession) mock.auth = AsyncMock(side_effect=ClientWebSocketResponse) - mock.commands = AsyncMock(spec_set=_MowerCommands) + mock.commands = AsyncMock(spec_set=MowerCommands) mock.get_status.return_value = values mock.start_listening = AsyncMock(side_effect=listen) diff --git a/tests/components/husqvarna_automower/test_number.py b/tests/components/husqvarna_automower/test_number.py index 814846ae1c6..628011e3f15 100644 --- a/tests/components/husqvarna_automower/test_number.py +++ b/tests/components/husqvarna_automower/test_number.py @@ -68,7 +68,7 @@ async def test_number_workarea_commands( values[TEST_MOWER_ID].work_areas[123456].cutting_height = 75 mock_automower_client.get_status.return_value = values mocked_method = AsyncMock() - setattr(mock_automower_client.commands, "workarea_settings", mocked_method) + mock_automower_client.commands.workarea_settings.return_value = mocked_method await hass.services.async_call( domain="number", service="set_value", @@ -79,12 +79,12 @@ async def test_number_workarea_commands( freezer.tick(timedelta(seconds=EXECUTION_TIME_DELAY)) async_fire_time_changed(hass) await hass.async_block_till_done() - mocked_method.assert_called_once_with(TEST_MOWER_ID, 123456, cutting_height=75) + mocked_method.cutting_height.assert_called_once_with(cutting_height=75) state = hass.states.get(entity_id) assert state.state is not None assert state.state == "75" - mocked_method.side_effect = ApiError("Test error") + mocked_method.cutting_height.side_effect = ApiError("Test error") with pytest.raises( HomeAssistantError, match="Failed to send command: Test error", diff --git a/tests/components/husqvarna_automower/test_switch.py b/tests/components/husqvarna_automower/test_switch.py index 48903a9630b..00b04ce9903 100644 --- a/tests/components/husqvarna_automower/test_switch.py +++ b/tests/components/husqvarna_automower/test_switch.py @@ -192,7 +192,7 @@ async def test_work_area_switch_commands( values[TEST_MOWER_ID].work_areas[TEST_AREA_ID].enabled = boolean mock_automower_client.get_status.return_value = values mocked_method = AsyncMock() - setattr(mock_automower_client.commands, "workarea_settings", mocked_method) + mock_automower_client.commands.workarea_settings.return_value = mocked_method await hass.services.async_call( domain=SWITCH_DOMAIN, service=service, @@ -202,12 +202,12 @@ async def test_work_area_switch_commands( freezer.tick(timedelta(seconds=EXECUTION_TIME_DELAY)) async_fire_time_changed(hass) await hass.async_block_till_done() - mocked_method.assert_called_once_with(TEST_MOWER_ID, TEST_AREA_ID, enabled=boolean) + mocked_method.enabled.assert_called_once_with(enabled=boolean) state = hass.states.get(entity_id) assert state is not None assert state.state == excepted_state - mocked_method.side_effect = ApiError("Test error") + mocked_method.enabled.side_effect = ApiError("Test error") with pytest.raises( HomeAssistantError, match="Failed to send command: Test error",