Hello all,
Can you all help me with the subject? I’m not very familiar with yaml and not a programmer in general.
This is what I have but it doesn’t seem to be working anymore.
todays_high_temp:
friendly_name: "Today's High Temp"
#unit_of_measurement: ""
device_class: temperature
value_template: >-
{% set forecast = state_attr('weather.forecast_home','forecast')[0] %}
{{ forecast.temperature }}
Below is what I am seeing in developer tools when calling the forecast home weather integration.
forecast:
- condition: sunny
datetime: "2024-06-07T16:00:00+00:00"
wind_bearing: 297.7
temperature: 79
templow: 65
wind_speed: 9.63
precipitation: 0
humidity: 38
Below is what I have but I know it’s not right because I want the value to be loaded to the actual sensor, not to attributes of the sensor.
Can someone show me how to write this properly? Thank you all!!
- trigger:
- platform: time_pattern
hours: /1
action:
- service: weather.get_forecasts
data:
type: daily
target:
entity_id: weather.forecast_home
response_variable: x
sensor:
- name: Today's High Temp
unique_id: todays_high_temp
state: "{{ now().isoformat() }}"
attributes:
todays_high_temp: >-
{{ x['weather.forecast_home'].forecast[0].temperature }}
- name: Tonight's Low Temp
unique_id: tonights_low_temp
state: "{{ now().isoformat() }}"
attributes:
tonights_low_temp: >-
{{ x['weather.forecast_home'].forecast[1].templow }}