a-p-z / datetime-card

A minimalistic card for Home Assistant Lovelace UI which shows how many days it has been between any input_datetime and today.
21 stars 1 forks source link

feature request: add max as an attribute #13

Closed erkr closed 1 year ago

erkr commented 1 year ago

Hi

I’m a very happy user of this card. Thanks! As I also wanted to have notifications, I wrote automations for each entity in the card.

There is a maintenance issue with that approach as the max time in the card is defined independently from the max I use in the automations.

It would really help if the max in the card was added to the helper entity as an extra attribute. That would allow automations to lookup the max value.

Have to admit that I don't know if this is possible in a card, nor if the extra attributes will persist a reboot ( I'm afraid not).

Alternatively it would be great if you can point me out how to read the max values of the card in an automation or script.

Best Eric

erkr commented 1 year ago

Update @a-p-z I wrote a PyScript: https://gist.github.com/erkr/45d6d82053d20001976b29e19ae2e7de That script needs the PyScript integration. It adds a service that looks-up all custom:datetime-card based cards in a particular dashboard. There it evaluates all entities if they exceed the max time configured in that card and then sends a notification for them. Maybe nice to reference my Gist in your readme before closing this issue ;-) I run the service once a day in a time-triggered automation Best Eric

a-p-z commented 1 year ago

Hi Eric! Thanks for the contribution. Feel free to add your gist in the readme file

On Sun, Feb 12, 2023, 22:42 Eric @.***> wrote:

Update @a-p-z https://github.com/a-p-z I wrote a PyScript: https://gist.github.com/erkr/45d6d82053d20001976b29e19ae2e7de That script needs the PyScript integration. It adds a service that looks-up all custom:datetime-card based cards in a particular dashboard. There it evaluates all entities if they exceed the max time configured in that card and then sends a notification for them. Maybe nice to reference my Gist in your readme before closing this issue ;-) Best Eric

— Reply to this email directly, view it on GitHub https://github.com/a-p-z/datetime-card/issues/13#issuecomment-1427139765, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGS5IPLALHIGGFEPJEXM4WLWXFKMHANCNFSM6AAAAAAUXXAPHM . You are receiving this because you were mentioned.Message ID: @.***>

erkr commented 1 year ago

@a-p-z Thanks. I proposed a change. You are free to alter it as you like

erkr commented 1 year ago

@a-p-z I’m reasonable new to GitHub. I hope I now successfully made a pull request🫣

erkr commented 1 year ago

@a-p-z , I still see that a warning that I (as first time contributor) need a workflow approval for this pull request. Do I have to do something ? Best Eric

erkr commented 1 year ago

image

a-p-z commented 1 year ago

No. Thanks for your contribution

erkr commented 1 year ago

👌