iprak / weatherapi

HomeAssistant custom integration to fetch data from weatherapi
MIT License
8 stars 3 forks source link

Hourly forecast is not updating #24

Closed ianpra closed 1 year ago

ianpra commented 1 year ago

Hi,

When configured to generate an hourly forecast it is always starting at midnight, regardless of what time of day it is, and doesn't appear to be updating it during the day.

This screenshot was taken at 11:35 am, and you will see that the first hourly forecast entry is at midnight for today...

2023-01-08 11_35_28-Window

Kind regards

Ian

iprak commented 1 year ago

Your observation is correct. WeatherAPI always returns the daily forecast split into hours starting from midnight. There is optional parameter to control this behavior, which might have the data size. I will look into skipping past data based on current hour.

ianpra commented 1 year ago

Hi,

I think I've solved my issue - I'm looking to use the hourly forecast data with this Lovelace card - https://github.com/decompil3d/lovelace-hourly-weather, and I've just realised that I can use an offset (which will accept a template) so the card only starts displaying from the current hour. Up to now it has just been dispalying the forecast from midnight to 6am, as that is the first 6 hourly values returned.

I am curious as to what data is returned for hours which have past - eg when you query the API at 10am, what values are returned for the hours from midnight to 9am - do they leave it as what they forecast it to be, or do they update it with the actual data (which is now effectively historical data) - as technically you can't forecast something that has already happened!

I'm going to save the sensor values and and compare again later in the day to see if they change once the forecast period has passed.

Kind regards

Ian

ianpra commented 1 year ago

Hi @iprak

Just updated to the latest release, and this all works now without having to apply an offset in the card.

Thanks for your help and the quick fix.

Kind regards

Ian