Open anthonydiiorio opened 1 month ago
Hey there @gwww, @michaeldavie, mind taking a look at this issue as it has been labeled with an integration (environment_canada
) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
environment_canada documentation environment_canada source (message by IssueLinks)
For reference it goes back to normal during the day.
I'm not an expert, but I "think" this is similar to a problem I had when setting up a custom Environment Canada display/dashboard. I created a "helper" to store the "previous" UTCSunset so that my weather display would properly show "day/night" values.
I suspect an integration could account for every time zone but; even Environment Canada weather reports a global timestamp that doesn't actually match any timezone in Canada.
It was a while ago, I could be wrong. I hope this helps.
6.
Thanks for flagging.
@gwww can you think of a way to correct for this? I suppose we could drop the overnight low forecast after midnight, but that seems less than ideal. I also noticed that the parent weather
integration now supports twice_daily
as a forecast type, which is aligned with the data ECCC provides.
I will ponder this one, but for now trying to get blocking calls out of the integrations I support. And then I'm poking at the edges of the Environment Canada memory leak that people are talking about.
It is 8:30 pm on Sunday July 7. What I see appears correct. Is it still broken for you? I'm running 2024.7.1. Maybe I'm not reproducing this correctly or maybe something changed in HA Core or UI?
I think the problem only occurs after midnight, with the "tonight" forecast showing up as the next day, and all of the other days also being ahead by one.
Ahhh. If that is the case my thought is to just drop that one entry.
"Twice daily" is something that could also be considered although I'm unsure if it would help with this issue.
Yup, can confirm still broken after midnight. Tuesday in HA is showing the Monday forecast, etc.
So the answer I can think of is to drop the overnight low after midnight, as you suggest. Something such as between midnight and 6am if the first entry in the EC forecast is a "tonight" ("low") then drop it.
I'm gathering the EC weather as XML in files once an hour for the next 24 hours just to see what the pattern is for when singular for tonight starts and when it ends. Once I see the pattern and confirm the timing I'll figure out a patch.
I further reflected on the twice daily and it does not seem appropriate - at least by my understanding of it. Twice daily would imply that twice a day there is a high/low reading. What we have is one high and one low for the day.
Twice daily means that you use the high temp during day and low temp for night. This is how the NWS data is also provided. But you should only do this, in my opinion, if you also have all the other data like condition, wind, etc.
@michaeldavie I two possible fixes to try.
Keep the previous day's night forecast but set it's timestamp to be the previous day. Also make sure the other days' have their timestamp set correctly and not skip a day. I'll try this first and see how it looks on the dashboard. I'm unsure what having forecast info from a previous day will do on the frontend.
The second approach is to just delete the night forecast when it's for the previous day. This is the fallback if the first approach does not work.
I hope to code the first approach today and test it out overnight.
The problem
At night when Environment Canada shows the weather for "tonight" with the day temperature blank, the data is in the right places in the dashboard, exactly the same as Environment Canada, but the day labels are incorrect. Everything is shifted by 1 day. Monday shows the Sunday forecast, Tuesday shows the Monday forecast, etc.
What version of Home Assistant Core has the issue?
2024.5.5
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant OS
Integration causing the issue
Environment Canada
Link to integration documentation on our website
https://www.home-assistant.io/integrations/environment_canada/
Diagnostics information
No response
Example YAML snippet
Anything in the logs that might be useful for us?
No response
Additional information
No response