I’m hoping the screenshots/ code post below will help someone help me get this rewritten to where my sensor will start working again. I think this has something to do with the weather changes that were made to home assistant months ago but I’m not completely sure.
If possible, I would like to stick with the same way of calling things out instead of switching to going straight to individual entities (second screenshot)
Thank you all again for any guidance you can give!
Yes, it is 100% to do with the changes made quite some time ago but forced in 2024.5, there is no longer a forecasts attribute on weather entities. You have to fetch the forecast with get_forecasts instead. It actually makes it tricky because you can’t test it in Developer for a script, you have to noodle it out.
What I did is just replicate the old method by creating a sensor that fetches the forecast and then populates attributes that I then use in other scripts and sensors:
Yeah, I will have to look at the docs too probably. I am just not very good with this stuff at all. Most of what I have built was through copy pasting from others sadly. So when it breaks, I’m screwed.
Sorry, you need that if you are getting the FIRST forecast. Or you loop them. Forecast is the attribute and [0] is the first record on the list, so if you want to know what todays forecast is then it’s 0, tomorrow is 1, etc. If hourly then 0 is generally the next hour, then 1 the hour after, etc.
That trigger is indented too far, please look at the doc link I posted and you’ll see the indention. If you are getting errors about the platform then you are using the legacy method:
And, if you are doing in a package it’s a little different too. Just reformat things to be like they were before but using the new trigger and references to the variable the get_forecasts returns and you’ll be on track.
You can still use the legacy system (for now) so just replace your code with the new code and you should be OK. As always, back up before you do big changes. Although I am not 100% positive that the trigger works with the old way…