The method you are calling to, lightOff, how are going from the map "it" to an actual device command? Because I have tried doing this:
def lightOff(thing){
thing.off()
}
and that doesn't work. When a device object is passed to another method it is no longer treated like a device object, it is treated like a map containing all of the fields of a device object. So, in your called method are you finding the object via the device ID or something? I'm curious what your "lightOff" method looks like, if you don't mind sharing.
I use the device.id to locate the target device in a multiple light input setting
void lightOff(dvcObj)
{
if (settings.logDebugs) log.debug "luxLighting lightOff entered ${dvcObj.id} ${dvcObj.name}"
luxHandler(false,false,dvcObj.id) //light may or may not be turned off based on lux and system status
}
void luxHandler(evt,forceOff=false,onlyLight=false)
globalLights.each
{
if (onlyLight && onlyLight != it.id) //dont process this light
{
if (settings.logDebugs) log.debug "luxHandler ${it.name} skipped ${it.id} $onlyLight"
}
else
That's pretty much what I thought you were doing because of the limitations I mentioned. Glad I hadn't completely missed something because I woulda been truly pissed!! Thanks!!
From what I remember, I think what you want to do could be done in ST. However, that's almost two years and a (now unplugged) device ago. And I look back without nostalgia!
I don't remember either but yes, I know it was different And since the Groovy IDE is going away anyway, I'm not even gonna take the time to look it up. So there ST.
"Some commands may expect parameters. All commands can take an optional map parameter, as the last argument, to specify delay time in milliseconds to wait before the command is sent to the device:
// wait two seconds before sending on command
mySwitch.on([delay: 2000])"