314ma

Max temp of given day

May 13th, 2021 (edited)
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  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 }}
Add Comment
Please, Sign In to add comment