From 10ec02ca3cfa248871a4db71fe0d55f48a37ef0b Mon Sep 17 00:00:00 2001 From: Simone Chemelli Date: Mon, 16 Mar 2026 10:00:52 +0100 Subject: [PATCH] Fix switch set for Vodafone Station (#165273) --- homeassistant/components/vodafone_station/coordinator.py | 9 +++++++-- homeassistant/components/vodafone_station/switch.py | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/vodafone_station/coordinator.py b/homeassistant/components/vodafone_station/coordinator.py index 6a5d8494669..94ac50d0332 100644 --- a/homeassistant/components/vodafone_station/coordinator.py +++ b/homeassistant/components/vodafone_station/coordinator.py @@ -78,6 +78,7 @@ class VodafoneStationRouter(DataUpdateCoordinator[UpdateCoordinatorDataType]): data, session, ) + self._session = session # Last resort as no MAC or S/N can be retrieved via API self._id = config_entry.unique_id @@ -135,11 +136,15 @@ class VodafoneStationRouter(DataUpdateCoordinator[UpdateCoordinatorDataType]): _LOGGER.debug("Polling Vodafone Station host: %s", self.api.base_url.host) try: - await self.api.login() + if not self._session.cookie_jar.filter_cookies(self.api.base_url): + _LOGGER.debug( + "Session cookies missing for host %s, re-login", + self.api.base_url.host, + ) + await self.api.login() raw_data_devices = await self.api.get_devices_data() data_sensors = await self.api.get_sensor_data() data_wifi = await self.api.get_wifi_data() - await self.api.logout() except exceptions.CannotAuthenticate as err: raise ConfigEntryAuthFailed( translation_domain=DOMAIN, diff --git a/homeassistant/components/vodafone_station/switch.py b/homeassistant/components/vodafone_station/switch.py index c0dd130c3dd..fd547f446f7 100644 --- a/homeassistant/components/vodafone_station/switch.py +++ b/homeassistant/components/vodafone_station/switch.py @@ -104,6 +104,7 @@ class VodafoneSwitchEntity(CoordinatorEntity[VodafoneStationRouter], SwitchEntit await self.coordinator.api.set_wifi_status( status, self.entity_description.typology, self.entity_description.band ) + await self.coordinator.async_request_refresh() except CannotAuthenticate as err: self.coordinator.config_entry.async_start_reauth(self.hass) raise HomeAssistantError(