Using the REST API I was able to pull a weather entity state along with the attached forecast. A little while ago (perhaps over the new year) this was removed.
My use case is I have a custom-built dashboard that pulls in state information, including weather over the API.
Sorry, I did try to search but ‘weather rest API’ just gave results about building integrations with external sources. I’d not realised this was more of a core change rather than just an API interface change.
Coming around to actually fix this. This is what I did to restore an API to get weather forecast.
Couple of caveats:
Firstly you cannot use POST /api/services/<domain>/<service> to call the weather.get_forecasts service as that API does not support responses. That’s be too easy! This stumped me for a bit as it was just returning a 500 without any detail. There’s a github issue that explains but I’ve closed it already.
Use weather.get_forecasts, weather.get_forecast is deprecated.
Define a template sensor. I tried doing this via UI first (helpers tab) and couldn’t get very far, YAML instead:
Came across the same issue today. Turns out the API does support responses (maybe it has been implemented since your last post), but it has to be requested in the POST call.
It works like this: POST /api/services/weather/get_forecasts?return_response=true.