Miicroo/ha-birthdays

Sensor.next_birthday unavailable?

Closed this issue · 3 comments

Hi thanks for this great integration. It has been working great for me until lately.

For some unknown reason the next_birthday has become unavailable.
It started after I have edited a persons birthday. It was set to year 2042 instead of 1942 resulting i him turning -18years this past week 😉.

Ever since making the update the next_birthday has stayed unavailable.

Any idea how to fix this?

Thank you advance.

Best regards Christian

Hmm, it is a bit hard to debug without knowing your full set up and birthdays, but maybe you can test it out in the template section in the development tools. Here is what I would use to print all names and values:

{%- set ns = namespace(days=365) -%}
{%- for birthday in states.birthdays -%}
  {{ birthday.entity_id }} {{ birthday.state }}
{% endfor -%}

The next_birthday sensor checks the lowest value (given that it is less than 365) and returns that. Does this help? Maybe there is more info in the system logs, like a warning or error? I can also see that the template in the documentation is the old style of template, I will try to update it as soon as possible. I hope (and think) that it should not effect functionality

@Hoekeren I have updated the section for the template now to fit the new format, let me know if this helps or if the problem persists

Figured I would comment for anyone in the future. I had the same issue. I found out that I created a birthday with the name 'test test' and then later deleted it in the config.yaml. The birthday entity however didn't actually get deleted and stayed as undefined. After deleting the entity manually, everything worked again. Was able to realize this using the template Miicroo gave above