I’d like to test decluttering-card starting with a simple example so:
- I've installed it using HACS (and removed and re-istalled again...)
- I can see it in /local/www/community/decluttering-card and under MY_IP:8123/config/lovelace/resources, so I suppose is well installed
- in ui-lovelace.yaml:
I imagine, given other entries, that if I’d done the HACS install, the .js file would be in a subfolder of local/www/community which has a shorthand of /hacsfiles/ so the resources section would read
If case you weren’t already, you can also use !include variable in each dashboard.yaml. This way you can have all your decluttering templates in one .yaml file and then include that one in each dashboard by using !include, like this:
Exactly. I do this and the same with my custom:button-card templates. It’s cleaner and since these are general definitions, I hardly ever edit them along with the individual button definitions (that are in my ui-lovelace.yaml file).
there is a big big problem of cpu usage using nested templates… let’s see what happens if i put all in one template
edit: same results using one template only… super simple template, it just encapsulates a generic_thermostat… cpu usage is 300-400% respect using generic_thermostat …
You need to use Javascript templates. You’re trying to use Jinja2 templates with button card. That doesn’t work. Most likely you used Markdown card before.
Since the code works within button-card, you should open a ticket and report this at the github repo of decluttering-card. The code itself is fine as others have confirmed. So not much else there is to do about it. Seems like decluttering-card doesn’t render Javascript somehow.
So you need to think outside the box and reverse it, which is how I use it myself. Use the variable in the template itself and only the entity in the card on lovelace. I like to keep my decluttering-card as tidy as possible and only pass through single codes (and set everything else like text strings and Javascript in the template).
This way you can use this decluttering template only for cards that need to show the current lights on.
If you have a different room, just change the entity variable to a different sensor tracking those lights and it’s set. If you want something else to show instead of current lights on, copy the template and change the variables.
it has never done that, and it will not,. Has been asked before, when decluttering came to existence.
Decluttering card simply replaces strings (like anchors) and does not use templating itself. Its as I explained in button-card this morning: Lovelace: Button card - #6376 by Mariusthvdb
you can however, replace a string in the template, as you did above.
This doesn’t go in lovelace.yaml, but in configuration.yaml if you use YAML mode.
lovelace:
mode: yaml
resources:
Also, the path has been change a few months ago to hacsfiles instead of local/www/community. hacsfile path points to the same folder, so the location of the files is correct.
After adding that you need to restart Home Assistant and then it should be loaded (or click the three dots menu (top-right) and click on Reload resources for Lovelace to pick up changes without restarting Home Assistant. You can also call lovelace.reload_resources service directly.) Sometimes it helps to clear your browser caches if a card isn’t loaded.