[Solved] Push button lamp switch in sitemap

Hoping this is an easy question to answer for the more experienced users…

In my sitemap, I have a dynamic frame setup to show lights that are on, using the visibility property. I would like to also show a single button by each listing called “OFF”, which will turn the lamp off.

Switch item=Bedroom_Corey visibility=[Bedroom_Corey==ON] label=“Corey’s Lamp” mappings=[0=“OFF”]

Switch Bedroom_Corey “Bedroom Lamp Corey” (Bed_Room, Lights) {hue=“1”}

Everything looks good, except I can’t turn the light off by pressing the button. What am I missing?

I use mappings=[OFF=“Turn Off”] instead of the zero there. Try to make the Switch simpler. by removing the visibility and label, and go from there?

A Switch has only 3 states, uninitialized, ON and OFF, so you have to use mappins=[OFF="OFF"]

That did it! Thank you so much for the help!

You’re welcome :slightly_smiling: