Bump aioautomower to 2024.3.4 (#114127)

* Bump aioautomower to 2024.3.4

* Update homeassistant/components/husqvarna_automower/sensor.py

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>

* adjust imports

---------

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
This commit is contained in:
Thomas55555 2024-03-25 16:11:12 +01:00 committed by GitHub
parent 3d6600364b
commit b71cbeff51
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 12 additions and 10 deletions

View File

@ -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.3.3"] "requirements": ["aioautomower==2024.3.4"]
} }

View File

@ -2,7 +2,7 @@
from collections.abc import Callable from collections.abc import Callable
from dataclasses import dataclass from dataclasses import dataclass
import datetime from datetime import datetime
import logging import logging
from aioautomower.model import MowerAttributes, MowerModes from aioautomower.model import MowerAttributes, MowerModes
@ -17,6 +17,8 @@ from homeassistant.config_entries import ConfigEntry
from homeassistant.const import PERCENTAGE, EntityCategory, UnitOfLength, UnitOfTime from homeassistant.const import PERCENTAGE, EntityCategory, UnitOfLength, UnitOfTime
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import StateType
from homeassistant.util import dt as dt_util
from .const import DOMAIN from .const import DOMAIN
from .coordinator import AutomowerDataUpdateCoordinator from .coordinator import AutomowerDataUpdateCoordinator
@ -30,7 +32,7 @@ class AutomowerSensorEntityDescription(SensorEntityDescription):
"""Describes Automower sensor entity.""" """Describes Automower sensor entity."""
exists_fn: Callable[[MowerAttributes], bool] = lambda _: True exists_fn: Callable[[MowerAttributes], bool] = lambda _: True
value_fn: Callable[[MowerAttributes], str] value_fn: Callable[[MowerAttributes], StateType | datetime]
SENSOR_TYPES: tuple[AutomowerSensorEntityDescription, ...] = ( SENSOR_TYPES: tuple[AutomowerSensorEntityDescription, ...] = (
@ -137,7 +139,7 @@ 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_dateteime, value_fn=lambda data: dt_util.as_local(data.planner.next_start_datetime),
), ),
) )
@ -172,6 +174,6 @@ class AutomowerSensorEntity(AutomowerBaseEntity, SensorEntity):
self._attr_unique_id = f"{mower_id}_{description.key}" self._attr_unique_id = f"{mower_id}_{description.key}"
@property @property
def native_value(self) -> str | int | datetime.datetime | None: def native_value(self) -> StateType | datetime:
"""Return the state of the sensor.""" """Return the state of the sensor."""
return self.entity_description.value_fn(self.mower_attributes) return self.entity_description.value_fn(self.mower_attributes)

View File

@ -203,7 +203,7 @@ aioaseko==0.1.1
aioasuswrt==1.4.0 aioasuswrt==1.4.0
# homeassistant.components.husqvarna_automower # homeassistant.components.husqvarna_automower
aioautomower==2024.3.3 aioautomower==2024.3.4
# homeassistant.components.azure_devops # homeassistant.components.azure_devops
aioazuredevops==1.3.5 aioazuredevops==1.3.5

View File

@ -182,7 +182,7 @@ aioaseko==0.1.1
aioasuswrt==1.4.0 aioasuswrt==1.4.0
# homeassistant.components.husqvarna_automower # homeassistant.components.husqvarna_automower
aioautomower==2024.3.3 aioautomower==2024.3.4
# homeassistant.components.azure_devops # homeassistant.components.azure_devops
aioazuredevops==1.3.5 aioazuredevops==1.3.5

View File

@ -49,13 +49,13 @@
'mower': dict({ 'mower': dict({
'activity': 'PARKED_IN_CS', 'activity': 'PARKED_IN_CS',
'error_code': 0, 'error_code': 0,
'error_dateteime': None, 'error_datetime': None,
'error_key': None, 'error_key': None,
'mode': 'MAIN_AREA', 'mode': 'MAIN_AREA',
'state': 'RESTRICTED', 'state': 'RESTRICTED',
}), }),
'planner': dict({ 'planner': dict({
'next_start_dateteime': '2023-06-05T19:00:00+00:00', 'next_start_datetime': '2023-06-05T19:00:00',
'override': dict({ 'override': dict({
'action': 'NOT_ACTIVE', 'action': 'NOT_ACTIVE',
}), }),

View File

@ -210,7 +210,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-06T02:00:00+00:00',
}) })
# --- # ---
# name: test_sensor[sensor.test_mower_1_number_of_charging_cycles-entry] # name: test_sensor[sensor.test_mower_1_number_of_charging_cycles-entry]