Easy PLEG question - Virtual switch for Home/Away

Okay… Still new to PLEG. I have an easy one for you. I’m setting up a HOME/AWAY state withing Vera. I am using a day/night plug in as well. Using pleg I am conditioning the home state switch and the day/night to create my Home/Away actions. So for home actions, lights will come on only if it is night, etc. The problem is my away actions are triggering with the night trigger.

So I tried…
night and home
but then the condition triggers with the change from day to night.

I tried (night, home < 5) but home doesn’t trigger with my Levetron switch.

Can someone help me clarify how pleg would be used in this case?

If you want to only trigger when you come home at night then you would use sequence expressions:

NIGHT and HOME and (NIGHT; HOME)

It’s best if you post your Status Report as a PDF … We can easily see exactly what you are doing, and can answer questions in the context of your specific problem.

Thank you!

Yes you have to think dumb like the computer… LOL

If you set lights on when your home and its night, it doesn’t care which happened first.

All it knows it home switch is on and night switch is on so turn on lights. Doesn’t matter if you were home then it became night after that, its going to kick it on soon as both become on or “TRUE”.

What Richard did was add a third variable.
Night on and home on and (Night was on ; before Home came on)

[quote=“RichardTSchaefer, post:2, topic:181020”]If you want to only trigger when you come home at night then you would use sequence expressions:

NIGHT and HOME and (NIGHT; HOME)

It’s best if you post your Status Report as a PDF … We can easily see exactly what you are doing, and can answer questions in the context of your specific problem.[/quote]

hi Richard or anyone, what does the semi-colon ( ; ) means. i know you told me once that ! is the same as NOT. i have never used a semi colon before. thanks.

“Then” I guess you would call it

So

Before; After
or
Before (then) After

PLEG puts a timestamp on each ‘event’

b[/b]

will be true if This happened chronologically before That

likewise,

b[/b]

will be true if This happened before That and That happened before TheOtherThing

Read up on the Sequence expressions … there are two parts …

  1. The set of inputs or conditions …
    Separated by a comma, or a semi-colon.
    Semi-colon separated list is only true if all of the elements are ordered.
  2. Optionally Min/Max constraints between the oldest and newest time stamps for the set of inputs or conditions.

Normally the Sequence expressions uses the ON time stamp.
But if an element in the set of inputs or conditions has a ! before it … it uses the OFF time stamp.

This is a complex expression … in terms of it’s semantics … but is extremely powerful for automation.