314ma

Max temp of given day

May 13th, 2021 (edited)
53
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. {% set now_date = ((now() + timedelta(days=0)) | string)[0:10] %}
  2. {% set forecast = state_attr("weather.dom_hourly", "forecast") %}
  3. {% set ns = namespace(max_temp=-1000) %}
  4. {%- for f in forecast -%}
  5. {%- if f["datetime"][0:10] == now_date %}
  6. {% set ns.max_temp = [f["temperature"], ns.max_temp] | max %}
  7. {%- endif -%}
  8. {%- endfor -%}
  9. {{ ns.max_temp }}
RAW Paste Data