junkfix / numberbox-card

Replace input_number sliders with plus and minus buttons
110 stars 9 forks source link

Support for templates secondary_info #35

Closed dodekaphilist closed 2 years ago

dodekaphilist commented 2 years ago

I'd like to show some variable information in the secondary_info, which is currently not possible due to the static text. It would be really nice, if the card could support templates. Thanks! 🙂

htmltiger commented 2 years ago

added in 3.7

dodekaphilist commented 2 years ago

@htmltiger Wouldn't it be better to have Jinja2 templates like everywhere else in HA where much more things are possible in comparison with this form of implementation? Essential stuff like conditions, calculations and filters is currently missing...

htmltiger commented 2 years ago

And how do we implement it?

dodekaphilist commented 2 years ago

I'm no developer, but when looking at the code of other custom cards that support templates like this one, it should be rather easy with the help of card-tools. Checkout the documentation and maybe also have a look at other popular custom cards 🙂

htmltiger commented 2 years ago

I have looked both before and it has its own problems with the updates that requires to be fetched on every request, also all users need to be admin, depends on card-tools.

This is a javascript card that renders in the browser and templates are processed in HA so I would rather keep a simple lightweight and more compatible.

For the filters/conditions a template sensor can be created and the status displayed in the secondary info.

dodekaphilist commented 2 years ago

What about this card. As far as I can see, it doesn't use card-tools nor any other dependency..?

htmltiger commented 2 years ago

Seems like a good candidate, will look into it. Thanks.