I am new to Vera and Luup. I really don’t understand the code. I am finding it hard to find really good documentation to teach some one how to use and understand the code.
I am trying to create a scene for the bathroom.
I have a Ecolink Z-Wave PIR Motion Detector and a Everspring HSM02 Z-Wave Mini Door Sensor. I would like to create a scene that if the bathroom door opens and closes and there is movement the lights should stay on for 30 min.
and
If the door remains open leave light on for 15 min
and
If the door closes and no movement turn light off after 1 min
Please can someone give me the code that can help me
I don’t have the code for your scenario but here are some links that I found helpful. They might also be helpful for you as I also just started with scripting this last weekend enhancing a scene, hence it’s for newbies.
@wbeard6142, that level of logic is best handled by the Program Logic Event Generator (PLEG) plugin. You will find many PLEG examples for motion and door operated lights on the forum. You can get an introduction from PLEG Basics.
It is theoretically possible to add Lua to a scene to implement the logic using delayed callbacks but it would not be robust. Pending timer callbacks are lost if Vera restarts. PLEG overcomes this limitation by managing its timers following a restart.
thank you, will give this a try… I did try some luup code that I wanted a scene to look at the home/away end of my Nest thermostat and run a temperature increase (only if Home) on a zwave thermostat based on time of day but it did not work as expected.