I have some button-cards that are used to set dim-levels (10%, 25%, 50%, 75% and 100%).
Now, whatever dim level the state of the button-card = on.
But I want by default only the actual card with the correct dim-level (brightness) to have state = on.
Each card call a script which perform the dim-process.
Can I use a template (and then; how?) that check the brightness of the light to set the correct button with state = on?
@RomRider, can I use the template inside the ‘button-card’ / ‘state’ ?
I’ve tested, but so far without success:
I understand but you can’t modify the state on or off with templating. You’re pulling the on/off from the light I assume. So if you are trying to do this, you’d have to template both on and off style sections of the card.
@petro I don’t want to change the state, I want to change the colors based on the brightness, as I set colors of the button based on state. Does that explain it better?
state:
- value: "on"
styles:
card:
- box-shadow: 0px 0px 10px 10px rgba(57,128,228)
icon:
- color: '#fed281'
name:
- color: white
state:
- color: white
label:
- color: white
I want to edit this to say “if the brightness = 25 (that is 10%) then use the colors as the if the state is off”
For some reason, it kind of works; it pick of the current brightness and show the correct color, but then the other buttons doesn’t work calling the script to change the brightness level…
what other button? Can you post your whole config for these buttons, still don’t see how you’re making the service call and how the light is attached to the button.
Sorry, the template of the code I pasted had ‘brighness 255’ whic is 100% (should been 25 as this is 10%). This was for testing.
Each button are identical except it calls for different scripts setting different levels.
EDIT: I was wrong, the brightness of the lights DO change when I press the other buttons, BUT the color in the template does not change whatever the brightness level it is, it always stay green.
Meaning this template always return ‘green’ what ever the brightness level are:
Sure, this is just the first layout - first I had to make it work, now to make it prettier…hehe…
I will try to alter the size of the popup-card also (the card is deprecated, so no help from author), the two size-options are either “normal” or “large” where “large” is REALLY large
EDIT: was easy to change X * Y size of the popup-card