Ensure metoffice daily are returned once daily (#72440)
* ensure metoffice daily are returned once daily * Fixes metoffice tests for MODE_DAILY
This commit is contained in:
parent
f43cc18aa3
commit
66b02ecff0
2 changed files with 28 additions and 21 deletions
|
@ -7,6 +7,7 @@ import datapoint
|
|||
from homeassistant.helpers.update_coordinator import UpdateFailed
|
||||
from homeassistant.util.dt import utcnow
|
||||
|
||||
from .const import MODE_3HOURLY
|
||||
from .data import MetOfficeData
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
@ -39,6 +40,9 @@ def fetch_data(connection: datapoint.Manager, site, mode) -> MetOfficeData:
|
|||
for day in forecast.days
|
||||
for timestep in day.timesteps
|
||||
if timestep.date > time_now
|
||||
and (
|
||||
mode == MODE_3HOURLY or timestep.date.hour > 6
|
||||
) # ensures only one result per day in MODE_DAILY
|
||||
],
|
||||
site,
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue