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:
parent
5766ea9541
commit
0d678120e4
8 changed files with 40 additions and 14 deletions
|
@ -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.6.4"]
|
"requirements": ["aioautomower==2024.7.3"]
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,10 @@ from dataclasses import dataclass
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import logging
|
import logging
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
from zoneinfo import ZoneInfo
|
||||||
|
|
||||||
from aioautomower.model import MowerAttributes, MowerModes, RestrictedReasons
|
from aioautomower.model import MowerAttributes, MowerModes, RestrictedReasons
|
||||||
|
from aioautomower.utils import naive_to_aware
|
||||||
|
|
||||||
from homeassistant.components.sensor import (
|
from homeassistant.components.sensor import (
|
||||||
SensorDeviceClass,
|
SensorDeviceClass,
|
||||||
|
@ -18,6 +20,7 @@ from homeassistant.const import PERCENTAGE, EntityCategory, UnitOfLength, UnitOf
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.typing import StateType
|
from homeassistant.helpers.typing import StateType
|
||||||
|
from homeassistant.util import dt as dt_util
|
||||||
|
|
||||||
from . import AutomowerConfigEntry
|
from . import AutomowerConfigEntry
|
||||||
from .coordinator import AutomowerDataUpdateCoordinator
|
from .coordinator import AutomowerDataUpdateCoordinator
|
||||||
|
@ -324,7 +327,10 @@ SENSOR_TYPES: tuple[AutomowerSensorEntityDescription, ...] = (
|
||||||
key="next_start_timestamp",
|
key="next_start_timestamp",
|
||||||
translation_key="next_start_timestamp",
|
translation_key="next_start_timestamp",
|
||||||
device_class=SensorDeviceClass.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(
|
AutomowerSensorEntityDescription(
|
||||||
key="error",
|
key="error",
|
||||||
|
|
|
@ -198,7 +198,7 @@ aioaseko==0.2.0
|
||||||
aioasuswrt==1.4.0
|
aioasuswrt==1.4.0
|
||||||
|
|
||||||
# homeassistant.components.husqvarna_automower
|
# homeassistant.components.husqvarna_automower
|
||||||
aioautomower==2024.6.4
|
aioautomower==2024.7.3
|
||||||
|
|
||||||
# homeassistant.components.azure_devops
|
# homeassistant.components.azure_devops
|
||||||
aioazuredevops==2.1.1
|
aioazuredevops==2.1.1
|
||||||
|
|
|
@ -186,7 +186,7 @@ aioaseko==0.2.0
|
||||||
aioasuswrt==1.4.0
|
aioasuswrt==1.4.0
|
||||||
|
|
||||||
# homeassistant.components.husqvarna_automower
|
# homeassistant.components.husqvarna_automower
|
||||||
aioautomower==2024.6.4
|
aioautomower==2024.7.3
|
||||||
|
|
||||||
# homeassistant.components.azure_devops
|
# homeassistant.components.azure_devops
|
||||||
aioazuredevops==2.1.1
|
aioazuredevops==2.1.1
|
||||||
|
|
|
@ -7,6 +7,10 @@ from tests.common import MockConfigEntry
|
||||||
|
|
||||||
async def setup_integration(hass: HomeAssistant, config_entry: MockConfigEntry) -> None:
|
async def setup_integration(hass: HomeAssistant, config_entry: MockConfigEntry) -> None:
|
||||||
"""Fixture for setting up the component."""
|
"""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)
|
config_entry.add_to_hass(hass)
|
||||||
|
|
||||||
await hass.config_entries.async_setup(config_entry.entry_id)
|
await hass.config_entries.async_setup(config_entry.entry_id)
|
||||||
|
|
|
@ -7,18 +7,20 @@
|
||||||
'calendar': dict({
|
'calendar': dict({
|
||||||
'events': list([
|
'events': list([
|
||||||
dict({
|
dict({
|
||||||
'end': '2024-03-02T00:00:00+00:00',
|
'end': '2024-03-02T00:00:00',
|
||||||
'rrule': 'FREQ=WEEKLY;BYDAY=MO,WE,FR',
|
'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',
|
'uid': '1140_300_MO,WE,FR',
|
||||||
'work_area_id': None,
|
'work_area_id': None,
|
||||||
|
'work_area_name': None,
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'end': '2024-03-02T08:00:00+00:00',
|
'end': '2024-03-02T08:00:00',
|
||||||
'rrule': 'FREQ=WEEKLY;BYDAY=TU,TH,SA',
|
'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',
|
'uid': '0_480_TU,TH,SA',
|
||||||
'work_area_id': None,
|
'work_area_id': None,
|
||||||
|
'work_area_name': None,
|
||||||
}),
|
}),
|
||||||
]),
|
]),
|
||||||
'tasks': list([
|
'tasks': list([
|
||||||
|
@ -33,6 +35,7 @@
|
||||||
'tuesday': False,
|
'tuesday': False,
|
||||||
'wednesday': True,
|
'wednesday': True,
|
||||||
'work_area_id': None,
|
'work_area_id': None,
|
||||||
|
'work_area_name': None,
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'duration': 480,
|
'duration': 480,
|
||||||
|
@ -45,6 +48,7 @@
|
||||||
'tuesday': True,
|
'tuesday': True,
|
||||||
'wednesday': False,
|
'wednesday': False,
|
||||||
'work_area_id': None,
|
'work_area_id': None,
|
||||||
|
'work_area_name': None,
|
||||||
}),
|
}),
|
||||||
]),
|
]),
|
||||||
}),
|
}),
|
||||||
|
@ -61,17 +65,18 @@
|
||||||
'mower': dict({
|
'mower': dict({
|
||||||
'activity': 'PARKED_IN_CS',
|
'activity': 'PARKED_IN_CS',
|
||||||
'error_code': 0,
|
'error_code': 0,
|
||||||
'error_datetime': None,
|
|
||||||
'error_datetime_naive': None,
|
'error_datetime_naive': None,
|
||||||
'error_key': None,
|
'error_key': None,
|
||||||
|
'error_timestamp': 0,
|
||||||
'inactive_reason': 'NONE',
|
'inactive_reason': 'NONE',
|
||||||
'is_error_confirmable': False,
|
'is_error_confirmable': False,
|
||||||
'mode': 'MAIN_AREA',
|
'mode': 'MAIN_AREA',
|
||||||
'state': 'RESTRICTED',
|
'state': 'RESTRICTED',
|
||||||
'work_area_id': 123456,
|
'work_area_id': 123456,
|
||||||
|
'work_area_name': 'Front lawn',
|
||||||
}),
|
}),
|
||||||
'planner': dict({
|
'planner': dict({
|
||||||
'next_start_datetime': '2023-06-05T19:00:00+00:00',
|
'next_start': 1685991600000,
|
||||||
'next_start_datetime_naive': '2023-06-05T19:00:00',
|
'next_start_datetime_naive': '2023-06-05T19:00:00',
|
||||||
'override': dict({
|
'override': dict({
|
||||||
'action': 'NOT_ACTIVE',
|
'action': 'NOT_ACTIVE',
|
||||||
|
@ -113,6 +118,17 @@
|
||||||
'name': 'Test Mower 1',
|
'name': 'Test Mower 1',
|
||||||
'serial_number': 123,
|
'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({
|
'work_areas': dict({
|
||||||
'0': dict({
|
'0': dict({
|
||||||
'cutting_height': 50,
|
'cutting_height': 50,
|
||||||
|
|
|
@ -548,7 +548,7 @@
|
||||||
'last_changed': <ANY>,
|
'last_changed': <ANY>,
|
||||||
'last_reported': <ANY>,
|
'last_reported': <ANY>,
|
||||||
'last_updated': <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]
|
# name: test_sensor_snapshot[sensor.test_mower_1_none-entry]
|
||||||
|
|
|
@ -73,12 +73,12 @@ async def test_next_start_sensor(
|
||||||
await setup_integration(hass, mock_config_entry)
|
await setup_integration(hass, mock_config_entry)
|
||||||
state = hass.states.get("sensor.test_mower_1_next_start")
|
state = hass.states.get("sensor.test_mower_1_next_start")
|
||||||
assert state is not None
|
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(
|
values = mower_list_to_dictionary_dataclass(
|
||||||
load_json_value_fixture("mower.json", DOMAIN)
|
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
|
mock_automower_client.get_status.return_value = values
|
||||||
freezer.tick(SCAN_INTERVAL)
|
freezer.tick(SCAN_INTERVAL)
|
||||||
async_fire_time_changed(hass)
|
async_fire_time_changed(hass)
|
||||||
|
|
Loading…
Add table
Reference in a new issue