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.
This commit is contained in:
parent
078a72d102
commit
5b3004c7b0
1 changed files with 5 additions and 2 deletions
|
@ -96,10 +96,13 @@ class ViCareClimate(ClimateDevice):
|
||||||
def update(self):
|
def update(self):
|
||||||
"""Let HA know there has been an update from the ViCare API."""
|
"""Let HA know there has been an update from the ViCare API."""
|
||||||
_room_temperature = self._api.getRoomTemperature()
|
_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
|
self._current_temperature = _room_temperature
|
||||||
|
elif _supply_temperature != PYVICARE_ERROR:
|
||||||
|
self._current_temperature = _supply_temperature
|
||||||
else:
|
else:
|
||||||
self._current_temperature = self._api.getSupplyTemperature()
|
self._current_temperature = None
|
||||||
self._current_program = self._api.getActiveProgram()
|
self._current_program = self._api.getActiveProgram()
|
||||||
|
|
||||||
# The getCurrentDesiredTemperature call can yield 'error' (str) when the system is in standby
|
# The getCurrentDesiredTemperature call can yield 'error' (str) when the system is in standby
|
||||||
|
|
Loading…
Add table
Reference in a new issue