Smartapp Code Not Running

Could someone tell me why the following snippet of code doesn’t run. In the logging all the variables are correct but the second IF never executes. Thanks for any help.

def CameraSwitchDetectHandler(evt) {
log.debug “Camera Switch handler called, $evt.value, state.lightdelay, {enable.currentswitch}”
if (enable.currentswitch == “on” && state.lightdelay == false) {
if (evt.value == “on”) {
log.debug “light on ran”
state.lightdelay = true
runIn(time*60, lightoff)
if (evt.value == “on”) {}

Can you share the log excerpt? Add an else to the second if and see if that executes?

Here are the log entries. As you can see everything is on and or false as required. The other entry is after the switch is turned back off in the same routine. These are in reverse order as that is the way they are in the log.

10:56:02 AM: debug Camera Switch handler called, off, false, [on]

10:56:02 AM: debug Camera Switch handler called, on, false, [on]

The debug output says enable.currentswitch is [on] which I guess is either a string with brackets in it or a list. Does comparing that with “on” really return true? (My Groovy is rudimentary).

Thats it. You jogged my memory. Just dawned on me I have multiple true on the preference. Sometimes it takes a hint to see something. Thanks.

Just tested it and that was the problem. Thanks again.