Bump aioautomower to 2024.7.3 (#121983)

* Bump aioautomower to 2024.7.0

* tests

* Bump to 2024.7.1

* bump to 2024.7.2

* use timezone Europe/Berlin

* bump to 2024.7.3

---------

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
Co-authored-by: Erik Montnemery <erik@montnemery.com>
This commit is contained in:
Thomas55555 2024-07-31 08:28:39 +02:00 committed by GitHub
parent 5766ea9541
commit 0d678120e4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 40 additions and 14 deletions

View file

@ -7,5 +7,5 @@
"documentation": "https://www.home-assistant.io/integrations/husqvarna_automower",
"iot_class": "cloud_push",
"loggers": ["aioautomower"],
"requirements": ["aioautomower==2024.6.4"]
"requirements": ["aioautomower==2024.7.3"]
}

View file

@ -5,8 +5,10 @@ from dataclasses import dataclass
from datetime import datetime
import logging
from typing import TYPE_CHECKING
from zoneinfo import ZoneInfo
from aioautomower.model import MowerAttributes, MowerModes, RestrictedReasons
from aioautomower.utils import naive_to_aware
from homeassistant.components.sensor import (
SensorDeviceClass,
@ -18,6 +20,7 @@ from homeassistant.const import PERCENTAGE, EntityCategory, UnitOfLength, UnitOf
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import StateType
from homeassistant.util import dt as dt_util
from . import AutomowerConfigEntry
from .coordinator import AutomowerDataUpdateCoordinator
@ -324,7 +327,10 @@ SENSOR_TYPES: tuple[AutomowerSensorEntityDescription, ...] = (
key="next_start_timestamp",
translation_key="next_start_timestamp",
device_class=SensorDeviceClass.TIMESTAMP,
value_fn=lambda data: data.planner.next_start_datetime,
value_fn=lambda data: naive_to_aware(
data.planner.next_start_datetime_naive,
ZoneInfo(str(dt_util.DEFAULT_TIME_ZONE)),
),
),
AutomowerSensorEntityDescription(
key="error",

View file

@ -198,7 +198,7 @@ aioaseko==0.2.0
aioasuswrt==1.4.0
# homeassistant.components.husqvarna_automower
aioautomower==2024.6.4
aioautomower==2024.7.3
# homeassistant.components.azure_devops
aioazuredevops==2.1.1

View file

@ -186,7 +186,7 @@ aioaseko==0.2.0
aioasuswrt==1.4.0
# homeassistant.components.husqvarna_automower
aioautomower==2024.6.4
aioautomower==2024.7.3
# homeassistant.components.azure_devops
aioazuredevops==2.1.1

View file

@ -7,6 +7,10 @@ from tests.common import MockConfigEntry
async def setup_integration(hass: HomeAssistant, config_entry: MockConfigEntry) -> None:
"""Fixture for setting up the component."""
# We lock the timezone, because the timezone is passed to the library to generate
# some values like the next start sensor. This is needed, as the device is not aware
# of its own timezone. So we assume the device is in the timezone which is selected in
# the Home Assistant config.
await hass.config.async_set_time_zone("Europe/Berlin")
config_entry.add_to_hass(hass)
await hass.config_entries.async_setup(config_entry.entry_id)

View file

@ -7,18 +7,20 @@
'calendar': dict({
'events': list([
dict({
'end': '2024-03-02T00:00:00+00:00',
'end': '2024-03-02T00:00:00',
'rrule': 'FREQ=WEEKLY;BYDAY=MO,WE,FR',
'start': '2024-03-01T19:00:00+00:00',
'start': '2024-03-01T19:00:00',
'uid': '1140_300_MO,WE,FR',
'work_area_id': None,
'work_area_name': None,
}),
dict({
'end': '2024-03-02T08:00:00+00:00',
'end': '2024-03-02T08:00:00',
'rrule': 'FREQ=WEEKLY;BYDAY=TU,TH,SA',
'start': '2024-03-02T00:00:00+00:00',
'start': '2024-03-02T00:00:00',
'uid': '0_480_TU,TH,SA',
'work_area_id': None,
'work_area_name': None,
}),
]),
'tasks': list([
@ -33,6 +35,7 @@
'tuesday': False,
'wednesday': True,
'work_area_id': None,
'work_area_name': None,
}),
dict({
'duration': 480,
@ -45,6 +48,7 @@
'tuesday': True,
'wednesday': False,
'work_area_id': None,
'work_area_name': None,
}),
]),
}),
@ -61,17 +65,18 @@
'mower': dict({
'activity': 'PARKED_IN_CS',
'error_code': 0,
'error_datetime': None,
'error_datetime_naive': None,
'error_key': None,
'error_timestamp': 0,
'inactive_reason': 'NONE',
'is_error_confirmable': False,
'mode': 'MAIN_AREA',
'state': 'RESTRICTED',
'work_area_id': 123456,
'work_area_name': 'Front lawn',
}),
'planner': dict({
'next_start_datetime': '2023-06-05T19:00:00+00:00',
'next_start': 1685991600000,
'next_start_datetime_naive': '2023-06-05T19:00:00',
'override': dict({
'action': 'NOT_ACTIVE',
@ -113,6 +118,17 @@
'name': 'Test Mower 1',
'serial_number': 123,
}),
'work_area_dict': dict({
'0': 'my_lawn',
'123456': 'Front lawn',
'654321': 'Back lawn',
}),
'work_area_names': list([
'Front lawn',
'Back lawn',
'my_lawn',
'no_work_area_active',
]),
'work_areas': dict({
'0': dict({
'cutting_height': 50,

View file

@ -548,7 +548,7 @@
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': '2023-06-05T19:00:00+00:00',
'state': '2023-06-05T17:00:00+00:00',
})
# ---
# name: test_sensor_snapshot[sensor.test_mower_1_none-entry]

View file

@ -73,12 +73,12 @@ async def test_next_start_sensor(
await setup_integration(hass, mock_config_entry)
state = hass.states.get("sensor.test_mower_1_next_start")
assert state is not None
assert state.state == "2023-06-05T19:00:00+00:00"
assert state.state == "2023-06-05T17:00:00+00:00"
values = mower_list_to_dictionary_dataclass(
load_json_value_fixture("mower.json", DOMAIN)
)
values[TEST_MOWER_ID].planner.next_start_datetime = None
values[TEST_MOWER_ID].planner.next_start_datetime_naive = None
mock_automower_client.get_status.return_value = values
freezer.tick(SCAN_INTERVAL)
async_fire_time_changed(hass)