I have the custom card working as far as opening and closing my garage door but I’m trying to change the icon (or color) based on the state of opened or closed.
I’m using the shelly 1 relay and I’m fine (for now) to get the state from the shelly cloud. The shelly app opens and closes with a button which changes color based on state.
Here is my code:
Here is an example (it is a template with variables I am using to create a lot of button-cards but just replace variables with what you need to create a unique card)
For creating defining the icon, I am using a different way (using “icon”) rather than the “state” as I can have very complex decision tree to display the icon for an entity… same for color and background color…
Let me know if you have questions…
I really appreciate the advice but unfortunately these changes have the same result. The garage opens and closes but the icon and the color stays in the ‘off’ position.
Any thing else to try?
I haven’t tried the template advice from the first reply yet as I’m hoping it is a simple change that is needed.
The only other card I have is for a light which turns on at sunset and off at 10:00pm…which works perfectly…changes icons and colors
I changed the entity on the light card to switch.shelly_shsw_1_e8db84d7180f’ and it acts like the card we’ve been messing with so I’d say the answer is no…it doesn’t show the correct state…only the closed or off state.
wow, can’t thank you enough! It get’s weirder. I made the change in the developer tools. I can watch the state change from on to off and then back as I open and close the door. In another tab I have the overview page up and it actually worked once. I saw the icon change and the color. But it was only that one time. Even more confused now. Couple screen shots attached. Hopefully that tells you if I followed the instructions properly
The IP is static.
I had the right entity…when I change it to the one with binary in it’s name the door doesn’t open or close. I think I had changed the state in the wrong entity. Not sure what, maybe I wasn’t waiting long enough for the icon and color to change but it’s working now!!!
I can’t thank you enough for hanging in there with me…really appreciate it!!
yes, seems so. I didn’t realize until I checked again just now. I thought I had tried the one which is working earlier. I was in this mode of trying different things and I got a bit lost.