Select Multiple Switches, but only turn one off?

Hello,

I am trying to build a app that I can control from the API. What I want to do is select a number of switches and then selectively turn them off… Everything is working how I expected except I can not find a way to only turn off one switch… switches.off(); turns them all off, and I can’t figure/find a syntax for switches.“switchName”.off(); This must be possible?? right?

This is the idea, where “switchName” is a name passed to the SmartApp via HTTP.

preferences {
section (“Allow external service to control these things…”) {
input “switches”, “capability.switch”, multiple: true, required: true
}
}

switches.“switchName”.off();

You’ll probably want something like:

def theSwitch = switches.find { it.displayName == theName }
theSwitch.off()
2 Likes

I was sooo close…Thanks that worked great! I knew there must be a way to do it.

B