diff --git a/custom_components/vicare/__init__.py b/custom_components/vicare/__init__.py index c571da0..7eeb162 100644 --- a/custom_components/vicare/__init__.py +++ b/custom_components/vicare/__init__.py @@ -132,7 +132,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: raise ConfigEntryNotReady from err except PyViCareInternalServerError as err: raise ConfigEntryNotReady from err - except requests.exceptions.ConnectionError as err: + except (requests.exceptions.ConnectionError, requests.exceptions.ReadTimeout) as err: raise ConfigEntryNotReady from err def vicare_login(hass, entry_data, scan_interval = DEFAULT_SCAN_INTERVAL): diff --git a/custom_components/vicare/binary_sensor.py b/custom_components/vicare/binary_sensor.py index 9160620..6742cb9 100644 --- a/custom_components/vicare/binary_sensor.py +++ b/custom_components/vicare/binary_sensor.py @@ -263,7 +263,7 @@ def update(self): try: with suppress(PyViCareNotSupportedFeatureError): self._state = self.entity_description.value_getter(self._api) - except requests.exceptions.ConnectionError: + except (requests.exceptions.ConnectionError, requests.exceptions.ReadTimeout): _LOGGER.error("Unable to retrieve data from ViCare server") except ValueError: _LOGGER.error("Unable to decode data from ViCare server") diff --git a/custom_components/vicare/button.py b/custom_components/vicare/button.py index 663a95c..69291a0 100644 --- a/custom_components/vicare/button.py +++ b/custom_components/vicare/button.py @@ -125,7 +125,7 @@ def press(self) -> None: try: with suppress(PyViCareNotSupportedFeatureError): self.entity_description.value_setter(self._api) - except requests.exceptions.ConnectionError: + except (requests.exceptions.ConnectionError, requests.exceptions.ReadTimeout): _LOGGER.error("Unable to retrieve data from ViCare server") except ValueError: _LOGGER.error("Unable to decode data from ViCare server") diff --git a/custom_components/vicare/climate.py b/custom_components/vicare/climate.py index 0639687..15f7ff1 100644 --- a/custom_components/vicare/climate.py +++ b/custom_components/vicare/climate.py @@ -282,7 +282,7 @@ def update(self) -> None: self._current_action or compressor.getActive() ) - except requests.exceptions.ConnectionError: + except (requests.exceptions.ConnectionError, requests.exceptions.ReadTimeout): _LOGGER.error("Unable to retrieve data from ViCare server") except PyViCareRateLimitError as limit_exception: _LOGGER.error("Vicare API rate limit exceeded: %s", limit_exception) @@ -480,7 +480,7 @@ def update(self) -> None: self._attributes = {} self._attributes["room_temperature"] = _room_temperature - except requests.exceptions.ConnectionError: + except (requests.exceptions.ConnectionError, requests.exceptions.ReadTimeout): _LOGGER.error("Unable to retrieve data from ViCare server") except PyViCareRateLimitError as limit_exception: _LOGGER.error("Vicare API rate limit exceeded: %s", limit_exception) diff --git a/custom_components/vicare/config_flow.py b/custom_components/vicare/config_flow.py index c839af3..96a928a 100644 --- a/custom_components/vicare/config_flow.py +++ b/custom_components/vicare/config_flow.py @@ -56,7 +56,7 @@ async def async_step_user( except PyViCareInternalServerError as err: errors["base"] = "server_error" description_placeholders = {"error": str(err)} - except requests.exceptions.ConnectionError as err: + except (requests.exceptions.ConnectionError, requests.exceptions.ReadTimeout) as err: errors["base"] = "cannot_connect" description_placeholders = {"error": str(err)} except PyViCareRateLimitError as err: diff --git a/custom_components/vicare/sensor.py b/custom_components/vicare/sensor.py index 6d5a34d..3734948 100644 --- a/custom_components/vicare/sensor.py +++ b/custom_components/vicare/sensor.py @@ -766,7 +766,7 @@ def update(self): self._attr_native_unit_of_measurement = ( VICARE_UNIT_TO_UNIT_OF_MEASUREMENT.get(vicare_unit) ) - except requests.exceptions.ConnectionError: + except (requests.exceptions.ConnectionError, requests.exceptions.ReadTimeout): _LOGGER.error("Unable to retrieve data from ViCare server") except ValueError: _LOGGER.error("Unable to decode data from ViCare server") diff --git a/custom_components/vicare/switch.py b/custom_components/vicare/switch.py index a3f9eb6..304a15b 100644 --- a/custom_components/vicare/switch.py +++ b/custom_components/vicare/switch.py @@ -142,7 +142,7 @@ def update(self): with suppress(PyViCareNotSupportedFeatureError): _LOGGER.debug("Fetching DHW One Time Charging Status") self._state = self.entity_description.value_getter(self._api) - except requests.exceptions.ConnectionError: + except (requests.exceptions.ConnectionError, requests.exceptions.ReadTimeout): _LOGGER.error("Unable to retrieve data from ViCare server") except ValueError: _LOGGER.error("Unable to decode data from ViCare server") @@ -161,7 +161,7 @@ async def async_turn_on(self, **kwargs: Any) -> None: self._ignore_update_until = datetime.datetime.utcnow() + TIMEDELTA_UPDATE self._state = True - except requests.exceptions.ConnectionError: + except (requests.exceptions.ConnectionError, requests.exceptions.ReadTimeout): _LOGGER.error("Unable to retrieve data from ViCare server") except ValueError: _LOGGER.error("Unable to decode data from ViCare server") @@ -179,7 +179,7 @@ async def async_turn_off(self, **kwargs: Any) -> None: self._ignore_update_until = datetime.datetime.utcnow() + TIMEDELTA_UPDATE self._state = False - except requests.exceptions.ConnectionError: + except (requests.exceptions.ConnectionError, requests.exceptions.ReadTimeout): _LOGGER.error("Unable to retrieve data from ViCare server") except ValueError: _LOGGER.error("Unable to decode data from ViCare server") diff --git a/custom_components/vicare/water_heater.py b/custom_components/vicare/water_heater.py index 49169f1..c075d0e 100644 --- a/custom_components/vicare/water_heater.py +++ b/custom_components/vicare/water_heater.py @@ -117,7 +117,7 @@ def update(self) -> None: with suppress(PyViCareNotSupportedFeatureError): self._current_mode = self._circuit.getActiveMode() - except requests.exceptions.ConnectionError: + except (requests.exceptions.ConnectionError, requests.exceptions.ReadTimeout): _LOGGER.error("Unable to retrieve data from ViCare server") except PyViCareRateLimitError as limit_exception: _LOGGER.error("Vicare API rate limit exceeded: %s", limit_exception)