PLEG & Ping

I’m stuck trying to devise the logic for our Home & Away PLEG.
So far I have everything happening as I would expect, but I have one small(?) problem in that
the Outside light keeps tripping, in fact I have it going in a 5 minute loop ON-OFF.

Any ideas on what to code so the Light comes on, then stays on for 5 min’s only, currently the tNight keeps revaluating to True .

Attached Status pdf, excuse the c1 and such as I use those to troubleshoot.

TIA

You really need to send the WHOLE status report !!!

What condition(s) is/are turning on the Light ?

That is the whole report, I deleted the Actions last night to stop the ping pong effect with the night.

The Action was triggered by either of these conditions:

cMArriveHome No (cMikeAway;tMikeHome) and tNight false 2016?05?04 04:07:14.341 2016?05?04 07:04:34.317 cCArriveHome No (cKazAway;tKazHome) and tNight false 2016?05?03 17:28:31.490 2016?05?04 07:04:34.319

When tNight becomes true and either of us are home, the Action is then triggered.

You can disarm a PLEG to sto the actions from running.

When you have a complete status report showing the problem I will look at it.

Thanks Richard,

I have reconstructed the PLEG and simplified it by removing the intermediate conditions.

Attached Status Report.

TIA.

[quote=“zedrally, post:5, topic:192253”]Thanks Richard,

I have reconstructed the PLEG and simplified it by removing the intermediate conditions.

Attached Status Report.

TIA.[/quote]

For one when you reconstructed it doesn’t look like the error has happened yet so not much to see.

You don’t need to double up your triggers.

tMikeAway is the same as saying tMikeHome is not true. Or that is worded “Not tMikeHome” or “!tMikeHome”.
Either of those will work in a condition and replace “tMikeAway”. Usually “!” is easier.

Same goes for tDay and tNight if its not day then it must be night. Only one is needed your choice.

You actions currently only turn on the light in this report. There is no action for “off”. Notice they both set to “1” or on.

You also have repeats check on for several things and I don’t see the need to have any of those checked.

“cHomeandNight” maybe just a test, but I wouldn’t use it and just use the other conditions with cHome and tNight in it.
I also don’t know what the Conditions for away is for. Does “tMikeAway” not work for you?

I’m unsure what your trying to do with “cMArriveHome” and why it would have Kaz in it. You arriving home I would think shouldn’t matter who was home first, just that you arrived home. Either you just arived home or not.

I used to use a Timer rather then the NOW but here was what my front Porch light was setup like.
This would also turn the light on when it was night and the door was opened. Also you need to setup the Night;cArrive or else even if your home then it turns night the light will now come on as your not using order saying only turn on light if it is dark and then I get home. You also need to setup a timer for either after you get home or I use after the door is opened. So the light comes on and is true when you get home, but after the door is opened then the light will not come back on until I leave and then return home again. That’s why I have (DoorOpenTimer; cHome). You can use just the sensor on the front door doesn’t have to be a timer. But this is what stop the light from coming back on again (since I’m home and it’s still night). I threw in the order or if the door is closed and then I get home. As soon as I open the door the order is flopped and the condition will not be true until next time I get home.

(Night and FrontDoorOpen) or (Night and cHome and DoorOpenTimer and ((Night;
cHome) and (DoorOpenTimer; cHome)))

Hope this helps point you in the right direction.

You do not have the OFF action now, I assume it’s on the cFrontLight condition.

I think you should delete ALL of the following:
delete tDay, tKazAway, tMikeAway (You already have the complements defined)
tDay = !tNight
tKazWay = !tKazHome
tMikeAway = !tMikeHome

delete cKazAway, cMikeAway
cKazAway is logically equal to tKazAway is logically equal to !tKazHome
Same for cMikeAway

delete cMArriveHome, cCArriveHome
They are ALWAYS true when you are home

Create
cFrontLightOn tNight and (tNight;cHome) and (!tFrontLightOn; cHome) (With Repeats)

This means:
When it’s night and, One of you comes home after dark, and you come home after the light is Off)
The LAST part will make the condition cFrontLihtOn go false after cFrontLightOff fires.
Someone will have to leave and come home again at night to fire!

Thanks to both of you :slight_smile:

I adopted Richards approach, it’s sweet, simple and elegant. I only wish my brain thought likewise.

The WAF has risen.

Bad news,

what should have worked, doesn’t.

The Front Light still keeps coming on.

Status attached.

[quote=“zedrally, post:9, topic:192253”]Bad news,

what should have worked, doesn’t.

The Front Light still keeps coming on.

Status attached.[/quote]

Well I’m not sure if you keep playing with your attachment or not but there is nothing in this PLEG attachment (off action) to even turn it OFF so it will always stay on.

The other thing is I’m not sure why you have “repeats” checked for every condition. I know Richard said to turn it on for the main condition and hes the master, but I would turn them all off for now. Only thing that’s going to change is when the 2nd person gets home after someone was alreayd home it won’t turn on the light. but you can flip that back on later after first round of testing is good.

Also to help with confusion of seeing true on the condition “cFrontSpotOn” I would add one more thing to your condition. Update it with below.

cFrontSpotOn = !tFrontLightOn and tNight and (tNight;cHome) and (!tFrontLightOn; cHome)

This will go false now after the light comes on.

You are having problems because your PING sensor said you were GONE then came home:

Your Ping sensor said you LEFT at 20:45:05.119
And came Home at: 20:45:10.265

That’s why the light came on.

Ping to mobile devices is notorious for FALSE alerts. It should always have a backup method.

What happened to the condition to turn off the light ?
Are you turning the light off Manually ?
[hr]
There are lots of other people that have examples out there to fix the reliability problem.
You need to do this with BOTH phones … before your combine them into the logic for cHome
i.e.
cHome ReliableMikeIsHome or ReliableKazIsHome

Check what others are using to reliably detect presence. It usually requires validating 2 independent pieces of information.
I use Vera Proximity with 2 Fences.
You could use Vera Proximity or the equivalent iPhone app as 1 source of information and the ping sensor as the other.

ie. ReliableXXIsHome: XXInfo1IsHome or XXInfo2IsHome
You should not get false hits on both at the same time.

It’s possible this may all be due to a DEVICE COMMUNICATION ERROR.

THe PLEG isn;t communicating and returning the above message.

FYI, I removed the Light Off condition & Action to simplify the PLEG.

Next step, I guess is to delete the PLEG and re-install as it’s become unresponsive.

The Ping sensor can be contributing to your stability problems as well.
When a device goes off line, the Ping sensor can block activity on Vera until the device times out or responds.

[quote=“zedrally, post:12, topic:192253”]It’s possible this may all be due to a DEVICE COMMUNICATION ERROR.

THe PLEG isn;t communicating and returning the above message.

FYI, I removed the Light Off condition & Action to simplify the PLEG.

Next step, I guess is to delete the PLEG and re-install as it’s become unresponsive.[/quote]

It would probley be best to post a picture of the error your seeing.

And Richard has a good point on the Ping sensor. First ping sensors don’t work on Iphones and I think with Marshmallow now on Android that it too is having problems. Reason is the phones shut down radios after a period of no activity (during sleep) to conserve battery. I really only Use ping as a backup and only for saying I’m home not that I left. If I restart my phone or wifi goes down (phone auto jumps off wifi if it detects no internet conenction) my house would go in away mode and shut everything down.

I use mostly geofence but with ping as a helper. I also have my phone check it’s geofence location when connecting or disconnecting to a wifi.

If what richard see’s (we can only see the last time stamp) is true that your ping sensor says you left then home then left and you never actually left or arrived nothing in PLEG is going help with your light problem. First get your home and away working right. But you should be able to test this now and see if that’s your issue. If needed have it send notifications when you arrive or leave (no extra mubo jumbo) just to see when that ping sensor is saying what. There is also settings in the ping sensor to help delay or supress a missed response. But that won’t fix the iphone issue and new marshmallow issue. Let us know what phone you have.

Just a couple of points, I had the PLEG Working in the background for the past 18 or so months, it just didn’t have any further logic to Action Lights.

So I know the PING is/was working as intended.

With winter approaching and wanting to increase the WAF, I added the first set of conditions and actions as in the first pdf. The only problem here was that the condition keep on becoming True.

Richards elegant solution looked to good to be true, but something odd has happened in that the PLEG returns Error messages (see attachment).

If the general consensus is that the PLEG is corrupted, then I will simply delete it and re-install.
Actually, when I think of it, It didn’t like cFrontLightOn and keep on correcting it to cFrontLightOn1, so the problem may have been there longer than I thought. I think I’ll just start again, at least I know that it’s a clean PEG and not corrupted.

Looks like you have an invisible character in the expression … delete it and retype it in.

OK, that was an easy fix.

Now the problem is that if one of us is home and it is night cHome prevents the FrontSpot from turning On.

That’s because you took the Repeats flag off of cHome. It was on previously.

[quote=“zedrally, post:17, topic:192253”]OK, that was an easy fix.

Now the problem is that if one of us is home and it is night cHome prevents the FrontSpot from turning On.[/quote]

That was stated would hapoem in post #9 middle paragraph.

I also stated that in the first part of the thread, hence my asking for help as to how to get around this.

In any case I think I can get around it by using a counter with cFrontSpotOn being TRUE for 10mins. , but when I go to setup one I get the following message (see attachment)and am unable to create one.

Soooo, me thinks that while all the advice is good, the PLEG has other ideas and doesn’t want to play nicely.

I going to delete it and start again with a fresh sheet of paper and then come back IF I still run into problems.