Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - platform: template
- sensors:
- next_birthday:
- friendly_name_template: >-
- {% set ns = namespace(entity_id="", prev=1000) %}
- {% for birthday in states.group.birthdays.attributes.entity_id -%}
- {% if states(birthday) | int < ns.prev %}
- {%- set ns.entity_id = birthday -%}
- {%- set ns.prev = states(birthday) | int -%}
- {% endif -%}
- {% endfor %}
- {{ state_attr(ns.entity_id, "friendly_name") }}
- value_template: >-
- {% set ns = namespace(entity_id="", prev=1000) %}
- {% for birthday in states.group.birthdays.attributes.entity_id -%}
- {% if states(birthday) | int < ns.prev %}
- {%- set ns.entity_id = birthday -%}
- {%- set ns.prev = states(birthday) | int -%}
- {% endif -%}
- {% endfor %}
- {{ ns.prev }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement