Newbie that does not understand Luup needs help Please

Hello

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.

http://wiki.micasaverde.com/index.php/Luup_Intro
http://wiki.micasaverde.com/index.php/Luup_Variables
http://wiki.mios.com/index.php/Luup_Scenes_Events
http://wiki.micasaverde.com/index.php/Luup_Lua_extensions#function:_log

@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 for your suggestions…I will take a look at the links Thanks again

Does the PLEG plug in that is listed in apps for UI7 also work with UI5 as that is what I am using and I do not want to upgrade at this point in time?

Yes PLEG works very well under UI5. It adapts itself to the resident UI version during installation.

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.

I tried PLEG however I can not edit ACTIONS.

I dont know if this is another issue withh ui7 or not.

I have not seen any documentation using ui7 and PLEG. This does not help for understanding…

[quote=“wbeard6142, post:8, topic:184024”]I tried PLEG however I can not edit ACTIONS.

I dont know if this is another issue withh ui7 or not.

I have not seen any documentation using ui7 and PLEG. This does not help for understanding…[/quote]

YES was… maybe still is an issue with UI7. Thought that there was some progress on this tho. Do a search you might find it.