mirror of
https://github.com/home-assistant/core.git
synced 2026-12-04 04:41:30 -04:00
Bump evohome-async to v3.0.0 (#185694)
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -385,7 +385,7 @@ class EvoController(EvoClimateEntity):
|
||||
await self.coordinator.call_client_api(
|
||||
self._evo_device.set_mode(mode, until=until)
|
||||
)
|
||||
except evo.InvalidSystemModeError as err:
|
||||
except evo.InvalidModeRequestError as err:
|
||||
raise ServiceValidationError(
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="invalid_system_mode",
|
||||
|
||||
@@ -89,7 +89,7 @@ class EvoDataUpdateCoordinator(DataUpdateCoordinator):
|
||||
"""
|
||||
|
||||
try:
|
||||
await self.client.update(dont_update_status=True) # only config for now
|
||||
await self.client.setup() # only config for now
|
||||
except ec2.EvohomeError as err:
|
||||
raise UpdateFailed(err) from err
|
||||
|
||||
@@ -130,20 +130,20 @@ class EvoDataUpdateCoordinator(DataUpdateCoordinator):
|
||||
}
|
||||
self.logger.debug("Config = %s", [config])
|
||||
|
||||
async def call_client_api(
|
||||
async def call_client_api[_T](
|
||||
self,
|
||||
client_api: Awaitable[dict[str, Any] | None],
|
||||
client_api: Awaitable[_T],
|
||||
request_refresh: bool = True,
|
||||
) -> dict[str, Any] | None:
|
||||
) -> _T | None:
|
||||
"""Call a client API and update the Coordinator state if required."""
|
||||
|
||||
try:
|
||||
result = await client_api
|
||||
|
||||
except ec2.InvalidSystemModeError:
|
||||
except ec2.AuthenticationFailedError:
|
||||
raise
|
||||
|
||||
except ec2.ApiRequestFailedError as err:
|
||||
except ec2.ApiCallFailedError as err:
|
||||
self.logger.error(err)
|
||||
return None
|
||||
|
||||
@@ -158,7 +158,7 @@ class EvoDataUpdateCoordinator(DataUpdateCoordinator):
|
||||
assert self.client_v1 is not None # mypy check
|
||||
|
||||
try:
|
||||
await self.client_v1.update()
|
||||
await self.client_v1.get_status()
|
||||
|
||||
except ec1.BadUserCredentialsError as err:
|
||||
self.logger.warning(
|
||||
@@ -191,9 +191,9 @@ class EvoDataUpdateCoordinator(DataUpdateCoordinator):
|
||||
"""Get the latest modes, temperatures, setpoints of a Location."""
|
||||
|
||||
try:
|
||||
status = await self.loc.update()
|
||||
status = await self.loc.get_status()
|
||||
|
||||
except ec2.ApiRequestFailedError as err:
|
||||
except ec2.ApiCallFailedError as err:
|
||||
if err.status != HTTPStatus.TOO_MANY_REQUESTS:
|
||||
raise UpdateFailed(err) from err
|
||||
|
||||
|
||||
@@ -144,8 +144,13 @@ class EvoChild(EvoEntity):
|
||||
if not self._schedule:
|
||||
return self._setpoints
|
||||
|
||||
this_sp_dtm, this_sp_val = self._evo_device.this_switchpoint
|
||||
next_sp_dtm, next_sp_val = self._evo_device.next_switchpoint
|
||||
if (this_sp := self._evo_device.this_switchpoint) is None or (
|
||||
next_sp := self._evo_device.next_switchpoint
|
||||
) is None:
|
||||
return self._setpoints
|
||||
|
||||
this_sp_dtm, this_sp_val = this_sp
|
||||
next_sp_dtm, next_sp_val = next_sp
|
||||
|
||||
key = "temp" if isinstance(self._evo_device, evo.Zone) else "state"
|
||||
|
||||
@@ -164,7 +169,7 @@ class EvoChild(EvoEntity):
|
||||
async def get_schedule() -> None:
|
||||
try:
|
||||
schedule = await self.coordinator.call_client_api(
|
||||
self._evo_device.get_schedule(), # type: ignore[arg-type]
|
||||
self._evo_device.get_schedule(),
|
||||
request_refresh=False,
|
||||
)
|
||||
except evo.InvalidScheduleError as err:
|
||||
|
||||
@@ -6,5 +6,5 @@
|
||||
"iot_class": "cloud_polling",
|
||||
"loggers": ["evohomeasync", "evohomeasync2"],
|
||||
"quality_scale": "legacy",
|
||||
"requirements": ["evohome-async==2.1.0"]
|
||||
"requirements": ["evohome-async==3.0.0"]
|
||||
}
|
||||
|
||||
Generated
+1
-1
@@ -1005,7 +1005,7 @@ eurotronic-cometblue-ha==2.0.0
|
||||
# evdev==1.9.3
|
||||
|
||||
# homeassistant.components.evohome
|
||||
evohome-async==2.1.0
|
||||
evohome-async==3.0.0
|
||||
|
||||
# homeassistant.components.bryant_evolution
|
||||
evolutionhttp==0.0.19
|
||||
|
||||
@@ -201,7 +201,7 @@ async def test_ctl_invalid_system_mode(
|
||||
with (
|
||||
patch(
|
||||
"evohomeasync2.control_system.ControlSystem.set_mode",
|
||||
side_effect=evo_exc.InvalidSystemModeError("Unsupported mode: xxx"),
|
||||
side_effect=evo_exc.InvalidModeRequestError("Unsupported mode: xxx"),
|
||||
),
|
||||
pytest.raises(ServiceValidationError) as exc_info,
|
||||
):
|
||||
@@ -217,6 +217,31 @@ async def test_ctl_invalid_system_mode(
|
||||
assert exc_info.value.translation_key == "invalid_system_mode"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("install", ["default"])
|
||||
async def test_ctl_authentication_failed(
|
||||
hass: HomeAssistant,
|
||||
ctl_id: str,
|
||||
) -> None:
|
||||
"""Test an authentication failure is raised, rather than only logged."""
|
||||
|
||||
# AuthenticationFailedError is a subclass of ApiCallFailedError, which is only logged
|
||||
with (
|
||||
patch(
|
||||
"evohomeasync2.control_system.ControlSystem.set_mode",
|
||||
side_effect=evo_exc.AuthenticationFailedError("Authentication failed"),
|
||||
),
|
||||
pytest.raises(evo_exc.AuthenticationFailedError),
|
||||
):
|
||||
await hass.services.async_call(
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_TURN_OFF,
|
||||
{
|
||||
ATTR_ENTITY_ID: ctl_id,
|
||||
},
|
||||
blocking=True,
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("install", TEST_INSTALLS)
|
||||
async def test_ctl_turn_on(
|
||||
hass: HomeAssistant,
|
||||
|
||||
@@ -39,7 +39,7 @@ async def test_refresh_system_deprecated(
|
||||
"""
|
||||
|
||||
# EvoService.REFRESH_SYSTEM
|
||||
with patch("evohomeasync2.location.Location.update") as mock_fcn:
|
||||
with patch("evohomeasync2.location.Location.get_status") as mock_fcn:
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
EvoService.REFRESH_SYSTEM,
|
||||
@@ -70,7 +70,7 @@ async def test_update_entity(
|
||||
|
||||
await async_setup_component(hass, "homeassistant", {})
|
||||
|
||||
with patch("evohomeasync2.location.Location.update") as mock_fcn:
|
||||
with patch("evohomeasync2.location.Location.get_status") as mock_fcn:
|
||||
await hass.services.async_call(
|
||||
"homeassistant",
|
||||
"update_entity",
|
||||
|
||||
Reference in New Issue
Block a user