kinghat / tabbed-card

a custom card for home assistant that utilizes tabs to segregate individual cards.
MIT License
87 stars 10 forks source link

feat: 🧑‍💻 Allow users to use jinja-templates to display first tab dynamically #105

Closed spasma closed 8 months ago

spasma commented 1 year ago

Hey @kinghat, 👋

Thanks for creating this awesome card! I missed the feature to dynamically show the tab, as I have some dynamic content for morning, afternoon and evening.

I also saw this discussion: https://github.com/kinghat/tabbed-card/discussions/70

For example I now use:

type: custom:tabbed-card
options:
  defaultTabIndex: '{% if now().hour > 17 %}2{% elif now().hour > 12 %}1{% else %}0{% endif %}'

to show different tabs by default based on the time of the day.

I've tested the old behaviour and all is still working. Please consider merging this PR.

Keep up the good work. 🎉

Sebastiaan

ilearn2023au commented 10 months ago

seems to be not working now.

spasma commented 10 months ago

It is working, but the JS in Home Assistant is cached for a long time. You cannot force to refresh it. After a while it will work.

kinghat commented 8 months ago

i still want something like this so hopefully you would be willing to collaborate on it and reopen in the future.

spasma commented 8 months ago

i didn't hear anything from you in 4 months, so I changed it to a fork of your repo: https://github.com/spasma/tabbed-card-programmable

On some devices the cached js was still an issue on my HA-instance (even after core updates) as mentioned here: https://github.com/kinghat/tabbed-card/pull/105#issuecomment-1689501912, and I got bothered with updates to your repo. so I needed a solution for that asap.

kinghat commented 8 months ago

i didn't hear anything from you in 4 months, so I changed it to a fork of your repo: https://github.com/spasma/tabbed-card-programmable

On some devices the cached js was still an issue on my HA-instance (even after core updates) as mentioned here: #105 (comment), and I got bothered with updates to your repo. so I needed a solution for that asap.

ya thats fine. im not saying its going to happen soon:tm: but i will eventually want to add dynamic templates to areas of the card. when the time comes, if youre still willing, i'd gladly accept your help.

spasma commented 8 months ago

yes, of course! no plans to add other features to it at the moment, but will keep it in sync with your changes for now. let me know if i can help anytime