Aika samanlainen omassa, laitetaan nyt tämäkin oheen, hieman eri mausteilla:
Laitetaan siis configuration.yaml tiedostoon.
YAML:
# Weather forecast from Meteorologisk institutt (Met.no).
# Response fields can be checked with action (Developer tools > Actions)
# action: weather.get_forecasts
# target:
# entity_id: weather.forecast_home
# data:
# type: daily
# Notice that entity ID for template sensors currently appear to be based on the name, not unique_id
# -https://community.home-assistant.io/t/template-sensor-unique-id-is-ignored/485206/2
template:
- trigger:
- trigger: time_pattern
hours: /1
#minutes: /1 # For debugging
- platform: homeassistant
event: start
action:
- action: weather.get_forecasts
data:
type: daily
target:
entity_id: weather.forecast_home
response_variable: daily
sensor:
- name: Weather forecast temperature today
state: "{{ daily['weather.forecast_home'].forecast[0].temperature }}"
unit_of_measurement: °C
- name: Weather forecat temperature tomorrow
state: "{{ daily['weather.forecast_home'].forecast[1].temperature }}"
unit_of_measurement: °C
- name: Weather forecast temperature day after
state: "{{ daily['weather.forecast_home'].forecast[2].temperature }}"
unit_of_measurement: °C
Laitetaan siis configuration.yaml tiedostoon.
