Just use the template feature of the button-card itself instead of decluttering-card for that and it will fix this issue. I’ll check what is happening though.
Also instead of setting width and height in the card style, use aspect_ratio: 1/1, it should work better for multiple screen size and will use the whole width of you horizontal-stack automatically
And just changed to aspect_ratio: 1/1 for the buttons and all looking good.
Will see what my wife’s response is to the revised look when she gets home.
[edit: wife didn’t seem fussed either way so that’s a win!]
Although, to be fair, 1/1 aspect ratio isn’t actually 1/1 in my config for some reason but it’s using the space better so I don’t actually mind.
Either way, I have now taken my main remote and updated that with the templates and gone from a nightmare of 2500 lines of YAML down to a more manageable 608 lines. Still using specific height/width for the buttons on this one as I like it to have a fixed size.Thanks again @RomRider.
And one last thing to add which is relevant to the decluttering card:
Just tried it and happy to report you can use the decluttering card in conjunction with the button_card templates from custom:button-card.
I have standard buttons for everything (now) based on templates then I use the decluttering card to further simplify the config by nesting a button_card_template within a decluttering card config for the AVR commands. If I want to change the standard button that change is now in a single place.
Add support for default values (this is optional). If no value is provided for a variable in the actual card, then the default value for that variable will be used (if any). (Fixes #1)
@daphatty, would you mind trying the version of vertical-stack-in-card from the master branch (it’s not part of a release yet). I PRed something there yesterday that might fix your issue.
Sorry it was a documentation error, I updated the post (not github yet)
Name has the entire value and icon will be the default value (fire in this case)
For some reason, the following template is not working.
decluttering_templates:
mediaplayer_template: # This is the name of a template
type: conditional
conditions:
- entity: '[[entity_1]]'
state: playing
card:
type: media-control
entity: '[[entity_1]]'
Are you sure the file is loaded correctly? If you don’t have errors in the javascript console then it probably doesn’t find the file on your disk.
Did you use the file from the dist folder?
It’s not just this template, but all of the templates that I use. Forcing a refresh of the Lovelace or in my browser doesn’t help either.
At the moment I have this issue on my computer, but on my phone it’s working perfectly.
What is lovelace-template-card? This one is only decluttering-card.js and you should only include that in your resource list.
It’s not enough to download the file, you also have to declare it in the resources of lovelace.