From 5b3004c7b08a05f7027c68769f1d1ba41f1103fb Mon Sep 17 00:00:00 2001 From: Hans Oischinger Date: Sat, 7 Sep 2019 02:41:34 +0200 Subject: [PATCH] Vicare: Avoid invalid temperature values (#26485) The PyVicare API can return the string "error" in case of connection or authentication errors. The current_temperature value could be set to "error" instead of a nueric value or None which breaks the climate component. This commit sets the current_temperature to None instead. --- homeassistant/components/vicare/climate.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/vicare/climate.py b/homeassistant/components/vicare/climate.py index 5727508deb4..1a5098360cf 100644 --- a/homeassistant/components/vicare/climate.py +++ b/homeassistant/components/vicare/climate.py @@ -96,10 +96,13 @@ class ViCareClimate(ClimateDevice): def update(self): """Let HA know there has been an update from the ViCare API.""" _room_temperature = self._api.getRoomTemperature() - if _room_temperature is not None and _room_temperature != "error": + _supply_temperature = self._api.getSupplyTemperature() + if _room_temperature is not None and _room_temperature != PYVICARE_ERROR: self._current_temperature = _room_temperature + elif _supply_temperature != PYVICARE_ERROR: + self._current_temperature = _supply_temperature else: - self._current_temperature = self._api.getSupplyTemperature() + self._current_temperature = None self._current_program = self._api.getActiveProgram() # The getCurrentDesiredTemperature call can yield 'error' (str) when the system is in standby