Anniversaries: Notification for upcoming birthdays

I am using the Anniversaries integration, this creates sensors with days left until an anniversary. So a birthday today would have value 0 in the sensor.

Now I would like to setup a notification automation which would notify me of all birthdays of that day. I don’t really want to setup a notification for each birthday, does anyone know how to set this up in one automation.

Like: if any of the sensors has value 0, then send a message like: Person X has his birthday (taken from that one sensor which has value 0, not the others).

There are probably a dozen reasonable ways to do this. Here’s one.

Create a sensor group helper (you can do this in the UI on the Helpers tab) with all of the anniversary sensors as members. Choose Minimum as the calculation type. You should probably also check “ignore non-numeric” to protect against any of the sensors becoming unavailable if you reconfigure or change anything.

Create an automation with a numeric state trigger on this new sensor when it equals zero.

Then add a notification action. The message could be something like:

Today's birthdays: {{ expand('sensor.birthday_group') |     
    selectattr('state','equalto','0') | 
    map(attribute='attributes.friendly_name') 
    | list | join(',')}}

This will put the sensor’s (who’s value equals zero) friendly name in a comma separated list for you.

I assume this automation would trigger at midnight, which may not be when you want to get the notification. In the trigger you could put twelve hours (for instance) in the For field so that the automation would trigger at noon instead.

@atlflyer
Hello, I followed your tips to create a group with birthdays, but an error is appearing about Unit of measurements, which is in days. When creating the group I cannot change it to days. Can you help me with how to overcome this?
Thank you

I think the only way to force a mismatched unit of measurement into a group is to create a template sensor that mirrors the value of the item that has the different UoM. Go to the helpers tab and choose to create a template sensor. Specify Days as the unit of measure and put

{{ states('sensor._anniversary_aniversario_teste') }}

as the template value (I’m assuming that’s the one with the Dias unit of measure…)

trigger:
  - platform: time
    at: "09:00"
    variables:
      ann_list: "{{ expand(integration_entities('anniversaries')) | selectattr('state', 'eq', '0') | list }}"
condition:
  - alias: Check if list of Anniversaries with state 0 has any items in it 
    condition: template
    value_template: "{{ ann_list | count > 0 }}"
action:
  - service: notify.example
    data:
      title: "Today's Bithdays and Anniversaries"
      message: "{{ ann_list | map(attribute='name') | join(', ') }}"

EDIT: Corrected typo

Well, I think I have both solutions here, I’m a newbie. in the home assistant and I can’t get there, I’m sorry. @atlflyer , In the helpers I don’t know how to fill in the fields, I entered some values ​​but I got an error.

@Didgeridrew , I know this anne_list is an example, but where do I create this list or give it the name? Is it also in the helpers?

@atlflyer ,When I created the birthdays group, it didn’t show days, but only numbers.

This is fine, the number represents the days left and you can use that in your automation condition. For example, when the value is <1, birthday is today.

The initial code from @atlflyer worked for me. I also got the UoM message but ignored it.

@Digeridrew 's solution is probably simpler, so long as there aren’t any items in the anniversaries integration you would want to exclude, because it doesn’t require any helpers or anything outside of the automation itself. In that example, ann_list is a variable, and it’s defined within the automation itself on line 4. However, if I’m not mistaken variables should not be indented in order to reflect that it is a top level dictionary entry, not nested under trigger.

What I posted is a fully working automation. It does not require any helpers. As @atlflyer mentioned, it will pull in all entities from the Anniversaries integration. If there

You just need to substitute your notification service where I put notify.example and change the trigger to meet your needs if a Time trigger isn’t what you want.

If you need a primer on how to transcribe YAML automation configurations that you find here using the UI Automation Editor, there is a (now slightly dated) tutorial available on the Resin Chem Tech Youtube channel.

Either will work, variables attached to a trigger have the same script-wide scope as those set up under a separate variables key.

Hello everyone, I would like to say that it is now working. Thank you everyone for the tips :pray: it was as @atlflyer said in the post above.
thank you :+1: