Get_forecasts not working

Since the recent update changes have been made to the weather, my node red automation which got the weather forecast for tomorrow has broken,

Historically the weather entity used to have an attribute array you could look at “msg.payload.attributes.forecast[1]” for example to get tomorrows data, but that’s now not available even though on the weather entity in HA you can see the next 5 days worth of weather.

No problem, I’ll move over to the newly created weather.get_forecasts, I look up the data on the wiki, and seems simple enough, I test in the services developer section, and it works wonderfully:

But for some reason, in node red, the service when called only gives back gibberish, it returns a string of numbers rather than anything useful, for the life of me I can’t figure it out and my googlefu and searching don’t return anything I could see that would work, anyone have any idea’s please?

[{"id":"a4cb3b18f81283f0","type":"inject","z":"4fbb0f02.0e5f6","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":160,"y":1660,"wires":[["043feebdb88ee1a0"]]},{"id":"043feebdb88ee1a0","type":"api-call-service","z":"4fbb0f02.0e5f6","name":"weather","server":"b3a3253e.d12568","version":5,"debugenabled":true,"domain":"weather","service":"get_forecasts","areaId":[],"deviceId":[],"entityId":["weather.home"],"data":"{\"type\":\"daily\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":340,"y":1660,"wires":[["5389b898e37db2b8"]]},{"id":"5389b898e37db2b8","type":"debug","z":"4fbb0f02.0e5f6","name":"debug 12","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":520,"y":1660,"wires":[]},{"id":"b3a3253e.d12568","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30,"areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]

TIA

Yes.

The service call is now based on service calls returning data.
The new weather.get_forecasts gets the forecast and returns it as data back from the call.

In the HA WebSocket call service node, the returned data is now returned, however you have to actually get it into the output properties.

Try setting an output property
msg - payload set to ‘results’

Works for me.

6 Likes

Thanks for that, getting closer, got a new error now complaining about entities, but it exists lol

Ignore me, did a full reboot of HA and it’s working now, thanks for your help

Thanks for the help guys.
However how do you reinject the results into HA ?
I cannot find a way to create a new sensor with the right values from my different weather entities.

Thank you!

When you use get forecassts, you pipe it in to a payload you can use however you see fit, the below flow pipes the current home forecast in to a payload called msg.tmw_weather

[{"id":"a4cb3b18f81283f0","type":"inject","z":"4fbb0f02.0e5f6","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":160,"y":1660,"wires":[["66a661222f434af9"]]},{"id":"5389b898e37db2b8","type":"debug","z":"4fbb0f02.0e5f6","name":"debug 12","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"tmw_weather","targetType":"msg","statusVal":"","statusType":"auto","x":480,"y":1660,"wires":[]},{"id":"66a661222f434af9","type":"api-call-service","z":"4fbb0f02.0e5f6","name":"Weather","server":"b3a3253e.d12568","version":7,"debugenabled":false,"action":"weather.get_forecasts","floorId":[],"areaId":[],"deviceId":[],"entityId":["weather.forecast_home"],"labelId":[],"data":"{\"type\":\"daily\"}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[{"property":"tmw_weather","propertyType":"msg","value":"","valueType":"results"}],"queue":"none","blockInputOverrides":false,"domain":"weather","service":"get_forecasts","x":320,"y":1660,"wires":[["5389b898e37db2b8"]]},{"id":"b3a3253e.d12568","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]