JLindvig

Max Paces

Oct 14th, 2021
665
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. sensors:
  2.   max_paces_entity:
  3.     unique_id: 0b1808b31fbe4ead98793def5960f046
  4.     friendly_name: Entity of the one with the most paces
  5.     value_template: >-
  6.       {%- set ns = namespace(entity_id="", previous_value=0) -%}
  7.       {%- set group = "group.birthdays" -%}
  8.       {% for max_paces_entity in state_attr(group, 'entity_id') if states(max_paces_entity) | int > ns.previous_value -%}
  9.         {%- set ns.entity_id = max_paces_entity -%}
  10.         {%- set ns.previous_value = states(max_paces_entity) | int -%}
  11.       {% endfor -%}
  12.       {{ ns.entity_id }}
RAW Paste Data