mirror of
https://github.com/home-assistant/core.git
synced 2025-04-27 10:47:51 +00:00
Bump aioautomower to 2024.4.3 (#114500)
This commit is contained in:
parent
2c7a1ddb1d
commit
f1fa33483e
@ -1,5 +1,7 @@
|
|||||||
"""Creates the device tracker entity for the mower."""
|
"""Creates the device tracker entity for the mower."""
|
||||||
|
|
||||||
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from homeassistant.components.device_tracker import SourceType, TrackerEntity
|
from homeassistant.components.device_tracker import SourceType, TrackerEntity
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
@ -44,9 +46,13 @@ class AutomowerDeviceTrackerEntity(AutomowerBaseEntity, TrackerEntity):
|
|||||||
@property
|
@property
|
||||||
def latitude(self) -> float:
|
def latitude(self) -> float:
|
||||||
"""Return latitude value of the device."""
|
"""Return latitude value of the device."""
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
assert self.mower_attributes.positions is not None
|
||||||
return self.mower_attributes.positions[0].latitude
|
return self.mower_attributes.positions[0].latitude
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def longitude(self) -> float:
|
def longitude(self) -> float:
|
||||||
"""Return longitude value of the device."""
|
"""Return longitude value of the device."""
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
assert self.mower_attributes.positions is not None
|
||||||
return self.mower_attributes.positions[0].longitude
|
return self.mower_attributes.positions[0].longitude
|
||||||
|
@ -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.4"]
|
"requirements": ["aioautomower==2024.4.3"]
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
"""Creates a select entity for the headlight of the mower."""
|
"""Creates a select entity for the headlight of the mower."""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
from typing import cast
|
||||||
|
|
||||||
from aioautomower.exceptions import ApiException
|
from aioautomower.exceptions import ApiException
|
||||||
from aioautomower.model import HeadlightModes
|
from aioautomower.model import HeadlightModes
|
||||||
@ -58,12 +59,14 @@ class AutomowerSelectEntity(AutomowerControlEntity, SelectEntity):
|
|||||||
@property
|
@property
|
||||||
def current_option(self) -> str:
|
def current_option(self) -> str:
|
||||||
"""Return the current option for the entity."""
|
"""Return the current option for the entity."""
|
||||||
return self.mower_attributes.headlight.mode.lower()
|
return cast(HeadlightModes, self.mower_attributes.headlight.mode).lower()
|
||||||
|
|
||||||
async def async_select_option(self, option: str) -> None:
|
async def async_select_option(self, option: str) -> None:
|
||||||
"""Change the selected option."""
|
"""Change the selected option."""
|
||||||
try:
|
try:
|
||||||
await self.coordinator.api.set_headlight_mode(self.mower_id, option.upper())
|
await self.coordinator.api.set_headlight_mode(
|
||||||
|
self.mower_id, cast(HeadlightModes, option.upper())
|
||||||
|
)
|
||||||
except ApiException as exception:
|
except ApiException as exception:
|
||||||
raise HomeAssistantError(
|
raise HomeAssistantError(
|
||||||
f"Command couldn't be sent to the command queue: {exception}"
|
f"Command couldn't be sent to the command queue: {exception}"
|
||||||
|
@ -18,7 +18,6 @@ from homeassistant.const import PERCENTAGE, EntityCategory, UnitOfLength, UnitOf
|
|||||||
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.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
|
||||||
@ -298,7 +297,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: dt_util.as_local(data.planner.next_start_datetime),
|
value_fn=lambda data: data.planner.next_start_datetime,
|
||||||
),
|
),
|
||||||
AutomowerSensorEntityDescription(
|
AutomowerSensorEntityDescription(
|
||||||
key="error",
|
key="error",
|
||||||
|
@ -204,7 +204,7 @@ aioaseko==0.1.1
|
|||||||
aioasuswrt==1.4.0
|
aioasuswrt==1.4.0
|
||||||
|
|
||||||
# homeassistant.components.husqvarna_automower
|
# homeassistant.components.husqvarna_automower
|
||||||
aioautomower==2024.3.4
|
aioautomower==2024.4.3
|
||||||
|
|
||||||
# homeassistant.components.azure_devops
|
# homeassistant.components.azure_devops
|
||||||
aioazuredevops==2.0.0
|
aioazuredevops==2.0.0
|
||||||
|
@ -183,7 +183,7 @@ aioaseko==0.1.1
|
|||||||
aioasuswrt==1.4.0
|
aioasuswrt==1.4.0
|
||||||
|
|
||||||
# homeassistant.components.husqvarna_automower
|
# homeassistant.components.husqvarna_automower
|
||||||
aioautomower==2024.3.4
|
aioautomower==2024.4.3
|
||||||
|
|
||||||
# homeassistant.components.azure_devops
|
# homeassistant.components.azure_devops
|
||||||
aioazuredevops==2.0.0
|
aioazuredevops==2.0.0
|
||||||
|
@ -50,12 +50,14 @@
|
|||||||
'activity': 'PARKED_IN_CS',
|
'activity': 'PARKED_IN_CS',
|
||||||
'error_code': 0,
|
'error_code': 0,
|
||||||
'error_datetime': None,
|
'error_datetime': None,
|
||||||
|
'error_datetime_naive': None,
|
||||||
'error_key': None,
|
'error_key': None,
|
||||||
'mode': 'MAIN_AREA',
|
'mode': 'MAIN_AREA',
|
||||||
'state': 'RESTRICTED',
|
'state': 'RESTRICTED',
|
||||||
}),
|
}),
|
||||||
'planner': dict({
|
'planner': dict({
|
||||||
'next_start_datetime': '2023-06-05T19:00:00',
|
'next_start_datetime': '2023-06-05T19:00:00+00:00',
|
||||||
|
'next_start_datetime_naive': '2023-06-05T19:00:00',
|
||||||
'override': dict({
|
'override': dict({
|
||||||
'action': 'NOT_ACTIVE',
|
'action': 'NOT_ACTIVE',
|
||||||
}),
|
}),
|
||||||
|
@ -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-06T02:00:00+00:00',
|
'state': '2023-06-05T19: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]
|
||||||
|
@ -10,7 +10,7 @@ from syrupy import SnapshotAssertion
|
|||||||
|
|
||||||
from homeassistant.components.husqvarna_automower.const import DOMAIN
|
from homeassistant.components.husqvarna_automower.const import DOMAIN
|
||||||
from homeassistant.components.husqvarna_automower.coordinator import SCAN_INTERVAL
|
from homeassistant.components.husqvarna_automower.coordinator import SCAN_INTERVAL
|
||||||
from homeassistant.const import Platform
|
from homeassistant.const import STATE_UNKNOWN, Platform
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers import entity_registry as er
|
from homeassistant.helpers import entity_registry as er
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ async def test_sensor_unknown_states(
|
|||||||
async_fire_time_changed(hass)
|
async_fire_time_changed(hass)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
state = hass.states.get("sensor.test_mower_1_mode")
|
state = hass.states.get("sensor.test_mower_1_mode")
|
||||||
assert state.state == "unknown"
|
assert state.state == STATE_UNKNOWN
|
||||||
|
|
||||||
|
|
||||||
async def test_cutting_blade_usage_time_sensor(
|
async def test_cutting_blade_usage_time_sensor(
|
||||||
@ -63,6 +63,30 @@ async def test_cutting_blade_usage_time_sensor(
|
|||||||
assert state.state == "0.034"
|
assert state.state == "0.034"
|
||||||
|
|
||||||
|
|
||||||
|
async def test_next_start_sensor(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
mock_automower_client: AsyncMock,
|
||||||
|
mock_config_entry: MockConfigEntry,
|
||||||
|
freezer: FrozenDateTimeFactory,
|
||||||
|
) -> None:
|
||||||
|
"""Test if this sensor is only added, if data is available."""
|
||||||
|
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"
|
||||||
|
|
||||||
|
values = mower_list_to_dictionary_dataclass(
|
||||||
|
load_json_value_fixture("mower.json", DOMAIN)
|
||||||
|
)
|
||||||
|
values[TEST_MOWER_ID].planner.next_start_datetime = None
|
||||||
|
mock_automower_client.get_status.return_value = values
|
||||||
|
freezer.tick(SCAN_INTERVAL)
|
||||||
|
async_fire_time_changed(hass)
|
||||||
|
await hass.async_block_till_done()
|
||||||
|
state = hass.states.get("sensor.test_mower_1_next_start")
|
||||||
|
assert state.state == STATE_UNKNOWN
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
("sensor_to_test"),
|
("sensor_to_test"),
|
||||||
[
|
[
|
||||||
|
Loading…
x
Reference in New Issue
Block a user