Hi,
I’m pretty new to HA, and I’d like to extract data from the Forecast and put it in sensors.
So, I managed to make it work in the Developer Tools with this:
{% set today = now().day -%}
{% for i in state_attr('weather.maison', 'forecast') -%}
{% set jour = as_timestamp(i.datetime) | timestamp_custom('%d') | int -%}
{{ jour }}
{% if jour == today %}
Condition_0d: {{ i.condition }}
Temperature_0d: {{ i.temperature }} °C
Temperature_basse_0d: {{ i.templow }} °C
Precipitation_0d: {{ i.precipitation }} mm
Precipitation_prob_0d: {{ i.precipitation_probability }} %
Vitesse_vent_0d: {{ i.wind_speed }} km/h
{% elif jour == today+1 %}
Condition_1d: {{ i.condition }}
Temperature_1d: {{ i.temperature }} °C
Temperature_basse_1d: {{ i.templow }} °C
Precipitation_1d: {{ i.precipitation }} mm
Precipitation_prob_1d: {{ i.precipitation_probability }} %
Vitesse_vent_1d: {{ i.wind_speed }} km/h
{% elif jour == today+2 %}
Condition_2d: {{ i.condition }}
Temperature_2d: {{ i.temperature }} °C
Temperature_basse_2d: {{ i.templow }} °C
Precipitation_2d: {{ i.precipitation }} mm
Precipitation_prob_2d: {{ i.precipitation_probability }} %
Vitesse_vent_2d: {{ i.wind_speed }} km/h
{% elif jour == today+3 %}
Condition_3d: {{ i.condition }}
Temperature_3d: {{ i.temperature }} °C
Temperature_basse_3d: {{ i.templow }} °C
Precipitation_3d: {{ i.precipitation }} mm
Precipitation_prob_3d: {{ i.precipitation_probability }} %
Vitesse_vent_3d: {{ i.wind_speed }} km/h
{% elif jour == today+4 %}
Condition_4d: {{ i.condition }}
Temperature_4d: {{ i.temperature }} °C
Temperature_basse_4d: {{ i.templow }} °C
Precipitation_4d: {{ i.precipitation }} mm
Precipitation_prob_4d: {{ i.precipitation_probability }} %
Vitesse_vent_4d: {{ i.wind_speed }} km/h
{% endif %}
{% endfor %}
So first, how can I get from that to defining sensors ?
And second, as forecast changes from one day to another, will these sensors update in time with the forecast ?
I tried to get it in the configuration.yaml, but it failed.
Thanks a lot in advance