You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A sensor that returns a list of all the entities that have birthday today with their age (maybe as attributes?)
That way, we can create an automation that only "listen" to this sensor
I've created my own:
{# Global Parameters #}
{% set debug_mode = False %} {# Set debug mode on (True) or off (False) #}
{% set debug_date = '2023-11-1' %} {# Date to simulate as today's date when debug mode is on #}
{# Find all sensors #}
{% set all_sensors = states.sensor | list %}
{# Filter sensors for Anniversaries integration #}
{% set anniversary_sensors = all_sensors | selectattr('entity_id', 'search', 'anniversary') | list %}
{# Get today's date or simulated date in debug mode #}
{% if debug_mode %}
{% set today = strptime(debug_date, '%Y-%m-%d').date() %}
{% else %}
{% set today = now().date() %}
{% endif %}
{# List filtered sensors with their friendly name, birthday, and age if the birthday matches today's date #}
{# Anniversary Sensors: #}
{% for sensor in anniversary_sensors %}
{% set birthday_date = sensor.attributes.date %}
{% if birthday_date.month == today.month and birthday_date.day == today.day %}
{% set friendly_name = sensor.attributes.friendly_name | replace('birthday', '') | replace('Birthday', '') | replace('BIRTHDAY', '') | trim %}
{% set current_age = sensor.attributes.current_years %}
Name: {{ friendly_name }}
Date of Birthday: {{ birthday_date.strftime('%Y-%m-%d') }}
Age: {{ current_age }}
{% endif %}
{% endfor %}
but it's not comfortable and i would rather have something from the "inside" of the integration.
(Ignore the top global parameters, it's just for debugging)
The text was updated successfully, but these errors were encountered:
A sensor that returns a list of all the entities that have birthday today with their age (maybe as attributes?)
That way, we can create an automation that only "listen" to this sensor
I've created my own:
but it's not comfortable and i would rather have something from the "inside" of the integration.
(Ignore the top global parameters, it's just for debugging)
The text was updated successfully, but these errors were encountered: