From bb758bcb26b32fa99b52bb742cddf0be8abc6a3e Mon Sep 17 00:00:00 2001 From: Thomas55555 <59625598+Thomas55555@users.noreply.github.com> Date: Tue, 21 May 2024 09:43:36 +0200 Subject: [PATCH] Bump aioautomower to 2024.5.1 (#117815) --- .../components/husqvarna_automower/manifest.json | 2 +- homeassistant/components/husqvarna_automower/number.py | 6 +++--- homeassistant/components/husqvarna_automower/select.py | 4 +++- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- .../components/husqvarna_automower/fixtures/mower.json | 8 +++++--- .../snapshots/test_diagnostics.ambr | 10 ++++++---- tests/components/husqvarna_automower/test_select.py | 2 +- 8 files changed, 21 insertions(+), 15 deletions(-) diff --git a/homeassistant/components/husqvarna_automower/manifest.json b/homeassistant/components/husqvarna_automower/manifest.json index 4f7a4bf966e..64cb3d9e92c 100644 --- a/homeassistant/components/husqvarna_automower/manifest.json +++ b/homeassistant/components/husqvarna_automower/manifest.json @@ -7,5 +7,5 @@ "documentation": "https://www.home-assistant.io/integrations/husqvarna_automower", "iot_class": "cloud_push", "loggers": ["aioautomower"], - "requirements": ["aioautomower==2024.5.0"] + "requirements": ["aioautomower==2024.5.1"] } diff --git a/homeassistant/components/husqvarna_automower/number.py b/homeassistant/components/husqvarna_automower/number.py index 94fe7d9aab7..2b3cf3fb7a8 100644 --- a/homeassistant/components/husqvarna_automower/number.py +++ b/homeassistant/components/husqvarna_automower/number.py @@ -30,8 +30,8 @@ def _async_get_cutting_height(data: MowerAttributes) -> int: """Return the cutting height.""" if TYPE_CHECKING: # Sensor does not get created if it is None - assert data.cutting_height is not None - return data.cutting_height + assert data.settings.cutting_height is not None + return data.settings.cutting_height @callback @@ -84,7 +84,7 @@ NUMBER_TYPES: tuple[AutomowerNumberEntityDescription, ...] = ( entity_category=EntityCategory.CONFIG, native_min_value=1, native_max_value=9, - exists_fn=lambda data: data.cutting_height is not None, + exists_fn=lambda data: data.settings.cutting_height is not None, value_fn=_async_get_cutting_height, set_value_fn=async_set_cutting_height, ), diff --git a/homeassistant/components/husqvarna_automower/select.py b/homeassistant/components/husqvarna_automower/select.py index 08de86baf00..1baa90e2799 100644 --- a/homeassistant/components/husqvarna_automower/select.py +++ b/homeassistant/components/husqvarna_automower/select.py @@ -59,7 +59,9 @@ class AutomowerSelectEntity(AutomowerControlEntity, SelectEntity): @property def current_option(self) -> str: """Return the current option for the entity.""" - return cast(HeadlightModes, self.mower_attributes.headlight.mode).lower() + return cast( + HeadlightModes, self.mower_attributes.settings.headlight.mode + ).lower() async def async_select_option(self, option: str) -> None: """Change the selected option.""" diff --git a/requirements_all.txt b/requirements_all.txt index 6b3313ce5c8..15c72d30788 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -201,7 +201,7 @@ aioaseko==0.1.1 aioasuswrt==1.4.0 # homeassistant.components.husqvarna_automower -aioautomower==2024.5.0 +aioautomower==2024.5.1 # homeassistant.components.azure_devops aioazuredevops==2.0.0 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 03a883b34a1..438f6865b4e 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -180,7 +180,7 @@ aioaseko==0.1.1 aioasuswrt==1.4.0 # homeassistant.components.husqvarna_automower -aioautomower==2024.5.0 +aioautomower==2024.5.1 # homeassistant.components.azure_devops aioazuredevops==2.0.0 diff --git a/tests/components/husqvarna_automower/fixtures/mower.json b/tests/components/husqvarna_automower/fixtures/mower.json index 7d125c6356c..4df505dfc69 100644 --- a/tests/components/husqvarna_automower/fixtures/mower.json +++ b/tests/components/husqvarna_automower/fixtures/mower.json @@ -157,9 +157,11 @@ } ] }, - "cuttingHeight": 4, - "headlight": { - "mode": "EVENING_ONLY" + "settings": { + "cuttingHeight": 4, + "headlight": { + "mode": "EVENING_ONLY" + } } } } diff --git a/tests/components/husqvarna_automower/snapshots/test_diagnostics.ambr b/tests/components/husqvarna_automower/snapshots/test_diagnostics.ambr index a87a97800d8..7e84097baf5 100644 --- a/tests/components/husqvarna_automower/snapshots/test_diagnostics.ambr +++ b/tests/components/husqvarna_automower/snapshots/test_diagnostics.ambr @@ -54,10 +54,6 @@ 'stay_out_zones': True, 'work_areas': True, }), - 'cutting_height': 4, - 'headlight': dict({ - 'mode': 'EVENING_ONLY', - }), 'metadata': dict({ 'connected': True, 'status_dateteime': '2023-10-18T22:58:52.683000+00:00', @@ -80,6 +76,12 @@ 'restricted_reason': 'WEEK_SCHEDULE', }), 'positions': '**REDACTED**', + 'settings': dict({ + 'cutting_height': 4, + 'headlight': dict({ + 'mode': 'EVENING_ONLY', + }), + }), 'statistics': dict({ 'cutting_blade_usage_time': 123, 'number_of_charging_cycles': 1380, diff --git a/tests/components/husqvarna_automower/test_select.py b/tests/components/husqvarna_automower/test_select.py index b6f3ba4b665..5ddb32828aa 100644 --- a/tests/components/husqvarna_automower/test_select.py +++ b/tests/components/husqvarna_automower/test_select.py @@ -46,7 +46,7 @@ async def test_select_states( (HeadlightModes.ALWAYS_ON, "always_on"), (HeadlightModes.EVENING_AND_NIGHT, "evening_and_night"), ]: - values[TEST_MOWER_ID].headlight.mode = state + values[TEST_MOWER_ID].settings.headlight.mode = state mock_automower_client.get_status.return_value = values freezer.tick(SCAN_INTERVAL) async_fire_time_changed(hass)