how to use PLEG to find out time between pings

I am using the ping sensor to determine if we are in our out. I am trying to adjust the ping settings to make it more accurate. So just for testing purposes I would like to find out the time between every Ping being true. The Ping frequency is 120 seconds, but I can see quite often that the ping sensor is not activated although the phone is home. So I want to get a statistic over a day, then change settings and run the statistic again.
Datamine is currently not an option, I cannot get that to work
I do have Vera Alerts
Any ideas ? I thought there might be a way of using PLEG to send the time between each ping to Vera Alerts

You can use the # operator in PLEG … to get the timestamp of a condition.
You can them get the time between two conditions (or inputs) in seconds as:

#VAR1  - #VAR2

Or you can just send an alert to your phone and look at the received messages later to see what’s happening.

That is the problem, I cannot send an alert to my phone every time the ping sensor is true, I would possibly have 30 messages an hour !
Ideally I would like to know the longest 5 or 10 intervals, that would be enough.
So going back to the #Var condition. As it is only one condition, what I would need would look like this:

Timediff = #Ping - #Ping

And I would have thought that would always be 0 ?

Yep you have to be creative in PLEG … I do not recommend it for this.

You are best using LUA … or just obtain the info from the PLEG log.

grep for the info from the log file at a later point in time.

I have never attempted LUA yet…
How would I be able to extract the info out of the log ? Is there an easy way ?
Can I import this into excel and then sort by event possibly ?

I used the term grep to search the logs.
If you have not heard that term before … than there is a learning curve for it.

If you have a MAC you will have grep available. (Launch Pad -> Other Tools -> Terminal -> grep command line command).
If you have Windows … you will need to install a third party tool to access grep.

In Grep the re stands for regular expressions. That’s a programming language in itself.

[hr]
In my log file … when an input trigger name tGarageWest is tripped then later untripped I get lines like the following in the log file:

Wed Apr 02 08:44:6.268 - TriggerPropertyUpdate:Name:tGarageWest State:true Device:252
...
Wed Apr 02 08:44:6.270 - TriggerPropertyUpdate:Name:tGarageWest State:false Device:252

So if I had the log file in a file called log.txt I could use the grep command as follows to extract all of the lines that look like this:

grep TriggerPropertyUpdate:Name:tGarageWest log.txt

This is a very trivial regular expression … in fact its a plain text search.

Or just the true ones:
grep “TriggerPropertyUpdate:Name:tGarageWest State:true” log.txt

Or All triggers that are true:
grep “TriggerPropertyUpdate:Name:[.]*State:true” log.txt

Ok now i understand how you can search log files easier. Very interesting. I have Windows, so i will google grep and have a play. I think that is very useful to learn, as it should make debugging a lot easier.

Actually grep is on Vera … and my PLEG Log Viewer can take a Grep argument … as you saw from the error on the other thread.

not trying to hijack your thread, but you could also use Data Mine to record and graph your pings over any period of time.

It can be quite useful for stuff like this, looking at fluctuations in temperature, humidity and tracking sensor activity.

Very useful little tool, mainly because of its nice output.

@RichardTSchaefer

so how would i use a greg argument in the PLEG log viewer ?

@Bulldoglowell

Ever since i’ve upgraded from my Vera lite to Vera 3 i never managed to get the Data mine working again. And at the moment i do not have the time or patience to see what the problem is… At the moment none of the 2 usb sticks i have on my Vera 3 work… so no external logging and no Data mine… it was all working on the Vera lite. Probably just a small thing just have to take the time to try and fix it…

We are getting into areas I do not usually like to explain/support … but …

On the PLEG/PLTS log command … when you are looking at the debug log for a standalone file …

Modify the URL and add: Grep=XXXX
where XXXX is the GrepString

If you do not have a USB stick … make sure you turn OFF all debug when you do not need them … they will eat up your free memory!