Dear all,
I’m having a blast with my new HA setup. I got a cool REST Command running and I want more! Here’s the idea: I want to POST the weather forecast data to a little server of mine, that then displays it on an eink display.
In the default dashboard there’s a weather card that show the temperature for example (state_attr("weather.forecast_home", "temperature")
gets me that value in the template editor too). What that weather card on my dashboard also shows is, once I tap on it, the forecast. Great. This, I believe is powered by the new action
, called weather.get_forecast
. So far so good! I can even inspect the action’s YAML in the developer tools:
action: weather.get_forecasts
target:
entity_id: weather.forecast_home
data:
type: daily
I can run said action and get a pretty response:
weather.forecast_home:
forecast:
- condition: rainy
datetime: "2024-09-06T10:00:00+00:00"
wind_bearing: 128.6
temperature: 19.9
templow: 19.1
wind_speed: 3.31
precipitation: 0.2
humidity: 94
- condition: cloudy
datetime: "2024-09-07T10:00:00+00:00"
wind_bearing: 111.5
temperature: 25.3
templow: 16.1
wind_speed: 4.11
precipitation: 0
humidity: 82
Note the forecast
key! I would expect I would be able to do something like this in my template state_attr("weather.forecast_home", "forecast")
. Alas, no luck. If I look at the States tab in the dev tools I can find the weather.forecast_home
entity but no associated forecast
key. What gives?
The REST Command I intend to make looks like this (not sure that tojson
works):
send_forecast:
url: "http://192.168.178.191/weather"
method: POST
headers:
Content-Type: application/json
payload: '{{ weather.forecast_home.forecast |tojson }}'