From 44f7d4e1ee234ef3bb8823e90b4e530db261753e Mon Sep 17 00:00:00 2001 From: David Bonnes Date: Mon, 12 Oct 2026 20:01:15 +0100 Subject: [PATCH] Bump evohome-async to v3.0.0 (#185694) Co-authored-by: Claude --- homeassistant/components/evohome/climate.py | 2 +- .../components/evohome/coordinator.py | 18 ++++++------- homeassistant/components/evohome/entity.py | 11 +++++--- .../components/evohome/manifest.json | 2 +- requirements_all.txt | 2 +- tests/components/evohome/test_climate.py | 27 ++++++++++++++++++- tests/components/evohome/test_services.py | 4 +-- 7 files changed, 48 insertions(+), 18 deletions(-) diff --git a/homeassistant/components/evohome/climate.py b/homeassistant/components/evohome/climate.py index b4038bf3f00a..78d726a0adea 100644 --- a/homeassistant/components/evohome/climate.py +++ b/homeassistant/components/evohome/climate.py @@ -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", diff --git a/homeassistant/components/evohome/coordinator.py b/homeassistant/components/evohome/coordinator.py index 88dda3718b8b..0a3ed0f3bf47 100644 --- a/homeassistant/components/evohome/coordinator.py +++ b/homeassistant/components/evohome/coordinator.py @@ -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 diff --git a/homeassistant/components/evohome/entity.py b/homeassistant/components/evohome/entity.py index a408e7c49647..d8827f1c0e06 100644 --- a/homeassistant/components/evohome/entity.py +++ b/homeassistant/components/evohome/entity.py @@ -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: diff --git a/homeassistant/components/evohome/manifest.json b/homeassistant/components/evohome/manifest.json index 386fa6f94221..562030abfcc9 100644 --- a/homeassistant/components/evohome/manifest.json +++ b/homeassistant/components/evohome/manifest.json @@ -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"] } diff --git a/requirements_all.txt b/requirements_all.txt index e415a1547e11..7d4fe392a121 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -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 diff --git a/tests/components/evohome/test_climate.py b/tests/components/evohome/test_climate.py index 7124f0d5271b..c8807bdef424 100644 --- a/tests/components/evohome/test_climate.py +++ b/tests/components/evohome/test_climate.py @@ -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, diff --git a/tests/components/evohome/test_services.py b/tests/components/evohome/test_services.py index 886388b247ec..2d87a14b72c9 100644 --- a/tests/components/evohome/test_services.py +++ b/tests/components/evohome/test_services.py @@ -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",