pirate-weather-ha
pirate-weather-ha copied to clipboard
Daily Forecast Timezone Issue
When deploying in HA weather card, the card is showing "yesterday" as Day 0 in the forecast. This seems to be due to timestamps being returned by the pirateweather api being 7am GMT and then subtracting the local timezone from that which makes the current daily forecast show yesterday.
Is this something configurable?
Thanks!
Sorry for the slow reply here- I aim for about a 36 hour turnaround, but this week has been insane!
Do you think you could give me an example of what you're seeing? When I look at the card on Wednesday, it looks like this for me:
The API should return midnight in your local time zone, so for me, in Eastern time, I 5:00 AM as the returned time. My best guess here is that that if you're seeing yesterday, it's either an issue with the API not guessing your time zone correctly (very possible!), or your home assistant time zone not matching the location?
Here's what I see in Lovelace (at 12:17pm on Thu 1/20):
At the same time I pull this from the API directly:
Which shows the TZ as "America/Denver" which aligns w/ the HA install, with "current" time in GMT, but even converting GMT to "America/Denver" at this point would still be Thu.
Thoughts? Thanks!
This one is so weird- that's definitely the correct API response, since 12 pm Denver is 7 pm UTC on the same day, so it's getting the correct data. But for some reason the HA card thinks that time is actually a day behind what it should be.
You're not seeing anything in the HA core logs right? And have you noticed if it's always exactly one day behind, or does it change depending on the time of day
I am just setting up pirate on my own instance and also seeing this same result (shows yesterday always). Any pointers to help narrow this down?
Here's a screen capture showing the same weather card showing my local NWS station on top against Pirates results (NOAA was it?) on bottom along with time & date cards below. Sunday is missing on both, presumably neither source can account for DST changes and that's fine given the frequency of occurance.
Edit: I had inadvertently broken my Time & Date source during this capture - after correction I still see the day prior however. This update was made 4/18/23 - issue still present.

There has not been any activity on this issue in the last ninety and will automatically close in seven days. Comment on this issue to prevent this issue from closing automatically.
I'm still having this issue with the daily forecast showing yesterday but with the correct forecast. The hourly forecast reports the correct day and time
@motionbluur Approximately where are you located? Querying the API in the browser what does the API show for your timezone and what does the time parameter show for the first block in the daily section? For the time parameter it'd be helpful to run it through https://www.epochconverter.com/ to convert it to a human-readable date.
@cloneofghosts
@motionbluur Approximately where are you located? Querying the API in the browser what does the API show for your timezone and what does the time parameter show for the first block in the daily section? For the time parameter it'd be helpful to run it through https://www.epochconverter.com/ to convert it to a human-readable date.
I'm in the Chicago area, central time. The API reports back time zone America/Detroit which is Eastern time, so that's off by 1 hour. However, in the daily section, it reports the time as 17 hours ago (queried Feb 10 at 1600, reports back Feb 9 at 2300)
I figured that the issue might be timezone related. I'll push out an update shortly to use the precise timezone which should fix the issue.
@cloneofghosts looks like it's working now, thanks!
I'm going to close this one for now as switching to the precise timezone has fixed the issue. There are still some other daily forecast timezone API issues which should hopefully be sorted out in the 2.0 release. See https://github.com/Pirate-Weather/pirateweather/issues/114 and https://github.com/Pirate-Weather/pirateweather/issues/32