diff --git a/homeassistant/components/wolflink/__init__.py b/homeassistant/components/wolflink/__init__.py index 9a272c502a0..611fa7da315 100644 --- a/homeassistant/components/wolflink/__init__.py +++ b/homeassistant/components/wolflink/__init__.py @@ -2,7 +2,7 @@ from datetime import timedelta import logging -from httpcore import ConnectError +from httpcore import ConnectError, ConnectTimeout from wolf_smartset.token_auth import InvalidAuth from wolf_smartset.wolf_client import WolfClient @@ -99,7 +99,7 @@ async def fetch_parameters(client: WolfClient, gateway_id: int, device_id: int): try: fetched_parameters = await client.fetch_parameters(gateway_id, device_id) return [param for param in fetched_parameters if param.name != "Reglertyp"] - except ConnectError as exception: + except (ConnectError, ConnectTimeout) as exception: raise UpdateFailed(f"Error communicating with API: {exception}") from exception except InvalidAuth as exception: - raise UpdateFailed("Invalid authentication during update.") from exception + raise UpdateFailed("Invalid authentication during update") from exception diff --git a/homeassistant/components/wolflink/manifest.json b/homeassistant/components/wolflink/manifest.json index c188c090369..633318f2f62 100644 --- a/homeassistant/components/wolflink/manifest.json +++ b/homeassistant/components/wolflink/manifest.json @@ -3,6 +3,6 @@ "name": "Wolf SmartSet Service", "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/wolflink", - "requirements": ["wolf_smartset==0.1.4"], + "requirements": ["wolf_smartset==0.1.6"], "codeowners": ["@adamkrol93"] } diff --git a/homeassistant/components/wolflink/sensor.py b/homeassistant/components/wolflink/sensor.py index 97f48e27988..1cae006824b 100644 --- a/homeassistant/components/wolflink/sensor.py +++ b/homeassistant/components/wolflink/sensor.py @@ -11,13 +11,6 @@ from wolf_smartset.models import ( Temperature, ) -from homeassistant.components.wolflink.const import ( - COORDINATOR, - DEVICE_ID, - DOMAIN, - PARAMETERS, - STATES, -) from homeassistant.const import ( DEVICE_CLASS_PRESSURE, DEVICE_CLASS_TEMPERATURE, @@ -27,6 +20,8 @@ from homeassistant.const import ( ) from homeassistant.helpers.update_coordinator import CoordinatorEntity +from .const import COORDINATOR, DEVICE_ID, DOMAIN, PARAMETERS, STATES + _LOGGER = logging.getLogger(__name__) @@ -63,6 +58,7 @@ class WolfLinkSensor(CoordinatorEntity): super().__init__(coordinator) self.wolf_object = wolf_object self.device_id = device_id + self._state = None @property def name(self): @@ -71,8 +67,10 @@ class WolfLinkSensor(CoordinatorEntity): @property def state(self): - """Return the state.""" - return self.coordinator.data[self.wolf_object.value_id] + """Return the state. Wolf Client is returning only changed values so we need to store old value here.""" + if self.wolf_object.value_id in self.coordinator.data: + self._state = self.coordinator.data[self.wolf_object.value_id] + return self._state @property def device_state_attributes(self): @@ -151,7 +149,7 @@ class WolfLinkState(WolfLinkSensor): @property def state(self): """Return the state converting with supported values.""" - state = self.coordinator.data[self.wolf_object.value_id] + state = super().state resolved_state = [ item for item in self.wolf_object.items if item.value == int(state) ] diff --git a/requirements_all.txt b/requirements_all.txt index 0879d069f00..0c9c287be2e 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -2262,7 +2262,7 @@ withings-api==2.1.6 wled==0.4.4 # homeassistant.components.wolflink -wolf_smartset==0.1.4 +wolf_smartset==0.1.6 # homeassistant.components.xbee xbee-helper==0.0.7 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index c7b33625fc1..3fe14f2404e 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -1055,7 +1055,7 @@ withings-api==2.1.6 wled==0.4.4 # homeassistant.components.wolflink -wolf_smartset==0.1.4 +wolf_smartset==0.1.6 # homeassistant.components.bluesound # homeassistant.components.rest