PLEG and iPhone Locator Muting

Hoping I can get some help here. I’m working on getting the iPhone locator plugin by amg0 working well in my environment, and one thing I’d like to do to help the battery life while at home is to use PLEG to mute/unmute the plugin based on circumstances. My goal is to mute the phone polling when I’ve been at home for more than 5 minutes (2 minutes below to speed up testing), and unmute whenever the front/garage door is tripped or if the alarm is set to armed.

I’m finding some odd results and assuming I must have something wrong in my logic, would love some assistance. The main issue, it seems like it might be working, but the status doesn’t seem to be reflecting as such. CPhoneMute1 below shows false, but seems to have enabled the Mute to be enabled. Or CPhoneMute was true again and was evaluated when it shouldn’t, and also wasn’t updated. It’s been driving me nuts for 2 days now. Hoping someone can help!

TShawnAway ()Destiny is away 2013-10-06 20:05:36.721 false
TShawnHome (
)Destiny is present 2013-10-06 20:05:49.568 true
TGarageDoor Zone #11 - Garage Door is tripped 2013-10-06 20:15:44.034 false
TFrontDoor Zone #9 - Front Door is tripped 2013-10-06 10:07:13.528 false
TArmed Alarm Panel is set to Armed

CPhoneMute ((TShawnAway; TShawnHome) AND (TShawnHome; Now > 2:00)) 2013-10-06 20:08:47.122 true
CPhoneMute1 (CPhoneMute AND (CPhoneMuteOff; Now > 2:00)) 2013-10-06 20:14:47.126 false
CPhoneMuteOff TFrontDoor OR TGarageDoor OR TArmed OR TShawnAway 2013-10-06 20:15:44.090 false

The time-stamps make sense. Remember that they show the last time a trigger or condition became true. In what way is it not working as you want?

Also the status report will NOT update when a condition changes value based on the NOW trigger … This is a performance issue. The internal state is still correct!

If you want to see an updated status report … add another trigger that you do not use in your logic … Like some light is turned on. Then Toggle the light … this will force the Status Database to be updated … then you can do a status report.
Of course the Status DB will be updated when any of your existing triggers are updated.
Or just create some interval timer that fires every minute and use it instead of NOW

AHHHH, now the lightbulb goes off in my head. ;D I didn’t realize that wouldn’t update, so I was assuming something else was wrong. That helps answer the WHY it was happening, despite not showing in the status. The explanation also makes sense, and ty Richard for putting that in due to the logic. Makes sense.

So I guess then the bigger question is, does my logic look correct for my goal? And/or is there any better of a way to write the logic I’ve put here? Trying to iron out my understanding of the way the logic gets evaluated and writing the most efficient logic.

The only thing I see that is strange is:

(TShawnAway; TShawnHome)

Since these two conditions are always opposites of each other this is the same as:

I think I had added this for testing (one test was to set me to away manually then refresh). Thinking a little further and (I hope more efficiently) could I potentially even replace these 2 conditions with a single condition:

TShawnHome AND (TShawnHome; Now > 5:00 OR CPhoneOff; Now > 5:00)

My understanding of the line I wrote above is the logic will process as follows:

  • When TSH become true, it will eval the logic and not see anything yet | (TSH) AND
  • After TSH being true for > than 5 minutes, it will fire the condition associated (Mute) | (TSH; N > 5)
  • If CPO then becomes true, it will fire the condition associated (unmute) and nothing else will happen
  • If TSH is still true, and CPO stays true for > 5 minutes, it will fire the condition associated (Mute) | (OR CPO; N > 5)

This should then achieve my goal: Mute phone locator after being home for 5 minutes, if any door is triggered or I magically appear away, unmute the phone. If I’m still home after 5 more minutes, re-mute the phone, aka re-start the cycle. Again I apologize in advance per my multiple posts you’ve seen on here for my ignorance in getting the full grasp on the logic, I lose my sense of understanding after not mucking with it for a few days. :wink: And thank you in advance for the help Richard and Rex, love the community support here!

Ok, so I’ve got an updated question to go along with this one. I’ve been adding a lot more automation as I’m starting to better understand the PLEG logic. Is there a way to tell how much memory a PLEG plugin is consuming? I ask as I’ve read the only common thread for Random Vera Restarts, is not enough memory. I’m working with a Vera Lite that has about 25 devices, 7 scenes, and a few of those devices are PLEG, Day/Night, and the iPhone locator.

Am I on the right path that these restarts could be from a lack of memory or filling up some buffers the Lite has? Just want to understand the impact of the PLEG plugin on memory consumption for the device so I can avoid these restarts. I’ve killed some extra plugin devices I wasn’t using yet, but fear I may need to just upgrade to a Vera 3, or optionally get a second vera lite as a secondary controller.

Do you have logging being sent to a USB stick ?

Unfortunately I do not. I had seen the option but never bothered with it at first as I wasn’t truly in need. Now the problem is that I have my AD2USB plugged into the USB port on the Vera Lite that I’m using, so disconnecting this is going to cause issues in this regard. Is there any way to grab local logs after an incident occurs? I might be able to write a script on a local machine that I can kickoff that can get to the console and pull the required log once the restart happens or when I notice the lockup.

Something is either happening from the PLEG plugin or the iPhone Locator plugin as it seems to start happening after this. The random restarts are a little less frequent (knock on wood) right now after clearing out some scenes and unused devices. Tonight I just stepped out though to get some froyo at a place about 5k away from home, iPhone locator stopped tracking me after 1.4k, when I finally returned home, Vera Restart, and now everything is acting normal again.

Trying to decipher what the problem is without having to individually test each plugin and such. I fear though that I had this working before and now adding the PLEG for MUTE is screwing it up somehow causing Vera to get into a loop and then crash/restart. Any help is greatly appreciated.

Without a USB stick … the logs are saved by using the Vera memory.
If you have the log files go to the usb stick … it greatly improves the reliability of the system.
Otherwise as time goes on … and the logs get bigger … you run out of memory.

Any idea if the logs are set to rollover at a certain set size or time/date? Wondering if from what you are saying if maybe I have something generating a lot of logs suddenly and need to make sure this isn’t overloading the memory buffer available. Wondering if it isn’t set if I can just got set the parameter myself understanding that this is just essentially a small linux server.

Is the Vera able to handle a USB hub being connected to the USB port? I’d love to be able to have the logs on a stick and the AD2USB still attached as well.

I believe there is a cron job that monitors the log space and rolls it when space is tight … But if the logs fill up faster than the check interval … problems!

Search USB Hub … people have used them.


Thank you, it appears most people have more luck with a powered hub so I may need to go pick one up off ebay or find a cheapy at a computer trade show or store. Maybe Amazon.

On the log front, I did find something in the Wiki about logs rolling at 2MB in size. So if there is a CRON job as you said that would point to how the logs could overflow. I’m not sure that was actually my issue though, I think it is actually something in a plugin that is causing a crash, so I’m going to dive a little deeper. Getting into the logs I’ve discovered other things that concern me now that I want to look into.

Thanks for the help!!

I’m using PLEG with PING SENSOR plugin to mute / unmute my iPhone locator plugin .

here is my settings


Name Description

home iPhone is tripped
away iPhone is not tripped

Name Expression

Home home
Away away AND (away; NOW > 900) just in case i turned off my wifi while i’m home and on again , you can ignore the timer if you want and make it just like HOME


Actions for Condition: Home
Device Action Arguments
(*)Rami’s iPhone SetMute newMuteStatus=1

Actions for Condition: Away
Device Action Arguments
(*)Rami’s iPhone SetMute newMuteStatus=0

Hope it helps

I’m not sure why I’m having issues with Muting. Here’s my PLEG setup. I have it unmute the phone when the garage opens and then mute if I’m still home after 5 minutes. And it unmutes if it detects that I’m away. Right now I have the locator looking at my iPad which never leaves the house. So it “should” be muted all the time. But even the times don’t seem to be updating since the CPhoneMute condition states it’s currently true but the Locator plugin was not muted.

Name Description Last Trigger State
TGarage Garage Door is opened 2013-10-22 07:02:31.393 false
TScottHome1 ()iPad is present 2013-10-19 18:55:39.501 true
TScottAway1 (
)iPad is away 2013-10-19 18:55:32.758 false

Name Expression Last True State
CPhoneMute TScottHome1 AND ((TScottHome1; Now > 5:00) OR (CPhoneUnMute; Now > 5:00)) 2013-10-19 19:01:17.119 true
CPhoneUnMute TGarage OR TScottAway1 2013-10-22 07:02:31.418 false
CHome TScottHome1 2013-10-19 18:55:39.506 true
CAway TScottAway1 2013-10-19 18:55:32.767 false

Actions for Condition: CPhoneMute
Device Action Arguments
(*)iPad SetMute newMuteStatus=1
iPhone Muted SetTarget newTargetValue=1

Actions for Condition: CPhoneUnMute
Device Action Arguments
(*) iPad SetMute newMuteStatus=0
iPhone Muted SetTarget newTargetValue=0

Is the PLEG armed ?
Were the Actions added after it was True ?

[quote=“RichardTSchaefer, post:16, topic:177232”]Is the PLEG armed ?
Were the Actions added after it was True ?[/quote]

Yes the PLEG is armed. There’s a good chance that the CPhoneMute condition might have been true when the actions were initially added.

I suggest you take your IPad on a rode trip!

LOL I’ll try to reconfigure everything to look at my iPhone. I figured it would be easier to test with something that was home all the time. I’ll post again if the iPhone doesn’t work either.

So preface my response by, clearly RichardT is the king of his plugin, so my statement could be completely wrong and I’ll let him correct my logic.

It appears that in your CPhoneMute condition includes TScottHome1 which I’m understanding is your iPhone Plugin showing present for the device. The problem I’m seeing, is that your CPhoneUnmute expression could be simply opening the garage door. Which I imagine your thought, would reset the CPhoneMute condition. But since TScottHome1 is not changing, CPhoneMute is still staying True. At the core for PLEG, the condition needs to have been False to be triggered, unless using the _NameOfCondition technique. Since CPhoneMute was True, and is still True, it isn’t firing again, thus leaving your phone Unmuted.

If my above statement is incorrect, one thing I will note that I learned from RichardT, is that sometimes the times will not show updated based on certain activity when using the NOW time function. This is to improve efficiency of the plugin. So it may have an updated time, but not show as such in the Status report.

Hope this helps!!