Skip to content

Commit

Permalink
optimized Error handeling and message
Browse files Browse the repository at this point in the history
  • Loading branch information
Fischelsberger committed Apr 20, 2024
1 parent 3322851 commit ad8df01
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions custom_components/car_wash/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,9 @@ async def async_update(self):
blocking=True,
return_response=True,
)
if not (isinstance(daily_response, dict)):
self._attr_is_on = None
raise HomeAssistantError("daily_response is empty.")
if (len(daily_response) == 0) or (
"forecast" in daily_response[self._weather_entity]
):
if (not (isinstance(daily_response, dict))) or (len(daily_response) == 0):
forecast = None
elif "forecast" in daily_response[self._weather_entity]:
forecast = daily_response[self._weather_entity]["forecast"]
else:
forecast = None
Expand Down

0 comments on commit ad8df01

Please sign in to comment.