From 235a34c10cf2ae5fedf2987fed4442e9e432cb14 Mon Sep 17 00:00:00 2001 From: Hans Oischinger Date: Thu, 29 Dec 2022 15:28:33 +0100 Subject: [PATCH] Catch vicare errors when deactivating preset fails (#84778) vicare: catch errors when deactivating preset fails --- homeassistant/components/vicare/climate.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/vicare/climate.py b/homeassistant/components/vicare/climate.py index c8a4781fa0a..9a55da0f219 100644 --- a/homeassistant/components/vicare/climate.py +++ b/homeassistant/components/vicare/climate.py @@ -6,6 +6,7 @@ import logging from typing import Any from PyViCare.PyViCareUtils import ( + PyViCareCommandError, PyViCareInvalidDataError, PyViCareNotSupportedFeatureError, PyViCareRateLimitError, @@ -354,7 +355,10 @@ class ViCareClimate(ClimateEntity): _LOGGER.debug("Setting preset to %s / %s", preset_mode, vicare_program) if self._current_program != VICARE_PROGRAM_NORMAL: # We can't deactivate "normal" - self._circuit.deactivateProgram(self._current_program) + try: + self._circuit.deactivateProgram(self._current_program) + except PyViCareCommandError: + _LOGGER.debug("Unable to deactivate program %s", self._current_program) if vicare_program != VICARE_PROGRAM_NORMAL: # And we can't explicitly activate normal, either self._circuit.activateProgram(vicare_program)