mirror of
https://github.com/jdejaegh/irm-kmi-ha.git
synced 2025-06-27 03:35:56 +02:00
Fix edge case in current weather
This commit is contained in:
parent
5f53d16ce2
commit
62e9e5fb9f
1 changed files with 2 additions and 2 deletions
|
@ -212,7 +212,7 @@ class IrmKmiCoordinator(TimestampDataUpdateCoordinator):
|
|||
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
|
||||
|
@ -278,7 +278,7 @@ class IrmKmiCoordinator(TimestampDataUpdateCoordinator):
|
|||
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
|
||||
|
|
Loading…
Add table
Reference in a new issue