Miicroo / ha-birthdays

Birthday integration for HomeAssistant
24 stars 8 forks source link

Feature - Weeks remain #20

Closed poudenes closed 1 month ago

poudenes commented 1 month ago

Great great integration!!!

To make it fully complete it would be great to have: weeks remain as attribute.

Keep up the good work!

Miicroo commented 1 month ago

Nice, thanks for the suggestion @poudenes ! Some quick questions so I can tailor the solution a bit better, do you have a lot of birthdays and are all shown in a list, or do you just use the next birthday and want to know how many weeks out that is? Since it is weeks remaining (so state divided by 7) it could be possible to have it templated, and if so also bring in some way of making custom attributes based on a template

poudenes commented 1 month ago

The answer is to know how many weeks till the birthday. Templating a sensor is an options. But if it can be integrated in the integrations as attribute would be nicer :)

Miicroo commented 1 month ago

Attribute works too, maybe the attribute itself can be a template so that users can customize their own attributes instead of waiting on new versions. Will try to see if I can come up with a PR :)

Den tors 3 okt. 2024 19:28Peter Oudenes @.***> skrev:

The answer is to know how many weeks till the birthday. Templating a sensor is an options. But if it can be integrated in the integrations as attribute would be nicer :)

— Reply to this email directly, view it on GitHub https://github.com/Miicroo/ha-birthdays/issues/20#issuecomment-2391948880, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSUSBB6WBCVYM7E37B4YOTZZV5C5AVCNFSM6AAAAABPKGESCSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOJRHE2DQOBYGA . You are receiving this because you commented.Message ID: @.***>

Miicroo commented 1 month ago

PR is on its way! https://github.com/Miicroo/ha-birthdays/pull/21 Will do some final testing and can add the config you need here when it is done :)

Miicroo commented 1 month ago

@poudenes v1.1.0 is released now, here is how you should configure it to add a custom templated attribute so you get weeks_until_birthday for each birthday. You have to change the birthdays-list though, I just added it so that you can see what it should look like

birthdays:
  config:
    attributes:
      weeks_until_birthday: '{{ ((this.state or -1) / 7) | int }}'
  birthdays:
    - name: 'Frodo Baggins'
      date_of_birth: 1921-09-22
    - name: 'Bilbo Baggins'
      date_of_birth: 1843-09-22
    - name: Elvis
      date_of_birth: 1935-01-08
      icon: 'mdi:music'

Let me know if you have any questions!

poudenes commented 1 month ago

Updated and worked great!

Miicroo commented 1 month ago

Super, closing the issue now! :)