I’m working on a very simple grid setup using a combination of different cards with the custom:button-card and I’m having problems with the icon “disappearing” if I add styling. My custom button cards are shorter than my other cards (whether I choose “render cards as squares” or not. If I choose to render as squares, and then change the aspect ratio of the custom button card to 1/1 it changes the button to the right size, but the icon disappears. I’ve played with icon sizes etc and just can’t get it. I can manipulate the size of the card by making the icon bigger (with aspect_ratio off) but then the size of my icon doesn’t match my other cards. Right now I’m only messing with the “motion” card and will apply to the others once I have a solution. Any suggestions? Thank you!
I probably don’t see the obvious.
I’m trying to change the background color based on the state of another entity.
I’ve done this several times and it always worked, in this case it didn’t
This code NOT WORK: whatever the value of the entity, the background color does not change
You’re not going wrong, you’re just doing different things.
not off is something different than is on. not off can be anything, including on, but it is not limited to. Just use a different state, eg. open or unavailable or unknown, and you see why. Open is not off, but it isn’t automatically is on.
And you’re doing a different check with === compared to !=. You’re checking here not only for the value, but additionally for the type of your condition.
See here:
Both things could be the reason, why things aren’t working as expected.
Hi Guys! I’m trying to alterate a state of a entity and in consequence the color of the icon:
If two switches are in state “on” it should turn green otherwise red for example. Tried this:
[[[
var circulation=states[switch.frischwasserzirkulationspumpe].state;
var loadingpump=states[switch.ladepumpe].state;
if (circulation == true) && (loadingpunp == true) return 'on';
else return 'off';
]]]
Trying to get toggle to work on a custom-card button so as to toggle on and off a relay on a PLC and also show its current state. Currently it does not show state and will only turn on the relay and not off when pressed again.
as that is the only way to get the state (either 0 or 1). Is there a way to get the toggle to work and also have the button reflect the state of the relay? Another thing to note is that the button, while supposed to be red backfround is dark grey.
I have a good couple of binary motion sensors (with device class motion) within a custom button card.
I cannot figure why the the state of them is showing on/off instead of clear/detected. It looks like custom button card doesn’t respect the device class, but I see examples in this thread where the correct state string is being displayed. The very same binary sensors are correctly displayed as clear/detected on other cards.
Took your advice an am using node red. How do you loop back state to your switch?
Below is a picture of my two PLCs (x410 and x310). I can read the coil (relays) states no problem but when I create a switch, how do I get the initial state? I created a switch called X410Relay1 switch, but how can I get it to keep state?
After viewing some other examples online, I am trying to get the output state of relay 1 and run it through change to mimic a toggle switch when x410_relay_switch is pressed…