Advertisement
jarekmor

forecast_lab

Jan 30th, 2023
960
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 2.09 KB | None | 0 0
  1. {## Definicja zmiennych ##}
  2. {% set my_wind_speed =
  3.   state_attr('weather.forecast_home_hourly', 'forecast')[0]["wind_speed"]
  4.  %}
  5.  
  6. {% set my_wind_hour =
  7.   state_attr('weather.forecast_home_hourly', 'forecast')[0]["datetime"][11:16]
  8. %}
  9.  
  10. {% set my_wind_date =
  11.   state_attr('weather.forecast_home_hourly', 'forecast')[0]["datetime"][:10]
  12. %}
  13.  
  14. {## Komunikat ##}
  15. Prognoza prędkości wiatru w dniu {{my_wind_date}}
  16. dla godziny {{my_wind_hour}}
  17. wynosi: {{ my_wind_speed }} km/h.
  18.  
  19. {## Warunek - czy jest większy od 20 km/h ##}
  20. {% if my_wind_speed | float > 20.0 -%}
  21.   ALARM!!! ALARM!!! - Send notification!!!
  22. {%- else -%}
  23.   CALM DOWN :-)
  24. {%- endif %}
  25.  
  26. {## do analizy ##}
  27.  
  28. Prognoza godzinowa w dniu:
  29. {{ state_attr('weather.forecast_home_hourly', 'forecast')[0]["datetime"][:10] }}
  30.  
  31. Jednostka:
  32. {{ state_attr('weather.forecast_home_hourly', 'wind_speed_unit') }}
  33.  
  34. Prognozy godzinowe:
  35. {{state_attr('weather.forecast_home_hourly', 'forecast')[0]["datetime"][11:16]}}
  36. wind speed: {{ state_attr('weather.forecast_home_hourly', 'forecast')[0]["wind_speed"] }}
  37.  
  38. {{state_attr('weather.forecast_home_hourly', 'forecast')[1]["datetime"][11:16]}}
  39. wind speed: {{ state_attr('weather.forecast_home_hourly', 'forecast')[1]["wind_speed"] }}
  40.  
  41. {{state_attr('weather.forecast_home_hourly', 'forecast')[2]["datetime"][11:16]}}
  42. wind speed: {{state_attr('weather.forecast_home_hourly', 'forecast')[2]["wind_speed"]}}
  43.  
  44. {{state_attr('weather.forecast_home_hourly', 'forecast')[3]["datetime"][11:16]}}
  45. wind speed: {{state_attr('weather.forecast_home_hourly', 'forecast')[3]["wind_speed"]}}
  46.  
  47. {{state_attr('weather.forecast_home_hourly', 'forecast')[4]["datetime"][11:16]}}
  48. wind speed: {{state_attr('weather.forecast_home_hourly', 'forecast')[4]["wind_speed"]}}
  49.  
  50. {### Ouput ###}
  51.  
  52. Prognoza prędkości wiatru w dniu 2023-01-30
  53. dla godziny 12:00
  54. wynosi: 25.6 km/h.
  55.  
  56. ALARM!!! ALARM!!! - Send notification!!!
  57.  
  58. Prognoza godzinowa w dniu:
  59. 2023-01-30
  60.  
  61. Jednostka:
  62. km/h
  63.  
  64. Godziny:
  65. 12:00
  66. wind speed: 25.6
  67.  
  68. 13:00
  69. wind speed: 24.1
  70.  
  71. 14:00
  72. wind speed: 23.0
  73.  
  74. 15:00
  75. wind speed: 20.9
  76.  
  77. 16:00
  78. wind speed: 20.5
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement