mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 10:17:09 +00:00
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
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user