CCCPaste

forecast_lab

{## Definicja zmiennych ##}
{% set my_wind_speed = 
  state_attr('weather.forecast_home_hourly', 'forecast')[0]["wind_speed"]
 %}

{% set my_wind_hour = 
  state_attr('weather.forecast_home_hourly', 'forecast')[0]["datetime"][11:16] 
%}

{% set my_wind_date = 
  state_attr('weather.forecast_home_hourly', 'forecast')[0]["datetime"][:10]
%}

{## Komunikat ##}
Prognoza prędkości wiatru w dniu {{my_wind_date}} 
dla godziny {{my_wind_hour}} 
wynosi: {{ my_wind_speed }} km/h.

{## Warunek - czy jest większy od 20 km/h ##}
{% if my_wind_speed | float > 20.0 -%}
  ALARM!!! ALARM!!! - Send notification!!!
{%- else -%}
  CALM DOWN :-)
{%- endif %}

{## do analizy ##}

Prognoza godzinowa w dniu:
{{ state_attr('weather.forecast_home_hourly', 'forecast')[0]["datetime"][:10] }}

Jednostka:
{{ state_attr('weather.forecast_home_hourly', 'wind_speed_unit') }}

Prognozy godzinowe:

{{state_attr('weather.forecast_home_hourly', 'forecast')[0]["datetime"][11:16]}}
wind speed: {{ state_attr('weather.forecast_home_hourly', 'forecast')[0]["wind_speed"] }}

{{state_attr('weather.forecast_home_hourly', 'forecast')[1]["datetime"][11:16]}}
wind speed: {{ state_attr('weather.forecast_home_hourly', 'forecast')[1]["wind_speed"] }}

{{state_attr('weather.forecast_home_hourly', 'forecast')[2]["datetime"][11:16]}}
wind speed: {{state_attr('weather.forecast_home_hourly', 'forecast')[2]["wind_speed"]}}

{{state_attr('weather.forecast_home_hourly', 'forecast')[3]["datetime"][11:16]}}
wind speed: {{state_attr('weather.forecast_home_hourly', 'forecast')[3]["wind_speed"]}}

{{state_attr('weather.forecast_home_hourly', 'forecast')[4]["datetime"][11:16]}}
wind speed: {{state_attr('weather.forecast_home_hourly', 'forecast')[4]["wind_speed"]}}

{### Ouput ###}

Prognoza prędkości wiatru w dniu 2023-01-30 
dla godziny 12:00 
wynosi: 25.6 km/h.

ALARM!!! ALARM!!! - Send notification!!!

Prognoza godzinowa w dniu:
2023-01-30

Jednostka:
km/h

Godziny:

12:00
wind speed: 25.6

13:00
wind speed: 24.1

14:00
wind speed: 23.0

15:00
wind speed: 20.9

16:00
wind speed: 20.5