Please help. I’ve been trying to find a solution for 5 days. I’ve tried a thousand different things. I went back to my first attempt and ask someone to please point me in the right direction.
The first sensor (sensor.nws_daily_forecasts) works perfectly. The second sensor (sensor.current_forecast) just needs its state value to equal the value of the first sensor’s first attribute (forecast_0).
Here is the template sensor:
template:
- trigger:
- platform: time_pattern
minutes: "/15"
action:
- service: nws.get_forecasts_extra
data:
type: twice_daily
target:
entity_id: weather.klqk_daynight
response_variable: daily_forecast
sensor:
- name: "NWS Daily Forecasts"
unique_id: nws_daily_forecasts
state: "{{ now() }}"
attributes:
forecast_0: "{{ daily_forecast.forecast[0].detailed_description }}"
forecast_1: "{{ daily_forecast.forecast[1].detailed_description }}"
forecast_2: "{{ daily_forecast.forecast[2].detailed_description }}"
forecast_3: "{{ daily_forecast.forecast[3].detailed_description }}"
- name: "Current Forecast"
unique_id: current_forecast
state: "{{ daily_forecast.forecast[0].detailed_description }}"
No matter what I have tried, I always get ‘unknown’ on the second sensor.
Thanks…