mirror of
https://github.com/jdejaegh/irm-kmi-ha.git
synced 2025-06-27 11:39:26 +02:00
Handle edge case for current weather
This commit is contained in:
parent
ea853a05a2
commit
a384a4b6fb
1 changed files with 4 additions and 4 deletions
|
@ -36,10 +36,10 @@ class IrmKmiWeather(CoordinatorEntity, WeatherEntity):
|
|||
data = self.coordinator.data.get('for', {}).get('hourly')
|
||||
if data is None or not isinstance(data, list) or len(data) == 0:
|
||||
return None
|
||||
data = data[0]
|
||||
if datetime.now().strftime('%H') != data['hour']:
|
||||
for current in data[:2]:
|
||||
if datetime.now().strftime('%H') == current['hour']:
|
||||
return current
|
||||
return None
|
||||
return data
|
||||
|
||||
@property
|
||||
def name(self) -> str:
|
||||
|
|
Loading…
Add table
Reference in a new issue