Advertisement
BoorAndras

Untitled

Sep 18th, 2024
293
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 0.84 KB | None | 0 0
  1. - trigger:
  2.     - platform: time_pattern
  3.       hours: "17"
  4.       minutes: "5"
  5.   action:
  6.     - service: weather.get_forecasts
  7.       target:
  8.         entity_id: weather.forecast_otthon
  9.       data:
  10.         type: hourly
  11.       response_variable: hourly
  12.   sensor:
  13.     - name: "forecasted_min_temp_next_16h"
  14.       unique_id: 9de810c8-9b93-4413-9451-988b4c9c8f72
  15.       icon: mdi:thermometer-chevron-down
  16.       unit_of_measurement: °C
  17.       state: >
  18.        {% set fc = hourly['weather.forecast_otthon'] %}
  19.         {% set ns = namespace() %}
  20.         {% set ns.min_temp = 40 %}
  21.         {% for hour in range(0, 15) %}
  22.           {% set temp = fc.forecast[hour].temperature %}
  23.           {% if temp < ns.min_temp %}
  24.             {% set ns.min_temp = temp %}
  25.           {% endif %}
  26.         {% endfor %}
  27.         {{ ns.min_temp |float(0) | round(2) }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement