Closed mcowell closed 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)
What version were you running when this was last working?
I think this is an upstream issue for something in templates. I've asked for some help on Discord.
Thanks @gwww ... I was not certain it is related to the weather integration either. It could certainly be that something changed with templates.
This broke when I moved to 2024.8.0 ... I believe I was running the last 2024.7.x version before that which I think was core-2024.7.4.
get_forecasts
is working properly and returns a dict
type. This can be shown by changing the last line of your template to:
forecast: "{{ daily['weather.ottawa_kanata_orleans'].forecast[0] }}"
That returns the dict
entry forecast
, which is an array and the [0]
returns the first element of the array. So, the Environment Canada integration is working properly.
I'm not a template expert and can't offer a solution. My suggestion would be to post on the forums and see what people there have to say. Feel free to tag this problem and tag me. I'm curious how this worked in previous versions but does not work now.
@home-assistant close
@home-assistant reopen
Fixed by #123960
The problem
Hello,
I have the following template for use with Tileboard to fetch hourly weather from Environment Canada.
Using the following
{{state_attr('sensor.weather_forecast_daily','forecast')}}
The above used to give me an array of objects back, but now I just get a string.{'forecast': [{'datetime': datetime.datetime(2024, 8, 12, 15, 0, tzinfo=tzutc()), 'precipitation_probability': 30, 'condition': 'lightning-rainy', 'temperature': 22.0, 'templow': 13.0}, {'datetime': datetime.datetime(2024, 8, 13, 15, 0, tzinfo=tzutc()), 'precipitation_probability': 0, 'condition': 'sunny', 'temperature': 27.0, 'templow': 15.0}, {'datetime': datetime.datetime(2024, 8, 14, 15, 0, tzinfo=tzutc()), 'precipitation_probability': 30, 'condition': 'rainy', 'temperature': 28.0, 'templow': 14.0}, {'datetime': datetime.datetime(2024, 8, 15, 15, 0, tzinfo=tzutc()), 'precipitation_probability': 0, 'condition': 'sunny', 'temperature': 28.0, 'templow': 15.0}, {'datetime': datetime.datetime(2024, 8, 16, 15, 0, tzinfo=tzutc()), 'precipitation_probability': 0, 'condition': 'partlycloudy', 'temperature': 28.0, 'templow': 18.0}, {'datetime': datetime.datetime(2024, 8, 17, 15, 0, tzinfo=tzutc()), 'precipitation_probability': 60, 'condition': 'rainy', 'temperature': 24.0, 'templow': 18.0}]}
Thus, when I try to get the [0]th element of the above I get undefined since it is not actually an array. This becomes an issue on Tileboard as I try to iterate though the first nth elements of the forecast.
Seemingly another user ran into the issue here also : https://community.home-assistant.io/t/need-help-with-recent-daily-weather-forecast-error/759166
Please let me know if I can provide any more information or do any testing for you.
Thanks!
What version of Home Assistant Core has the issue?
core-2024.8.0
What was the last working version of Home Assistant Core?
core-2024.7.4
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
No response
Anything in the logs that might be useful for us?
No response
Additional information
No response