Help with Multiple Triggers and Motion

So I have been using PLEG, but very basic and I am still trying to wrap my head around coding (never was really good at it). I am tossing this out there in hopes that if I see how its done, it will help me a little with the rest of my house.

This would be for my garage. I have a sensor on the main garage door, a sensor on the door to the house, and a motion sensor in the garage.
Basically what I am looking to have done is if any of the sensors are triggered (at night), have the lights come on in the garage. I want a timeout on the lights of 2 minutes after no motion is detected, unless the main door is open, then I want the lights to stay on the duration of time the main door is open, and then have the 2 min timeout start once it is closed.

Also right now I have it setup in my house with a scene switch that i can manually put the house into “night mode” earlier vs waiting for auto if needed. I would like to be able to tie this into my PLEG config as well (suspect using a virtual switch would be the way to go here). Having it toggle the day/night plugin doesn’t work because if I switch to another scene (like for entertaining), the Night is already triggered and I use this switch as well to put it back to just normal evening.

I have been using the smart switch for a while now to do a lot of what I am doing, but finding as my network grows, the smart switch is causing things to slow down a little, so I think its time to switch to PLEG for memory overhead.

Please let me know if I am missing anything in the details of what I am looking for. I have tried to do this on my own and have weird results related to blinking lights (stress testing the z wave switch for sure).

Start with this:

Triggers
ItsNight DayTime indicates night
GarageLight Garage Light is on
GarageMotion Garage Motion-sensor Tripped
MainDoor Main Garage Door Open
SideDoor Side Garage Door Open

Conditions
LightOn !GarageLight and (SideDoor or MainDoor or GarageMotion) and ItsNight
HoldOn MainDoor or GarageMotion
LightOff GarageLight and !HoldOn and (!HoldOn; Now > 2:00)

Actions
LightOn Garage Light On
LightOff Garage Light Off

I didn’t understand your comment about night mode. You could use a VirtualSwitch instead of the DayTime plugin if you are setting that elsewhere.

Thanks Rex. This gets me started.

Sorry, what I meant was I would like a way to flag to have motion disabled (for when I entertain and don’t want the sensors to trip).

Update. What you sent got me going and I am able to build off of it what I need for my other triggers around the house, so thank you very much. I did have to modify it as the one you sent was giving me my original problem of turn the switch on and off every second while one of my triggers was true. Could this be because none of my switches are instant status, don’t think this would matter since Vera is the one controlling the light and status should be instant on that?

Here is what I did now and want to confirm I won’t have any issues down the road (It is working, but not sure if there wouldn’t be any situations where I could run into problems):

Triggers
Name Description
IsNight Day or Night indicates Night time.
GarageLights Garage Lights is turned on
GarageMotion Garage Motion 2:2 armed is tripped
GarageDoor Garage Door armed is tripped
LaundryDoor Garage Door 3:5 armed is tripped

Conditions
Name Expression
GarageLightOn (LaundryDoor or GarageDoor or GarageMotion) and IsNight
GarageLightOff GarageLights and !GarageLightOn and (!GarageLightOn; Now > 30)

There is a Vera bug that affects sensor triggers and causes problems with PLEG Triggers using armed is tripped. I suggest you change these to just tripped. This may be why you got rapid cycling.

Your modified logic should work. My only reservation is that, if you are in the garage with the doors closed, it will send repeated on commands to the light whenever you trip the motion sensor. Not really a major problem and easily fixed with another Condition.

Please post a STATUS report while this is happening.

And a log file (With debug set to: Standalone file).

Will work on that for you.

I am still learning how to pull the files from Vera… so it might take a little bit.

Thanks for looking into it for me.

Richard,
I haven’t forgotten, but I am also unable to reproduce to get you the logs you need.

At this point I have moved everything to PLEG and have about 40 conditions right now to run things. All appears to be working as expected (well as coded, still learning to fix some issues I have made).

If I can reproduce it, I will let you know.