Ildar, using cad_mod works quite well !! Many thanks!
Now I need to check if a variable I use for a select entity is not null and if it’s not null check whether the value is the same of the state of the entity to change the color. How do I do this in jinja2 ? Sorry for my lack of knowledge…
The following is the code in custopm button card:
if (variables.var_select_option_value) {
if (states[entity.entity_id].state == variables.var_select_option_value) {
return "rgb(0,100,255)";
} else {
return "Silver";
};
};
Basically I need to know how to call a variable, for the entity I just used the code of your example and I need to add the above code into the below code:
that might be a problem, because that is something that lives in the Frontend, and Jinja is connected with backend…
It makes me speak out my earlier thought, on why you would want to write this ‘generic’ template for all button cards? why not only do this on these specific cards, so you can leave out that test.
Could any CSS gurus help me with this. What I am trying to achieve is the fade in animation on page load. And then when I hover over the card, transition the opacity again. The opacity on hover changes but it does not respect the duration/fade.
Marius, because I have many cards with the same needs… So basically it’s not possible to read a variable set in each card? Unless it’s the main entity? That’s pretty frustrating?
I’ll need to fing a workaround…
Ildar, if this is possible it would be amazing!
I tried the following code, but it doesn’t seem to work, unfortunately. I might have done something wrong?:
I do not think that “null” is a correct word in jinja…
Check my example from Dev tools, try comparing with a STRING “null”.
I am a “C/C++” person, for me these python/jinja things are smth weird.