mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 20:27:08 +00:00
Bump aioautomower to 2025.1.1 (#136365)
This commit is contained in:
parent
f3074dc218
commit
5a30156372
@ -9,10 +9,10 @@ import logging
|
|||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from aioautomower.exceptions import (
|
from aioautomower.exceptions import (
|
||||||
ApiException,
|
ApiError,
|
||||||
AuthException,
|
AuthError,
|
||||||
|
HusqvarnaTimeoutError,
|
||||||
HusqvarnaWSServerHandshakeError,
|
HusqvarnaWSServerHandshakeError,
|
||||||
TimeoutException,
|
|
||||||
)
|
)
|
||||||
from aioautomower.model import MowerAttributes
|
from aioautomower.model import MowerAttributes
|
||||||
from aioautomower.session import AutomowerSession
|
from aioautomower.session import AutomowerSession
|
||||||
@ -64,9 +64,9 @@ class AutomowerDataUpdateCoordinator(DataUpdateCoordinator[dict[str, MowerAttrib
|
|||||||
self.ws_connected = True
|
self.ws_connected = True
|
||||||
try:
|
try:
|
||||||
data = await self.api.get_status()
|
data = await self.api.get_status()
|
||||||
except ApiException as err:
|
except ApiError as err:
|
||||||
raise UpdateFailed(err) from err
|
raise UpdateFailed(err) from err
|
||||||
except AuthException as err:
|
except AuthError as err:
|
||||||
raise ConfigEntryAuthFailed(err) from err
|
raise ConfigEntryAuthFailed(err) from err
|
||||||
|
|
||||||
self._async_add_remove_devices(data)
|
self._async_add_remove_devices(data)
|
||||||
@ -100,7 +100,7 @@ class AutomowerDataUpdateCoordinator(DataUpdateCoordinator[dict[str, MowerAttrib
|
|||||||
"Failed to connect to websocket. Trying to reconnect: %s",
|
"Failed to connect to websocket. Trying to reconnect: %s",
|
||||||
err,
|
err,
|
||||||
)
|
)
|
||||||
except TimeoutException as err:
|
except HusqvarnaTimeoutError as err:
|
||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
"Failed to listen to websocket. Trying to reconnect: %s",
|
"Failed to listen to websocket. Trying to reconnect: %s",
|
||||||
err,
|
err,
|
||||||
|
@ -8,7 +8,7 @@ import functools
|
|||||||
import logging
|
import logging
|
||||||
from typing import TYPE_CHECKING, Any, Concatenate
|
from typing import TYPE_CHECKING, Any, Concatenate
|
||||||
|
|
||||||
from aioautomower.exceptions import ApiException
|
from aioautomower.exceptions import ApiError
|
||||||
from aioautomower.model import MowerActivities, MowerAttributes, MowerStates, WorkArea
|
from aioautomower.model import MowerActivities, MowerAttributes, MowerStates, WorkArea
|
||||||
|
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
@ -67,7 +67,7 @@ def handle_sending_exception[_Entity: AutomowerBaseEntity, **_P](
|
|||||||
async def wrapper(self: _Entity, *args: _P.args, **kwargs: _P.kwargs) -> None:
|
async def wrapper(self: _Entity, *args: _P.args, **kwargs: _P.kwargs) -> None:
|
||||||
try:
|
try:
|
||||||
await func(self, *args, **kwargs)
|
await func(self, *args, **kwargs)
|
||||||
except ApiException as exception:
|
except ApiError as exception:
|
||||||
raise HomeAssistantError(
|
raise HomeAssistantError(
|
||||||
translation_domain=DOMAIN,
|
translation_domain=DOMAIN,
|
||||||
translation_key="command_send_failed",
|
translation_key="command_send_failed",
|
||||||
|
@ -8,5 +8,5 @@
|
|||||||
"iot_class": "cloud_push",
|
"iot_class": "cloud_push",
|
||||||
"loggers": ["aioautomower"],
|
"loggers": ["aioautomower"],
|
||||||
"quality_scale": "silver",
|
"quality_scale": "silver",
|
||||||
"requirements": ["aioautomower==2025.1.0"]
|
"requirements": ["aioautomower==2025.1.1"]
|
||||||
}
|
}
|
||||||
|
@ -165,14 +165,14 @@ class StayOutZoneSwitchEntity(AutomowerControlEntity, SwitchEntity):
|
|||||||
async def async_turn_off(self, **kwargs: Any) -> None:
|
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||||
"""Turn the switch off."""
|
"""Turn the switch off."""
|
||||||
await self.coordinator.api.commands.switch_stay_out_zone(
|
await self.coordinator.api.commands.switch_stay_out_zone(
|
||||||
self.mower_id, self.stay_out_zone_uid, False
|
self.mower_id, self.stay_out_zone_uid, switch=False
|
||||||
)
|
)
|
||||||
|
|
||||||
@handle_sending_exception(poll_after_sending=True)
|
@handle_sending_exception(poll_after_sending=True)
|
||||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||||
"""Turn the switch on."""
|
"""Turn the switch on."""
|
||||||
await self.coordinator.api.commands.switch_stay_out_zone(
|
await self.coordinator.api.commands.switch_stay_out_zone(
|
||||||
self.mower_id, self.stay_out_zone_uid, True
|
self.mower_id, self.stay_out_zone_uid, switch=True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
2
requirements_all.txt
generated
2
requirements_all.txt
generated
@ -201,7 +201,7 @@ aioaseko==1.0.0
|
|||||||
aioasuswrt==1.4.0
|
aioasuswrt==1.4.0
|
||||||
|
|
||||||
# homeassistant.components.husqvarna_automower
|
# homeassistant.components.husqvarna_automower
|
||||||
aioautomower==2025.1.0
|
aioautomower==2025.1.1
|
||||||
|
|
||||||
# homeassistant.components.azure_devops
|
# homeassistant.components.azure_devops
|
||||||
aioazuredevops==2.2.1
|
aioazuredevops==2.2.1
|
||||||
|
2
requirements_test_all.txt
generated
2
requirements_test_all.txt
generated
@ -189,7 +189,7 @@ aioaseko==1.0.0
|
|||||||
aioasuswrt==1.4.0
|
aioasuswrt==1.4.0
|
||||||
|
|
||||||
# homeassistant.components.husqvarna_automower
|
# homeassistant.components.husqvarna_automower
|
||||||
aioautomower==2025.1.0
|
aioautomower==2025.1.1
|
||||||
|
|
||||||
# homeassistant.components.azure_devops
|
# homeassistant.components.azure_devops
|
||||||
aioazuredevops==2.2.1
|
aioazuredevops==2.2.1
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
import datetime
|
import datetime
|
||||||
from unittest.mock import AsyncMock, patch
|
from unittest.mock import AsyncMock, patch
|
||||||
|
|
||||||
from aioautomower.exceptions import ApiException
|
from aioautomower.exceptions import ApiError
|
||||||
from aioautomower.model import MowerAttributes
|
from aioautomower.model import MowerAttributes
|
||||||
from freezegun.api import FrozenDateTimeFactory
|
from freezegun.api import FrozenDateTimeFactory
|
||||||
import pytest
|
import pytest
|
||||||
@ -69,7 +69,7 @@ async def test_button_states_and_commands(
|
|||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
state = hass.states.get(entity_id)
|
state = hass.states.get(entity_id)
|
||||||
assert state.state == "2023-06-05T00:16:00+00:00"
|
assert state.state == "2023-06-05T00:16:00+00:00"
|
||||||
getattr(mock_automower_client.commands, "error_confirm").side_effect = ApiException(
|
getattr(mock_automower_client.commands, "error_confirm").side_effect = ApiError(
|
||||||
"Test error"
|
"Test error"
|
||||||
)
|
)
|
||||||
with pytest.raises(
|
with pytest.raises(
|
||||||
@ -111,7 +111,7 @@ async def test_sync_clock(
|
|||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
state = hass.states.get(entity_id)
|
state = hass.states.get(entity_id)
|
||||||
assert state.state == "2024-02-29T11:00:00+00:00"
|
assert state.state == "2024-02-29T11:00:00+00:00"
|
||||||
mock_automower_client.commands.set_datetime.side_effect = ApiException("Test error")
|
mock_automower_client.commands.set_datetime.side_effect = ApiError("Test error")
|
||||||
with pytest.raises(
|
with pytest.raises(
|
||||||
HomeAssistantError,
|
HomeAssistantError,
|
||||||
match="Failed to send command: Test error",
|
match="Failed to send command: Test error",
|
||||||
|
@ -7,10 +7,10 @@ import time
|
|||||||
from unittest.mock import AsyncMock, patch
|
from unittest.mock import AsyncMock, patch
|
||||||
|
|
||||||
from aioautomower.exceptions import (
|
from aioautomower.exceptions import (
|
||||||
ApiException,
|
ApiError,
|
||||||
AuthException,
|
AuthError,
|
||||||
|
HusqvarnaTimeoutError,
|
||||||
HusqvarnaWSServerHandshakeError,
|
HusqvarnaWSServerHandshakeError,
|
||||||
TimeoutException,
|
|
||||||
)
|
)
|
||||||
from aioautomower.model import MowerAttributes, WorkArea
|
from aioautomower.model import MowerAttributes, WorkArea
|
||||||
from freezegun.api import FrozenDateTimeFactory
|
from freezegun.api import FrozenDateTimeFactory
|
||||||
@ -111,8 +111,8 @@ async def test_expired_token_refresh_failure(
|
|||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
("exception", "entry_state"),
|
("exception", "entry_state"),
|
||||||
[
|
[
|
||||||
(ApiException, ConfigEntryState.SETUP_RETRY),
|
(ApiError, ConfigEntryState.SETUP_RETRY),
|
||||||
(AuthException, ConfigEntryState.SETUP_ERROR),
|
(AuthError, ConfigEntryState.SETUP_ERROR),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
async def test_update_failed(
|
async def test_update_failed(
|
||||||
@ -142,7 +142,7 @@ async def test_update_failed(
|
|||||||
),
|
),
|
||||||
(
|
(
|
||||||
["start_listening"],
|
["start_listening"],
|
||||||
TimeoutException,
|
HusqvarnaTimeoutError,
|
||||||
"Failed to listen to websocket.",
|
"Failed to listen to websocket.",
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from unittest.mock import AsyncMock
|
from unittest.mock import AsyncMock
|
||||||
|
|
||||||
from aioautomower.exceptions import ApiException
|
from aioautomower.exceptions import ApiError
|
||||||
from aioautomower.model import MowerActivities, MowerAttributes, MowerStates
|
from aioautomower.model import MowerActivities, MowerAttributes, MowerStates
|
||||||
from freezegun.api import FrozenDateTimeFactory
|
from freezegun.api import FrozenDateTimeFactory
|
||||||
import pytest
|
import pytest
|
||||||
@ -82,7 +82,7 @@ async def test_lawn_mower_commands(
|
|||||||
|
|
||||||
getattr(
|
getattr(
|
||||||
mock_automower_client.commands, aioautomower_command
|
mock_automower_client.commands, aioautomower_command
|
||||||
).side_effect = ApiException("Test error")
|
).side_effect = ApiError("Test error")
|
||||||
with pytest.raises(
|
with pytest.raises(
|
||||||
HomeAssistantError,
|
HomeAssistantError,
|
||||||
match="Failed to send command: Test error",
|
match="Failed to send command: Test error",
|
||||||
@ -142,7 +142,7 @@ async def test_lawn_mower_service_commands(
|
|||||||
|
|
||||||
getattr(
|
getattr(
|
||||||
mock_automower_client.commands, aioautomower_command
|
mock_automower_client.commands, aioautomower_command
|
||||||
).side_effect = ApiException("Test error")
|
).side_effect = ApiError("Test error")
|
||||||
with pytest.raises(
|
with pytest.raises(
|
||||||
HomeAssistantError,
|
HomeAssistantError,
|
||||||
match="Failed to send command: Test error",
|
match="Failed to send command: Test error",
|
||||||
@ -196,7 +196,7 @@ async def test_lawn_mower_override_work_area_command(
|
|||||||
|
|
||||||
getattr(
|
getattr(
|
||||||
mock_automower_client.commands, aioautomower_command
|
mock_automower_client.commands, aioautomower_command
|
||||||
).side_effect = ApiException("Test error")
|
).side_effect = ApiError("Test error")
|
||||||
with pytest.raises(
|
with pytest.raises(
|
||||||
HomeAssistantError,
|
HomeAssistantError,
|
||||||
match="Failed to send command: Test error",
|
match="Failed to send command: Test error",
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from unittest.mock import AsyncMock, patch
|
from unittest.mock import AsyncMock, patch
|
||||||
|
|
||||||
from aioautomower.exceptions import ApiException
|
from aioautomower.exceptions import ApiError
|
||||||
from aioautomower.model import MowerAttributes
|
from aioautomower.model import MowerAttributes
|
||||||
from freezegun.api import FrozenDateTimeFactory
|
from freezegun.api import FrozenDateTimeFactory
|
||||||
import pytest
|
import pytest
|
||||||
@ -40,7 +40,7 @@ async def test_number_commands(
|
|||||||
mocked_method = mock_automower_client.commands.set_cutting_height
|
mocked_method = mock_automower_client.commands.set_cutting_height
|
||||||
mocked_method.assert_called_once_with(TEST_MOWER_ID, 3)
|
mocked_method.assert_called_once_with(TEST_MOWER_ID, 3)
|
||||||
|
|
||||||
mocked_method.side_effect = ApiException("Test error")
|
mocked_method.side_effect = ApiError("Test error")
|
||||||
with pytest.raises(
|
with pytest.raises(
|
||||||
HomeAssistantError,
|
HomeAssistantError,
|
||||||
match="Failed to send command: Test error",
|
match="Failed to send command: Test error",
|
||||||
@ -84,7 +84,7 @@ async def test_number_workarea_commands(
|
|||||||
assert state.state is not None
|
assert state.state is not None
|
||||||
assert state.state == "75"
|
assert state.state == "75"
|
||||||
|
|
||||||
mocked_method.side_effect = ApiException("Test error")
|
mocked_method.side_effect = ApiError("Test error")
|
||||||
with pytest.raises(
|
with pytest.raises(
|
||||||
HomeAssistantError,
|
HomeAssistantError,
|
||||||
match="Failed to send command: Test error",
|
match="Failed to send command: Test error",
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
from unittest.mock import AsyncMock
|
from unittest.mock import AsyncMock
|
||||||
|
|
||||||
from aioautomower.exceptions import ApiException
|
from aioautomower.exceptions import ApiError
|
||||||
from aioautomower.model import HeadlightModes, MowerAttributes
|
from aioautomower.model import HeadlightModes, MowerAttributes
|
||||||
from freezegun.api import FrozenDateTimeFactory
|
from freezegun.api import FrozenDateTimeFactory
|
||||||
import pytest
|
import pytest
|
||||||
@ -77,7 +77,7 @@ async def test_select_commands(
|
|||||||
mocked_method.assert_called_once_with(TEST_MOWER_ID, service.upper())
|
mocked_method.assert_called_once_with(TEST_MOWER_ID, service.upper())
|
||||||
assert len(mocked_method.mock_calls) == 1
|
assert len(mocked_method.mock_calls) == 1
|
||||||
|
|
||||||
mocked_method.side_effect = ApiException("Test error")
|
mocked_method.side_effect = ApiError("Test error")
|
||||||
with pytest.raises(
|
with pytest.raises(
|
||||||
HomeAssistantError,
|
HomeAssistantError,
|
||||||
match="Failed to send command: Test error",
|
match="Failed to send command: Test error",
|
||||||
|
@ -4,7 +4,7 @@ from datetime import timedelta
|
|||||||
from unittest.mock import AsyncMock, patch
|
from unittest.mock import AsyncMock, patch
|
||||||
import zoneinfo
|
import zoneinfo
|
||||||
|
|
||||||
from aioautomower.exceptions import ApiException
|
from aioautomower.exceptions import ApiError
|
||||||
from aioautomower.model import MowerAttributes, MowerModes, Zone
|
from aioautomower.model import MowerAttributes, MowerModes, Zone
|
||||||
from aioautomower.utils import mower_list_to_dictionary_dataclass
|
from aioautomower.utils import mower_list_to_dictionary_dataclass
|
||||||
from freezegun.api import FrozenDateTimeFactory
|
from freezegun.api import FrozenDateTimeFactory
|
||||||
@ -92,7 +92,7 @@ async def test_switch_commands(
|
|||||||
mocked_method = getattr(mock_automower_client.commands, aioautomower_command)
|
mocked_method = getattr(mock_automower_client.commands, aioautomower_command)
|
||||||
mocked_method.assert_called_once_with(TEST_MOWER_ID)
|
mocked_method.assert_called_once_with(TEST_MOWER_ID)
|
||||||
|
|
||||||
mocked_method.side_effect = ApiException("Test error")
|
mocked_method.side_effect = ApiError("Test error")
|
||||||
with pytest.raises(
|
with pytest.raises(
|
||||||
HomeAssistantError,
|
HomeAssistantError,
|
||||||
match="Failed to send command: Test error",
|
match="Failed to send command: Test error",
|
||||||
@ -144,12 +144,12 @@ async def test_stay_out_zone_switch_commands(
|
|||||||
freezer.tick(timedelta(seconds=EXECUTION_TIME_DELAY))
|
freezer.tick(timedelta(seconds=EXECUTION_TIME_DELAY))
|
||||||
async_fire_time_changed(hass)
|
async_fire_time_changed(hass)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
mocked_method.assert_called_once_with(TEST_MOWER_ID, TEST_ZONE_ID, boolean)
|
mocked_method.assert_called_once_with(TEST_MOWER_ID, TEST_ZONE_ID, switch=boolean)
|
||||||
state = hass.states.get(entity_id)
|
state = hass.states.get(entity_id)
|
||||||
assert state is not None
|
assert state is not None
|
||||||
assert state.state == excepted_state
|
assert state.state == excepted_state
|
||||||
|
|
||||||
mocked_method.side_effect = ApiException("Test error")
|
mocked_method.side_effect = ApiError("Test error")
|
||||||
with pytest.raises(
|
with pytest.raises(
|
||||||
HomeAssistantError,
|
HomeAssistantError,
|
||||||
match="Failed to send command: Test error",
|
match="Failed to send command: Test error",
|
||||||
@ -207,7 +207,7 @@ async def test_work_area_switch_commands(
|
|||||||
assert state is not None
|
assert state is not None
|
||||||
assert state.state == excepted_state
|
assert state.state == excepted_state
|
||||||
|
|
||||||
mocked_method.side_effect = ApiException("Test error")
|
mocked_method.side_effect = ApiError("Test error")
|
||||||
with pytest.raises(
|
with pytest.raises(
|
||||||
HomeAssistantError,
|
HomeAssistantError,
|
||||||
match="Failed to send command: Test error",
|
match="Failed to send command: Test error",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user