service: notify.telegram
data:
message: ‘INFO: Today is the birthday of NAME - Age: {{ states.birthday.NAME.attributes.age_at_next_birthday }}’
The code works without problems.
states.birthday.NAME.state == “0”
(0: zero days left == today)
(NAME: name of the birthday person, for example “tom”)
I can also get the name of the person by an attribute: states.birthday.NAME.attributes.friendly_name
Now, I have round about 20 persons in my birthday list and I dont want to write an automation for each person. Is there a way to handle it in one automation by setting a variable or something else? I dont want to have redundant code.
I started to use this and it works very well for me.
A couple of questions. Is there a database of holidays that you used or a d/l file?
I have attempted to make a card in lovelace but am failing.
Any ideas on how to display a birthday and holiday on my main lovelace page.
Thanks
cwb
Thank you for the response.
Would you know or give me a hint on to displaying this in Lovelace?
BTW from your github page looks like you are going to be a father soon.
Congratulations.
cwb
I followed all the instructions. Created sensor, automation and json file. But sensor.holiday is showing value of unknown. I am running my HassIO under docker of Ubuntu OS VM. Please help
Im guessing that the file path may be causing the issue.
For hassio /config/data/days.json' works. This means in the main folder where your configuration.yaml file resides, create a data folder and place the days.json file in there.
Hi all - I have had this up and running for awhile now thanks to @silvrr Github page. My question is can I use {% else %} in some way to have it display None on non holiday/birthday days? I been messing around and cant seem to get it to work. Thank you in advance!
value_template: >
{% set today = now().month ~ '/' ~ now().day %}
{% set holiday = value_json.MAJOR_US.static[ today ] %}
{% if holiday | trim == "" %}
{% set today = now().month ~ '/' ~ now().day ~ '/' ~ now().year %}
{% set holiday = value_json.MAJOR_US.dynamic[ today ] %}
{% if holiday | trim == "" %}
{% set holiday = None %}
{% endif %}
{% endif %}
{{ holiday }}
You might be able to clean up the nested if’s but I have to go do something else right now and can’t do any more with it right now. But this will get you what you want…I think…