Using a motion sensor to trigger a light switch

Hey All,

I’m new to this site so I’m sorry if someone has already posted something similar… I’ve not used Luup to script anything but I’m guessing I’m going to have too, in order to do what i’m trying to do…

So here is what I want to happen on my vera lite unit…

I want to set a motion sensor during the night that if tripped then to switch the light to 30% and for 5 minutes I only want this to happen during 1am and 6pm every day. outside of this time I want to be able to turn the light on when ever I want.

I’ve created a scene but this starts at 1am and then continues I don’t know how to put in an end time.

My motion sensor is called Motion Sensor Landing and is device ID 10 the light switch is called Landing Light an is ID 11. I have a trigger that I created which is called Night Light Wake Trigger this basically arms the motion sensor and turns the light on to 30%

Does anybody have a luup code for this…? or how can I make this scene run during the hours of 1am and 6am…?

Thanks in advance Tesh :slight_smile:

I don’t have any experience with luup - but have you checked out the PLEG plugin? Amazing, and lots of code out there already to do just what you want. I’m not telling you that you should go with PLEG, just that when I asked a similar question someone told me the same thing and that changed, everything. http://forum.micasaverde.com/index.php?topic=21603.70

Regular contributor @RexBeckett did a fantastic and extensive how-to program conditional scene execution with Lua and LUUP. It explains everything you want to know and a lot more.

Using PLEG is usually simpler than Lua/PUUP for the non-programmer. Amazingly, @RexBeckett created a fantastic how-to “manual” for PLEG Basics too!

Hey thanks guys i’ll defo look into the links above and come back to you :slight_smile:

Hey all, sorry again a stupid question coming up…

But is PLEG plugin an app to install on the vera lite…?

Yes, Program Logic Event Generator(PLEG) is an app installed on Vera. It has a prerequisite app, the Program Logic Core(PLC), that must not be forgotten.