dev = data.dev.toString()
log.debug "$dev, ${getObjectClassName(dev)}"
log.debug lightControl.deviceId
dev2 = lightControl.find { it.deviceId == dev }
log.debug dev2
Thanks for all the help, ive finally got it working using what you said originally without changing the type. The must have been a typo some where .
runIn(randomTime, switchControlOn, [data: [dev:lightControl.get(randomDev).deviceId]])
void switchControlOn(data){ //data.dev == device ID
if(state.running == true) {
def swtchDev = lightControl.find { it.deviceId == data.dev }
//log.debug "swtchDev $swtchDev, ${getObjectClassName(swtchDev)}"
swtchDev.on()
if(logEnable == true) log.info "${app.label} switchControlOn - ${swtchDev} switched on"
}
else {
//log.debug "master switch must be off"
}
}
1 Like