Skip to content

Commit

Permalink
Fix edge case in current weather
Browse files Browse the repository at this point in the history
  • Loading branch information
jdejaegh committed Jun 23, 2024
1 parent 5f53d16 commit 62e9e5f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions custom_components/irm_kmi/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ async def current_weather_from_data(api_data: dict) -> CurrentWeatherData:
or not isinstance(hourly_forecast_data, list)
or len(hourly_forecast_data) == 0):

for current in hourly_forecast_data[:2]:
for current in hourly_forecast_data[:4]:
if now.strftime('%H') == current['hour']:
now_hourly = current
break
Expand Down Expand Up @@ -278,7 +278,7 @@ async def current_weather_from_data(api_data: dict) -> CurrentWeatherData:
if current_weather['condition'] is None:
try:
current_weather['condition'] = CDT_MAP.get((int(now_hourly.get('ww')), now_hourly.get('dayNight')))
except (TypeError, ValueError):
except (TypeError, ValueError, AttributeError):
current_weather['condition'] = None

return current_weather
Expand Down

0 comments on commit 62e9e5f

Please sign in to comment.