Light switch to activate leaving house

I am trying to setup a PLEG activity which sets my thermostat away, turns lights off and turns security system on. To activate it, I want to turn my kitchen light on/off/on/off. I’ve tried a couple different things (such as what I have below and also tried to put “KitchenLightTurnedOn and KitchenLightTurnedOff and KitchenLightTurnedOn and KitchenLightTurnedOff”) but this is the basics of my current setup:

Program Logic Event Generator

Device ID: 132014-03-04 20:52:13.796 PLC Version: 6

Registration

You are not licensed!
Triggers

Name Description
KitchenLightTurnedOn Kitchen Light is turned on
KitchenLightTurnedOff Kitchen Light is turned off
Conditions

Name Repeat Expression
LeavingHouse1 No KitchenLightTurnedOn and KitchenLightTurnedOff and (KitchenLightTurnedOn;KitchenLightTurnedOff;KitchenLightTurnedOn;KitchenLightTurnedOff <0:15

Actions

Actions for Condition: LeavingHouse1

Immediate

Device Action Arguments
Front Porch Light SetTarget newTargetValue=0
Front Flood Light SetTarget newTargetValue=0
Home SetOccupancyState NewOccupancyState=Unoccupied
Garage Interior Light (Upstairs) SetTarget newTargetValue=0
Guest Bedroom Light Module SetTarget newTargetValue=0
Kitchen Light SetTarget newTargetValue=0
Living Room Light Module SetTarget newTargetValue=0
Master Bedroom Lamp Module SetTarget newTargetValue=0
Office Lamp Module SetTarget newTargetValue=0
Partition 1 RequestArmMode State=Armed PINCode=XXXX (I put X’s to hide pin code)

Any help would be greatly appreciated.

this won’t work:

KitchenLightTurnedOn and KitchenLightTurnedOff and (KitchenLightTurnedOn;KitchenLightTurnedOff;KitchenLightTurnedOn;KitchenLightTurnedOff <0:15

because

KitchenLightTurnedOn and KitchenLightTurnedOff

is not possible, plus the sequenced argument is not correct, you may want to read up on that. PLEG uses the date stamp from the last time that input or condition was true.

Try

LeavingHouse1 = KitchenLightTurnedOn AND (!KitchenLightTurnedOnKitchenLightsTurnedOff;Now<15)

means the light is on and the last time it was off was less than 15 seconds (you turned it off-on quickly)

Or

LeavingHouse1 = KitchenLightsTurnedOn @ 2 < 15

Which looks for you to turn it on-off-on (or On twice) in less than 15 sec.

that should do it. Don’t forget to turn off the kitchen lights too, but perhaps a little delay to get out.

what kind of switch is it?

[quote=“Bulldoglowell, post:2, topic:179968”]this won’t work:

KitchenLightTurnedOn and KitchenLightTurnedOff and (KitchenLightTurnedOn;KitchenLightTurnedOff;KitchenLightTurnedOn;KitchenLightTurnedOff <0:15

because

KitchenLightTurnedOn and KitchenLightTurnedOff

is not possible, plus the sequenced argument is not correct, you may want to read up on that. PLEG uses the date stamp from the last time that input or condition was true.

Try

LeavingHouse1 = KitchenLightTurnedOn AND (!KitchenLightTurnedOn;Now<15)

means the light is on and the last time it was off was less than 15 seconds (you turned it off-on quickly)

Or

LeavingHouse1 = KitchenLightsTurnedOn @ 2 < 15

Which looks for you to turn it on-off-on (or On twice) in less than 15 sec.

that should do it. Don’t forget to turn off the kitchen lights too, but perhaps a little delay to get out.

what kind of switch is it?[/quote]

I tried your first one (LeavingHouse1 = [b]KitchenLightTurnedOn AND (!KitchenLightTurnedOn;Now<15)) last night and it worked once but that was it and I’m not sure why it worked that one time but not the other attempts (unless I have to wait a period of time to try it again…

Tonight I will try your second one to see if that works.

One thing my wife noticed also was that while sitting in bed later last night she wanted to turn on her reading light (which is automated) and it kept turning itself off. The only thing I had done recently was add in the new PLEG to try and set up this LeavingHouse1 scenario. Not sure why it would cause that light to turn off though…

because I screwed that first line up, sorry!

LeavingHouse1 = KitchenLightTurnedOn AND (KitchenLightTurnedOff;Now<15)

returns true if the light is turned on less than 15 seconds from when it was last turned off. But if this is a quick flip, use a shorter duration like 10 seconds.

!KitchenLightTurnedOn won’t have a timestamp… really sorry about that.

I see. I wasn’t sure what the ! was for in front of !KitchenLightTurnedOn but I figured most of you understand the programming of PLEG better than I do (since this is only my second “scene” using PLEG). I’ll try your new line this evening when I get home and let you know if it works. Thanks for the quick response.

[quote=“Bulldoglowell, post:4, topic:179968”]because I screwed that first line up, sorry!

LeavingHouse1 = KitchenLightTurnedOn AND (KitchenLightTurnedOff;Now<15)

returns true if the light is turned on less than 15 seconds from when it was last turned off. But if this is a quick flip, use a shorter duration like 10 seconds.

!KitchenLightTurnedOn won’t have a timestamp… really sorry about that.[/quote]

!KitchenLightTurnedOn should have a timestamp because the timestamp should be when KitchenLightTurnedOn was last false. Or am I completely wrong about that? I normally do not create an ON and OFF triggers for switches because the conditions can just use the ! to get the false value (when it is “not on”). I also thought this worked for the timestamps. It would instead return the timestamp of when the trigger was last “false” instead of when it was “true”.

When I introduced OFF time stamps I also introduced !XXX in a sequence expression. It’s the only operator allowed INSIDE a sequence expression.

So:
(!KitchenLightTurnedOn;Now<15)

Is a legal expression and !KitchenLightTurnedOn will have the value of the OFF timestamp.
The problem is the 15 seconds is too short a time for the NOW timer … it fires once a minute … and you only have a 25% chance of catching it with this expression.

I think you want:
KitchenLightTurnedOn AND (!KitchenLightTurnedOn; KitchenLightTurnedOn <15)

This will be true when the Light is turned on AND it was turned on within 15 Seconds of being turned off. Of course this will not likely work unless you have instant status switches.

[quote=“RichardTSchaefer, post:7, topic:179968”]When I introduced OFF time stamps I also introduced !XXX in a sequence expression. It’s the only operator allowed INSIDE a sequence expression.

So:
(!KitchenLightTurnedOn;Now<15)

Is a legal expression and !KitchenLightTurnedOn will have the value of the OFF timestamp.
The problem is the 15 seconds is too short a time for the NOW timer … it fires once a minute … and you only have a 25% chance of catching it with this expression.

I think you want:
KitchenLightTurnedOn AND (!KitchenLightTurnedOn; KitchenLightTurnedOn <15)

This will be true when the Light is turned on AND it was turned on within 15 Seconds of being turned off. Of course this will not likely work unless you have instant status switches.[/quote]

How do I know if I have instant status switches? The switch in particular that I’m wanting to do this with is an Evolve LSM-15 120 VAC 15-Amp Wall Mount Switch.

so… try the logic with your existing switch. with the

KitchenLightsTurnedOn @ 2 < 15

i have basic GE (non-instant) switches and it works. turn switch deliberately slouch, you have 15 seconds.

with this there is nothing like trying. Before you upset the wife, test with a visible light so you know if it is working to your satisfaction.

I tried the different conditions that both Bulldoglowell and RichardTShaefer recommended and none of them worked. I have a button on my Homewave app to do this same thing (set away mode for security, thermostat and lights) but was just wanting to set up a light switch to do the same thing so it was a little easier in case my phone isn’t with me or my wife doesn’t have hers and needs to set it all quickly.

yeah, this is why i asked what kind of switch, and Richard pointed out the reason.

if the switch cannot report back to vera that the status changes, well it can be downright unreliable.

you could try a scene controlling switch or one with instant status reporting.

Evolve does not have instant status.

So Vera will not see switch changes until the next poll interval.

These switches are not useful for input to Vera because of the large (can be 5-10 minutes) lag from changes until Vera notices the change.