If I have an input selection to select more than one switch. Then in the handling routines I can’t seem to figure out how to select which switch to turn on/off or whatever. I can see how to do it for just one, but not how to select particular ones. I’m sure it’s simple, just not seeing it.
Probably not exactly what you want to do, but it may help. Change the name ‘thesiren’ to whatever you have defined
if (settings.thesiren)
{
thesiren.each //fails when not defined as multiple contacts
{
if (it.hasCommand(“beep”))
{
it.beep([delay: 2000])
}
else
{
it.on([delay: 2000])
it.off([delay: 2250])
}
}
}
I beleive to do all of them at one time it’s “thesiren(beep)”
Another Groovy question. I have an existing smartapp I was modifying for my own use. In that app there is a variable that I am trying to compare. Here is what I have:
def MyUserName = settings."userName${i}"
If ({MyUserName} = “John”) {
do something
}