When "Changes" Ability?

I’m trying to figure out how to automate the garage door to open for people when they come home. I have the geofence part working and have VirtuSwitches for each person. The problem is how to do this in PLEG.

Basic logic

if GarageDoor is Closed AND if P1 OR P2 OR P3 CHANGES from OFF to ON; then OpenGarage

How do I do that with PLEG?

Almost ad you wrote it:

GarageDoorClosed AND (P1 OR P2 OR P3)

Where all of the variables are input triggers.

Sent from my SAMSUNG-SM-G935A using Tapatalk

[quote=“RichardTSchaefer, post:2, topic:198592”]Almost ad you wrote it:

GarageDoorClosed AND (P1 OR P2 OR P3)

Where all of the variables are input triggers.

Sent from my SAMSUNG-SM-G935A using Tapatalk[/quote]

The problem with that is that if more there’s still someone at home. I work from home most of the time. So I’m home. My wife is in and out throughout the day. If I’m home then I’m always on so the grab door opens because it evaluates to true all the time.

I’m testing this.

GarageDoorClosed AND (P1; !P1) OR (P2; !P2) etc…

going to see if that works. The idea is only IF they change from OFF to ON will it evaluate to true.

Is there a logic evaluation tool out there that can be used as a simulator for testing this?

You could use these conditions:
GarageDoorClosed AND P1
GarageDoorClosed AND P2
GarageDoorClosed AND P3

And create 3 Actions that not only open the door but sends an alert via Vera Alerts:
“Garage door opened because P1 is home”, etc.

[quote=“Don Phillips, post:4, topic:198592”]You could use these conditions:
GarageDoorClosed AND P1
GarageDoorClosed AND P2
GarageDoorClosed AND P3

And create 3 Actions that not only open the door but sends an alert via Vera Alerts:
“Garage door opened because P1 is home”, etc.[/quote]

I’ll have to give that a try. So far I haven’t had any luck. I think I’m over thinking it.

I struggled for a long time before I finally “got it”. That is why I created the test PLEG - to try things out and learn. I remember someone telling me “practice makes perfect”.

Sames results as I have been getting.

Works as expected when they arrive home. Door opens.

But…

Once the door closes the condition evaluates to true again and the door opens again. That’s why I need a “Changes to” or “Changes Away” function. This will evaluate to true only when the objects state changes to or from something else.

I have another condition rule I’m using for testing and watching how it is evaluated. Just a pain to reload lua and wait constantly to get a result.

A sequence expression should solve the problem. You want to ensure Pn occurs more recently than GarageDoorClosed. For example:

Conditions

cSomeoneArrivedHome P1 OR P2 OR P3

cOpenGarageDoor GarageDoorClosed AND cSomeoneArrivedHome AND (GarageDoorClosed; cSomeoneArrivedHome)

The first condition is there because arguments in sequence expressions cannot themselves be expressions.

[quote=“cc4005, post:8, topic:198592”]A sequence expression should solve the problem. You want to ensure Pn occurs more recently than GarageDoorClosed. For example:

Conditions

cSomeoneArrivedHome P1 OR P2 OR P3

cOpenGarageDoor GarageDoorClosed AND cSomeoneArrivedHome AND (GarageDoorClosed; cSomeoneArrivedHome)

The first condition is there because arguments in sequence expressions cannot themselves be expressions.[/quote]

cSomeoneArrivedHome 90% of the time evaluates to TRUE because someone is always home.

GraageDoorClosed = True
cSomeoneArrivedHome = True
Sequence: The door is closed and someone is home so that’s TRUE

This is the problem I’m having. If everyone was always gone then it may be easier. However with at least one person generally home in between others being gone and coming back.

Now perhaps I’m not understanding the sequence fully. But I’m trying everything and they work for when someone arrives. But then they keep working every time the door is closed. So it just keeps re-opening.

Try setting “Repeats” on cSomeoneArrivedHome.

Maybe it’s just me… even this what I think should be simple one… isn’t working.

!FibaroMotion AND (!ZSE09Motion; NOW > 5)

idea… simple. No motion from Fibaro and No motion from ZSE09 for 5 minutes… then turn the lights off. Nope. As soon a no motion is detected on them lights go out. This is for my office lights. Fibaro is at the door way and the ZSE09 is sitting on my desk. I sit still for… time it takes to write this and the lights just went off again.

So there’s something screwed up with my understanding of how the logic flows with PLEG.

I also tried it this way…

!FibaroMotion AND !ZSE09Motion AND (!ZSE09Motion; NOW > 5)

Same results. Lights go off before 5 minutes.

Post a pdf of your status report and we’ll be able to give better input.

In case you’re not yet aware, NOW forces the PLEG to reevaluate every 1 minute 24/7. Once you have things working as expected you may want to convert to schedules to reduce processor load. Seems that’s what most PLEG users ultimately do.

[quote=“cc4005, post:12, topic:198592”]Post a pdf of your status report and we’ll be able to give better input.

In case you’re not yet aware, NOW forces the PLEG to reevaluate every 1 minute 24/7. Once you have things working as expected you may want to convert to schedules to reduce processor load. Seems that’s what most PLEG users ultimately do.[/quote]

Here’s the report.

Overlooked it before. This is 5 seconds. Try 5:00.

Seems there’s a LONG startup time for PLEG with changes to rules. Example, playing with the light rule to just keep it from turning off.

The lights are off. I modify the rule to stop turning them off. Restart Lua… it took a couple of minutes AFTER the blue bar restart message was done before the lights turned back on from motion.

Is this normal that it takes a long time to update and adjust for changes in rules?

Others with more experience may respond differently, but I would expect the PLEG to act immediately after LUA reload based on my experience. I have motion sensors that require a couple minutes to reset before they’ll detect/report motion again. Don’t know if that’s the issue for you.

Overlooked it before. This is 5 seconds. Try 5:00.[/quote]

So the above would be 5 seconds? Ok

I changed it to this.

(!FibaroMotion AND !ZSE09Motion) > 5

and that hasn’t turned off the lights on me yet. And it’s been a couple minutes between motion. So the “rules” or “statements” of TIME are not consistent depending on usage???

(!FibaroMotion AND !ZSE09Motion) > 5

Don’t think that’s a valid sequence expression.

I was curious, but it didn’t throw any errors on the Lua restart.

Your need a Boolean expression for the time element.
Presently you have >5, but need the NOW for the timestamp.
So think of it as (NOW>5) which would evaluate to TRUE once the 5 sec’s (or there about as NOW is a minute timer) counts down.

5 has nothing to tell it where to start the time event.
Read up about it in PLEG Basics, it will give you a better understanding of how PLEG works.