Skip to content

Commit

Permalink
Catch vicare errors when deactivating preset fails (home-assistant#84778
Browse files Browse the repository at this point in the history
)

vicare: catch errors when deactivating preset fails
  • Loading branch information
oischinger authored and balloob committed Dec 30, 2022
1 parent 31847e3 commit cae3864
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion homeassistant/components/vicare/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from typing import Any

from PyViCare.PyViCareUtils import (
PyViCareCommandError,
PyViCareInvalidDataError,
PyViCareNotSupportedFeatureError,
PyViCareRateLimitError,
Expand Down Expand Up @@ -354,7 +355,10 @@ def set_preset_mode(self, preset_mode: str) -> None:
_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)
Expand Down

0 comments on commit cae3864

Please sign in to comment.