Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions homeassistant/components/sensor/buienradar.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,12 @@ def load_data(self, data):

# update all other sensors
if self.type.startswith(SYMBOL) or self.type.startswith(CONDITION):
condition = data.get(FORECAST)[fcday].get(CONDITION)
try:
condition = data.get(FORECAST)[fcday].get(CONDITION)
except IndexError:
_LOGGER.warning("No forecast for fcday=%s...", fcday)
return False

if condition:
new_state = condition.get(CONDITION, None)
if self.type.startswith(SYMBOL):
Expand All @@ -240,7 +245,11 @@ def load_data(self, data):
return True
return False
else:
new_state = data.get(FORECAST)[fcday].get(self.type[:-3])
try:
new_state = data.get(FORECAST)[fcday].get(self.type[:-3])
except IndexError:
_LOGGER.warning("No forecast for fcday=%s...", fcday)
return False

if new_state != self._state:
self._state = new_state
Expand Down