Light Switch override

Hi everyone, I have a zwave wall switch that turns on a light. I also have a D/W sensor on a door nearby. I have created an scene that; when the D/W sensor is tripped (not in armed state) it triggers the wall switch to turn the light on; after 2 min., the light automatically turns off. The problem is: if the switch was manually turned on via the wall switch and I want the light to stay on, if someone trips the D/W sensor, the light turns off after 2 min.

Is there a way to have the scene look at the state of the light switch (if turned on manually). If it sees that the switch was turned on manually, it ignores the action of tripping the D/W sensor so it will not turn off after 2 min.?

Is it possible to do this in one scene? If so, how? Would I be able to insert Luua code…if so, how would I do this. Or would I need to this via a PLEG plugin…I am also green on this and am still learning PLEG…therefore, how would I do it this way?

Your goal could be accomplished with a bit of LUA code or with a few lines in PLEG.

With PLEG you’ll probably want to test if the light is on first, when the trigger is fired. If yes, no action, if no then initiate your 2 minute timer.

How can it be accomplished with LUA code? would I have to make more than one scene? would the lua code go into the main luup tab of the scene, or into the luup event of a specific trigger? could you be as detailed as possible, I am still learning this, plus I am very green when it comes to Lua code.

I think that it would be better this way instead of wasting a PLEG plugin.

Sorry, I haven’t the time or interest in writing the LUA for you. If you’re lucky @RexBeckett might be bored enough to get involved. PLEG is much easier and better suited to non-programmers.

The LUA code would go in the LUUP tab of a scene.

Pretty much the following:[code]lightStatus = luup.variable_get(“urn:upnp-org:serviceId:SwitchPower1”,“Status”,DEVICE_ID)
if (lightStatus == “0”) then
return true
end

return false[/code]Change “DEVICE_ID” to the Vera device ID for the light in question