Geting data from weather.get

Hi,

I’m trying to create morning weather briefing, I started from creating template sensors. Problem is that only part of them works. Does anyone have idea why?

Below is code I use, only first 2 works (temperatura maksymalna and temperatura minimalna) the rest create sensor, but state is “unknown”.

- trigger: #temperatura maksymalna
    - trigger: time_pattern
      hours: /1
      minutes: "/1"
  action:
    - action: weather.get_forecasts
      data:
        type: daily
      target:
        entity_id: weather.forecast_home
      response_variable: daily
  sensor:
    - name: Temp max prog
      unique_id: temp_max_prog
      state: "{{ daily['weather.forecast_home'].forecast[0].temperature }}"
      unit_of_measurement: °C
- trigger: #temperatura minimalna
    - trigger: time_pattern
      hours: /1
      minutes: "/1"
  action:
    - action: weather.get_forecast
      data:
        type: daily
      target:
        entity_id: weather.forecast_home
      response_variable: daily
  sensor:
    - name: Temp min prog
      unique_id: temp_min_prog
      state: "{{daily['weather.forecast_home'].forecast[0].templow}}"
      unit_of_measurement: °C
- trigger: #predkosc wiatru
    - trigger: time_pattern
      hours: /1
      minutes: "/1"
  action:
    - action: weather.get_forecast
      data:
        type: daily
      target:
        entity_id: weather.forecast_home
      response_variable: daily
  sensor:
    - name: predkosc wiatru prog
      unique_id: predkosc_wiatru_prog
      state: “{{daily['weather.forecast_home'].forecast[0].wind_gust_speed}}”
      unit_of_measurement: m/s
- trigger: #prawdopodobienstwo opadow
    - trigger: time_pattern
      hours: /1
      minutes: "/1"
  action:
    - action: weather.get_forecast
      data:
        type: daily
      target:
        entity_id: weather.forecast_home
      response_variable: daily
  sensor:
    - name: opad prawdopodobienstwo
      unique_id: opad_prawdopodobienstwo
      state: “{{daily['weather.forecast_home'].forecast[0].precipitation_probability}}”
- trigger: #opad
    - trigger: time_pattern
      hours: /1
      minutes: "/1"
  action:
    - action: weather.get_forecast
      data:
        type: daily
      target:
        entity_id: weather.forecast_home
      response_variable: daily
  sensor:
    - name: opad prog
      unique_id: opad_prog
      state: “{{daily['weather.forecast_home'].forecast[0].precipitation}}”
      unit_of_measurement: mm
- trigger: #wilgotnosc
    - trigger: time_pattern
      hours: /1
      minutes: "/1"
  action:
    - action: weather.get_forecast
      data:
        type: daily
      target:
        entity_id: weather.forecast_home
      response_variable: daily
  sensor:
    - name: wilgotnosc prog
      unique_id: wilgotnosc_prog
      state: “{{daily['weather.forecast_home'].forecast[0].humidity}}”

Hi mwpol20,

You should be able to use that trigger, then the action once, then the sensor: key, then list all the named sensor sections instead of what you have.
I don’t know if it will fix the problem, but it would be easier to read and may work better…

This is a list of the available attributes…