Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Half Anniversary Attributes #34

Closed
twochannel opened this issue Mar 8, 2020 · 14 comments · Fixed by #41
Closed

Half Anniversary Attributes #34

twochannel opened this issue Mar 8, 2020 · 14 comments · Fixed by #41
Labels
enhancement New feature or request
Milestone

Comments

@twochannel
Copy link

Your integration has been very helpful, thank you for creating and sharing it.

I have a few things for your consideration I wanted to share.

I've been researching how to do this w/ a template in a card but I can't seem to find a straight forward way to do it with the custom cards I've looked into.

secondaryinfo-entity-row Doesn't support jinaj2 templates or timestamp formatting
lovelace-multiple-entity-row Didn't allow me to combine multiple attributes/text on a a row

I have not gone down the path of the other custom card/custom entity value cards yet. The above is about as far as I was wanting to go down the custom card rabbit hole.

That said, what I am trying to do is

  1. Calculate and display info about the half-birthday for a birthday (days-til, date of). (We look for any opportunity to eat more cake). Its simply 6 months before the actual birthday.
  2. Show the day of the week for the coming date.

I could spawn a template sensor and calculate these in the new entity but I felt others could benefit from them being included. And I try to avoid chains of entities.

In addition to your card I display similar info for upcoming events in my google calendar. For that I used a template sensor to calculate and expose the days-til and then schedule a daily automation to update. If you were looking for other enhancements perhaps there's a way you can refer to an existing sensor to create your sensors in addition to your native events.

Thanks!

@pinkywafer
Copy link
Owner

I should be able to add these as attributes

@twochannel
Copy link
Author

That'd be great! I'm happy to test if you have a dev branch or similar.

@pinkywafer
Copy link
Owner

Thanks. I'll let you know when I've got something available

pinkywafer added a commit that referenced this issue Mar 23, 2020
@pinkywafer pinkywafer changed the title Additional attributes/features Half Anniversary Attributes Mar 23, 2020
@pinkywafer pinkywafer added the enhancement New feature or request label Mar 23, 2020
@pinkywafer
Copy link
Owner

You can try the Dev branch. Note that this cannot be installed through hacs and will need to be installed manually

@twochannel
Copy link
Author

Thanks!

Couple observations for the half-birthday part of the request.

  • Had to create a new entry so the half-date option could be selected and populated. I can recreate my entries but wanted to share what I saw.
  • The half-date itself is just 6 months prior, but on the same date. This may not be technically 'half' in terms of days. e.g. If today- 3/23 was a someone's birthday, their half-birthday would be sept 23rd. And because nothing is every easy - feb 29 will be fun :)

@pinkywafer
Copy link
Owner

  • you shouldn't need to re-create the entities, You should be able to enable the half option. Go to the config, integrations page. click on the entry you wish to enable the half options, clich the gear in the top right and turn it on.
  • I'd worked on 183 days before... 6 months would pose lots of other issues, eg, 6 months before December 31st would be June 31st I'm not sure how this could be addressed!

@pinkywafer
Copy link
Owner

maybe original date + 183 days may be better? but the dates would never line up perfectly month to month?

@twochannel
Copy link
Author

lol! yeah... Maybe make it a manual/custom field on creation then people can do whatever they want?

@pinkywafer
Copy link
Owner

actually... I think I'm going to have a feb '29th bug anyway... must test that!

what do you suggest? a custom date field? (mm-dd) with date +183 as default?

@twochannel
Copy link
Author

Well,
The most flexible would be to give the user the ability to add fields with user provided names and values. For this use case I would create one called half-bday and put a date in. But no calculations would be performed on that date, that way you don't have to worry about month length or leap day. If a calculated date doesn't work then people wont use it. Although I'm not sure if anyone else even does this!

Another use case would be weekday, especially if the value could be a jinja2 template. This way you don't have to code for weekday, users can do just about anything they wanted. But I dont know enough about how integrations handle data to know if thats possible

The simplest may just to do nothing and let users create a template sensor off yours and they can add their own attributes. This is what I do w/ google calendar entries now. I dont love it because its another entity to manage.

@pinkywafer
Copy link
Owner

I don't think there's an easy solution to this, other than simply using a template based off the existing. The biggest problem is that the method of defining a half anniversary could mean different things to different people, so I'm going to leave this out

@pinkywafer pinkywafer added the wontfix This will not be worked on label Mar 30, 2020
@pinkywafer pinkywafer removed the wontfix This will not be worked on label Mar 31, 2020
@pinkywafer
Copy link
Owner

Further thoughts on this... use relativedelta library...

@pinkywafer pinkywafer reopened this Mar 31, 2020
pinkywafer added a commit that referenced this issue Apr 1, 2020
should close #36 and #34
@pinkywafer
Copy link
Owner

@twochannel can you try the latest dev branch please?

@twochannel
Copy link
Author

nice! i tested one non-30/31 date and it looks good. I'm not able to edit an existing entry to toggle feature though. I'm on 106.6 and I swear It was there on 104.3. When i click the gear I get the basic entity stuff (override name, disable, and graph). I also dont see how to delete a entry, either in integrations or entities.

@pinkywafer pinkywafer added this to the 2.0.0 milestone Apr 7, 2020
@pinkywafer pinkywafer mentioned this issue Apr 7, 2020
Merged
pinkywafer added a commit that referenced this issue Apr 7, 2020
pinkywafer added a commit that referenced this issue Apr 7, 2020
should close #36 and #34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants