Skip to content

Commit

Permalink
Check for 'unavailable' while updating temperature sensor in Climate …
Browse files Browse the repository at this point in the history
…device (#416)

* add state_unavailable to sensor update.

* fix style

* fix style
  • Loading branch information
vlebourl authored Apr 13, 2021
1 parent afd7317 commit f426d8c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion custom_components/tahoma/climate_devices/somfy_thermostat.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from homeassistant.const import (
ATTR_TEMPERATURE,
EVENT_HOMEASSISTANT_START,
STATE_UNAVAILABLE,
STATE_UNKNOWN,
TEMP_CELSIUS,
)
Expand Down Expand Up @@ -141,7 +142,7 @@ async def _async_temp_sensor_changed(self, entity_id, old_state, new_state) -> N
@callback
def update_temp(self, state):
"""Update thermostat with latest state from sensor."""
if state is None or state.state == STATE_UNKNOWN:
if state is None or state.state in [STATE_UNKNOWN, STATE_UNAVAILABLE]:
return

try:
Expand Down

0 comments on commit f426d8c

Please sign in to comment.