The Vera Community forums have moved!

Advanced => Plugins & Plugin Development => Programming => Ping Sensor Plugin => Topic started by: TedStriker on September 12, 2009, 11:08:06 am

Title: Ping Sensor
Post by: TedStriker on September 12, 2009, 11:08:06 am
Hello all together,

After upgrading to the current version of Vera yesterday and having a look at Guesseds weather plugin, I had to create a plugin on my own.
I never had used Lua before and only after one day and night I have a working PingSensor plugin. Thanks go out to Guessed for his weather plugin. It teached me a lot, how plugins work.

However, I made a plugin which pings defined addresses (IP and domain names) a keeps the result of the ping in a variable.

My intention is, that it can trigger scenes when a IP-based device appears or disappears in the network.
So you can turn on your TV when your network-enabled HD-Recorder is turned on, or you can turn on a printer if your PC turns on, without the need of having another Z-Wave switch put between your network-device and the powerline.

Nevertheless I struggle with a few features I finally need to have it work the way I want it to. Probably someone of you can give me some hints: Here are the things to still be implemented.

1. Update the UI on state-change (device becomes visible or unvisible to the plugin)
    Currently you have to reload the Vera UI to display changes.
2. Display a red / green circle (similar to motion sensors) to indicate the presence of a device
3. Active / Inactive Buttons (even this should work similar to the motion sensors "Armed" and "Bypass")
4. Show up as a sensor in the scene-events.
5. A custom icon should be displayed instead of the na.gif

Have a look on the wikipage -> http://wiki.micasaverde.com/index.php/Ping_Sensor_Plugin (http://wiki.micasaverde.com/index.php/Ping_Sensor_Plugin)

Ideas, hints and questions are welcome.
Title: Re: Ping Sensor
Post by: TedStriker on September 13, 2009, 03:40:47 pm
Wiki has been updated http://wiki.micasaverde.com/index.php/Ping_Sensor_Plugin (http://wiki.micasaverde.com/index.php/Ping_Sensor_Plugin)
Title: Re: Ping Sensor
Post by: TedStriker on September 18, 2009, 11:37:40 am
The Ping Sensor is now working as it was inteded.
Use it as a regular sensor in scenes, to trigger them.

Feel free to ask, if something's unclear or you have an idea for improvements.

Ted
Title: Re: Ping Sensor
Post by: Boyo on September 18, 2009, 02:25:01 pm
What impact does the sensor have on the stability and responsiveness of vera?
Title: Re: Ping Sensor
Post by: cbarker on September 22, 2009, 10:50:38 pm
Shouldn't the Tripped indicator be reversed - IE, 0 for 'not tripped' and 1 for 'tripped' - IE, if the site is unavailable, the sensor is tripped.  This would make a 'working' sensor green.
Title: Re: Ping Sensor
Post by: TedStriker on September 23, 2009, 02:08:58 am
What impact does the sensor have on the stability and responsiveness of vera?

I recognized no impact running three sensors parallel for a short time. Actually I need only one sensor. So I guess a ping every 15th second is not too hard to handle for Vera ;)

Have you made different experiences?
Title: Re: Ping Sensor
Post by: TedStriker on September 23, 2009, 02:15:35 am
Shouldn't the Tripped indicator be reversed - IE, 0 for 'not tripped' and 1 for 'tripped' - IE, if the site is unavailable, the sensor is tripped.  This would make a 'working' sensor green.

I thought about it, too. But the I decided to let it be at the moment to have a clear UI. e.g.
When you have a motion sensor, it displays you a red cirle when it found something. And when the ping sensor found something it turns red, too. So if you have a look on the dashboard, red means: something is going on.

BUT, it's planned to create a field in the UI to give you the possibility to invert red/green circle by setting it to "0" or "1".
Title: Re: Ping Sensor
Post by: cbarker on September 23, 2009, 10:04:14 pm
Ok. . . got that.
What I'm trying to do is exactly the opposite of what the plugin was created for; I'm checking for Internet connectivity and trying to have Vera reset the DSL router if it loses connectivity (which happens once a day).  I'm trying to reverse the operation with Scene 'event type: An armed sensor has pinged  a device' and 'Got response: No', but it is still triggering when the Internet is reachable.

How can I reverse the operation so the scene triggers when an IP address is not reachable?
Title: Re: Ping Sensor
Post by: TedStriker on September 24, 2009, 01:50:04 am
How can I reverse the operation so the scene triggers when an IP address is not reachable?
What IP did you ping? I guess it was an external one, wasn't it?

I would have expected it to work exactly the way you tried it.... Well, I'll have a look on it, but you have to get it back to work.
But this weekend I have got to work for my job, because I have to finance my hobby somehow;)
So the fix will take a little time.
Meanwhile you can try the attached version 1.2 of the plugin, which might fix your problem. It's not tested very much, but maybe you'll give it a try.

The only difference is, that event states are not enforced while a device has been found / not found. It only triggers an event if a transition occurs between "not found -> found" and "found -> not found".

e.g. let's have a light which is turned on when your router has been pinged successfully.
In V 1.1 you could turn off the light and max. 15 seconds (default value) later the light would be turned on again, and again and again...

In V1.2 this trigger should only be fired on changes like the ones mentioned above.

(Wiki will be updated later, when I have time!  ;))
Title: Re: Ping Sensor
Post by: mpenda on September 30, 2009, 11:50:26 am
I too want to cycle power on my DSL modem for the same reason. I was starting to look at doing it with an 'ash' script, but this is much more elegant.
Thanks for posting the plug-in in the Wiki.
Title: Re: Ping Sensor
Post by: TedStriker on September 30, 2009, 05:19:18 pm
Thanks for the flowers ;)
Title: Re: Ping Sensor
Post by: mpenda on September 30, 2009, 07:45:50 pm
This is probably a dumb question, but where do I find the place to install LUUP plugins? I got the files onto the hard drive, but there is NO place under "Devices" to add LUUP plugins. I'm running v1.0.616. I can only add regular devices, or controllers.
Title: Re: Ping Sensor
Post by: Ap15e on September 30, 2009, 08:05:53 pm
Luup plugins require a Luup firmware (http://wiki.micasaverde.com/index.php/Vera_Luup_Releases).
The latest Luup firmware is 1.0.939 (http://forum.micasaverde.com/index.php?topic=2100.0). Your firmware is pre-Luup, so you have to upgrade your firmware.
Title: Re: Ping Sensor
Post by: mpenda on September 30, 2009, 09:13:58 pm
Thanks, that did the trick for the luup plugins.
The ping plugin does not look like it will do the reverse yet. It looks like it will only fire on the not-found to found transition, and not the reverse (the two actions in the event pull-down).
So we'll wait until you make enough money to support your (and our) hobbies!!  :)
Title: Re: Ping Sensor
Post by: TedStriker on October 05, 2009, 04:43:08 pm
Ping Sensor 1.3 has been finished. Now you can invert the red/green circle by configuration.
And I did some renaming of scene events and response field.
Have a look at the wiki for details http://wiki.micasaverde.com/index.php/Ping_Sensor_Plugin (http://wiki.micasaverde.com/index.php/Ping_Sensor_Plugin)

Invert = 1 -> red = no response, green = response
Invert = 0 -> red = response, green = no response

To make the scene handling congurent you have to choose between D_PingSensor.xml (if Invert = 0) and D_PingSensor_Invert.xml (if Invert = 1). It's not possible at the moment to handle this by the script itself, because it's static text within the device description.

If you have questions or experience issues, please let me know. I will answer as fast as it is possible.

P.S. New version files are attached
Title: Re: Ping Sensor
Post by: mpenda on October 05, 2009, 07:20:41 pm
Hi.
I can see the D_PingSensor_Invert.xml file in my list, and I can choose it in the device, but nowhere do I see an "Invert" variable to change to "1".
So its still red on success (which I can live with) but no option to do something when there's NO response.
I'm probably missing something.....
Thanks for the help.
Title: Re: Ping Sensor
Post by: TedStriker on October 06, 2009, 01:19:31 am
Hi Mpenda,

maybe you have to remove the old ping device and install it again. While testing I removed the devie many times and readded it.
As you can see on the screenshot in the wiki there should be an invert field.

To make a scene become activated by a not reachable device you should have configured it similar to the one on the attached screenshot. I've tried it and it worked. The important part in the scene configuration is the "Device responded = No".
Then you should get what you were looking for.
Title: Re: Ping Sensor
Post by: mpenda on October 07, 2009, 07:51:39 am
It seems one file was not updating. I wound up going in via telnet, changing permission for the file in /etc and then uploaded again. That time the file took. Even then, though, it took two attempts to get the necessary variables (Address, Period and Invert) to show up.
Looks good now though.
Many thanks for that update and help!!
Title: Re: Ping Sensor
Post by: 325xi on October 07, 2009, 08:30:42 pm
That one great plugin!
Ted, what's the purpose of awareness service?
It seems that functionality doesn't use it directly.
Title: Re: Ping Sensor
Post by: TedStriker on October 08, 2009, 03:34:41 am
Hi 325xi, I'm happy you like it.
The AwarenessSensor was/is intended to be reused in future sensors. I didn't want to write the same code over and over again.  
But as I experienced, Vera doesnt support this kind of device development (it's not reflected in the UI as expected) So for now, it's just a wrapper for the SecuritySensor + UPnP access to the variables, which is not provided by the SecuritySensor itself.  
Title: Re: Ping Sensor
Post by: TedStriker on October 09, 2009, 04:15:03 pm
Found some inconsistency in I_AwarenessSensor.xml which has been removed.
http://wiki.micasaverde.com/index.php/Ping_Sensor_Plugin (http://wiki.micasaverde.com/index.php/Ping_Sensor_Plugin)
Title: Re: Ping Sensor
Post by: mpenda on October 11, 2009, 03:45:58 pm
I created a scene which has an event that fires on the armed ping sensor, when it does NOT trip (invert = 1).
It works, I put in a bogus address in the device and so it fails to ping it. I set a command to shut off a lamp for testing purposes and off goes the lamp.
But I also put in a command to set the Ping Sensor device to BYPASS for 5 minutes to allow for the modem to reboot and the connection to re-establish before I start to check for a connection again.

The command to set it to BYPASS mode doesn't work. Any ideas?
Title: Re: Ping Sensor
Post by: TedStriker on October 12, 2009, 03:49:55 pm
I'll have a look on it. Have you loaded the D_PingSensor.xml or the D_PingSensor_Invert.xml?
Title: Re: Ping Sensor
Post by: mpenda on October 12, 2009, 03:52:01 pm
I loaded D_PingSensor_Invert.xml as I like the inverted mode.
Thanks!!
Title: Re: Ping Sensor
Post by: mpenda on October 12, 2009, 03:56:10 pm
By the way, the buttons in Dashboard to arm and bypass work just fine...its just from the command section that it does not change.
Title: Re: Ping Sensor
Post by: TedStriker on October 12, 2009, 04:11:55 pm
Thank you for that hint.
What do you mean by "the command section"?
Title: Re: Ping Sensor
Post by: mpenda on October 12, 2009, 04:16:48 pm
When I create a scene, I put an event in to fire on the lack of a ping.
Then under the event I add the commands. There's pull downs for each of the devices. So one device is the appliance module on the modem which I turn off for 30 seconds and then back on. There's also the Ping Sensor which has options to ARM and BYPASS.
Title: Re: Ping Sensor
Post by: TedStriker on October 12, 2009, 04:43:37 pm
Which version of the sensor do you use?
Title: Re: Ping Sensor
Post by: mpenda on October 12, 2009, 08:27:52 pm
I'm running the latest, 1.4
Title: Re: Ping Sensor
Post by: mpenda on October 13, 2009, 01:53:35 pm
I was able to get it to work using a luup event, rather then trying to do it with the gui command portion of the scene. Since I got a tip on the timer function on another thread, I was able to do what I wanted to do (bypass, wait 5 minutes, arm).

Thanks for all your help.
Title: Re: Ping Sensor
Post by: myhomeserver on November 05, 2009, 04:13:56 pm
I like the idea of the awareness sensor, I can use something like this to ping my Laptop on the LAN while I'm home.  When I pack up and leave my home (usually with the laptop when it's an extended period) it will arm sensors, turn off the lights, turn down the heat, etc.  Very cool.   You can use a Static DHCP or MAC reservation for DHCP to make sure the laptop (or Iphone, etc)

I'll have to try this....
Title: Re: Ping Sensor
Post by: Richardb on November 09, 2009, 07:03:52 pm
I guess I missed somethign..
I installed as indicated by your Wiki, but the device has no options, and looks nothing like you picture...
Any ideas?

Not even sure how to remove the files, the files have the absolute path listed in the Vera GUI after I uploaded them...

Would like to remove them and readd them...

I started to write a perl module on my Linux Server and have it do teh pinging and then issue web commands to cycle the device... Your approach is much more asthetically pleasing...

Title: Re: Ping Sensor
Post by: Richardb on November 09, 2009, 07:49:08 pm
Ok, I SSH'ed into Vera, removed the C:\xxxxx verisions of the file, and then transferred them over via the shell, and all works..

might this be a bug?  When uploading that it uses the FULL LOCAL ADDRESS instead of just the file name???

Title: Re: Ping Sensor
Post by: mcvovidiu on November 10, 2009, 06:17:02 am
Hi,

If you upload a new version of the file, it will overwrite the older one. This is maybe why you get the full address instead of just the file name.
Title: Re: Ping Sensor
Post by: TedStriker on November 27, 2009, 11:44:33 am
Thanks for the support, mcvovidiu.

Just want you guys to know that a new version of the sensor will be delayed some further.
I'm trying to add ZigBee capabilities to Vera by using a XBee device at the moment and I guess all of you know how time consuming those projects can be  ;)
Title: Re: Ping Sensor
Post by: blacey on December 05, 2010, 12:57:24 am
Does this sensor work with UI14?  I tried but the device configuration panel is blank.
Title: Re: Ping Sensor
Post by: m0jon on December 05, 2010, 12:52:34 pm
Need a little help.

I've installed the plugin and used D_PingSensor.xml

The sensor appears to be working great with my iPhone, wifi on sensor tripped, wifi off sensor armed and waiting.

The problem is i can't get the sensor to trigger a scene. Either a scene turning on a light or running some Lua code. Any ideas where i'm going wrong?

Do i need to add anything in impl_file section under Advanced within the virtual sensor?

Any help greatly received

m0jon
Title: Re: Ping Sensor
Post by: blacey on December 05, 2010, 06:10:10 pm
m0jon,

Are you on UI4?  If so, did you use a different installation procedure than uploading via the web UI?  I uploaded through the LUUP files vera Web UI but the Device Panel is blank.  Logging in and searching for the Ping plugin files shows they are all there - confirmed through the web ui too.

Code: [Select]
root@MiOS_13202:~# find / -name '*Ping*'
/etc/cmh-ludl/S_PingSensor.xml.lzo
/etc/cmh-ludl/I_PingSensor.xml.lzo
/etc/cmh-ludl/D_PingSensor_Invert.xml.lzo
/etc/cmh-ludl/D_PingSensor.xml.lzo
/overlay/etc/cmh-ludl/S_PingSensor.xml.lzo
/overlay/etc/cmh-ludl/I_PingSensor.xml.lzo
/overlay/etc/cmh-ludl/D_PingSensor_Invert.xml.lzo
/overlay/etc/cmh-ludl/D_PingSensor.xml.lzo

Ideas?
Title: Re: Ping Sensor
Post by: m0jon on December 06, 2010, 03:43:05 am
Hi blacey,

I'm using Vera 2 and UI4. I used the web interface to upload all the files and then created a device in the usual way.

The sensor appeared in my main dashboard and has all the options/variables available. Just can't get it to trigger a scene, YET!!!
Title: Re: Ping Sensor
Post by: pepebel4 on December 06, 2010, 06:34:12 am
Hello,
Could you tell me how to create a device 'the normal way'?
I selected Developers --> Create Device and entered D_PingSensor.xml into the column
UpnpDevFilename. But that creates a new device without any real options. So I guess I must be doing something wrong :(

Brg,
Pascal
Title: Re: Ping Sensor
Post by: m0jon on December 07, 2010, 05:47:14 pm
Thanks pepebel4 for the extra bit of code that needed adding to make the sensor trigger a scene

http://forum.micasaverde.com/index.php?topic=4943.0 (http://forum.micasaverde.com/index.php?topic=4943.0)

Now as i approach my house vera picks my iPhone (my router has a fixed ip address for my iPhone) by using the ping plugin and then i get a push message received on my iPhone, 'Welcome Home'. Will be looking to have it trigger other scenes too, as soon as i acquire more z wave devices, now that my iPhone acts as a proximity sensor.

Cheers

m0jon
Title: Re: Ping Sensor
Post by: strangely on December 11, 2010, 02:01:04 am
Hello,
Could you tell me how to create a device 'the normal way'?
I selected Developers --> Create Device and entered D_PingSensor.xml into the column
UpnpDevFilename. But that creates a new device without any real options. So I guess I must be doing something wrong :(

Brg,
Pascal
After adding it, try a second save (or dashboard refresh ) again and it may populate the rest of the options for you!
Title: Re: Ping Sensor
Post by: BrianAz on January 09, 2011, 03:36:58 am
Thanks pepebel4 for the extra bit of code that needed adding to make the sensor trigger a scene

http://forum.micasaverde.com/index.php?topic=4943.0 (http://forum.micasaverde.com/index.php?topic=4943.0)

Now as i approach my house vera picks my iPhone (my router has a fixed ip address for my iPhone) by using the ping plugin and then i get a push message received on my iPhone, 'Welcome Home'. Will be looking to have it trigger other scenes too, as soon as i acquire more z wave devices, now that my iPhone acts as a proximity sensor.

Cheers

m0jon

Going to do this.. curious how quickly your iPhone switches from 3g to your home WIFI? Is it something where you trigger immediately, or are you already at the front door by the time it connects?

Thx
Title: Re: Ping Sensor
Post by: evanes on January 09, 2011, 03:21:17 pm
My iphone only activates the wifi if I start the mail app.

This makes the iphone as a presences detector useless.

Could a bluetooth connection work better?
Are there tools to detect bluetooth devices? Can this trigger an event in Vera?
Title: Re: Ping Sensor
Post by: rlmalisz on January 09, 2011, 03:40:35 pm
My iphone only activates the wifi if I start the mail app.

This makes the iphone as a presences detector useless.

Could a bluetooth connection work better?
Are there tools to detect bluetooth devices? Can this trigger an event in Vera?

I tried going down this route, having a Linux server do an l2ping for the phone, since the BT stays up if the phone is powered on at all.  Problem is that l2ping will hang when the phone's not in range, and nothing I did to set the "timeout" shorter worked.  So I went to doing a btscan or whatever it is that simply scans for devices within range, and then parsed the results with Perl looking for my phone's BTADDR.  That worked, but was pretty range-limited.  Then I went down the "aircable" BT device rathole--they have devices that are good for much longer distances, but for BT, it's symmetric--if the phone is good for 10m, it doesn't matter if the thing that is trying to identify it is good for 4K--you still get 10m.

You also won't have BlueZ or Perl on Vera, so this would have to be proxied off to some other machine running 24/7.  We have Linux servers in the house, but for a lot of folks, this isn't an option.

I finally threw in the towel.  Guessed has a nice system working using RFID.  Once I get some other fires put out, I'm planning on setting up his stuff with passive tags in the cars.  But no hurry.

--Richard
Title: Re: Ping Sensor
Post by: guessed on January 09, 2011, 04:15:17 pm
I finally threw in the towel.  Guessed has a nice system working using RFID.  Once I get some other fires put out, I'm planning on setting up his stuff with passive tags in the cars.  But no hurry.

I can't claim that one, that piece of handywork is @woodsby's   8)
Title: Re: Ping Sensor
Post by: ZMaF on January 17, 2011, 11:30:27 pm
Has anyone tried the Ping_Sensor in UI4?

I was able to create a device and the variables for ip address, period, trigger etc showed up. It seemed to ping the IP only if I saved/restarted vera instead of an ongoing basis.

The fact that the UI just showed a generic device was expected.

-ZMaF
Title: Re: Ping Sensor
Post by: strangely on January 18, 2011, 01:45:03 am
It works for me although I remember when I first installed it I had some troubles getting it to work.

When you say a generic device, what do you mean?
Title: Re: Ping Sensor
Post by: woodsby on January 18, 2011, 04:59:03 pm
I finally threw in the towel.  Guessed has a nice system working using RFID.  Once I get some other fires put out, I'm planning on setting up his stuff with passive tags in the cars.  But no hurry.

I can't claim that one, that piece of handywork is @woodsby's   8)

It's active RFID, not passive, and thanks to Guessed (and others) it is in much better shape than when I started.  Although it's active, they say the advanced 40m tags last 4-5 years on one set of batteries.  Who knows where we'll be in 4-5 years... right?
Title: Re: Ping Sensor
Post by: ZMaF on January 23, 2011, 01:00:30 am
I got it to work. Important fact seems to be to put in the urn:schemas-micasaverde-com:device:MotionSensor:1 device type when creating the device. If I add it later, it won't work.

I've played with IPhone detection and I'm seeing the same problem as was noted before. The IPhone goes off the air when it is inactive, so this won't work for presence sensing.

Does anyone have the link to the RFID approach that was mentioned?
Title: Re: Ping Sensor
Post by: woodsby on January 23, 2011, 07:29:04 am
Check code.mios.com. I havent updated the docs since I changed the code, but the install hasn't changed other than adding one more file than is listed in the docs.  Download all the files from the browse source page.
Title: Re: Ping Sensor
Post by: ZMaF on January 25, 2011, 02:55:04 am
Thanks, I found it. The RFID approach is pretty cool.

Title: Re: Ping Sensor
Post by: mcardenas on February 05, 2011, 09:58:06 pm
Hi, I'm trying to setup the Ping sensor in 1183 but is not working  :(. I'm creating device with D_PingSensor.xml as UpnpDevFilename. I also tried including urn:schemas-micasaverde-com:device:MotionSensor:1 as DeviceType. Am I missing anything?
Title: Re: Ping Sensor
Post by: mcardenas on February 15, 2011, 10:50:25 pm
I'm still having issues with Ping Sensor. I dig into log and Tripped var is updating fine, however, my Vera doesn't recognize it as a sensor in the scenes config. Besides, the device doesn't show the arm and Bypass buttons.

Somebody is having the same issue? Somebody can help me?
Title: Re: Ping Sensor
Post by: jediobiwan on February 23, 2011, 06:56:18 pm
I'm still having issues with Ping Sensor. I dig into log and Tripped var is updating fine, however, my Vera doesn't recognize it as a sensor in the scenes config. Besides, the device doesn't show the arm and Bypass buttons.

Somebody is having the same issue? Somebody can help me?
Same here, any updates from anyone running a ping sensor on 1183?
Title: Re: Ping Sensor
Post by: jediobiwan on February 23, 2011, 11:02:19 pm
Scratch that. Got it working, now just need to deal with the iPhone wifi going to sleep when the phone is not awake. Any ideas?
Title: Re: Ping Sensor
Post by: mcardenas on February 24, 2011, 07:44:42 am
Scratch that. Got it working, now just need to deal with the iPhone wifi going to sleep when the phone is not awake. Any ideas?

How do you get it working?
Title: Re: Ping Sensor
Post by: jediobiwan on February 24, 2011, 11:31:43 am
Combination of adding urn:schemas-micasaverde-com:device:MotionSensor:1 as the Device type when adding the device as ZMaF said. And you need to follow these instructions:

I modifed the D_PingSensor.xml.
I added <staticJson> after the devicetype :

<deviceType>urn:schemas-micasaverde-com:device:MotionSensor:1</deviceType>
<staticJson>D_MotionSensor1.json</staticJson>

Adding this line enables the device to be selected when creating a scene.
Hope that works out for you too.
Tested this evening; works perfect! When I come home in the evening with my iPad; my home welcomes
me with turning on the lights:) Cheaper then a motion sensor (taken into account you already have an iphone/ipad  :P :P )
Title: Re: Ping Sensor
Post by: mcardenas on February 27, 2011, 10:37:15 pm
Hey Jedi, thanks a lot. It worked! Now I can see the buttons and the blue or red icon on Vera's interface.

However, the arm and bypass buttons doesn't work. Both of them shows a "Delivery failed" error. Any idea?
Title: Re: Ping Sensor
Post by: iflyM3 on February 27, 2011, 11:45:18 pm
I get the same thing, however the 'arm' and 'bypass' does actually work through the Mobile Phone GUI.  Go figure. lol.  

I used this once to unlock my front door and turn on the outside light and inside lights when I pull into my driveway  It was cool, I like the RFID approach better tho because waiting for my android to connect to my LAN takes too much time to make it practical.  

I would think that this Ping Utility would be awesome combined with a WOL plugin.  For instance, to turn on my server via layer 2 packet (WOL) when the ping utility gets a reply from my PS3 being turned on.  
Title: Re: Ping Sensor
Post by: Henk on June 02, 2011, 12:11:47 pm
I've got the Ping sensor up and running in UI4, graphics and all.
My question is, once its tripped, how do i reset it to untrip and re-arm?

Ive been following some scenecoding threads and was thinking this thread could help?
http://forum.mios.com/index.php?topic=6685.0

Using some part of the code mentioned there, courtesy of  @Samea with added suggestion of @Ap15e
Any suggestions?

@Samea's code
Code: [Select]
--identification
local magnetDevice = 7
local movementDevice = 10
local SS_SID = "urn:micasaverde-com:serviceId:SecuritySensor1"

--untrip the device
luup.variable_set(SS_SID,"Tripped","0",magnetDevice)
luup.variable_set(SS_SID,"Tripped","0",movementDevice)

--suggestion to pause before sending next command for n seconds
.......

--re-arm the devices
luup.variable_set(SS_SID,"Armed","1",magnetDevice)
luup.variable_set(SS_SID,"Armed","1",movementDevice)

But how to bring @Ap15e suggestion into the equasion?
Code: [Select]
luup.call_action / SetArmed / newArmedValue

Hope anyone can help me advance this....
Title: Re: Ping Sensor
Post by: strangely on June 03, 2011, 03:49:16 am
What are you trying to achieve, if you could get it to do that?
Title: Re: Ping Sensor
Post by: Henk on June 03, 2011, 03:52:43 am
What are you trying to achieve, if you could get it to do that?

I have a wireless device thats pretty much stretched out to its limit on wifi signal.
If i loose connection, i want to be notified, then rearm the trigger (say every 5 or 10 minutes) and loop the process that way.

This gives be a sence on how often the devices loses connection and i can either manually interfere or see when the device is back online.

For presence functionality this could provide not only event triggering, but also notifications on arrival (but i agree the RFID solution is more solid there)

Problem at hand right now is that the sensor doesnt re-arm....
Title: Re: Ping Sensor
Post by: strangely on June 03, 2011, 04:07:03 am
I'm not sure if it changed, but there used to be a time when notifications would keep coming once something was tripped. If this still worked then you could set the notification for un-tripped and it would notify you every 15 mins if it did un-trip.

@guessed had a post about this, as the logic changed at some point, I'll see if I can dig it out.

Would that have achieved what you were looking for?

It Might be worth the effort and trouble to try and increase the range with antennas etc, rather than chase this :)
Title: Re: Ping Sensor
Post by: strangely on June 03, 2011, 04:12:21 am
Regarding the above, you wont be able to see this thread as its in the beta area, but I'll copy @guessed's posts here:

Quote
At some point in the last releases, not sure when, the behaviour of S_SecuritySensor1.xml was changed to "allowRepeats=yes" for change notifications on "Tripped" state.

@woodsby noticed this one, and we've been PM'ing about it:

Here's the snippet from the newer S_SecuritySensor1.xml file
Code:
  
Code: [Select]
<stateVariable allowRepeats="yes">
       <name>Tripped</name>

       <sendEventsAttribute>yes</sendEventsAttribute>
       <dataType>boolean</dataType>
       <shortCode>tripped</shortCode>
    </stateVariable>

and it now has the "allowRepeats="yes", which is contrary to the original setup, per this discussion:

    http://forum.micasaverde.com/index.php?topic=1591.0


Can you restore the prior file to avoid the functional regression?


UPDATE 19th Jan: Filed Ticket http://bugs.micasaverde.com/view.php?id=1384 to formally track the Regression.

I guess the relevant part is here:

http://forum.micasaverde.com/index.php?topic=1591.0
Title: Re: Ping Sensor
Post by: Henk on June 03, 2011, 05:05:17 am
@strangely,

Gee thanks! (sigh, even more data to process ;-))

I done the network tinkering thing (not easy with fixed antennas), installed a repeater, etc etc
I'd like to see if I can relate the loss of signal to time of day or any other environment variable.

Might end up with a homeplug setup to carry the signal via mains.

Having said that, I'm also trying to learn and see Vera as a hobby (ask my wife ;-))
therefore I'm exploring what can and can't be done, what's functional and what not...

I'll take the info you gave me and will check my XML files.
Thing is, I got my sensor package by d/l it from the forum and tweaking it as per forum directions to get it to work with UI4.

So I might just have a version that lacks the codesnippets you suggest.
Will report later on my findings and would like to thank you for your efforts do far!
Title: Re: Ping Sensor
Post by: JOD on June 03, 2011, 09:53:07 am
@Henk,
I read the above posts but still not 100% sure what your asking about re-arming.
Quote
I have a wireless device thats pretty much stretched out to its limit on wifi signal.
If i loose connection, i want to be notified, then rearm the trigger (say every 5 or 10 minutes) and loop the process that way
So you basically want to monitor your wifi? Why not install the D_PingSensor_Invert.xml to trip on losing the signal? 

Unless I'm missing the point of what your trying to do?

JOD.

Title: Re: Ping Sensor
Post by: Henk on June 03, 2011, 01:13:36 pm
@Henk,
I read the above posts but still not 100% sure what your asking about re-arming.
Quote
I have a wireless device thats pretty much stretched out to its limit on wifi signal.
If i loose connection, i want to be notified, then rearm the trigger (say every 5 or 10 minutes) and loop the process that way
So you basically want to monitor your wifi? Why not install the D_PingSensor_Invert.xml to trip on losing the signal? 

Unless I'm missing the point of what your trying to do?

JOD.

I'm slowly getting the idea that either im taking the wrong approach OR my sensor does stuff you guys dont experience.

Ill try to explain.

I HAVE used the inverted logic, having the sensor trigger when the IP was unavailable.
I ALSO tried the trigger in the regular way (checking when my wifes iPhone came home)

In both occcasions i get a trigger, no problem.
BUT, the trigger (little red guy running) never resets... thus trigger state stays enabled even if IP isnt detected anymore (in normal mode) ar is detected again (in inverted mode).

Is this just me doing something wrong?
Title: Re: Ping Sensor
Post by: strangely on June 03, 2011, 01:30:42 pm
OK so its doing something wrong, mine will reset if the device goes offline.
Title: Re: Ping Sensor
Post by: Henk on June 03, 2011, 01:35:30 pm
OK so its doing something wrong, mine will reset if the device goes offline.

Ill check the xml data you provided and report back, maybe thats something to do with it....
Title: Re: Ping Sensor
Post by: JOD on June 03, 2011, 01:36:43 pm
Mine resets too (iPhone) when the phone goes to sleep or if I turn WiFi off.
I'm sure @oTi@ will pop up here any minute with the link to the correct download.

JOD.

*Edit. @Henk, wasnt there a patch for this? Did you install it?
Title: Re: Ping Sensor
Post by: strangely on June 03, 2011, 01:49:39 pm
OK so its doing something wrong, mine will reset if the device goes offline.

Ill check the xml data you provided and report back, maybe thats something to do with it....

The data I posted before was more to do with repeat notifications.
Title: Re: Ping Sensor
Post by: Henk on June 03, 2011, 01:52:08 pm
Mine resets too (iPhone) when the phone goes to sleep or if I turn WiFi off.
I'm sure @oTi@ will pop up here any minute with the link to the correct download.

JOD.

*Edit. @Henk, wasnt there a patch for this? Did you install it?


Im unaware of that... the patch i found was getting the sensor to work with UI4 and had to do with consistent linking to the json file in the xmls....

Maybe @oTi@ could add that link too ;-)
Title: Re: Ping Sensor
Post by: JOD on June 03, 2011, 01:55:23 pm
I do remember this problem with this device, I was having a convo with @iFlyM3 about it. When I added ALL your files it started working...

http://forum.micasaverde.com/index.php?action=dlattach;topic=6096.0;attach=2251

JOD.
Title: Re: Ping Sensor
Post by: Henk on June 03, 2011, 01:57:58 pm
I do remember this problem with this device, I was having a convo with @iFlyM3 about it. When I added ALL your files it started working...

http://forum.micasaverde.com/index.php?action=dlattach;topic=6096.0;attach=2251

JOD.

Isnt there a complete package on the code page?
If not, we might have to consider to post the full set in this thread once more to eliminate problems for other users....
Title: Re: Ping Sensor
Post by: Henk on June 03, 2011, 03:05:26 pm
Regarding the above, you wont be able to see this thread as its in the beta area, but I'll copy @guessed's posts here:
At some point in the last releases, not sure when, the behaviour of S_SecuritySensor1.xml was changed to "allowRepeats=yes" for change notifications on "Tripped" state.

@woodsby noticed this one, and we've been PM'ing about it:

Quote
Here's the snippet from the newer S_SecuritySensor1.xml file
Code:
  
Code: [Select]
<stateVariable allowRepeats="yes">
       <name>Tripped</name>

       <sendEventsAttribute>yes</sendEventsAttribute>
       <dataType>boolean</dataType>
       <shortCode>tripped</shortCode>
    </stateVariable>

My xml doesnt have that piece of code...
Ill upload my packegae here to serve as comparison for those participating in this discussion.
As im only allowed to upload 4 files ill zip it (knowing the TFP policy of @JOD) anyway.

i HAVE adapted the code for UI4 creating the json statements pointing to the json file as per directions in this very thread.

Hope one of you can find something i missed....

Then one more, if i wanted to ADD the <stateVariable allowRepeats>, where would i put it in the code? simply at the end?

--EDIT--
I removed the sensor and created a new one with the existing D_PingSensor.xml
Armed the sensor and it works. Ip detected, on (set a scene to switch on a light) After removing the device from the LAN the trigger rest to "armed" as it should!

Thats on part of the mystery solved, i probably had a corrupt device.
Then there is the issue of the bypass button not working ("delivery failed") has anyone looked into that and solved it for UI4? NOTE, manually changing the Armed variable for 1 to 0 and saving the device DOES set it to bypass, so its just the button not working.

One more (im on a roll  :D), when the trigger returned to "armed" and the little red man colled of and went back to blue, my light didnt switch off. I couldnt find anything in the event to set that option. Does it have to be coded in with luup? (like: lamp on when IP is detected because pingsensor tripped, lights off when IP is not detected by pingsensor anymore)
Title: Re: Ping Sensor
Post by: strangely on June 03, 2011, 11:36:12 pm
One more (im on a roll  :D), when the trigger returned to "armed" and the little red man colled of and went back to blue, my light didnt switch off. I couldnt find anything in the event to set that option. Does it have to be coded in with luup? (like: lamp on when IP is detected because pingsensor tripped, lights off when IP is not detected by pingsensor anymore)

You can create a second scene and have it do the reverse I guess?! The tripped event can be either tripped "yes" or "no"
Title: Re: Ping Sensor
Post by: Henk on June 04, 2011, 03:35:07 am
@strangely

Ok, thanks for that logical pointer!
Now I'm slowly starting to understand why people ask
for IF & AND logic.....

So much for ping sensors normal functions.

Anyone on why the bypass button doesn't work?
Look like a small coding glitch since manual override works

and what about the repeat notifications part?
Where should I add that in the XML?
Title: Re: Ping Sensor
Post by: JOD on June 04, 2011, 09:45:00 am
The bypass button works for me via the UI and within scenes.

The bypass function not working was an old issue (old code) that was fixed with your code. The Ping Sensor works perfectly.

@Henk you seem to have regressed!!

JOD.
Title: Re: Ping Sensor
Post by: Henk on June 04, 2011, 09:54:47 am
@JOD

as I recall you grabbed pieces from anywhere.
My addition made the json reference in XML complete. Therefore your plugin started to work.

Presumably i have some other outdated xmls since i cant locate the codesnippet @strangely mentioned either.

I would appreciate it if someone would attach his XML files here (@JOD perhaps)
i can then remove my upload an ppl can acces the latest working plugin.

Thats what happens of noone keeps track of versions and builds :-(
Title: Re: Ping Sensor
Post by: JOD on June 04, 2011, 10:32:53 am
I think this is the complete zip file. V1.41?

http://forum.micasaverde.com/index.php?action=dlattach;topic=6096.0;attach=2251

Ps. It's not on code.mios
*Edit. If you only want the xml's I can post those too?
*Edit. FYI,
Quote
I removed the sensor and created a new one with the existing D_PingSensor.xml
You don't need to remove, just upload the modified .xml which will overwrite the old.

JOD.
Title: Re: Ping Sensor
Post by: Henk on June 04, 2011, 02:06:48 pm
The bypass button works for me via the UI and within scenes.

The bypass function not working was an old issue (old code) that was fixed with your code. The Ping Sensor works perfectly.

@Henk you seem to have regressed!!

JOD.

@JOD,

I went through the complete thread and all code revisions.
Its *not* old code...

@Mcardenas had the issue with 1.4
http://forum.mios.com/index.php?topic=1997.msg33980#msg33980

Also @ifylM3 had the same issue
http://forum.mios.com/index.php?topic=1997.msg33986#msg33986

Its mentioned elsewhere too.
1.41 is nothing more than me adding the json code that pepebel4 suggested to the xml, that helpes Ping Sensor triggering scenes.

Heres the code that should activate the buttons and creates "delivery failed" messages.
Code: [Select]
{
"group_1":{
"cmd_1":
{
"label": "Arm",
"serviceId": "urn:micasaverde-com:serviceId:SecuritySensor1",
"action": "SetArmed",
"arguments":
{
"newArmedValue": "1"
}
},
"cmd_2":
{
"label": "Bypass",
"serviceId": "urn:micasaverde-com:serviceId:SecuritySensor1",
"action": "SetArmed",
"arguments":
{
"newArmedValue": "0"
}
}
}
}

Anyone ideas? @guessed? @Ap15e?

Title: Re: Ping Sensor
Post by: guessed on June 04, 2011, 09:15:59 pm
@Henk,
I'm not clear on the issues you're having.  I opened the ZIP, but it appears to have a hodge-podge of different codebases in it (including 3x Implementation files) so I'm not clear on what's trying to be done (I also don't use the Ping Plugin, so that might be part of my problem ;) and which exact files are being used for any given purpose.

It looks like someone partially augmented I_PingSensor_update.xml to handle UI4, where you need to explicitly have an ACTION Handler for things like SetAction.  This should be handling the Button presses from the [default, SecuritySensor1] UI.  The I_PingSensor.xml appears to be written for UI2, and would give you errors in the UI if you attempted to press the buttons.
Title: Re: Ping Sensor
Post by: strangely on June 04, 2011, 09:52:47 pm
I think this should be one of those things that MCV adopts in as default, and fixes this type of issue!
Title: Re: Ping Sensor
Post by: JOD on June 04, 2011, 11:11:50 pm
@Henk,
Quote
I went through the complete thread and all code revisions.
Its *not* old code...
IT *IS* OLD CODE and it is an old issue that was rectified.
Quote
@Mcardenas had the issue with 1.4
http://forum.mios.com/index.php?topic=1997.msg33980#msg33980

Also @ifylM3 had the same issue
http://forum.mios.com/index.php?topic=1997.msg33986#msg33986
Look at the dates of those posts. February 27th 2011
If you unpack 1.41 and look at the dates of the files you can see that both the I_PingSensor_update.xml and the D_PingSensor.xml file's were changed on 5/7/11 (May 7th 2011) as a result of this thread.
http://forum.micasaverde.com/index.php?topic=6096.msg39963#msg39963 where you confirm the Ping Sensor plugin worked and then repackaged it and labeled it 1.41
Upload those two files from 1.41 an see if that fixes your issue.

JOD.
Title: Re: Ping Sensor
Post by: Henk on June 05, 2011, 02:33:54 am
@Henk,
I'm not clear on the issues you're having.  I opened the ZIP, but it appears to have a hodge-podge of different codebases in it (including 3x Implementation files) so I'm not clear on what's trying to be done (I also don't use the Ping Plugin, so that might be part of my problem ;) and which exact files are being used for any given purpose.

It looks like someone partially augmented I_PingSensor_update.xml to handle UI4, where you need to explicitly have an ACTION Handler for things like SetAction.  This should be handling the Button presses from the [default, SecuritySensor1] UI.  The I_PingSensor.xml appears to be written for UI2, and would give you errors in the UI if you attempted to press the buttons.

@guessed
Heres a run down of (my) history on 1.41

I downloaded the hodge-podge set of @TedStrikers v1.4 (From this thread)
I added the json commands as per @pepebel4 (to make it work for ui4? or at least have the sensor work with scenes)
I then repacked without other changes and gave it v1.41 and released it.

Since i was unfamiliar with the code, and im not the author, i left the rest intact and unchanged.
Now that you clarified matters, would it be a lot of work to clean some stuff up, keep whats necassary, make sure we *only* keep UI4 code and move it to the code base (v1.42?)? Would you be willing to lend your expertise for that?
Title: Re: Ping Sensor
Post by: iflyM3 on June 07, 2011, 12:13:43 am
strange thing is, once I added an HRDS1 to my lineup the arm and bypass buttons began to work for the Ping Sensor through Vera's GUI just fine.  hmm, go figure.    :-\
Title: Re: Ping Sensor
Post by: guessed on June 08, 2011, 11:11:13 am
@Henk,
I'm not clear on the issues you're having.  I opened the ZIP, but it appears to have a hodge-podge of different codebases in it (including 3x Implementation files) so I'm not clear on what's trying to be done (I also don't use the Ping Plugin, so that might be part of my problem ;) and which exact files are being used for any given purpose.

It looks like someone partially augmented I_PingSensor_update.xml to handle UI4, where you need to explicitly have an ACTION Handler for things like SetAction.  This should be handling the Button presses from the [default, SecuritySensor1] UI.  The I_PingSensor.xml appears to be written for UI2, and would give you errors in the UI if you attempted to press the buttons.

@guessed
Heres a run down of (my) history on 1.41

I downloaded the hodge-podge set of @TedStrikers v1.4 (From this thread)
I added the json commands as per @pepebel4 (to make it work for ui4? or at least have the sensor work with scenes)
I then repacked without other changes and gave it v1.41 and released it.

Since i was unfamiliar with the code, and im not the author, i left the rest intact and unchanged.
Now that you clarified matters, would it be a lot of work to clean some stuff up, keep whats necassary, make sure we *only* keep UI4 code and move it to the code base (v1.42?)? Would you be willing to lend your expertise for that?

I've requested a code.mios.com space for it, so we can gather all the pieces into one place and folks can work on it in an orderly manner, eliminate the unnecessary bits, and consider what's needed to evolve it... and who should own it longer term, since the code is currently un-owned.

This should cut down on the duplicate and/or branched copies floating around in the forums here.
Title: Re: Ping Sensor
Post by: guessed on June 19, 2011, 10:05:59 pm
@Henk,
I have a merged version of the PingSensor code, in code.mios.com, that you can test out if you have cycles. 

It's not ready for general consumption just yet but the key changes are as follows:
a) Addition of UI4-compliant JSON file for a Dashboard UI
b) Removal of all UI2 "bits", so the code is UI4 only (to simplify testing)
c) Merging of a few files together, resulting in the elimination of a number of redundant files (I_AwarenessSensor.xml, S_AwarenessSensor.xml, D_PingSensor_Invert.xml)

I've attached a screenshot of the Dashboard display under UI4.


The new/merged code is here if you want to test it:
    http://code.mios.com/trac/mios_ping-sensor/browser/tags/0.1
Title: Re: Ping Sensor
Post by: utz on June 20, 2011, 01:44:31 pm
Works but now all my other Motion Sensors have in addition to the Arm/Bypass the buttons Normal/Invert (which do not work when clicked on). (has that to do with the SecuritySensor1?)
Title: Re: Ping Sensor
Post by: guessed on June 20, 2011, 02:16:28 pm
Works but now all my other Motion Sensors have in addition to the Arm/Bypass the buttons Normal/Invert (which do not work when clicked on). (has that to do with the SecuritySensor1?)
ok, hold off testing for now, I'll tweak something tonight to address that.  It wasn't showing up on my machine last night, but that's also a characteristic of the bug below... (timing problems in seeing it)

It's likely it's this problem in MiOS:
    http://bugs.micasaverde.com/view.php?id=1501

Short version...
It should be possible for unique Devices & Implementations, sharing the same Device Type, to have unique JSON UI's.  In practice, MiOS (1.1.12xx at least) doesn't allow this... nasty bug.

ie. Devices have a DeviceType, DeviceType's have one-or-more DevicesDevices have UI's.    Given this, a DeviceType should be able to have multiple UI's... but MiOS isn't handling this correctly.
Title: Re: Ping Sensor
Post by: Henk on June 20, 2011, 02:44:06 pm
Damn... i was just going to remove the old one and start testing on your new code...
Ill wait a bit more......
Title: Re: Ping Sensor
Post by: guessed on June 20, 2011, 02:51:41 pm
Damn... i was just going to remove the old one and start testing on your new code...
Ill wait a bit more......
I forgot to mention, it's cosmetic only as the Bug is only in the MiOS UI layer.  Once I tweak the file tonight, all the "regular" motion sensors will automatically go back to their Old UI without changing anything else.

It likely means that this component will have to "lose" it's Normal/Invert buttons though, so it can stay "findable" by the control points that only look at DeviceType to determine their renditions (they should look at Services implemented, but that's another story)
Title: Re: Ping Sensor
Post by: Henk on June 20, 2011, 02:57:00 pm
@guessed,

No problem, i just cleaned out my old install files from the cmh-ludl folder to make sure i get a clean install.
Rather than setting it up with the current code, ill wait for your new update.

As for the invert option, no problem, that CAN still be done in the appropriate variable field of the advanced tab of the plugin.... so no functionality lost in this workaround.

I DO hope MCV is working on that bug though.

Thx,

Henk
Title: Re: Ping Sensor
Post by: guessed on June 20, 2011, 03:37:38 pm
@guessed,

No problem, i just cleaned out my old install files from the cmh-ludl folder to make sure i get a clean install.
Rather than setting it up with the current code, ill wait for your new update.

As for the invert option, no problem, that CAN still be done in the appropriate variable field of the advanced tab of the plugin.... so no functionality lost in this workaround.

I DO hope MCV is working on that bug though.

Thx,

Henk
The change is to D_PingSensor.xml, this line

    <staticJson>D_PingSensor.json</staticJson>

changes to:

    <staticJson>D_MotionSensor1.json</staticJson>

and then I obsolete the D_PingSensor.json.... at least until the MiOS UI bug is fixed.  The Custom UI will go away, and folks will have to go back to setting the Normal/Invert option via the Advanced tab.

I'll make the changes perm in source control tonight
Title: Re: Ping Sensor
Post by: utz on June 20, 2011, 03:56:25 pm
This works (The UI; not sure about functionality of the sensor). However, the device only gets the buttons and the little figure after once pressing "Save" in the UI. It seems not to initialize right the first time installed (But I had that with other devices as well).
Title: Re: Ping Sensor
Post by: guessed on June 20, 2011, 11:30:32 pm
Latest version is now here with the fixes for the UI/JSON problem referenced above:
    http://code.mios.com/trac/mios_ping-sensor/changeset/19/tags/0.1.1?old_path=%2F&format=zip
Title: Re: Ping Sensor
Post by: oTi@ on June 23, 2011, 01:28:43 am
Latest version is now here with the fixes for the UI/JSON problem referenced above[...]
Tested it (Tripped Yes/No events, Arm/Bypass.); appears to work. Nice work cleaning it up @guessed.
Title: Re: Ping Sensor
Post by: JOD on July 24, 2011, 04:09:59 pm
Is there a way to add the variable <LastTrip>?

JOD.
Title: Re: Ping Sensor
Post by: guessed on July 24, 2011, 04:38:51 pm
Yes, but that Variable (and it's required behavior) isn't present and/or documented in the Service Descriptor (S_SecuritySensor1.xml).

If you file a bug for that, I can add the functionality in the meantime...  The question though is what this value should store.  I can make it a timestamp, no problems, but since there's no documentation it's not clear if it should be updated solely upon a state transition (Tripped "0" -> "1") or whether it should be updated when the value is sampled and is found to be (or still be) "1".

I suspect it's on the state transition, each time the "Tripped" state goes from "0" -> "1" - that would be the most logical since not every device "polls".

In  the meantime, I already update urn:micasaverde-com:serviceId:HaDevice1, LastUpdate, each time I Poll the device.
Title: Re: Ping Sensor
Post by: JOD on July 24, 2011, 05:28:30 pm
You're a scholar and a gentleman.
Bug filed. http://bugs.micasaverde.com/view.php?id=1541

Much appreciated.
JOD.
Title: Re: Ping Sensor
Post by: guessed on July 24, 2011, 05:38:36 pm
@JOD,
Pull this file, and upload it.

    http://code.mios.com/trac/mios_ping-sensor/export/21/trunk/I_PingSensor.xml

Once you're ok with it, I'll re-tag everything for a new build/drop for people to test.  At some point here, I need a "sign-off" of sorts, along with a finalized Wiki page for install (etc) so that it can be mass-consumed.
Title: Re: Ping Sensor
Post by: JOD on July 24, 2011, 06:32:17 pm
Nice job, works like a charm.

Thank you sir.
JOD.
Title: Re: Ping Sensor
Post by: JOD on July 26, 2011, 01:41:30 pm
I've run into a problem and I'm not sure if it's the Ping Sensor or the code I'm using, but my scenario is not working the way I want it to.

The scenario is using the Ping Sensor as an event that when it resets, turns off a virtual device after a set period of time (the code) which then triggers scenes to run or not run.

The scene is set up with the PS as the event, tripped "No" the code is put in the Luup tab (either for the event or the main Luup tab) and the command is turning off the VD.
Code borrowed from here: http://wiki.micasaverde.com/index.php/Scripts_for_scenes#Scene_that_runs_only_if_a_security_sensor_hasn.27t_been_tripped_in_a_set_period_of_time
But I've also used the other code listed there of "a security sensor HAS been tripped" which gives the same result.

Code: [Select]
local deviceNo = 22
local period = 30
 
local SS_SID = "urn:micasaverde-com:serviceId:SecuritySensor1"
 
local armed = luup.variable_get(SS_SID, "Armed", deviceNo)
if armed == "1" then
   local lastTrip = luup.variable_get(SS_SID, "LastTrip", deviceNo) or os.time()
   lastTrip = tonumber(lastTrip)
   if (os.difftime(os.time(), lastTrip) / 60) >= period then
       return true
   end
end
 
return false

The problem is, the scene executes if the PS is either "Tripped" or "Tripped No"  

Am I missing something obvious?

JOD.
Title: Re: Ping Sensor
Post by: JOD on July 27, 2011, 05:36:45 pm
Pulling the code out of the Luup tab of a scene setup using the Ping Sensor as the Event using Tripped "No" DOES work for a trigger.
But Luup does NOT work in the same setup to accomplish the same thing.

How does the scene setup differ from the Luup tab to see the Trip "No" (reset) that Luup cant see?

If the Ping Sensor does not generate a LastTrip =="0"

Why doesn't LastTrip ~= "1" not automatically register as == "0" (this does not work either) ???

JOD.
Title: Re: Ping Sensor
Post by: guessed on July 27, 2011, 09:52:33 pm
@JOD,
I'm still not 100% on what you're setting up, but a few comments/questions:




If I understand what you're scene is currently setup to do, it's  akin to:

When the Motion Sensor Un-Trips, immediately check to see whether it was Tripped more than 30 minutes ago and run the rest of the Scene, otherwise Stop.


I don't think that's the behavior you're shooting for...
Title: Re: Ping Sensor
Post by: JOD on July 27, 2011, 11:12:10 pm
Event: Armed sensor is tripped "No" (I'm looking for the tripped & then reset before running the code)

Timer: 1 minute (to check the status of the Ping Sensor)

Luup: <Delay> I've tried numerous variations of tripped, not tripped & various time scenarios

Command: Turn off Virtual Device. (hopefully after 30 minutes) It either never turns off, or turns off immediately

JOD.
Title: Re: Ping Sensor
Post by: guessed on July 28, 2011, 01:05:46 am
Ok, Scenes fire by some type of Input.

Inputs include Timers, Events/Triggers, etc, in ANY combination.  If you specify a Timer, as well as an Event, then either of those triggers will cause the Scene to fire.

Your timer says "Run this Scene every minute, no matter what"
Your event says "Run this Scene when the [Armed] Ping Sensor Transitions to Not-Tripped"

In other words...
   Every minute, OR any time the Ping Sensor goes from Tripped to Not-Tripped, run the Scene's code


So I imagine it's running a lot of times, and the code inside is only checking for Armed state, so it'll start firing every minute after an initial 30 minute delay.... independent of the state of the Sensor, probably sending you lots of SMS messages ;)



Can you try this:

a) Use example Scene 1 from the Wiki page you've indicated, the one titled:
        Scene that runs only if a security sensor hasn't been tripped in a set period of time
b) Set the PingSensor's "Invert" Parameter to "1", under Advanced
c) Remove the PingSensor Tripped-state Event from the Scene.

I also recommend tuning down the timer somewhat, as every minute is probably a little agressive given the other stability in your system (since it's large)

The logic in the above is basically to turn "invert" the Tripped state logic.  With the Invert flag set to "1", It'll ping your [phone?] IP Address and if it DOESN'T see it, it'll consider it Tripped and establish the LastTrip variable. 

This is you leaving the house, getting out of reach of the Router, etc, etc, and the LastTrip will capture the timestamp of you "not being seen"

The Scene will continue to fire every minute, and will look at the Armed/LastTrip state and hopefully do the right thing.
Title: Re: Ping Sensor
Post by: JOD on July 28, 2011, 03:01:46 am
Still no go.

Removing the Event, and inverting the Sensor to (1) there is no trigger while the iPhone is on and it's Wifi active.
Turning the iPhone off, the Ping Sensor triggers.

Setting the Ping Sensor back to normal (0) it triggers when the iPhone is sensed and turns on my Virtual Device.

Turning the phones Wifi Off, ~one minute later the Ping Sensor resets and the Virtual device turns off at the same time.

I've played with all three timers, the Ping Sensors, scene timer and the Luup timer.
The last attempt was with a 2 minute Ping, 5 minute scene timer and a 30 minute Luup timer.

JOD.



Title: Re: Ping Sensor
Post by: JOD on July 31, 2011, 03:58:03 pm
@guessed, starting from scratch and using the #2 wiki example this project now works, and it reset's the logic timer with each trip / reset.

Looking back at the other scenario for one last time, is this where the problem could be?

When you say
Quote
I suspect it's on the state transition, each time the "Tripped" state goes from "0" -> "1"
Does that mean the PS doesn't generate the "1" -> "0" trip state? so it either trips or never trips when using the LastTrip variable?
Those were the two scenario's I seemed to experience, as though the LastTrip variable never toggles between the two states and it was either always tripped or never tripped.

But, at least I can cross this project off my TODO list  :D

JOD.



Title: Re: Ping Sensor
Post by: guessed on July 31, 2011, 04:07:20 pm
@JOD,
The Tripped state is "1".  In the Ping Sensor the LastTrip is currently set to only change when the Tripped state occurs, and NOT on the Un-Tripped state.

This is why I wanted the Bug, so the variable, along with it's semantic behaviors, would be documented formally by MCV & Team.
Title: Re: Ping Sensor
Post by: JOD on July 31, 2011, 04:13:43 pm
You can rest assured I'll be following up with pushing to get it resolved.  ;)
I appreciate all the help you've given me..

JOD.
Title: Re: Ping Sensor
Post by: oTi@ on July 31, 2011, 08:42:38 pm
@JOD,

Looking back at the other scenario for one last time, is this where the problem could be?
I think to make it work with the (not-perfect) first wiki example (http://wiki.micasaverde.com/index.php/Scripts_for_scenes), you could insert a check to see if Tripped equals 1. This would time the length of the Tripped state only and return true if it exceeds period. You'd have to use the inverted Ping Sensor (i.e. tripped = ping unsuccessful).
Title: Re: Ping Sensor
Post by: JOD on July 31, 2011, 09:14:40 pm
I'm pretty sure I tried all options of normal & inverted Ping with both Tripped "1" & "0" but I'll go back and try it again tomorrow.

JOD.
Title: Re: Ping Sensor
Post by: Quixote on August 08, 2011, 05:45:43 am
A bit confused -- Is this plugin complete, or not?
Thanks.
Title: Re: Ping Sensor
Post by: mcvflorin on August 08, 2011, 06:12:59 am
I think to make it work with the (not-perfect) first wiki example (http://wiki.micasaverde.com/index.php/Scripts_for_scenes)

How can it be improved so it would be closer to perfection :)?
Title: Re: Ping Sensor
Post by: JOD on August 08, 2011, 09:06:39 am
Quote
How can it be improved so it would be closer to perfection :)?
@mcvflorin,

It's not an issue with your script per se; it's an inherent bug with the LastTrip variable that the script is based on.

Any chance this could get pushed through?
http://bugs.micasaverde.com/view.php?id=1541

JOD.
Title: Re: Ping Sensor
Post by: mcvflorin on August 08, 2011, 09:27:58 am
LastTrip stores the timestamp when the sensor was last tripped. It doesn't store the time when the Tripped variable changed from 0 to 1 or from 1 to 0.
Title: Re: Ping Sensor
Post by: oTi@ on September 14, 2011, 08:05:35 am
I think to make it work with the (not-perfect) first wiki example (http://wiki.micasaverde.com/index.php/Scripts_for_scenes)
How can it be improved so it would be closer to perfection :)?
As @JOD also pointed out, not sure if the script can be improved without adding data. As it is based on LastTrip, there needs to be a trip, an untrip and another trip within the specified period, for the scene not to trigger. Which is perhaps not intuitive, as, for example, the scene will trigger even if the sensor is still tripped.
Title: Re: Ping Sensor
Post by: usmampoer on October 16, 2011, 08:43:10 pm
@guessed, I hope you can help, I am very new to all this... I loaded your (tedstricker) latest pingSensor, which works perfectly but like any good user could not just leave it alone.

I needed to store some global variables for something I would like to track, like if a user switches off a HVAC I record the event and don't switch it back on, and someother stuff like how long it's been off etc....

So I added some code to S_PingSensor.xml to create the variable

    <stateVariable>
       <sendEventsAttribute>no</sendEventsAttribute>
       <name>ThemometerState</name>
       <dataType>string</dataType>
       <defaultValue>0</defaultValue>
    </stateVariable>

in I_PingSensor.xml I initialize the variable

luup.variable_set(PING_SID, "ThemometerState", "unknown", parentDevice)

Everything works, device loads and the variable shows up under the advanced tab and is set to "unknown"

Now I tried to access the variable through LUUP code so see if I can get the variable and set the variable and there it all goes to .....

I used the following

local PING_SID = "urn:demo-ted-striker:serviceId:PingSensor1"

luup.variable_set(PING_SID, "ThemometerState", "CoolOn", 22)
luup.variable_set(PING_SID, "Address", "www.woot.com", 22)

Both these did not work, I assume I am not address the device correctly. I did try to troll the forum but no luck

Any help appreciated
Title: Re: Ping Sensor
Post by: guessed on October 18, 2011, 01:47:44 am
@usmampoer,
What you've written looks correct, as long as the Device# of the Ping Sensor device is 22.

You don't need to make the mods to S_PingSensor.xml in order to "set" your own variables against the device.  You can just set them as you have for the Address variable that you're using in the example.  That'll avoid problems should you ever need to patch the Ping Sensor code at some point later on (where your mods would otherwise drop out)

When you enter your Lua, for the bits that aren't working, where are you entering it?

Also, when you say it's not working, how are you validating that it's working (or not)?  There are cases where the Dashboard UI won't reflect the underlying changes made through scripted variable value changes, even when the actual values are changing.
Title: Re: Ping Sensor
Post by: usmampoer on October 18, 2011, 09:35:25 am
@Guessed, many thanks for your reply, I was left the system for about 24 hours and was going to do some more tests but before I started I checked the variable status under the device advanced tab and the values had changes to the ones I set running LUUP code in the debug page....

So I tried again, I changed the value in the test LUUP run the code got a good result but when I checked in the advanced tab nothing had changed i.e the old values. I decide to do another test, I went to the advanced tab of the virtual device and changed on of the other variables, this forced a "SAVE" When I selected SAVE the system did it's thing and straight after I checked the variables I changed in LUUP and they were not reflected in the device advanced tab

I am suggesting that the manual "SAVE" action caused the LUUP device to "update" and the variables updated to the new values I had set through LUUP code.

I think I will do a set and a get to see if the variable is set but not updated to the device advanced tab

EDIT------------------------------------------------------------------------------------------------------------

I did the test, to recap I ran the code to set the variables, I then did an immediate get from the device and
sent that to a file with outf:write. When I checked the log file using putty the "new" values were in the variables but when
I checked the GUI under the plugin advanced tab it still showed the old values.

I can only assume that there is a timing issue to refresh the advanced tab data

-----------------------------------------------------------------------------------------------------------------
Title: Re: Ping Sensor
Post by: computerScience on October 23, 2011, 01:59:58 pm
This is so beautiful. Thanks a lot for this wonderful plugin!
I have not read through the entire thread but is this plugin able to handle mac-addresses?
It would be a lot more stable dealing with mac-addresses when sensing devices locally as mac-addresses really are unique.
Playing a little with the network might ruin the setup if IPs were used.

Thanks once again for sharing!
Title: Re: Ping Sensor
Post by: guessed on October 23, 2011, 02:14:35 pm
Internally it uses ping, not arp, so it has to have something that'll resolve to an [IPv4] address (either a native one, or one resolvable via your local DNS resolvers)

So as long as you setup your Localized DNS correctly, nothing will break... and you can have routed IP, that would otherwise break with MAC addresses.

This is so beautiful. Thanks a lot for this wonderful plugin!
I have not read through the entire thread but is this plugin able to handle mac-addresses?
It would be a lot more stable dealing with mac-addresses when sensing devices locally as mac-addresses really are unique.
Playing a little with the network might ruin the setup if IPs were used.

Thanks once again for sharing!
Title: Re: Ping Sensor
Post by: computerScience on October 23, 2011, 02:53:04 pm
Thanks for the answer. I think I'm fine with IPs for now  :)

However I did not get the ping sensor to trigger a scene correctly.
It senses the presence of my attached device correctly. But I am unable to get it to trigger a scene.

I did like with my motion sensor;
created a scene
events -> choosed the ping sensor -> an armed sensor is tripped -> Tripped set to yes
And luup code for that event was to set on a light

But apparently I cant get it to work. Does anyone know what I am doing wrong here?
Title: Re: Ping Sensor
Post by: guessed on October 23, 2011, 02:59:03 pm
@computerScience,
Is the Ping Sensor Armed?  There should be both "an Armed sensor is Tripped" as well as "a sensor is Tripped".  If the Ping sensor isn't armed, then the one you've selected won't trigger.


Thanks for the answer. I think I'm fine with IPs for now  :)

However I did not get the ping sensor to trigger a scene correctly.
It senses the presence of my attached device correctly. But I am unable to get it to trigger a scene.

I did like with my motion sensor;
created a scene
events -> choosed the ping sensor -> an armed sensor is tripped -> Tripped set to yes
And luup code for that event was to set on a light

But apparently I cant get it to work. Does anyone know what I am doing wrong here?
Title: Re: Ping Sensor
Post by: computerScience on October 23, 2011, 03:03:03 pm
@guessed
it is indeed armed. I would however like the option to choose when to activate the ping setting. but I will try with both.
So it should work no different than my motion sensor?

EDIT: tried with both settings and is seems not to be working. Can't really put my finger on what I've missed here.
I've been using the files and instructions form the wiki: http://wiki.micasaverde.com/index.php/Ping_Sensor_Plugin
Maybe they're outdated?

EDIT2: Yes, got it working now. Source from wiki seems outdated.
Title: Re: Ping Sensor
Post by: guessed on October 24, 2011, 10:03:52 pm
@computerScience,
Yes, those instructions haven't been kept up to date.  We "rebuilt" the PingSensor plugin from a few different divergent codebases, and I think one of the lads here was going to write a set of install pages on code.mios.com for it.

Thanks for the heads up...
Title: Re: Ping Sensor
Post by: HouseBot on October 31, 2011, 04:01:20 pm
Hi,
I'm not able to get it to work... U14, 1.1.1338

What I did was:
Downloaded the files from:
http://code.mios.com/trac/mios_ping-sensor/browser/tags/0.1
Upload the files to MiOS developers. Luup files tab, Restart Luup after upload.
MiOS developer button, Creat device.
DeviceType: urn:schemas-micasaverde-com:device:MotionSensor:1
UpnpDevFilename: D_PingSensor.xml
Pressed Create device

All I get is a generic Motion Detector device. Any advices! ???
Title: Re: Ping Sensor
Post by: guessed on November 08, 2011, 09:00:52 am
@HouseBot,
The latest/stable code is here:
    http://code.mios.com/trac/mios_ping-sensor/changeset/19/tags/0.1.1?old_path=%2F&format=zip

and it should install ok using the standard HowTo:
    http://wiki.micasaverde.com/index.php/Install_LUUP_Plugins

taking note not to use IE to do the File upload.  I've never had to specify the Device Type during this process.


Hi,
I'm not able to get it to work... U14, 1.1.1338

What I did was:
Downloaded the files from:
http://code.mios.com/trac/mios_ping-sensor/browser/tags/0.1
Upload the files to MiOS developers. Luup files tab, Restart Luup after upload.
MiOS developer button, Creat device.
DeviceType: urn:schemas-micasaverde-com:device:MotionSensor:1
UpnpDevFilename: D_PingSensor.xml
Pressed Create device

All I get is a generic Motion Detector device. Any advices! ???
Title: Re: Ping Sensor
Post by: utz on November 10, 2011, 06:20:15 am
I cannot ping my XBOX as apparently the XBOX does not respond to ICMP messages (What IP stack implementation is that?). So the ping sensor cannot pick up an XBOX. To get around this problem one could ping the XBOX and then do a grep on the arp cache on vera as a valid MAC address (either of the XBOX or an intermediate bridge element) should show up there when the XBOX is switched on. Should this be integrated in the ping sensor (an option to detect stealthy devices) or should such code be kept out of the ping sensor and we leave it as it is? 
Title: Re: Ping Sensor
Post by: guessed on November 10, 2011, 08:16:30 am
Go for it.  Either some sort of PingMode parameter controlling a fixed # of commands, or an actual command to run (more complex to config, less secure, more powerful).

I can open SVN to you or you cand add and I'll just merge it.  Might as well have one, more powerful, pinger...
Title: Re: Ping Sensor
Post by: intveltr on November 10, 2011, 09:26:18 am
Is it possible to turn the pinging on and off based on the armed state of the ping sensor?  I would like to ping for my phone very frequently (think every 5 secs) when the sensor is armed, so it will get picked up quickly when I return home.  However once I am home and the ping sensor is disarmed, I want it to stop pinging altogether.
Title: Re: Ping Sensor
Post by: utz on November 10, 2011, 09:42:45 am
Go for it.  Either some sort of PingMode parameter controlling a fixed # of commands, or an actual command to run (more complex to config, less secure, more powerful).

I can open SVN to you or you cand add and I'll just merge it.  Might as well have one, more powerful, pinger...

Ok, as soon as I find time I try to add this feature (have to fix my alarm panel first). If it works I will ask for svn access to put it in.
Title: Re: Ping Sensor
Post by: HouseBot on November 12, 2011, 03:20:18 pm
Thanks guessed!
Now it works!  ;D
Title: Re: Ping Sensor
Post by: chixxi on November 22, 2011, 05:22:54 am
So the newest version can be downloaded here?
http://code.mios.com/trac/mios_ping-sensor/browser/trunk (http://code.mios.com/trac/mios_ping-sensor/browser/trunk)
http://code.mios.com/trac/mios_ping-sensor/changeset/22/tags/0.1.1?old_path=%2F&format=zip (http://code.mios.com/trac/mios_ping-sensor/changeset/22/tags/0.1.1?old_path=%2F&format=zip)

What happened to the files D_PingSensor_Invert.xml, S_AwarenessSensor.xml and I_AwarenessSensor.xml? They are included if I use the download from the Wiki. Are they not needed anymore?

If I update the files, is it necessary to recreate devices?

Thanks to everybody for programming such nice plugins and for all the supporters!
Title: Re: Ping Sensor
Post by: sjolshagen on December 13, 2011, 09:05:25 am
Hi,

I just upgraded to UI5 on my Vera2 and it immediately went into a Luup restart loop. Came to find, by looking at the logs, that the Ping sensor (installed from the app store) initiates the loop (there's a
Code: [Select]
luup.call_action(GATEWAY_SID, "Reload", {}, 0) call in the initSettings() function. I have no clue as to whether or not the Reload is really needed, but commenting it out seems to have stopped the perma-restart and the ping sensor (now) seems functional again.

FWIW
Title: Re: Ping Sensor
Post by: sjolshagen on December 13, 2011, 10:11:03 am
Spoke too soon, I guess.

It will not save the IP address I specify, nor the invert value, so It's obviously not working and that probably explains why it insists on restarting continuously.
Title: Re: Ping Sensor
Post by: myhomeserver on December 14, 2011, 02:26:43 pm
Finally got around to getting the ping sensor downloaded and installed.  Using a new Vera3 and UI5 latest build.   It appears to be working. It's now avail via plugs so it was easier to install than uploading the files. Good news I can get it to work, and when my cell phone wifi goes off or I leave the proximity, this will trigger a scene to turn down the lights and heat when armed hopefully...

Heres the problem:

I got to setup a scene in UI5, and tell it to turn off a light, but under TRIGGERS I don't see the Ping Sensor listed as a device (#6 on my test network)
I don't see why everything else is working except how I can set a "armed sensor is tripped" event or "trigger" on this in UI5?
Title: Re: Ping Sensor
Post by: sjolshagen on December 14, 2011, 04:24:16 pm
I got to setup a scene in UI5, and tell it to turn off a light, but under TRIGGERS I don't see the Ping Sensor listed as a device (#6 on my test network)

+1 in terms of this issue (on Vera2 + UI5). - Seems to be working again under 1.5.236.
Title: Re: Ping Sensor
Post by: guessed on December 15, 2011, 01:46:46 am
Heres the problem:

I got to setup a scene in UI5, and tell it to turn off a light, but under TRIGGERS I don't see the Ping Sensor listed as a device (#6 on my test network)
I don't see why everything else is working except how I can set a "armed sensor is tripped" event or "trigger" on this in UI5?
@myhomeserver,
I'm not clear on what build you're running.  There appear to be a few floating around, so I'll be very version specific in my response.

I'm slowly testing each of my plugins, with the Ping Sensor I'm using Vera3/UI5/1.5.215 as the current testbed.

The Scene editing UI is... well... not the most intuitive.  It actually took me a few turns to get something to show up in the Triggers section as it really doesn't operate at all like I was expecting it to (it also feels like I'm using Crayola, but that's a more general theme of comments I've had for a while now)

That said, in the version I've specified, it does show up.  See the attached screenshot.


It's possible that there's a problem under the upgrade Vera2/UI5/1.5.xyz scenario that needs to be fleshed out though.  You might want to try the 1.5.236 release to see if it's any better.

Either way, working or not, can you provide the complete version# and whether you're Vera2 or Vera3 in the test scenario (it seems to make a difference in some cases)
Title: Re: Ping Sensor
Post by: sjolshagen on December 15, 2011, 10:17:02 am
V1.5.236 got the Ping Sensor working and appearing in the Triggers list.

FWIW, I fully agree with @guessed regarding the editing/creation of scenes! It's making me think it'd be _much_ easier to just write LUA to address my scene needs should I decide to return to UI5 (which I doubt was the intent?)
Title: Re: Ping Sensor
Post by: mcvflorin on December 15, 2011, 12:15:44 pm
@guessed

I propose a modification in the code, which is replacing:

Code: [Select]
      --
      -- due to strange behavior we have to restart the lua engine
      -- if we wouldn't, the sensor would not appear as sensor in the UI
      -- (the results of the action call do not matter)
      --
      log("RESTARTING LUA TO INITIALIZE PING SENSOR!")
      lul_resultcode, lul_resultstring, lul_job, lul_returnarguments = luup.call_action(GATEWAY_SID, "Reload", {}, 0)

with

Code: [Select]
      luup.task("Please restart Luup to initialize the plugin.", 1, "Ping Sensor", -1)

This would prevent repeated Luup restarts in case something goes wrong.
Title: Re: Ping Sensor
Post by: guessed on December 15, 2011, 12:27:03 pm
Yeah, that's a throwback to the original codebase, I have no idea as to the real intent of why it was put in.  I'll put that on the Todo list of changes as it's fairly simple.

... that said, no amount of this type of coding is really going to make Plugins work when the underpinning framework had the set of issues it had that triggered this to be an issue in the first place.

aka. the problems with luup.variable_get and friends.
Title: Re: Ping Sensor
Post by: guessed on December 15, 2011, 12:27:58 pm
@mcvflorin,
If you'd like, just go ahead and make that change in code.mios.com, on trunk, and re-tag it.
Title: Re: Ping Sensor
Post by: myhomeserver on December 15, 2011, 02:05:20 pm
Heres the problem:

I got to setup a scene in UI5, and tell it to turn off a light, but under TRIGGERS I don't see the Ping Sensor listed as a device (#6 on my test network)
I don't see why everything else is working except how I can set a "armed sensor is tripped" event or "trigger" on this in UI5?
@myhomeserver,
I'm not clear on what build you're running.  There appear to be a few floating around, so I'll be very version specific in my response.

I'm slowly testing each of my plugins, with the Ping Sensor I'm using Vera3/UI5/1.5.215 as the current testbed.

The Scene editing UI is... well... not the most intuitive.  It actually took me a few turns to get something to show up in the Triggers section as it really doesn't operate at all like I was expecting it to (it also feels like I'm using Crayola, but that's a more general theme of comments I've had for a while now)

That said, in the version I've specified, it does show up.  See the attached screenshot.


It's possible that there's a problem under the upgrade Vera2/UI5/1.5.xyz scenario that needs to be fleshed out though.  You might want to try the 1.5.236 release to see if it's any better.

Either way, working or not, can you provide the complete version# and whether you're Vera2 or Vera3 in the test scenario (it seems to make a difference in some cases)



I'm using a brand spanking new Vera3 with one appliance switch I added, the weather plugin and the ping sensor.   Using UI5 with 1.5.232  and the ping sensor was downloaded directly from the Plugins repository. It simply jsut installed it, and no custom files uploads like in older versions (uploading the xml, making the device from the xml, etc was not needed)

I'lll try 1.5.236 and see if that fixes it
Title: Re: Ping Sensor
Post by: myhomeserver on December 15, 2011, 04:29:45 pm
You might want to try the 1.5.236 release to see if it's any better.

Where do I find this version?  Im on UI5 with a new Vera3 and don't see any threads referencing this new version,even in the beta forum (private)

Reports have it that  1.5.236 seems to fix this issue with this plugin

thanks!
Title: Re: Ping Sensor
Post by: guessed on December 16, 2011, 01:32:33 am
@myhomeserver,
There's a thread on 1.5.236 pre-access in the Private beta forum for Vera3 usage.  That said, I've not had any problems running it under Vera3... The problems reported so far have been related to Vera2 and UI5.
Title: Re: Ping Sensor
Post by: mcvflorin on December 16, 2011, 05:01:09 am
If you'd like, just go ahead and make that change in code.mios.com, on trunk, and re-tag it.

OK, I committed rev. 26, tag 0.1.3-UI5.

... that said, no amount of this type of coding is really going to make Plugins work when the underpinning framework had the set of issues it had that triggered this to be an issue in the first place.

There's no arguing against that, but it helps reducing the side effects in the case of a major bug in MiOS.
Title: Re: Ping Sensor
Post by: autotoronto on December 18, 2011, 09:51:52 pm
I'm using the latest public release of the pitiful excuse for a system known as UI5 (which is 1.5.215) and I can install the the ping plugin but not make it work.

The "arm"/"disarm" buttons don't do anything, both are unlighted. I can set invert mode in the advanced settings page which makes the "invert" button light but clicking on the button doesn't do anything.

The ping sensor is device #9. When I go to add a trigger to an existing scene the device dropdown list doesn't list it, it only goes up to #8.

Is there something obvious I could have done wrong (apart, possibly from buying a Vera3 in the first place...)

Title: Re: Ping Sensor
Post by: guessed on December 18, 2011, 10:07:48 pm
in 1.5.215, pressing any Plugin Button in the UI will cause UI5 to crash, and restart.  1.5.236 fixes that problem, but hasn't been set to Auto-Update the Vera3 units (it sounds like 1.5.215 is still set as the Auto-Update for some reason)

The Invert Button(s) shouldn't be present in the UI at all, that's a porting problem introduced by the MCV Team when they put the Plugin into apps.mios.com.

I reverted that part of the change in the source control system for that plugin, and I'm waiting to get permissions to be able to push those changes to apps.mios.com.
Title: Re: Ping Sensor
Post by: autotoronto on December 18, 2011, 10:11:20 pm
Thanks for the exceptionally prompt response. I'll post back when I've got an update to a more recent release; hopefully it will work then.
Title: Re: Ping Sensor
Post by: mcvflorin on December 20, 2011, 11:40:56 am
I reverted that part of the change in the source control system for that plugin, and I'm waiting to get permissions to be able to push those changes to apps.mios.com.

Who are you waiting permissions from?
Title: Re: Ping Sensor
Post by: guessed on December 20, 2011, 11:47:49 am
Um, you! You said that you needed to release the Plugins to us, which presumably changes the author attribution (to my forum handle?) so I have permissions to do it.  I'd indicated a week ago that I was ready for a handful of plugins (listed in the Beta thread) that I'd merged back into their real-source control.
Title: Re: Ping Sensor
Post by: mcvflorin on December 20, 2011, 12:11:13 pm
;D Sorry, I was expecting a more obvious request (with big, red fonts, and blinking  :D), with your MiOS username.
Title: Re: Ping Sensor
Post by: guessed on December 20, 2011, 12:21:00 pm
ok, sounds like I'll need to create a new MiOS username then, as I've deliberately made my not match my forum handle, for obvious reasons.
Title: Re: Ping Sensor
Post by: mcvflorin on December 20, 2011, 12:30:26 pm
I'll ask Vali tomorrow to transfer the ownership of the plugins you requested.
Title: Re: Ping Sensor
Post by: autotoronto on December 20, 2011, 06:23:58 pm
I am now on 1.5.232
Quote
I got to setup a scene in UI5, and tell it to turn off a light, but under TRIGGERS I don't see the Ping Sensor listed as a device (#6 on my test network)
Me either. I think this is a bug in 1.5.232.

Looking forward to the next software release.
Title: Re: Ping Sensor
Post by: autotoronto on January 01, 2012, 09:32:51 pm
Now running 1.5.254 on Vera 3. The Ping sensor still doesn't show up in the list of devices in the Trigger page.

Any suggestions? Is this working for anyone on Vera 3?

EDIT: I downloaded the code from code.mios.com instead of installing via the plugin page, and it functions now. Looks like the plugin page is still loading old code.
Title: Re: Ping Sensor
Post by: intveltr on January 03, 2012, 09:49:59 am
Which files did you install exactly?  I can't get the Ping sensor to work under UI5, the log shows the following:
Code: [Select]
09      01/03/12 15:03:43.147   JobHandler_LuaUPnP::Run device 85 PingSensor room 9 type urn:schemas-micasaverde-com:device:MotionSensor:1 id  parent 0/0x9a87b0 upnp: 0 <0x400>
01      01/03/12 15:45:15.704   JobHandler_LuaUPnP::CreateDevice_LuaUPnP failed to load 85/D_PingSensor.xml so device 85 is offline <0x400>
02      01/03/12 15:45:17.074   Device_Service::MatchupUpnpServices no upnp service for urn:demo-ted-striker:serviceId:PingSensor1 <0x400>

I got my files from here: http://code.mios.com/trac/mios_ping-sensor/browser/tags/0.1.3-UI5
Title: Re: Ping Sensor
Post by: mcvflorin on January 03, 2012, 10:59:55 am
I published version 0.13 (version 0.1.3-UI5 from code.mios.com) which fixes the triggers.
Title: Re: Ping Sensor
Post by: chixxi on January 03, 2012, 11:48:26 am
I can confirm that ping sensors work as scene triggers with UI5 1.5.255 on Vera2. Thanks for the update!

Will you publish this on apps.mios.com too? How do updates from apps.mios.com work, do they get installed automatically or do I get notifications?
Title: Re: Ping Sensor
Post by: mcvflorin on January 03, 2012, 01:23:24 pm
Already published (see my previous post). The update should install automatically (details coming soon :) )
Title: Re: Ping Sensor
Post by: weissertigerxl on January 11, 2012, 06:06:02 am
Hi, McvFlorin,

can I use the ping sensor with UI4? I only find version 1.3. with extension UI5.

The official Plug In website shows noch plugin with this name.

Thanks!
Title: Re: Ping Sensor
Post by: sjolshagen on January 11, 2012, 11:26:45 pm
Looking for confirmation that the ping sensor (multiple instances of it) may cause instability on UI4 & UI5? Anything I can do to help troubleshoot/debug why (if it's the case)?

Was thinking about a ping sensor + delayed (remote) wifi sync invocation attempt to trigger the phone to "hit the airwaves" (wifi) once somebody exited the door (opened the lock w/o using the code - "assuming" that implies people are leaving, not coming back in) together with a virtual switch as a method to track whether I or my wife are home (and set heat accordingly). Since it's for heating purposes only, the timing can be off by 5(ish) minutes w/o a lot of pain.

However, if I can't have more than a single ping sensor running, I'll need it as a way to track & reset my wifi cam when it, once again, hangs up on me.
Title: Re: Ping Sensor
Post by: computerScience on January 12, 2012, 02:40:21 am
How many instances of the ping sensor do you have? Which UI are you running?
I have two instances of the sensor and vera is running quite smooth in UI4. I guess it also has to do with the ping period that you've set up.

I think there is a way to see the resources (memory, processor) usage if you telnet into the Vera but as I've understood Linux always strive to use maximum resources which kind of makes this data useless.

However you could always check the logs and see if you find anything interesting:
http://wiki.micasaverde.com/index.php/Logs
Title: Re: Ping Sensor
Post by: mcvflorin on January 12, 2012, 05:36:29 am
can I use the ping sensor with UI4? I only find version 1.3. with extension UI5.

Yes, that version should work with both UI4 and UI5.
Title: Re: Ping Sensor
Post by: sjolshagen on January 12, 2012, 07:38:30 am
How many instances of the ping sensor do you have? Which UI are you running?

Three (3) was what I was trying to use on UI4 (1.1.1362)

I think there is a way to see the resources (memory, processor) usage if you telnet into the Vera but as I've understood Linux always strive to use maximum resources which kind of makes this data useless.

Yes: ssh to the box, run (for instance) the top utility. But that assumes the box has the resources to fork the shell on login (and since the login hangs, that appears to not be the case). Also not possible to check the logs at that point either.

This could/would imply that there's a memory leak triggered by something the ping sensor uses. And since, when I have 3 sensors running w/ping windows of ~30 seconds, the Luup/lua engine restarts every couple of hours, it should be relatively easy to identify with a debugger/valgrind?
Title: Re: Ping Sensor
Post by: guessed on January 13, 2012, 11:53:14 am
Under UI4 there are a limited number of threads to run ALL of the plugins, a global limit.  In addition, there is a timeout function that effectively nukes the LuaUPnP process when ANY thread takes longer than 30 seconds to complete.

For the Ping sensor there are times that, for whatever reason, the Host command to launch 'ping' takes longer than 30 to respond... Presumably when a device is missing from the net.

Anyhow, this delay (along with the UI4 resource restrictions and the low timeout value) can cause it to be restarted.  This isn't isolated to the Ping Pluin as anything that blocks for more than 30s can cause this behavior to trigger.

In UI5, there are more threads and the timeouts are greater, so the overall likelihood is lower.
Title: Re: Ping Sensor
Post by: trouty00 on January 19, 2012, 03:29:32 pm
hi great plugin but i have a quick question, im using this like others for location reasons but there are certain times i want to disarm it. I have a scene which triggers when this sensor tripped which is working but then i try to disarm the sensor however it seems like it is continuing to ping.

any thoughts?

UI5 1.5.255

thanks
Stu
Title: Re: Ping Sensor
Post by: computerScience on January 19, 2012, 03:46:11 pm
hi great plugin but i have a quick question, im using this like others for location reasons but there are certain times i want to disarm it. I have a scene which triggers when this sensor tripped which is working but then i try to disarm the sensor however it seems like it is continuing to ping.

any thoughts?

UI5 1.5.255

thanks
Stu

As I've understood disarming the ping sensor will not stop it from detecting devices (pinging). It will only ignore the detected presence if you use "when an armed sensor is tripped". At least this is how motion sensors work.
Title: Re: Ping Sensor
Post by: trouty00 on January 19, 2012, 04:54:41 pm
argh ok, that makes sense, is there a way to stop it pinging do you know, I presume via lua code it must be possible. I may not actually need it though.
Title: Re: Ping Sensor
Post by: guessed on January 20, 2012, 12:41:12 am
Under UI4, there should be options under Advanced scenes to let you Enable/Disable the pinging behavior.  It's not been tested, but the rough code was added about 2months back.

From Lua, it behaves like a light-switch so you can use the same type of Lua code to Enable (on) or Disable (off) the Pinging behavior like it was a light switch.
Title: Re: Ping Sensor
Post by: trouty00 on January 24, 2012, 01:53:52 pm
I tried the following and it still seems to ping
luup.call_action("urn:upnp-org:serviceId:SwitchPower1", "SetTarget", {newTargetValue = "0"}, 29)

I have made the following change for now

luup.call_action("urn:demo-ted-striker:serviceId:PingSensor1", "SetAddress", {newAddressValue = "192.192.192.192"}, 29)

which does make the change to the IP as shown by the device state JSON but doesn't seem to be changing the IP through the web interface, a "reload" does it through the web interface, not sure if i just need to give it a little time or have to set a manual reload.
Title: Re: Ping Sensor
Post by: guessed on January 25, 2012, 02:39:29 am
@trouty00,
I made a change, and pushed it into apps.mios.com that'll fix that.  I was caching the Enable flag, along with the IP Address to ping, so it would only pick up changes when the Plugin (and hence Vera) was restarted.

These changes have been submitted to apps.mios.com, so they should popout eventually, and auto-update all users.  When they do, you'll be able to enable/disable using the code snippet you have above, and it'll take effect on the next timer execution.
Title: Re: Ping Sensor
Post by: weissertigerxl on January 25, 2012, 10:52:03 am
I use UI4 and when I select form apps.mios.com a plugin ( I tried ping sensor and wake on lan) and it never installs the request one. 1st a TV plugin... and so more.

How can I install them correctly?

And I don't find any installations intructions there? :-)
Title: Re: Ping Sensor
Post by: guessed on January 25, 2012, 11:28:59 am
apps.mios.com is the plugin catalog for UI5 only.

One of the other members here was going to write the Install/Wiki pages for this plugin, but has been bogged down for a few months.  I have no idea when they'll get formal, but they are scattered throughout this discussion thread and also the generic Plugin installation instructions:

    http://wiki.micasaverde.com/index.php/Install_LUUP_Plugins

In UI4, this process is manual, involving downloading each file from the source repository, and uploading it to Vera (etc, per above generic hyperlink)
Title: Re: Ping Sensor
Post by: guest15212 on January 25, 2012, 02:00:25 pm
Correct me if I'm wrong, everything still seems to point to UI4 and not ui5. is this plugin incompatible with UI5?
I've tried to install it, but I'm stuck on having to restart LuuP and not having found the option to do so in UI5


<I'm running on a Vera V3>
Title: Re: Ping Sensor
Post by: chixxi on January 25, 2012, 02:10:29 pm
Quote
having to restart LuuP and not having found the option to do so in UI5

there should be a blue reload button in the upper right corner. this reloads luup...
Title: Re: Ping Sensor
Post by: guest15212 on January 25, 2012, 02:15:10 pm
Quote
having to restart LuuP and not having found the option to do so in UI5

there should be a blue reload button in the upper right corner. this reloads luup...

Thanks for pointing me to the obvious I should have figured out myself. But I have tripped on that button various times already and it didn't bring me any solution. I've tried a reload a couple of times and rebooted 3 times in the past 2 days.
Title: Re: Ping Sensor
Post by: chixxi on January 25, 2012, 02:22:00 pm
sorry about the obvious   ;D

why do you have to do that step manually? if you use a ui5 you can install the plugin automatically through apps.mios.com.

anyway, when you reboot the vera the luup engine is also restartet.
Title: Re: Ping Sensor
Post by: guest15212 on January 25, 2012, 02:25:24 pm
sorry about the obvious   ;D

why do you have to do that step manually? if you use a ui5 you can install the plugin automatically through apps.mios.com.

anyway, when you reboot the vera the luup engine is also restartet.

No pun intended, but I really didn't realize the obvious until now. Anyway, I indeed did install the apps through the in-system "install apps" option and rebooted the device, reloaded it a couple of times, but no luck. It keeps popping up I have to restart LuuP.
Title: Re: Ping Sensor
Post by: davidd1205 on February 24, 2012, 08:05:43 am
Hello

I have an iphone 4 and I would realize a scene when I come home and another when I go
I want to use the iphone to make a presence detection of only the idle cut iphone wifi and therefore pingsensor think I am no longer the
have you had this kind of problem and how did you solved
thank you
Title: Re: Ping Sensor
Post by: nswint on February 27, 2012, 03:59:59 pm
Is there anyway to set the Tripped stated back to 0 after the ping is successful?

Title: Re: Ping Sensor
Post by: guessed on February 27, 2012, 04:09:14 pm
Tripped is re-computed on every ping interval. 

The Dashboard may not always display this, depending upon the specific version of the dashboard you're currently running, and what caching is going on (specifically inside the Device's Dialog, they virtually never refresh the value whilst it remains open).

If it's not the device's dashboard dialog, then you'll need to be more specific on where you're seeing the behavior.
Title: Re: Ping Sensor
Post by: nswint on February 27, 2012, 05:08:57 pm
I'm looking at the code now on mios.com but I would think that the state would be set to 0 each time when the ping is successful.

ie
luup.variable_set(SECURITY_SID, "Tripped", pingResult, parentDevice)

to

luup.variable_set(SECURITY_SID, "Tripped", 0 , parentDevice)


My problem is that tripped flag is not reset back to 0 after a successful ping.
Title: Re: Ping Sensor
Post by: oTi@ on February 27, 2012, 08:48:42 pm
My problem is that tripped flag is not reset back to 0 after a successful ping.
Did you wait until the next ping interval where the ping was unsuccessful?
Title: Re: Ping Sensor
Post by: guessed on April 10, 2012, 12:34:10 am
@mcvflorin,
I see that you closed this out as fixed today.  Can you update the Bug with the specifics on the behavior, and what release this will be made available in?

ie. Leading edge only (0->1), Leading and Trailing edge trip (0->1 and 1->0) etc.
eg. 1.5.xxx or UI4 and UI5?

Quote
How can it be improved so it would be closer to perfection :)?
@mcvflorin,

It's not an issue with your script per se; it's an inherent bug with the LastTrip variable that the script is based on.

Any chance this could get pushed through?
http://bugs.micasaverde.com/view.php?id=1541

JOD.
Title: Re: Ping Sensor
Post by: mcvflorin on April 10, 2012, 09:51:10 am
@guessed

The first firmware which contains the updated file is 1.5.328, built on 1 March, which means that 1.5.346 is the first release that contains the fix.

The LastTrip variable is updated on a 0 to 1 transition of the Tripped variable. If Tripped is "1" and a new trip message comes from the sensor, the LastTrip variable is updated only if more than 15 seconds have passed since it was last updated. When a manual poll is requested by the user, the LastTrip variable is updated only on the 0->1 transition.

Edit: rephrased to be more clear.
Title: Re: Ping Sensor
Post by: guessed on April 10, 2012, 01:32:44 pm
Perfect, thanks! 

That's the behavior I've implemented across my devices already ...except the 15 second thing, but that's isolated to certain whacked Z-Wave devices (from what I understand)
Title: Re: Ping Sensor
Post by: mcvflorin on April 10, 2012, 02:19:48 pm
I rephrased the explanation to be more clear.
Title: Re: Ping Sensor
Post by: jimpapa on April 24, 2012, 02:04:21 pm
I have an Idea that will actually make my HA geekness useful to me :)

Items used:  Ping sensor & Garage Door Plugin


Just ant to run it by ya...

Create a scene that is called Motorcycle Ride. 

Run the scene,  will close garage door, wait ~10 min as to make sure my iPhone is off my WIFI network.

When the iPhone and I come back from the ride... Garage door opens.


I think I can do this all in UI5 without any code ... 


Going to try later and see if I can pull that off ..

Title: Re: Ping Sensor
Post by: strangely on April 24, 2012, 04:11:26 pm
Just bear in mind that your iPhone switches off the WiFi when the screen goes into standby, and this is likely to cause you problems when trying to use your iPhone with any scenes and the Ping plugin.
Title: Re: Ping Sensor
Post by: jimpapa on April 24, 2012, 06:28:26 pm
Hmmm That would be a problem...  Looks like the RFID route my be better
Title: Re: Ping Sensor
Post by: davidd1205 on April 26, 2012, 03:12:41 am
My iphone only activates the wifi if I start the mail app.

This makes the iphone as a presences detector useless.

Could a bluetooth connection work better?
Are there tools to detect bluetooth devices? Can this trigger an event in Vera?

+ 1000 for bluetooth with vera
Title: Re: Ping Sensor
Post by: trouty00 on April 27, 2012, 06:33:30 am
ive been using the ping sensor as trigger to put the kettle on when i get home from work and has been working fine, dont turn the screen on or check mail, it just connects.

maybe I have an app which is always looking to connect to wifi not sure. just tried pinging my ipad which I haven't used this morning and didn't get a response.
Title: Re: Ping Sensor
Post by: big517 on April 27, 2012, 06:43:31 am
In Android you have to go to: settings -network -wifi, then hit the option key on the phone, click "advanced", then "wifi sleep policy" and check "never".  I haven't checked on my iPad 2, but maybe there is a similar option.
Title: Re: Ping Sensor
Post by: jjwatmyself on May 04, 2012, 08:18:40 am
Heads up. It appears that the ping sensor icons are reversed with 1.4 on ui5. Running man has a red background. Standing man has a green background. Also, I have found that the IP field has no effect and that address must be used.
Title: Re: Ping Sensor
Post by: TANE on May 05, 2012, 06:20:22 pm
I have install problems with the plugin.

getting the message No implementation when trying to use the plugin.

Remove of the pluing is giving the next error.
Command failedInvalid plugin

Few times reloaded the Luup and restart the vera.
Title: Re: Ping Sensor
Post by: jjwatmyself on May 16, 2012, 06:14:49 pm
On ui5 I have factory restored and not reinstalled the ping and Google weather plugins. One was causing my vera2 to crash every few hours. This post is not a confirmed instance of either directly causing ui5 in vera2 to crash. If we have any other Vera2 user running ui5 with the ping plugin installed, a post of you results would be helpful.

 2
Title: Re: Ping Sensor
Post by: mcvflorin on May 17, 2012, 03:19:13 am
Unfortunately Vera 2 doesn't have enough memory to run UI5 + certain plugins. The solution is to store the logs (which are in the /tmp directory, which in turn it's in the RAM) on an USB flash drive, so that all the available RAM can be used by LuaUPnP.
Title: Re: Ping Sensor
Post by: frichter09 on July 23, 2012, 03:47:59 pm
Hi everyone,
I have been browsing through this topic but did not find the answer to my question.
Can I use this plugin to also ping certain nodes or does it only support ip's?

Thanks!
Title: Re: Ping Sensor
Post by: guessed on July 23, 2012, 04:22:47 pm
It uses the IP-based "ping" command to reach devices.  So either an IP address, or something that's resolvable to an IP Address, that responds to ping commands is needed.
Title: Re: Ping Sensor
Post by: frichter09 on July 23, 2012, 04:49:18 pm
It uses the IP-based "ping" command to reach devices.  So either an IP address, or something that's resolvable to an IP Address, that responds to ping commands is needed.

Thanks!
My plan was to use this plugin to inform me about power outages and I wanted to ping a certain node for this.
Well, guess this is not possible then - at least with pinging z-wave nodes. I might just ping my DVR instead.

Thanks again!
Title: Ping Sensor
Post by: electricessence on August 27, 2012, 01:24:59 pm
Features I'd like to see with this plug-in:
- Allow for "triggering" a ping instead of waiting for a time delay.
- Allow for disabling/enabling the periodic check.
- Allow for repeated ping confirmation before changing state. It could be a parameter compared against a count. Example:
Sensor state is currently tripped. (computer on)
Sensor pings computer but gets no response. (count +1)
Sensor pings computer and request is answered. (count = 0)
Sensor pings computer but gets no response. (count +1)
 Sensor pings computer but gets no response. (count +1)
Since now the count is greater than 1, it changes to not triggered.
This can allow the user to adjust the robustness/responsiveness.

Title: Re: Ping Sensor
Post by: garrettwp on August 28, 2012, 07:22:56 am
Not sure I follow the last bit. Why add the extra steps and code. Either the ping returns that the computer is available or not. A plugin that I am working on (mostly completed) allows you to enable or disable pinging of the box, and you can change the poll delay. I believe the the current ping sensor plugin also allows for enabling and disabling of the check.

- Garrett
Title: Ping Sensor
Post by: electricessence on August 29, 2012, 12:51:55 pm
It does not enable/disable.
It simply arms/disarms. I guess you could set target on the period to alter how quickly it pings. But let's say you have a setup where you don't need it to ping at all until that scene is active. Having a way to simply trigger it to check is useful. Or at least enable/disable. Although I agree that I wouldn't want to alter the current UI. I'm guessing you could do this in code by changing the period.
Title: Re: Ping Sensor
Post by: parkerc on September 02, 2012, 11:48:14 am
Hi

Please can I just check where the latest version of this plugin is?

I originally installed the plugin from the Vera app store and it tells me that it's v. 0.14 - however I cannot see it listed in the listing anymore  (even if I search for keyword "ping")

Looking at the wiki site (http://wiki.micasaverde.com/index.php/Ping_Sensor_Plugin) it states the last version was 1.4? Although that page was last updated on April 17th 2010

Looking at the mios code page (http://code.mios.com/trac/mios_ping-sensor/browser#trunk) It looks to be source 28. That was last updated 7 months ago by guessed.

* 1.4 and 0.14 could be one and the same ?

Out of interest who owns and manages the roadmap for this plugin nowadays - is it you @guessed ?
Title: Re: Ping Sensor
Post by: garrettwp on September 02, 2012, 11:57:31 am
I used the one posted at code.mios.com. I took the source and modified it to incorporate the wol plugin into the ping sensor plugin. I should have this plugin released very soon. But the one from code.mios.com should suffice.

- Garrett
Title: Re: Ping Sensor
Post by: guessed on September 02, 2012, 12:17:22 pm
Please can I just check where the latest version of this plugin is?
The latest source versions, published or not, are in source control (http://code.mios.com/trac/mios_ping-sensor).
The latest published version is in apps.mios.com as http://apps.mios.com/plugin.php?id=1228.

Quote
Out of interest who owns and manages the roadmap for this plugin nowadays - is it you @guessed ?
I spent some time a while back to "put it back together" as it had spread into all sorts of splinter versions, with code in various places on the forum, and was confusing during the UI5 transition.

The original author doesn't appear to be around anymore, so I recently handed it back to @mcvflorin for ongoing ownership/fixes.
Title: Re: Ping Sensor
Post by: mcvflorin on September 03, 2012, 02:43:04 am
The original author doesn't appear to be around anymore, so I recently handed it back to @mcvflorin for ongoing ownership/fixes.

I don't think I'll have much time to work on this plugin, so if anyone is interested to work on it send me a PM or an e-mail at florin@my.mios.com to give you SVN commit permission to the code.mios.com repository.
Title: Re: Ping Sensor
Post by: flue on December 01, 2012, 04:18:41 pm
I've made some changes to the code. I've added a configurable variable to allow ping failures without changing the status.
Upload the attached file and configure the "allowedFailure" variable.

Now i can relieable detect presence by pinging wifi phone's in my network!

Good luck!
Title: Re: Ping Sensor
Post by: parkerc on December 02, 2012, 04:04:21 am
Hi Flue

What variable settings do you use and as a result how do you feel it has become more reliable as a result ?
Title: Re: Ping Sensor
Post by: flue on December 02, 2012, 06:35:52 am
Hi Parkerc,

I added the variable "allowedFailure". You can define the number of ping failures before the armed status will change.

In my case i monitor android phones by IP address. Sometime the phones do not responde within 1 second. This resulted in armed status changes 10/15 times a day. Now i have configured the amount of failures accepted.

For example: the scripts pings every 15 seconds. when you configure allowedFailure to 4, the script accepts 1 minute (4x failed ping) before state changes. When de device send a response withing 4 pings, the counter is been reset. With set to 4, the ping online have to be positive 1 out of 5 times (4 + original 1 ping).
Title: Re: Ping Sensor
Post by: Intrepid on December 02, 2012, 11:20:54 am
This a somewhat of a sidetrack networking question, but it is ping-related.  If anyone can help I'd appreciate it.

I have a comcast SMC modem/router.  I have two routers attached to to the SMC.  A DLink and an Airport Extreme.  I use the DLink for my camera server and wireless cameras and XBoxes, and the Airport extreme for all other devices including vera.  It works well this way, totally separate subnets.  Each router does its own DHCP.

The main reasons for the two APs are (1) xbox live needs UPNP (dlink does this well, apple does not) and (2) i port forward my camera server outside the LAN so I can view my cameras from the internet.  These somewhat risky devices are isolated from the rest of my network.

I cannot ping DLink devices from my apple router, which is what I expect.  But is there a safe way to allow this while keeping the networks separated?  I would like to be able to ping my xbox (on DLink) from my vera (airport).

Thanks.
Title: Re: Ping Sensor
Post by: parkerc on December 03, 2012, 02:35:28 am
I don't think you can ping other devices if they are on a different subnets?
Title: Re: Ping Sensor
Post by: garrettwp on December 03, 2012, 02:58:23 am
Not unless you add the proper routes for each subnet. This in turn would defeat the purpose of having isolated networks.

- Garrett
Title: Ping Sensor
Post by: futzle on December 03, 2012, 06:31:50 am
Intrepid, you may be able to set up forwarding for a specific source IP, a specific target IP and a specific protocol (for ping, ICMP). But most consumer routers haven't got firewall software sophisticated enough to do it.  The chances of your ISP-supplied modem/router having this kind of control are unlikely. Most consumer equipment can only forward nothing or everything, the latter leading inevitably to what Garrett said.

Ironically, OpenWrt can do this with iptables.
Title: Re: Ping Sensor
Post by: GroundLoop on December 26, 2012, 03:18:39 pm
Ping Sensor is exactly what I was looking for.
I'd like to set the house to "away" (turn off the lights, I'm not the electric company.) when three phones have left the building.

The phones are always on WiFi, and have fixed IP addresses on the LAN, so that part is fine.
The Combination Switch plug-in looks like a good way to create a voting or 3-of-3 system to trigger a Scene.

So.. How do I create multiple instances of the Ping Sensor?  Is there a common trick to this (or multiple Combination Switches, for that matter)

When I install the plug-in, I get one Ping Sensor. It supports one IP address and does its thing.
How do I make three of them with different IP address settings?

Thanks!
Title: Re: Ping Sensor
Post by: Otje on December 26, 2012, 05:16:37 pm
Hi

normally with apps you can create multiple instances when you go back to the APPS section and then click on the name of the Ping plugin to open it.
in the menu you can then click the button to create another instance.
hope it works
Title: Re: Ping Sensor
Post by: Crismaison on December 27, 2012, 07:16:37 am
After checking the IP (1900 secs) the sensor stays tripped for a certain amount of time and goes back into untripped mode after a couple of minutes. I want to have the status tripped until the sensor checks the IP (1900 secs) again. Is the behaviour of the sensor wrong or am I overlooking the staying tripped period variable?

Background, I have my Iphone checking the mail every 15 min and trying to run the sensor in the same interval, hoping it bypasses this stupid sleepmode
Title: Re: Ping Sensor
Post by: stappy on December 29, 2012, 10:04:09 am
Hi flue,

Thanks for the effort to modify the Ping Sensor.
I've been unable to change the value of "allowedFailure" in my installation. That is, if I change the value to say 8 and then hit the save button, when I go back the value has been reset to the default, 4. Are you able to change the value? (Vera3 UI5 1.5.408)

btw, any plans to get this modification into the "official" version so we don't have to worry about Vera overwriting the xml file.

Thanks
Title: Re: Ping Sensor
Post by: GroundLoop on December 29, 2012, 02:07:32 pm
I'd really like to get Ping Sensor to work, but the model doesn't seem quite right.

Ideally, I'd like to use it as a slow-response indication of whether someone is home.
If any of three phones responds to a ping, then Someone Is Home.

The problem is that all the phones periodically drop off WiFi (for power saving, most likely), so it's hit or miss whether they check in.

I'd like logic that goes something like:
Ping IP address -- if you get a positive response, you're good for XX minutes.  make "True", Sleep, wait, do not ping again.
After XX minutes, ping again.  If you get no response, don't panic just yet.  Keep pinging every XX seconds until either 20 minutes pass or you get a positive response.
Only then, mark absent.

Right now the Plug-In gets a little anxious, even if I set the poll time to slow.  It has a lot of false toggles.
I'd like it to be more like a slow motion detector.
Then it would be useful as a "Here, let me turn off all these lights for you." indication.

Alternatively, I'm thinking of somehow tying it into DHCP -- make the lease really short-term, 10 minutes or so, and then when all the leases expire without renewal, you know nobody is home.  Not sure how to have Vera query if the lease is valid. :)
Title: Re: Ping Sensor
Post by: strangely on December 29, 2012, 02:16:41 pm
I'd really like to get Ping Sensor to work, but the model doesn't seem quite right.

Are you using the latest version of the plugin with the "allowedFailure" adjustment?

I think if you use that in tandem with some Luup code, or with the combination switch plugin, or the Program Logic Event Generator plugin, then you should be able to get it to so what you want if you can adjust it for allowed failures with the latest ping sensor plugin addition.
Title: Re: Ping Sensor
Post by: parkerc on December 29, 2012, 02:37:14 pm
@GroundLoop

Maybe look at determining presence in a different way, for example, if you have door sensors, you could consider that you only really need to do a ping test if one of those has been tripped.

Plus, while phones may sleep and drop off tge network to conserve power, you can still wake them up. For example I use the Notification plugin (backed off to Prowl) which allows me to send a notification to all registered smart phones when the door sensor is tripped.

From the limited tests ive done so far, that notification wakes up the phone  (via 3G) allowing it then momentarily connects back onto the wifi network, thereby obtaining its assigned static address, thus updating the Ping Sensor status

So from a 'users' perspective they're all being told the door has been opened, yet at the same time the Vera ping sensor is checking for me who's phones is still in the house.






Title: Re: Ping Sensor
Post by: parkerc on January 03, 2013, 05:36:21 am
If anyone is looking to do an update to th current Ping Sensor, one enhancement I would like to see is on th device/plugin UI that it also shows you the date/time of the last successful ping .

That way if you notice it has tripped you can see when the last good connection was made?
Title: Re: Ping Sensor
Post by: RLKinMD on January 12, 2013, 09:45:13 pm
Used Ping Sensor to email me when the house loses power.

So I read the whole thread....  Many hours later and many attempts later, I have a working sensor with a set of scenes that send emails to myself and my wife when the networked printer in the house fails to respond to ping (i.e. there is a power failure in the house or someone turned the printer off). A few more scenes send emails when the printer starts to respond to ping again (power is restored)

This is how I configured the ping sensor to work:
ip address <printer ip address> must be static ip address
under advanced, variables, I set address to <printer ip address>
under advanced, I set invert to 1 so that ping responses show as green and ping failures show as red.
set up four scenes (no power email to wife, no power email to me, power on email to wife, and power on email to me)
the trigger type was "A sensor is tripped" - I did not use "an armed sensor is tripped"
the "no power" emails trigger setting after the name field is "device is tripped" while the "power on" emails trigger setting under the name field is "device is not tripped"

Now I have to buy an UPS to keep the Vera Lite alive long enough to send the "no power" emails. The router and FiOS boxes are already on an UPS.

Thanks to everyone on the thread (esp. TedStriker and guessed) for the prior art and time that went in to creating the app.
Title: Re: Ping Sensor
Post by: allmoney.ws on January 27, 2013, 03:21:51 pm
1) I aploaded file with AllowedFailure
http://i.imm.io/UjG0.png
2) In devices I have phone:
http://i.imm.io/UjGv.png
3) I created trigger:
http://i.imm.io/UjGY.png
and new scene:
http://i.imm.io/UjHs.png
4) Save, reload

Try to switch OFF wi-fi on phone - wait 2 minutes - red pic not changed to green and scene not run. Manually if I click "Run" all is OK with scene.
Any ideas? Bug in AllowedFailure file?
Title: Re: Ping Sensor
Post by: Andersen on February 15, 2013, 10:57:40 am
Hi all,

Running a Vera 2 on UI5 - latest (public) firmware.

I downloaded the Ping Sensor app from the app section and managed to setup a system in which the ping sensor could check whether my iPhone was on the home wifi. This detection was used by Vera to decide whether heating should be lowered during late morning hours (Combination Switch in combination with a couple of scenes and virtual switches) (lowered heat if I was working in the office in the city (left home) or normal heatsetting if I was working from home).

This was working quite slick, however....

After activating the Ping sensor plugin my Vera 2 seems to become unresponsive after a couple of hours and will require power off power on  :(

The pattern seems quite consitent.

So I have pulled the plug on the Ping Sensor an made a restore from a backup - now everything is back in order.

However I would like to have the Ping Sensor up and running...

Does anybody have experienced the same pattern?

From the thread it is not possible for me to see whether the app-version in the app-section is fully functional - can somebody confirm?

Any ideas for getting my system running solid including the Ping sensor app?
Title: Re: Ping Sensor
Post by: allmoney.ws on February 17, 2013, 11:28:03 am
Hi all,

Running a Vera 2 on UI5 - latest (public) firmware.

I downloaded the Ping Sensor app from the app section and managed to setup a system in which the ping sensor could check whether my iPhone was on the home wifi. This detection was used by Vera to decide whether heating should be lowered during late morning hours (Combination Switch in combination with a couple of scenes and virtual switches) (lowered heat if I was working in the office in the city (left home) or normal heatsetting if I was working from home).

This was working quite slick, however....

After activating the Ping sensor plugin my Vera 2 seems to become unresponsive after a couple of hours and will require power off power on  :(

The pattern seems quite consitent.

So I have pulled the plug on the Ping Sensor an made a restore from a backup - now everything is back in order.

However I would like to have the Ping Sensor up and running...

Does anybody have experienced the same pattern?

From the thread it is not possible for me to see whether the app-version in the app-section is fully functional - can somebody confirm?

Any ideas for getting my system running solid including the Ping sensor app?

I have similar problems.
When I go back to home after long time - my vera restarted itself.
Sometimes when I switch off devices - they switch on but they must not to do it because I not leave home for a long time.
In my case I think that this plugin freeze vera too. :(
Title: Re: Ping Sensor
Post by: Andersen on February 22, 2013, 06:47:08 am
I was wondering if any one runs a succesfull setup including this plugin?
Title: Re: Ping Sensor
Post by: parkerc on February 23, 2013, 02:42:19 am
Those of you have trouble with the Ping Sensor, does the same thing occur if you use the 'WOL and Ping Sensor' plugin - http://forum.micasaverde.com/index.php/topic,11641.0.html
Title: Re: Ping Sensor
Post by: guessed on February 23, 2013, 11:38:09 am
I was wondering if any one runs a succesfull setup including this plugin?
I use it to detect power outages in the house.  Vera, and all my wired comms gear is on UPS, so I just ping something that isn't (like a wifi router)
Title: Re: Ping Sensor
Post by: lolodomo on February 23, 2013, 11:54:39 am
Ok for me, I am just pinging one particular IP.
Title: Re: Ping Sensor
Post by: a-lurker on February 23, 2013, 03:26:59 pm
I have a set up where I ping a cell phone. Every couple of days, when it feels like it, it doesn't reply to a ping even though it's on the charger just sitting there. I set up WinSCP to see what was going on. As soon as the missing ping occurred I found that I could not manually ping the phone either. That is the phone was sitting right there and unpingable by the plugin or by doing it manually.

Seconds later the cell phone became pingable again. I don't know why: could be just plain radio interference blocking the RF link from time to time or it could be a network blockage in the router / switch. Probably the former. I would like to see the ping sensor modified so that if it detects a missing ping that it has another try a short time later (user specified interval but about 10 seconds?) before deciding the device is unpingable. This could be extended further so you could also specify the interval and a number of retries as well.
Title: Re: Ping Sensor
Post by: Andersen on February 25, 2013, 03:19:45 am
Those of you have trouble with the Ping Sensor, does the same thing occur if you use the 'WOL and Ping Sensor' plugin - http://forum.micasaverde.com/index.php/topic,11641.0.html

I will try the WOL plugin and revert back - thank you for the tip.
Title: Re: Ping Sensor
Post by: ExHempKnight on March 26, 2013, 10:52:57 pm
I've installed the updated I_PingSensor.xml file, and now the plugin won't untrip. I've got it set to the IP address of my phone, and when I turn off the phone's wifi, The Ping Sensor stays tripped. I've checked my dashboard from work, and it'll be still tripped. All day.

Period is set to 15, AllowedFailure to 4.

It worked fine before I installed the updated file. I was having the same problem that was the reason for adding AllowedFailure in the first place, but have run into an entirely different problem.
Title: Re: Ping Sensor
Post by: Andersen on April 09, 2013, 08:43:29 am
I Can confirm that my serup seems to work fine with WOL sensor App instead of Ping sensor app.

I must note that I have attached an USB stick to my Vera2 In the meantime.

Thanks again.
Title: Re: Ping Sensor
Post by: allmoney.ws on April 21, 2013, 07:36:23 am
AllowedFailure works for anybody good?
Title: Re: Ping Sensor
Post by: nono240 on May 05, 2013, 07:42:04 am
I have a set up where I ping a cell phone. Every couple of days, when it feels like it, it doesn't reply to a ping even though it's on the charger just sitting there. I set up WinSCP to see what was going on. As soon as the missing ping occurred I found that I could not manually ping the phone either. That is the phone was sitting right there and unpingable by the plugin or by doing it manually.

Seconds later the cell phone became pingable again. I don't know why: could be just plain radio interference blocking the RF link from time to time or it could be a network blockage in the router / switch. Probably the former. I would like to see the ping sensor modified so that if it detects a missing ping that it has another try a short time later (user specified interval but about 10 seconds?) before deciding the device is unpingable. This could be extended further so you could also specify the interval and a number of retries as well.


Your phone is going to deep sleep, shutting down wireless interfaces to save battery and will go online later to "sync". Normal behavior =)
But I agree that a great feature would be to allow a "timeout" before reporting it as unstripped.
I'll try to modify the sources by myself.
Title: Re: Ping Sensor
Post by: allmoney.ws on May 05, 2013, 08:05:02 am
I'll try to modify the sources by myself.
Great!!! Will wait your modification :))
Title: Re: Ping Sensor
Post by: nono240 on May 05, 2013, 08:05:49 am
I've made some changes to the code. I've added a configurable variable to allow ping failures without changing the status.
Upload the attached file and configure the "allowedFailure" variable.

Now i can relieable detect presence by pinging wifi phone's in my network!

Good luck!

Exactly what I was looking for, I was on the way to wrote it myself =)

EDIT: your code is buggy, see my corrections below
Title: Re: Ping Sensor
Post by: nono240 on May 05, 2013, 08:09:44 am
Great!!! Will wait your modification :))

No need to wait, I just saw that flue made a modification to add a number of failures (http://forum.micasaverde.com/index.php/topic,1997.msg93556.html#msg93556). Just upload its my implementation file, and set how many failure you want before going stripped : for example if you want a 30min delay, and if you're polling every 15s, just set the allowed failure value to 120   ;)

Please note I haven't tested it yet.

EDIT: Just tested, and the code is buggy, the startup code overrides whatever AllowedFailure we set, and moreover the device stay tripped because of the algorithm.

Attached, the corrected version. ::)

For anyone interested, here is the diff:

Code: [Select]
--- I_PingSensor.xml.old        2013-05-05 16:59:17.588279616 +0200
+++ I_PingSensor.xml    2013-05-05 18:30:29.051411137 +0200
@@ -36,7 +36,7 @@
     --
     -- Initializes variables if none were found in config
     --
-    local function initSettings(address, period, invert, enable)
+    local function initSettings(address, period, invert, enable, allowedFailure)
       --
       -- Create a fallback delay if no parameters are given
       --
@@ -75,12 +75,13 @@
       local period = luup.variable_get(PING_SID, "Period", parentDevice)
       local invert = luup.variable_get(PING_SID, "Invert", parentDevice)
       local enable = luup.variable_get(SWITCH_SID, "Status", parentDevice)
+      local allowedFailure = luup.variable_get(PING_SID, "AllowedFailure", parentDevice)
 
       --
       -- init configuration variables if they were empty
       --
       if (address == nil or period == nil or invert == nil or enable == nil or allowedFailure == nil) then
-        address, period, invert, enable = initSettings(address, period, invert, enable)
+        address, period, invert, enable = initSettings(address, period, invert, enable, allowedFailure)
       end
 
       return address, period, invert, enable
@@ -189,21 +190,21 @@
       -- Store the current ping result only when it has changed
       local origTripped = luup.variable_get(SECURITY_SID, "Tripped", parentDevice)
       origTripped = origTripped or "0"
-         
-         local allowedFailure = luup.variable_get(PING_SID, "AllowedFailure", allowedFailure)
-         
-         -- Last result was positive, current result is negative, and the allowed failures is not reached
-         -- keep pingresult positive as long allowedFailure is not reached
-         if (origTripped == "1" and pingResult == "0" and allowedFailureNum &lt; allowedFailure) then
-               allowedFailureNum = allowedFailureNum + 1
-               pingResult = 1
-               log("ping failed, allowedFailureNum " .. tostring(allowedFailureNum))
-         end
-
-         -- If pingresult is positive, always reset allowedFailureNum
-         if (pingResult == "1") then
+
+       local allowedFailure = luup.variable_get(PING_SID, "AllowedFailure", parentDevice)
+         
+       -- If pingresult is positive, always reset currentFailureNum
+       if (pingResult == "1") then
                allowedFailureNum = 0
-         end
+       end
+
+       -- Last result was positive, current result is negative, and the allowed failures is not reached
+       -- keep pingresult positive as long allowedFailure is not reached
+       if (origTripped == "1" and pingResult == "0" and allowedFailureNum &lt; tonumber(allowedFailure)) then
+               pingResult = "1"
+               allowedFailureNum = allowedFailureNum + 1
+               log("ping #"..parentDevice.." failed, failure = " .. allowedFailureNum .. "/".. allowedFailure)
+       end
         
         
       if (origTripped  ~= pingResult) then

Any chance to get this modification upstream? Who's the maintainer?
Title: Re: Ping Sensor
Post by: a-lurker on May 05, 2013, 06:46:59 pm
Re mobile turning off WiFi to conserve battery: this phone is sitting on the charger all the time, so I'm not sure why it would be turning off the WiFi link. The phone only fails to reply to a ping on rare occasions, so it seems it's more likely to be a network issue.

Mmm - I also missed the work @Flue had done, buried deep in some post, way back. I haven't tried the latest code but noticed that allowedFailure is not returned by initSettings.

Code: [Select]
**** In  function initSettings:
return address, period, invert, enable

****  In  function readSettings
address, period, invert, enable = initSettings(address, period, invert, enable, allowedFailure)
Title: Re: Ping Sensor
Post by: nono240 on May 06, 2013, 01:34:31 am
Quote

Mmm - I also missed the work @Flue had done, buried deep in some post, way back. I haven't tried the latest code but noticed that allowedFailure is not returned by initSettings.

You need to consider the code in the whole. Just use my implementation above, trust me, it works.
Title: Re: Ping Sensor
Post by: parkerc on May 06, 2013, 01:51:19 pm
Any chance to get this modification upstream? Who's the maintainer?

I seem to recall this plugin is ownerless (an orphan) so @mcvflorin had taken it under his wing.  If someone was interested in taking care of it, feeding and watering then maybe private message @mcvflorin and maybe something can be sorted out.

(It's a great plugin and would benefit from som TLC)
Title: Re: Ping Sensor
Post by: nono240 on May 06, 2013, 01:54:16 pm
I seem to recall this plugin is ownerless (an orphan) so @mcvflorin had taken it under his wing.  If someone was interested in taking care of it, feeding and watering then maybe private message @mcvflorin and maybe something can be sorted out.

(It's a great plugin and would benefit from som TLC)

I'm willing to. I can't live without it. Will send an email to mcvflorin
Title: Re: Ping Sensor
Post by: allmoney.ws on May 07, 2013, 04:45:26 pm
nono240
It works!! Thanks!
But...
I set
Period = 5
AllowedFailure = 12

I turned off WiFi and it showed that I offline only after 2 minutes (not 1 min. 5x12=60sec)... Can't understand why...  ???
Title: Re: Ping Sensor
Post by: RichardTSchaefer on May 07, 2013, 07:44:52 pm
When it is successful the period is probably the poll inteval.
When it fails it's probable the poll interval + the timeout interval.
Title: Re: Ping Sensor
Post by: nono240 on May 09, 2013, 12:06:55 pm
nono240
It works!! Thanks!
But...
I set
Period = 5
AllowedFailure = 12

I turned off WiFi and it showed that I offline only after 2 minutes (not 1 min. 5x12=60sec)... Can't understand why...  ???

5 sec is a very low period that I dont recommend, not sure the timer is accurate enough to go exactly every 5s (even more if your VERA is really busy). Could you try with an acceptable period (30 to 60s should be enough for most cases) and allowed failure between 5 and 10 ?

BTW, thanks to mcvflorin, I'm now responsible/admin of the plugin :D I'll push that feature upstream once tested enough. Waiting for your feedbacks!  ::)
Title: Re: Ping Sensor
Post by: garrettwp on May 09, 2013, 01:38:03 pm
Nono,

Do you mind if I take your changes and add it to my wol plus ping plugin?

- Garrett

Title: Re: Ping Sensor
Post by: nono240 on May 09, 2013, 01:42:41 pm
Nono,

Do you mind if I take your changes and add it to my wol plus ping plugin?

- Garrett

Absolutely no worries. But You probably want to wait for the official release? The implementation doesn't actually remember the failure count over luup engine restart. I'm implementing it.
Title: Re: Ping Sensor
Post by: parkerc on May 09, 2013, 02:09:34 pm
Hi @nano240
BTW, thanks to mcvflorin, I'm now responsible/admin of the plugin :D I'll push that feature upstream once tested enough. Waiting for your feedbacks!  ::)

Well done, this plugin has had lots of interest since its first release, but no controlled investment for a while due to a lack of clear ownership. 

I look forward to your first 'official release'
Title: Re: Ping Sensor
Post by: nono240 on May 09, 2013, 02:15:52 pm
Quote
I look forward to your first 'official release'

My current branch is:

http://code.mios.com/trac/mios_ping-sensor/browser/branches/nono240

You'll find my latest implementation (the failure count is now persisting over luup engine restart  ;))

You can just upload the implementation file (I_PingSensor.xml) if you're already running the latest plugin version.

I need feedbacks before publishing  ;D
Title: Re: Ping Sensor
Post by: nono240 on May 11, 2013, 03:36:37 am
Ok, just added a "Settings" tab that will help newbie:

http://i.imgur.com/TbU71ys.png

The "Device Timeout" field will automagically set the AllowedFailure variable for you  ;D

Moreover, the failure count will survive to luup engine restart.

Attached the beta version. Waiting for feedbacks.
Title: Re: Ping Sensor
Post by: allmoney.ws on May 11, 2013, 04:56:55 am
5 sec is a very low period that I dont recommend, not sure the timer is accurate enough to go exactly every 5s (even more if your VERA is really busy). Could you try with an acceptable period (30 to 60s should be enough for most cases) and allowed failure between 5 and 10 ?

5 sec = 5000 ms, it's not low period :))) I would like to run Scene quickly when my phone start ping... All work correct, but I can't understand why it show that phone OFF only after 2 minutes,.. not after 1... Maybe Vera developers can answer?..
Title: Re: Ping Sensor
Post by: nono240 on May 11, 2013, 05:45:49 am
I repeat : the Vera is NOT a real time device. Timers won't go exactly every 5s, even more if the Vera CPU is really busy. Background task.

Title: Re: Ping Sensor
Post by: RichardTSchaefer on May 11, 2013, 07:18:51 am
I guess you missed my previous answer ...

http://forum.micasaverde.com/index.php/topic,1997.msg111889.html#msg111889

A review of the code verified my previous assumption.

@nono240
Maybe you should replace period with delay ...
The length of time a single ping takes is dependent on a number of things ... If the network is good it can be done in  10-100 ms.   If the device is not present it takes about 10 seconds to timeout.
Title: Re: Ping Sensor
Post by: nono240 on May 11, 2013, 07:57:02 am
I guess you missed my previous answer ...

http://forum.micasaverde.com/index.php/topic,1997.msg111889.html#msg111889

A review of the code verified my previous assumption.

@nono240
Maybe you should replace period with delay ...
The length of time a single ping takes is dependent on a number of things ... If the network is good it can be done in  10-100 ms.   If the device is not present it takes about 10 seconds to timeout.

You're right, the "poll delay" minus whatever processing time it takes of course.
Title: Re: Ping Sensor
Post by: allmoney.ws on May 12, 2013, 07:30:03 am
I have 2 scenes.

When all phones OFF (no ping) - av+dream OFF run
When any phone ON (ping) - av+dream ON run

But if I av+dream OFF run manually - it's run av+dream ON again (I can't turn OFF if I at home - every time it turn ON again...). How can I fix it? If I manually run OFF - it's not must run ON... Please, help!

UPDATE: I set AllowedFailure to 0 and try again - all works correctly! Not run ON after manual OFF!!! Is it bug? Or how can I fix it if I need AllowedFailure not to be 0?
Title: Re: Ping Sensor
Post by: nono240 on May 19, 2013, 07:53:31 am
Just to let you know that v0.15 is now upstream and official =)
Title: Re: Ping Sensor
Post by: chuck1026 on May 20, 2013, 05:28:18 am
Just to let you know that v0.15 is now upstream and official =)

So is that why the "Normal" and "Invert" buttons have reappeared? I liked not having them on the dash and only under the wrench...
Title: Re: Ping Sensor
Post by: panopek on May 20, 2013, 07:12:24 am
hi,
after soft change Ping Sensor doesn't exist as the trigger, also you cannot set any notification in it. I have VeraLite soft ver.1.5.622. Have any of you this problem?
Title: Re: Ping Sensor
Post by: nono240 on May 20, 2013, 12:12:19 pm
hi,
after soft change Ping Sensor doesn't exist as the trigger, also you cannot set any notification in it. I have VeraLite soft ver.1.5.622. Have any of you this problem?

Just noticed the problem, will look at it and push an update.

EDIT: attached the corrected .json file (sorry for the inconvenience)

Btw, I was asking for beta testers for days :-P
Title: Re: Ping Sensor
Post by: RichardTSchaefer on May 20, 2013, 01:32:51 pm
Yep,
 I had complaints about Vera Alerts not working ... and tracked it down to the 0.15 version of the Ping Sensor.
Title: Re: Ping Sensor
Post by: Intrepid on May 25, 2013, 12:19:02 pm
i just installed this to monitor my camera server which randomly blue screens.  it seems to work great and sends me a notification when it is offline.  i have an outdoor appliance module on the pc to power cycle it.  gotta love this stuff.
Title: Re: Ping Sensor
Post by: chuck1026 on May 25, 2013, 01:08:48 pm
Suddenly on the dashboard I have Ping Sensor with "Normal" and "Invert" buttons again... is there a way to hide these? They seem fine under the Advanced tab since it is a "set it and forget it" kind of thing.
Title: Re: Ping Sensor
Post by: nono240 on May 26, 2013, 05:15:02 am
Suddenly on the dashboard I have Ping Sensor with "Normal" and "Invert" buttons again... is there a way to hide these? They seem fine under the Advanced tab since it is a "set it and forget it" kind of thing.

I'll move that to the "Settings" tab in the future release.
Title: Re: Ping Sensor
Post by: LightsOn on July 21, 2013, 06:59:43 am
Hi all,

Many thanks for the plugin great stuff.

I need lua code to check if status of ping sensor is tripped and then to run an else / if cmd.  I can work it all out except the lua code to get status (groped or not tripped). Any thoughts?

Sent from my HTC HD2 using Tapatalk 2

Title: Re: Ping Sensor
Post by: simonnet on July 22, 2013, 08:26:07 pm
Hello
I'm wondering, if there is ability to add additional sources for pinging, and also receive statuses for that sources? can anyone program this in this ping sensor ?
And also i have a problem with this plugin, i have installed PLEG plugin, and trying to receive status from ping plugin, but it always shoes me "1".

as you can see in the screenshot "ping 1" is fake address, and "ping 2" is real. May be i'm doing something wrong?
Title: Re: Ping Sensor
Post by: LightsOn on July 23, 2013, 06:13:46 am
Hi Simonnet,

re: " if there is ability to add additional sources for pinging" you can add another ping sensor to ping another IP address if you like?  as they are virtual you can have as many ping sensors as you like similar to virtual switches etc. just create another.  is that what you mean?

I thought I would share my code that I am using that is currently not working.  As per my previous post I am trying to get status of the ping sensor via LUA code. e.g. tripped or not tripped.  the below code does not seem to work :-(

Code: [Select]
local lul_tmp = luup.variable_get("urn:micasaverde-com:serviceId:SecuritySensor1","Tripped",839)

if (lul_tmp=="1")

then luup.call_action("urn:futzle-com:serviceId:CountdownTimer1", "RestartTimer", {}, 843)
else
end

Title: Re: Ping Sensor
Post by: simonnet on July 23, 2013, 10:12:19 am
Hi Simonnet,

re: " if there is ability to add additional sources for pinging" you can add another ping sensor to ping another IP address if you like?  as they are virtual you can have as many ping sensors as you like similar to virtual switches etc. just create another.  is that what you mean?
Thank you, virtual devices that's what i need.

Quote
I thought I would share my code that I am using that is currently not working.  As per my previous post I am trying to get status of the ping sensor via LUA code. e.g. tripped or not tripped.  the below code does not seem to work :-(

Code: [Select]
local lul_tmp = luup.variable_get("urn:micasaverde-com:serviceId:SecuritySensor1","Tripped",839)

if (lul_tmp=="1")

then luup.call_action("urn:futzle-com:serviceId:CountdownTimer1", "RestartTimer", {}, 843)
else
end
unfortunately i can't help you with your code, at the first sight it looks correct....
May be you also can try PLEG? But PLEG action doesn't support LUA coding
Title: Re: Ping Sensor
Post by: LightsOn on July 23, 2013, 10:30:58 am
Thanks Simonnet,

I am sure I can get the sensor status but not sure if the LUA is correct - perhaps I need to use "motionsensor1" instead of "securitysensor1"?

If anyone has this LUA working for a similar implementation to how I want it I would be interested to hear.  ;D
Title: Re: Ping Sensor
Post by: Da_JoJo on July 23, 2013, 10:36:36 am
urn:upnp-org:serviceId:SwitchPower1  for set disarm/arm
http://wiki.mios.com/index.php/Luup_UPNP_Files#SecuritySensor1 (http://wiki.mios.com/index.php/Luup_UPNP_Files#SecuritySensor1)
Title: Re: Ping Sensor
Post by: guessed on July 23, 2013, 10:45:42 am
Remove the "else" since that block (currently) contains no statements. 

The original SID is correct, and doesn't need to change (the underlying Service is the same for all sub-types of security sensor)

You should also "return true" at the end.

Not sure how you got DeviceIds that are high like that...
Title: Re: Ping Sensor
Post by: LightsOn on July 23, 2013, 11:04:06 am
Hi Guessed,

Thank you for your help, I appreciate your time.

How does this now look, cant try till tonight:

Code: [Select]
local lul_tmp = luup.variable_get("urn:micasaverde-com:serviceId:SecuritySensor1","Tripped",839)

if (lul_tmp=="1")

then luup.call_action("urn:futzle-com:serviceId:CountdownTimer1", "RestartTimer", {}, 843)

end

return true

I have been tinkering with Vera for around a year so plenty of adding and removing devices has led to the number increasing  ???
Title: Re: Ping Sensor
Post by: guessed on July 23, 2013, 11:29:14 am
It looks correct now, at least from a syntax standpoint.
Title: Re: Ping Sensor
Post by: LightsOn on July 23, 2013, 11:32:30 am
Brilliant, Many :) thanks I shall try it tonight and report back how I get on.
Title: Re: Ping Sensor
Post by: LightsOn on July 24, 2013, 02:38:24 pm
Hello again,

Sadly the above does not work? very odd? I am UI5 and have installed as per app store with no other changes.  it is the 2nd ping sensor I have working. but I cant get the code to work.

I have also tried code variables from here where there is a similar discussion from some time ago:

http://forum.micasaverde.com/index.php/topic,4943.0.html (http://forum.micasaverde.com/index.php/topic,4943.0.html)

any other thoughts? I am stumped on this one?  ???
Title: Re: Ping Sensor
Post by: guessed on July 24, 2013, 03:28:30 pm
Hello again,

Sadly the above does not work? very odd? I am UI5 and have installed as per app store with no other changes.  it is the 2nd ping sensor I have working. but I cant get the code to work.

I have also tried code variables from here where there is a similar discussion from some time ago:

http://forum.micasaverde.com/index.php/topic,4943.0.html (http://forum.micasaverde.com/index.php/topic,4943.0.html)

any other thoughts? I am stumped on this one?  ???
Ok, so we might need to get back to first principals.  A few questions/comments:

a) What are you really looking to have it do?
b) Where do you have this Luup code tied in?
c) When you say "doesn't work" do you mean "it errors out", or "doesn't do what I want it to"?

Screenshots, 1000 words and all that.
Title: Re: Ping Sensor
Post by: LightsOn on July 24, 2013, 03:51:59 pm
Hi Guessed,

Many thanks.

I have a countdown timer, a ping sensor, a scene to check if ping sensor is tripped to  then restart timer or not.

Logic is to have the scene run every minute on a schedule (easy enough) and in the scene just have the Luup code.

I want for the code to run on schedule and check if the ping sensor is tripped - if it is then I want for the timer to restart, if it is not tripped I want it to do nothing.

I then have other scenes that do things on the count down timer starting or completing and these all work fine.

I am using the device ID's and scene Numbers and I am assuming this is correct? 

I am not getting error's from vera stating lua code is wrong (apart from when it is of course, when trying out things) however instead of the timer restarting when the ping sensor is tripped or of course timing out when it is not the timer just repeatedly keeps restarting.  so in essence no matter what Luup code I am using the timer count down time keeps restarting when condition in luup is met or not identifying that it is not working correctly.

For testing I have the ip in the ping sensor set to one that will not cause it to trip.  I then test the code in the scene and hope that the end result will be that the count down timer completes - but so far all it does is keeps restarting where as it should not do that until it notices that the ping sensor is tripped.

I should perhaps look at PLEG for this - however I am still a PLEG virgin! although I have seen that some one else with a similar issue to me too had troubles so could it be a pingsensor thing perhaps?  http://forum.micasaverde.com/index.php?topic=13277.0 (http://forum.micasaverde.com/index.php?topic=13277.0)

hope my ramble helps somewhat?

Thanks again for your help and guidance.

Title: Re: Ping Sensor
Post by: guessed on July 25, 2013, 12:31:50 pm
ok, so the block of Luup code is setup to run periodically via some scene that you've defined.

Quote
I am using the device ID's and scene Numbers and I am assuming this is correct? 
For the calls being made in this Luup block, the parameters passed are both DeviceID's (839 should be the Ping Sensor's DeviceId, and 843 should be the one for @futzle's CountdownTimer)

It would be worthwhile double-checking that you have these correct.

I'm not familiar with the countdown timer either, so if it has any form of auto-reset, you should also check it's not set either.

(or, for that matter, any other "test" scene you may have previously defined that could be doing it)

Quote
...however instead of the timer restarting when the ping sensor is tripped or of course timing out when it is not the timer just repeatedly keeps restarting.  so in essence no matter what Luup code I am using the timer count down time keeps restarting when condition in luup is met or not identifying that it is not working correctly.
If you look at the Ping Sensor, is it indicating Tripped or not?  Given you've pointed it to a Ping Device who's IP Address doesn't exist, it should indicate that it's not tripped.

Quote
I should perhaps look at PLEG for this - however I am still a PLEG virgin!
Possibly.  When I start these discussions, I assume that people are interested in learning how to do it from first principles, but that's not for everyone.  More than happy to continue to try and diagnose this, but if it gets too frustrating/time consuming for you, then you may be easier going with the more declarative route with PLEG.
Title: Re: Ping Sensor
Post by: LightsOn on July 26, 2013, 05:43:40 am
Hi Guessed,

Quote
Possibly.  When I start these discussions, I assume that people are interested in learning how to do it from first principles, but that's not for everyone.  More than happy to continue to try and diagnose this, but if it gets too frustrating/time consuming for you, then you may be easier going with the more declarative route with PLEG

I could not agree more.  I have been playing with different "code", if you will, for a while and I find it of great help to get my head around similar styles and the principals of how things work. My general understanding of things for my Home automation and Media Centre projects has benefited hugely.

So I can confirm I have now fixed the problem.  I tried and tried all different things, checked and double checked all ID's etc. I also played with PLEG (which to be fair seems quite expletory when you actually have a play if you know VERA process).  In the end I gave up and deleted the ping sensor, timer, and scene.  I then recreated the ping sensor, timer, and scene with the code discussed above and low and behold all worked as intended.  I am stumped. who knows what the issue was but I can only assume a problem occurred when one of the 3 elements got created originally?

Thank you so much again for your support and I guess a lesson learned here is if you have tried all things that make sense, delete and start from fresh to make sure.  worked for me.  ::)
Title: Re: Ping Sensor
Post by: chuck1026 on August 14, 2013, 09:29:08 am
I feel a bit dumb asking this question, but I want to make sure I understand why there is a setting for both Poll Period and Device Timeout.

Poll period makes sense that it is the frequency of the ping (check every xxx seconds) but is Timeout how long the ping will wait for a response in seconds?

I am guessing period = 60 and timeout = 5 means every 60 seconds ping sensor will send one ping and wait 5 seconds for a return ping... or does it perform multiple pings in that 5 second window???

Chuck
Title: Re: Ping Sensor
Post by: LightsOn on August 14, 2013, 09:40:13 am
Hi Chuck,

your not alone - I would be grateful for clarity on this also  :)
Title: Re: Ping Sensor
Post by: garrettwp on August 14, 2013, 10:26:09 am
I feel a bit dumb asking this question, but I want to make sure I understand why there is a setting for both Poll Period and Device Timeout.

Poll period makes sense that it is the frequency of the ping (check every xxx seconds) but is Timeout how long the ping will wait for a response in seconds?

I am guessing period = 60 and timeout = 5 means every 60 seconds ping sensor will send one ping and wait 5 seconds for a return ping... or does it perform multiple pings in that 5 second window???

Chuck

You have it correct. It will ping every 60 seconds and time out after 5 seconds if no response.

- Garrett

Title: Re: Ping Sensor
Post by: Crismaison on September 02, 2013, 01:52:10 pm
Is there a way to start the polling via a Scene or directly after I have run a Scene?
Title: Re: Ping Sensor
Post by: ppajko on September 06, 2013, 08:32:40 pm
I have mi casa verde 3 and a Mi Casa Verde SmartSwitch with Immediate Wattage Energy Usage, I want to create a notification then when there is a power outage that the vera send me an email. I currently created a trigger that when the device is off to send notification and that works fine but it does not when I unplug the unit simulating an outage.
I want this to work for my server so when there is a energy outage then it send me an email or sms. The vera3 and modem would be connected through an UPS for power. I would like to know if this Ping sensor would work and how to configure it. Thanks
Title: Re: Ping Sensor
Post by: guessed on September 28, 2013, 08:08:25 pm
Suddenly on the dashboard I have Ping Sensor with "Normal" and "Invert" buttons again... is there a way to hide these? They seem fine under the Advanced tab since it is a "set it and forget it" kind of thing.

I'll move that to the "Settings" tab in the future release.

If you're still making mods against the plugin, it might pay to add the "-w" option to the Ping command that's being executed,

Basically this line:
    http://code.mios.com/trac/mios_ping-sensor/browser/trunk/I_PingSensor.xml#L152

would change from:
Code: [Select]
      local returnCode = os.execute("ping -c 1 " .. address)to
Code: [Select]
      local returnCode = os.execute("ping -c 1 -w 5 " .. address)
in order to get a 5 second timeout on the overall Ping.  The times themselves might benefit from parameterization, but the goal is to cap the overall time the OS-level ping can take, in order to avoid the Ping Plugin being blamed for spurious Vera instability (has happened in UI4, when Aaron didn't allow sufficient time for Lua calls to complete)
Title: Re: Ping Sensor
Post by: richgodfrey on October 10, 2013, 04:05:07 pm
Can anyone help with the following:

I have a Foscam camera that I arm manually (via a scene ) when I leave the house and disarm when I get home.  I would like to automate this so that if my wife and I leave the house and our phones are no longer detectable the house arms.  Then if either of us gets home,  the camera disarms when the phone reconnects and is reachable.

I have got two instances of the ping sensor installed to ping our respective phones and this is working correctly.

I've looked at creating a vSwitch that is set to on when either or both phones are at home and pingable and set to off if neither are.  But Luup code is a bit beyond me.

Can anyone assist please?  Many thanks....

Title: Re: Ping Sensor
Post by: Crismaison on October 10, 2013, 04:31:26 pm
I have done a similar thing, without luup code.
Via a VSwitch I know the status of the phones.
Via the PLEG plugin.  I defined an action = start scene to switch on/off the cam
Title: Re: Ping Sensor
Post by: richgodfrey on October 13, 2013, 11:25:08 am
Can anyone help with the following:

I have a Foscam camera that I arm manually (via a scene ) when I leave the house and disarm when I get home.  I would like to automate this so that if my wife and I leave the house and our phones are no longer detectable the house arms.  Then if either of us gets home,  the camera disarms when the phone reconnects and is reachable.

I have got two instances of the ping sensor installed to ping our respective phones and this is working correctly.

I've looked at creating a vSwitch that is set to on when either or both phones are at home and pingable and set to off if neither are.  But Luup code is a bit beyond me.

Can anyone assist please?  Many thanks....

So I am trying to test the following Lua code but it keeps saying code failed.  I have set a timer on the "Arm House" scene to run every five minutes but don't run if my phone is detected by the ping sensor and the tripped variable is 0.  35 is the device ID of the Ping Sensor.

local richabsent = luup.variable_get("urn:micasaverde.com:ServiceID:SecuritySensor1","Tripped", 35)
if (tonumber(richabsent) = 0) then
    return false
  end

Can anyone help with this?  Lua noob here!
Title: Re: Ping Sensor
Post by: mikee123 on October 13, 2013, 12:37:53 pm
Have a few question regarding the plugin. I have installed 2 instances, one for my iphone one for my wifes. They seem to work, they do go green but they are not all the time when i am at home and logged into my wifi. I guess thats normal ? I want to use the ping sensor to determine if the phones are at home and connect some logic to it via PLEG. So which variable is green/red ? Not sure from what i have read here. Arm/bypass, has it the same function as it has in PLEG or a door sensor ? What ping time would you recommend for a phone, does it drain the battery ? I have ping time of 60 secs, timeout 5 secs ?
Title: Re: Ping Sensor
Post by: richgodfrey on October 13, 2013, 12:56:16 pm
Have a few question regarding the plugin. I have installed 2 instances, one for my iphone one for my wifes. They seem to work, they do go green but they are not all the time when i am at home and logged into my wifi. I guess thats normal ? I want to use the ping sensor to determine if the phones are at home and connect some logic to it via PLEG. So which variable is green/red ? Not sure from what i have read here. Arm/bypass, has it the same function as it has in PLEG or a door sensor ? What ping time would you recommend for a phone, does it drain the battery ? I have ping time of 60 secs, timeout 5 secs ?

One thing to check with your iPhone is whether they are ping-able when in standby/lock screen mode.  A friend of mine has reported they aren't whereas my Samsung/Android is.  Worth checking before you venture too far.
Title: Re: Ping Sensor
Post by: mikee123 on October 13, 2013, 01:34:26 pm

One thing to check with your iPhone is whether they are ping-able when in standby/lock screen mode.  A friend of mine has reported they aren't whereas my Samsung/Android is.  Worth checking before you venture too far.

Looks as if they might. Even when lockscreen is on, the ping sensor goes green, with the occasional red. What i do not really understand, when i switch my wifi off, the ping sensor should go red ? But it stays on green. Have waited 5 mins with ping sensor times every 60 secs..  ???
Title: Re: Ping Sensor
Post by: richgodfrey on October 13, 2013, 02:00:39 pm

One thing to check with your iPhone is whether they are ping-able when in standby/lock screen mode.  A friend of mine has reported they aren't whereas my Samsung/Android is.  Worth checking before you venture too far.

Looks as if they might. Even when lockscreen is on, the ping sensor goes green, with the occasional red. What i do not really understand, when i switch my wifi off, the ping sensor should go red ? But it stays on green. Have waited 5 mins with ping sensor times every 60 secs..  ???

To have the sensor go green when your device is reachable you need to set the invert button on.

Also,  you may have to play with the "poll period" and "device timeout" values.  I have mine set to 6 for both and it seems fairly reliable.

Also,  try a ping -t ip address from a command prompt on your pc and see if you get fairly consistent replies from the phone.  Mine is sometimes flakey at best and this is where the timers come in to play.
Title: Re: Ping Sensor
Post by: Ramiii on October 13, 2013, 09:49:29 pm
I installed the plugin easily with no problems , now the trigger is working fine , my only problem is that i doesn't activate the scenes , i made a scene to mute my iPhone location plugin when it's tripped with no luck , any ideas ?
Title: Re: Ping Sensor
Post by: LightsOn on October 14, 2013, 02:22:14 am
Perhaps trigger the state of a v.switch and run the scene based on if switch is on or off.

Sent from my HTC HD2 using Tapatalk 2

Title: Re: Ping Sensor
Post by: Ramiii on October 14, 2013, 09:09:50 am
so how do i trigger the stat of the v switch ? i have to do it in scenes , right ? so it's the same problem
Title: Re: Ping Sensor
Post by: Ramiii on October 14, 2013, 09:21:18 am
Managed to do it using PLEG , it's working fine now , still don't know what's wrong with the scene
Title: Re: Ping Sensor
Post by: LightsOn on October 14, 2013, 10:34:02 am
glad you got it fixed - I too have had similar issues before that I found no reason for - deleted scenes, rec-created as before and they worked - who knows - glad you got it working :-)
Title: Re: Ping Sensor
Post by: Ramiii on October 14, 2013, 10:36:11 am
yea , actually i just discovered that i can replace most of me scenes with PLEG , it eliminates scenes page clutters . pretty cool
Title: Re: Ping Sensor
Post by: LightsOn on October 14, 2013, 10:47:45 am
I hear great things about PLEG - on my list of "to-do's" :-)
Title: Re: Ping Sensor
Post by: shmixx on October 16, 2013, 10:48:35 pm
I've installed the plugin hoping to accomplish the same as Mikee123: knowing when we are home/away based off the pings.

It seems the plugin is constantly registering the phone tripped, then not tripped. I think it has something to do with the timeout. It seems whenever I try to set the timeout, it automatically resets to 0. I've tried multiple times and different values for the poll period. Any idea why this would happen? I'm hoping the timeout will help alleviate the problem.
Title: Re: Ping Sensor
Post by: garrettwp on October 16, 2013, 11:21:47 pm
The problem with using the ping sensor to sense presence by using your phone is somewhat flawed. The other reason being is that many phones will power down the wifi when the screen is off.

- Garrett

Title: Re: Ping Sensor
Post by: mikee123 on October 17, 2013, 06:23:20 am
What i am doing is using PLEG, and i have a condition home = ping + present, so if iphone is present after a little while ping goes true too then i am home, So far it seems to be working ok. It sometimes takes 5 or 10 minutes when my phone is present for the condition to become true, which is down to the ping sensor, but if you can live with that delay it works ok
Title: Re: Ping Sensor
Post by: Javelin on October 17, 2013, 06:52:17 am
Any chance of a zip of all the files for latest Beta version of this software.

I already have llama setup to send my tasks via authomationHD when I leave or get home. But I would like to compare how well this system works to your ping implementation on the Vera.

Regards Javelin
Title: Re: Ping Sensor
Post by: richgodfrey on October 18, 2013, 08:23:52 am
I'm trying to create a scene with some Luup code to set the period of the ping sensor but I can't seem to get it working.

Is this correct:

luup.variable_set("urn:demo-ted-striker:serviceId:SecuritySensor1","Period", 2, 33)

I'm trying to set the period between pings to 2 seconds for device 33.
Title: Re: Ping Sensor
Post by: mikee123 on November 04, 2013, 09:49:58 am
I think i am having a mental block at the moment. I am trying to create a condition which is true when the ping sensor has not been triggered for at least 10 mins. I am not sure if that is right...

NopingJ  NOT (Pingjust and (PingJust; Now > 10:00))
Title: Re: Ping Sensor
Post by: LightsOn on November 04, 2013, 09:57:12 am
Hi mikee123,

You could just use a count down timer? I do and saves on lua codeing but unsure if it is more efficient to use lua or not?

Sent from my HTC HD2 using Tapatalk 2

Title: Re: Ping Sensor
Post by: mikee123 on November 04, 2013, 10:02:18 am
I also want to be able to trigger conditions from NopinJ, so it would be better to have it in PLEG i think
Title: Re: Ping Sensor
Post by: LightsOn on November 04, 2013, 10:56:42 am
Agreed that PLEG is liky the best way forward :)

Sent from my HTC HD2 using Tapatalk 2

Title: Re: Ping Sensor
Post by: mikee123 on November 04, 2013, 11:21:42 am
Looking at my status report, i think the condition works as it is. I just was not sure.
Title: Re: Ping Sensor
Post by: sapiloncat on November 17, 2013, 01:09:32 pm
Hi Guys,

my 1st post.... so don't be mean to me :D

I set my poll period to 15 sec and device timeout = 150, Inverted. then it automatically changed my allowedFailured to 10. Does it mean that if VERA cannot detect my iphone in 15x ping, it will only tripped (red color) my status. lets say if 14x ping then VERA detect it than it the status stay ?

how about the other way around. what if my status tripped then I ON my phone, does it need to wait for another 15x ping than trigger my Status or direct ?

Title: Re: Ping Sensor
Post by: shmixx on November 25, 2013, 09:21:57 pm
Ok, so I've caught up reading through the whole thread, and would first off like to thank the creators and all the folks who've got this plugin to the point it's at. Some input/feedback I'd like to add, and some questions I have:

- I echo the option of putting invert/normal options in the settings, set it and forget it
- Some clarity on the man page in the Wiki or the code.mios.com site would be EXTREMELY helpful, needless to say without reading this whole thread I was a bit confused on multiple fronts
- Clarification on the Device Timeout setting
    - From what I was reading in recent posts, and the naming, I figured this would be the TTL applied to a PING (or how long to wait for a response) before it is considered to have failed or count it as a failure. In actuality it seems that this Device Timeout refers to the number of times the PING will be attempted before it is considered to reset the tripped status translated to seconds. Aka if I set my ping to 60 sec intervals, I send a ping request every 60 seconds, if I don't have a response in 5 of those pings (60 interval x 5 attempts = 300 secs) then the Device Timeout will be 300.
- On demand PING initiation would be an AWESOME improvement option. Perfect use case for my goal which is to use the PING sensor for when the iPhone arrives home. I would assume (still testing) that when I hit the home WiFi network range, the iPhone will connect or wake the WiFi for a few minutes. Using PLEG, I can sense a Door sensor tripped, action it to PING the iPhone which just connected.

Question - Is it possible to modify the poll period or device timeout using PLEG without causing a vera restart? I know when I manually modify those options it prompts me for a save in the interface and ends up restarting vera. Is there a way to do so without restarting vera?
Title: Re: Ping Sensor
Post by: shanew on December 28, 2013, 09:46:19 am
First let me say a big thanks to all the various contributors who have helped with this plugin.  It stands to be the basis of a lot of notifications and triggers for various functionality.

One of my only frustrations with it, though, is that it tends toward false positives over unreliable connections, most notably wifi.  I understand that the Allowed Failures is intended to address this issue, but from my testing of a device that's near the range of my wifi set up, this solution doesn't cut down on false positives nearly as much as I'd like.  While testing the plugin with this device, I also ran a script from my home server to mirror (as much as possible) the same testing, but using multiple ICMP requests in a single ping command (for instance "ping -c 5 target_addr").  What I've found in several days of testing is that raising the "count" creates a more robust test.  If something is really down, all the ICMP requests time out, but if even one of them receives a response, ping still exits with a 0, indicating success.  Ideally, you'd be able to test for a certain percentage, but that's (way?) more complicated than testing the exit status.

So, I've created some custom modifications to the Ping Sensor plugin that make the argument to the -c option a variable that can be set.  I've only just started testing in place of my old sensors, but so far it seems to work as expected (I see multiple request/response pairs when watching traffic to a targeted host, it shows green against a reachable host vs. red against an unreachable one, notifications get sent, works in inverted mode).

Nonetheless, I suspect it could use more testing and someone more experienced with plugins to review the changes I made, so if someone can point me to a place where I can upload either the code or the diffs, I'll be happy to share.
Title: Re: Ping Sensor
Post by: parkerc on December 28, 2013, 10:48:28 am
@shanew

Once you have made a number of post you should be able to attach the files to your posts - if you would like to reach out to me via a private message I could try and upload them for you ?
Title: Re: Ping Sensor
Post by: shanew on January 02, 2014, 03:56:52 pm
At Parkerc's suggestion, I'm going to post the changes I've made (as diffs) so that others can take a look.  Since the output is fairly long, I'm going to break this into three separate posts for the three files I modified.  Apologies if this is annoying, but I think it will make the changes more readable.

So, to start with, here are the relatively minimal changes to J_PingSensor.xml:

Code: [Select]
5a6
>     var pingcount  = get_device_state(deviceID,  pingsensor_svs, 'PingCount');
11a13
>       ' <tr><td>Ping Count </td><td><input  type="text" id="ping_pingcount" size=10 value="' +  pingcount + '" onchange="pingcount_set(' + deviceID + ', this.value);"> times</td></tr>' +
19a22,25
> }
>
> function pingcount_set(deviceID, varVal) {
>   set_device_state(deviceID,  pingsensor_svs, 'PingCount', varVal);
Title: Re: Ping Sensor
Post by: shanew on January 02, 2014, 03:58:55 pm
Changes to S_PingSensor.xml:

Code: [Select]
28a29,48
>       <name>SetPingCount</name>
>       <argumentList>
>         <argument>
>           <name>newPingCountValue</name>
>           <direction>in</direction>
>           <relatedStateVariable>PingCount</relatedStateVariable>
>         </argument>
>       </argumentList>
>     </action>
>     <action>
>       <name>GetPingCount</name>
>       <argumentList>
>         <argument>
>           <name>PingCountValue</name>
>           <direction>out</direction>
>           <relatedStateVariable>PingCount</relatedStateVariable>
>         </argument>
>       </argumentList>
>     </action>
>     <action>
80a101,106
>     </stateVariable>
>     <stateVariable>
>        <sendEventsAttribute>no</sendEventsAttribute>
>        <name>PingCount</name>
>        <dataType>i4</dataType>
>        <defaultValue>1</defaultValue>
Title: Re: Ping Sensor
Post by: shanew on January 02, 2014, 04:01:16 pm
And finally, where the major changes are, I_PingSensor.xml:

Code: [Select]
20a21
>     local DEFAULT_PINGCOUNT = 1
40c41
<     local function initSettings(address, period, invert, enable, allowedFailure)
---
>     local function initSettings(address, pingcount, period, invert, enable, allowedFailure)
49a51
>       pingcount = pingcount or DEFAULT_PINGCOUNT
56a59
>       luup.variable_set(PING_SID, "PingCount", pingcount, parentDevice)
65a69
>       log("Initialized variable: 'PingCount' = " .. pingcount)
72c76
<       return address, period, invert, enable
---
>       return address, pingcount, period, invert, enable
80a85
>       local pingcount = luup.variable_get(PING_SID, "PingCount", parentDevice)
89,90c94,95
<       if (address == nil or period == nil or invert == nil or enable == nil or allowedFailure == nil) then
<         address, period, invert, enable = initSettings(address, period, invert, enable, allowedFailure)
---
>       if (address == nil or pingcount == nil or period == nil or invert == nil or enable == nil or allowedFailure == nil) then
>         address, pingcount, period, invert, enable = initSettings(address, pingcount, period, invert, enable, allowedFailure)
93c98
<       return address, period, invert, enable
---
>       return address, pingcount, period, invert, enable
121,122c126,127
<       local address, period, invert, enable = readSettings(parentDevice)
<       if (address == nil or period == nil) then
---
>       local address, pingcount, period, invert, enable = readSettings(parentDevice)
>       if (address == nil or period == nil or pingcount == nil) then
146a152,154
>     -- pingcount (Integer):
>     --                 Number of ICMP requests to send out
>     --
151,152c159,160
<     local function executePing(address)
<       local returnCode = os.execute("ping -c 1 " .. address)
---
>     local function executePing(address, pingcount)
>       local returnCode = os.execute("ping -c " .. pingcount .. " " .. address)
159c167
<         -- log("abnormal exit while ping execution. ErrorCode: " .. tostring(returnCode))
---
>         log("abnormal exit while ping execution. ErrorCode: " .. tostring(returnCode))
245c253
<       local address, period, invert, enable = readSettings(parentDevice)
---
>       local address, pingcount, period, invert, enable = readSettings(parentDevice)
256c264
<         setResult(PARENT_DEVICE, invertResult(executePing(address), invert))
---
>         setResult(PARENT_DEVICE, invertResult(executePing(address, pingcount), invert))
297a306,319
>       </run>
>     </action>
>     <action>
>       <serviceId>urn:demo-ted-striker:serviceId:PingSensor1</serviceId>
>       <name>GetPingCoung</name>
>       <run>
>         luup.variable_get(PING_SID, "PingCount", parentDevice)
>       </run>
>     </action>
>     <action>
>       <serviceId>urn:demo-ted-striker:serviceId:PingSensor1</serviceId>
>       <name>SetPingCount</name>
>       <run>
>         luup.variable_set(PING_SID, "PingCount", lul_settings.newPingCountValue, parentDevice)
Title: Re: Ping Sensor
Post by: Piwtorak on January 08, 2014, 09:46:26 am
I am searching for new and consistant files to reinstall my ping sensor plugin,

someone can indicates this newest files and instructions to correct setting up ??

thanks in advance...

Title: Re: Ping Sensor
Post by: JuniorJedi on January 16, 2014, 06:32:09 am
I've searched high and low on this and I cannot find the answer.
I have a requirement to ping my mobile. Once it has found the mobile then go to bypass. This works and I can see the change to bypass in the UI.
However,  when bypassed the plugin continues to ping my device. Am I doing something wrong?

Thanks for any help.
Title: Re: Ping Sensor
Post by: hfleejr on January 17, 2014, 10:45:15 pm
I need some assistance with this app.  I have a vacation home that i'm monitoring remotely.  Problem is that the DSL is somewhat unreliable and has a tendency to periodically require a reboot of the modem along with the wireless router.  Here is what I'd like to do:


Sounds simple enough.  I tested with a local ip address on my network (foscam camera).  i unplugged the camera and the scene triggered which in turn turned off/on the electrical outlet as expected.  However, if i left the camera unplugged, the scene wasn't triggered again during the subsequent ping cycle.

I'm sure i'm missing something very basic, but the wiki doesn't look up-to-date on the app.  I read and re-read this thread multiple times but couldn't find the answer.    Thanks in advance.
Title: Re: Ping Sensor
Post by: jimpapa on January 18, 2014, 07:07:19 am
In your scene use the Ping sensor for the trigger, then when tripped shut off AC
(So you got that part correct it looks like)
Then go up and select manage delays and add a 30 second or 1 min delay
And select the same outlet and this time click on the "on" buttons


You should now be power cycling because you have a delayed ON command after your OFF

Title: Re: Ping Sensor
Post by: hfleejr on January 18, 2014, 08:33:08 am
jimpapa, Thanks for the reply.

The power cycling works well in my scene - I have the delay included.  What doesn't seem to be working is that the Ping senor doesn't reset.  By that I mean if the ip address remains unreachable, I'm expecting the scene to be triggered again at the end of the next poll period.

Title: Re: Ping Sensor
Post by: jimpapa on January 18, 2014, 09:31:52 am
Ok. I get it now..  I used to use the ping sensor... I'll reinstall it see what's up.
From what I remember it acts like a motion sensor ... Have you tested pinging your iPhone or something what you can make come and go.
Title: Re: Ping Sensor
Post by: LightsOn on January 20, 2014, 07:52:05 am
Title: Re: Ping Sensor
Post by: shanew on January 20, 2014, 10:51:26 am
    Hi All,

    Just a couple of quick question:

    • I appear to only be able to select "ARM" or "BYPASS" if the sensor is actually able to ping something - is this right as sometimes I want to change the state of the ping sensor weather the Ping is achievable on not.
    • What is the latest version of the ping sensor?  Mine say 0.16 yet the wiki does not list this version and states the latest is 1.4 yet I ran an update and nothing changed - am I on the latest version?

    Many thanks.
Just to test, I turned the wireless off on my phone (which I have a sensor for), and I still show the Arm and Bypass buttons.  Or are you saying that pressing them doesn't do what you expect them to?  It does seem like the functionality of bypass mode is complicated by whether you're in Normal or Invert.

I'm pretty sure 1.4 corresponds to 0.14 (or I suppose 0.16 corresponds to 1.6).  Either way, I think the last time I looked, what's available via the Apps page is slightly older than what's available to download and install manually.  That said, there's so few files in the Ping Sensor plugin that it's not that bad doing it manually.
Title: Re: Ping Sensor
Post by: LightsOn on January 20, 2014, 11:06:12 am
@shanew

thank you for the reply - have you tried any new manually downloadable updates?  to what result and with what benefit?  I am just using the URL update function that pulls the latest update from the MIOS app site.  I agree it would be logical that 0.16 represents latest release version 1.6

The issue I have is that although the arm and bypass buttons are there still, if no ping is detected then I can no longer switch between arm and bypass modes.  this works if a ping is detected.  can you also recreate this problem?

I have tried different browsers but with no difference.  Surly Arm or Bypass should be switchable irrespective of if the Ping sensor is getting a pig result (Trip) or not?

Would love to fix this.
Title: Re: Ping Sensor
Post by: hfleejr on January 20, 2014, 01:00:36 pm
@jimpapa

Yes, I tested with a local device that I can turn on/off.  In Invert-mode, if it fails to successfully ping the ip address, the scene is triggered correctly.  In the next ping cycle, an unsuccessful ping will not re-trigger the scene.  So, it looks like I will need a LUUP process - e.g. if the last cycle was unsuccessful AND this cycle is unsuccessful, then trigger the scene.  Any ideas?
Title: Re: Ping Sensor
Post by: shanew on January 20, 2014, 04:53:55 pm
@LightsOn

My recollection of versions was backwards apparently.  0.16 is what's available through Apps, 0.15 is available through the mios TRAC repository.  What the differences between those two versions is, I don't know.  As mentioned at the top of the previous page, I've added my own modifications to 0.16, and I think they're very useful in a wireless environment (cuts down on my false positives considerably).

With my phone ping sensor set to Invert, and with the symbol turned red (which means my phone isn't pingable), I am able to change between Armed and Bypass, though I noticed there was about a 5-10 second delay when I clicked to re-arm it.  I confirmed that the variable changed in the Advanced tab by reloading after each click.  As far as I can tell, though, the only situation where bypass/armed matters is when you're specifically testing for the "armed sensor is tripped" condition, not the plain "sensor is tripped" condition.  That is, the tripped variable changes regardless of whether the sensor is in Arm or Bypass mode.

Can you go into the advanced tab and manually change the Armed variable (0 is bypass, 1 is armed; and you'll have to save your change)?  This might indicate whether it's an interface failure or something in the plugin logic.
Title: Re: Ping Sensor
Post by: LightsOn on January 21, 2014, 07:38:24 am
Hi @shanew

I did some further testing and I am able to manual change 'invert' or 'normal' and also 'Bypass' or 'Armed' manually under advanced tab, then reload luup then f5 and the changes are seen.  If however I try these via manual click of the button or via automation with PLEG - the changes are not seen and not possible.  In my case for 'invert' or 'normal' and also 'Bypass' or 'Armed' to work via a button push or via automation with PLEG the "ping" has to be present.

Hmm this could be a problem for me.  if you have a moment could you see if you get the same results.  I used a test via ping to my mobile and then jus turned off wifi on my mobile to test.

I am keen to try your changes so will look at those later today and give them a try - thanks for sharing these changes you made  :)
Title: Re: Ping Sensor
Post by: Aaron on January 21, 2014, 02:49:50 pm
I have v .16 and use in Invert mode, so Green is Home & Red is Away.

I suggest not touch the Ping Sensor device once set... it should purely be for status.
Title: Re: Ping Sensor
Post by: shanew on January 21, 2014, 08:06:06 pm
@LightsOn

I'm able to toggle armed/bypass regardless of ping status, and, as far as I can tell, regardless of whether it's in Invert or Normal mode.  I'm not sure how much help I can be, but you might look at troubleshooting the javascript in your browser, especially since the plugin seems to do the right thing when you change the variables manually.
Title: Re: Ping Sensor
Post by: LightsOn on January 22, 2014, 05:46:53 am
@shanew
thank you for trying to replicate - it may be good for me to uninstall and re-install then as I have tried multiple browsers and also automated "set" variables and both fail if no ping is detected - may just be an error on my system.  I had a similar thing once before and a simple re-install fixed it and given I only have a couple this is likely the quickest next test.

@Aaron
I agree but as part of my "geofencing" work I require to be able to arm and disarm the ping sensor and since it should work I must have a 'gremlin' somewhere.  This said I played with the Tasker geofencing add on as discussed the your other specific thread and initial tests are really very promising so as such I may not require this solution any way.
Title: Re: Ping Sensor
Post by: hfleejr on January 24, 2014, 10:50:22 pm
Still looking for some insight on a question I posed earlier.  I have a scene that is triggered by a failed ping (using invert mode).  The Ping Senor is set to ping every 10 mins.  If it fails, then the scene is triggered correctly.  The problem is that in the next ping cycle (or any subsequent cycle), if the ping is not successful, the scene isn't triggered.  So, what is the easiest way to to trigger the scene if each and every ping cycle is not successful? 

I'm testing on a local, static IP address that I can turn off/on (IP Camera).  If I leave the device off for an extended period of time, I'd like the scene to trigger on each failed ping cycle.

I'm sure there is a very easy answer...

Title: Re: Ping Sensor
Post by: RichardTSchaefer on January 24, 2014, 11:43:50 pm
See the attribute:
   <stateVariable allowRepeats="yes">
In S_SecuritySensor1.xml
You need that attribute for the appropriate event in S_PingSensor.xml
Title: Re: Ping Sensor
Post by: hfleejr on January 25, 2014, 09:47:30 am
@RichardTSchaefer

Thanks for your response.  I appreciate the feedback.  However as a newbie, I need more guidance on how to implement the recommendation so that the scene would be triggered after each non-successful ping. 
Title: Re: Ping Sensor
Post by: Vreo on February 01, 2014, 10:03:26 pm
Hello everybody, this is a nice plugin! Is there a way to request a ping "manually" (let's say by a triggered scene like door open) without changing the period nor any other setting? Like a Lua action?
Title: Re: Ping Sensor
Post by: Eraser on February 05, 2014, 03:22:37 am
Hello,

I was looking for a ping sensor to check if my internet connection is available. I want to reboot my modem when the connection is down. So i downloaded this plugin on my Vera 2.
I have been testing it for a while now and the sensor does not seem to work very well. It has a lot of false ping timeouts. I have tried different external IP addresses like Google DNS (8.8.8.8) or the gateway from my internet provider. The results are the same. Multiple false timeouts during the day. Am i doing something wrong? Are my settings correct? I currently use these values:

Poll Period: 30
Device Timeout: 30
Title: Re: Ping Sensor
Post by: nullx8 on February 08, 2014, 12:32:05 am
short question.

the older ping sensor had the "invert" configuration done via different xml files.
is there a version out there that is up to date but NOT has the invert option/button ?

and most important, where do i get it ;)
Title: Re: Ping Sensor
Post by: AgileHumor on March 25, 2014, 11:24:51 am
Hello,

I was looking for a ping sensor to check if my internet connection is available. I want to reboot my modem when the connection is down. So i downloaded this plugin on my Vera 2.
I have been testing it for a while now and the sensor does not seem to work very well. It has a lot of false ping timeouts. I have tried different external IP addresses like Google DNS (8.8.8.8) or the gateway from my internet provider. The results are the same. Multiple false timeouts during the day. Am i doing something wrong? Are my settings correct? I currently use these values:

Poll Period: 30
Device Timeout: 30

I have the same issue. 

Poll Period: 30
Device Timeout: 90
Title: Re: Ping Sensor
Post by: BulldogLowell on March 25, 2014, 12:48:43 pm
you could use PLEG to look over a period of time before it reboots.  It would then ignore a one-off timeout error.

Input

NoExternalPing (Ping sensor tripped/not tripped) --depends on how you have that set up

Condition

RebootRouter = NoExternalPing and NoExternalPing>30:00

Action

RebootRouter  Send the instructions to reboot, etc

This will look to see that the NoExternalPing was continuous for 30 minutes before it gives instructions to reboot the router.
Title: Re: Ping Sensor
Post by: shanew on April 04, 2014, 10:01:57 am
@Eraser and @Agile This is exactly why I made my modifications to the ping sensor code, so that I could tell it how many pings to send out.  Now, if even one ping out of the N I send gets through, it's seen as a success (in my experience, a "false" ping reply is nearly impossible).   I've set most of mine to 5 pings, and false positives are rare now.  It was an absolute must for wireless devices where say even 5% of packets would get lost, but it's also reduced false positives on wired connections.

My patches are up a few pages, I think.  I'm not sure how active the PingSensor maintainer is recently, but if there were a few people who could test my changes / clean up any mistakes, I'd love to see this make it into the "official" version.
Title: Re: Ping Sensor
Post by: AgileHumor on April 04, 2014, 07:08:00 pm
ShaneW, I see like 4+ versions of your files and unsure which one to use.

Can you share the latest version, and maybe remove the old uploads and replace with a link to your latest post.

Title: Re: Ping Sensor
Post by: hfleejr on April 04, 2014, 09:07:32 pm
Still looking for some insight on a question I posed earlier.  I have a scene that is triggered by a failed ping (using invert mode).  The Ping Senor is set to ping every 10 mins.  If it fails, then the scene is triggered correctly.  The problem is that in the next ping cycle (or any subsequent cycle), if the ping is not successful, the scene isn't triggered.  So, what is the easiest way to to trigger the scene if each and every ping cycle is not successful? 

I'm testing on a local, static IP address that I can turn off/on (IP Camera).  If I leave the device off for an extended period of time, I'd like the scene to trigger on each failed ping cycle.

I'm sure there is a very easy answer...

Still looking for an easy solution to this question.  I'm rebooting the router if i'm unable to ping an IP address.  Works great under normal circumstances.  However, if the reboot doesn't reestablish the connect, i'd like the next ping cycle to retrigger the reboot.  However, subsequent ping failures does not trigger the scene. 
Title: Re: Ping Sensor
Post by: BulldogLowell on April 04, 2014, 09:34:36 pm
have you looked into PLEG (http://forum.micasaverde.com/index.php/topic,21603.0.html)?
Title: Re: Ping Sensor
Post by: AgileHumor on April 04, 2014, 10:10:02 pm
Bulldog, do you have a sample perhaps?

I'm assuming you would do a "Trigger @ 3" as a condition or something?
Title: Re: Ping Sensor
Post by: BulldogLowell on April 04, 2014, 11:13:40 pm
Yeah, the problem with rebooting if you have a single failed ping is that you may have just been timed out on the Vera side (busy) or the server side.

You have a good approach, you could do this with a counter, looking for say 5 NoPing events in 30 mins.

I look for a continuous period of NoPing

NoPing AND (NoPing;Now>30:00)

a lot of ways to approach this with PLEG!

Title: Re: Ping Sensor
Post by: shanew on April 05, 2014, 10:43:42 am
I have three posts, each one detailing the changes to a different file in the PingSensor plugin.  I provided them in a patch format, so they could be "automagically" used to update the file (assuming you're familiar and comfortable with patch).

I'm a big fan of PLEG, but this is one place where it's simpler (though not necessarily easier if you're not comfortable editing plugin files) to make the plugin do the "multiple" testing.
Title: Re: Ping Sensor
Post by: shanew on April 05, 2014, 11:09:29 am
To make life easier for those who may not have experience reading or applying patch files, I've zipped up all the updated files and am attaching it here.
As with other plugins that require manual installation, you'll need to go to: APPS->Develop Apps->Luup files in the UI5 interface.  From there, upload the five files included in the zip.

While I've been using these for several months without major issues, and if anything goes wrong, you should be able to reinstall the PingSensor plugin from the "Install apps" page, PLEASE NOTE that by installing these files, you're accepting the risk that this might break things.

I would recommend that you create new PingSensor devices once these files are installed, rather than edit ones you already have, as I noticed some issues with the configuration interface not always showing the new "Count" field properly.
Title: Re: Ping Sensor
Post by: mikee123 on April 09, 2014, 07:43:05 am
I have updated my ping sensor to the newest version, and now have the ping count. But I am still not 100% sure what to use the ping count for, or the device timeout
I have searched for ping count in the thread but have not come up with an answer
Title: Re: Ping Sensor
Post by: shanew on April 09, 2014, 09:34:01 am
The Ping Count allows you to specify how many ping (ICMP) requests get sent in each check, and if any one of those requests gets a reply, the check returns true.  By default, the Ping Count is 1, which I found to be overly sensitive across many networks (especially wireless networks).  I would recommend a setting of somewhere between 3 and 5, though particularly flaky wireless networks might benefit from a number as high as 8 or 10.

This effectively cuts down on false negatives (where the sensor says it can't reach a device despite that device being available on the network).  Since there are now multiple ICMP requests, the chances that one of them gets through AND that a reply successfully returns is increased (though not totally eliminated).

This is a separate functionality from and in no way related to the timeout (though I gather the timeout was also intended to cut down on false negatives).
Title: Re: Ping Sensor
Post by: mikee123 on April 09, 2014, 10:32:03 am
Ok it is becoming a little clearer now. I have now set my wife's ping count to 5, as that seems to be a little trickier to get a consistent ping while she is at home, lets see if that helps. The poll period I have set to 120 secs. I don't know if I should set that longer, would that have an effect on battery drain ? I have tried setting the device timeout to 20 (still don't really understand what that does) but that is immediately changed back to 0. Only when I put a number greater than 60 in, it will change it to 120.
Title: Re: Ping Sensor
Post by: BulldogLowell on April 09, 2014, 11:29:39 am
Since your phone has to be on-network and awake in order to receive and return a ping, you are not really demanding much of your smartphone.

particularly when compared to iPhone locator which really takes CPU time (and has data demands of your phone) for example.

Title: Re: Ping Sensor
Post by: Aaron on April 10, 2014, 02:40:20 am
I've been using Ping Sensor for a long time now with Android phones and PCs - for my phones, works great for me using Poll Period 30, Timeout 0.


Title: Re: Ping Sensor
Post by: shanew on April 10, 2014, 08:24:54 am
At least in my limited experience, iPhones are really flaky about responding to pings, no matter what adjustments you make to Ping Count, Timeouts, etc.  I wouldn't rely on it to determine if the phone is off, off-network, or similar.
Title: Re: Ping Sensor
Post by: mikee123 on April 10, 2014, 08:29:10 am
@shanew

that is the impression I am getting after playing around with the settings. Normally I have a door sensor which triggers a few location refreshes from the iphonelocator, and I only have the ping as a 'backup'. But my door sensor is out of action at the moment... so I have to rely on the ping sensor until I have got the door sensor working again...
Title: Re: Ping Sensor
Post by: Aaron on April 10, 2014, 10:18:50 am
for iPhones, maybe try a bluetooth connection to detect presence?
Title: Re: Ping Sensor
Post by: mikee123 on April 10, 2014, 10:34:38 am
Then I would have to leave Bluetooth on all the time, and that really drains the battery. So unfortunately not an option as my other half already complains all the time about having to recharge once a day...
Title: Re: Ping Sensor
Post by: Aaron on April 10, 2014, 11:00:44 am
Wow... my Bluetooth on my SGS3 is on all the time. very little battery drain. Maybe the iPhones just don't work that well? Sorry.
Title: Re: Ping Sensor
Post by: integlikewhoa on May 09, 2014, 05:37:08 pm
Wow... my Bluetooth on my SGS3 is on all the time. very little battery drain. Maybe the iPhones just don't work that well? Sorry.

I have to agree with that, I have never turn Bluetooth off on any of my Android phones.
Title: Re: Ping Sensor
Post by: clippermiami on May 15, 2014, 07:57:28 am
Does the Arm/Bypass functions of Ping Sensor actually start/stop the ping or just start/stop the reporting of the result?
Title: Re: Ping Sensor
Post by: nullx8 on May 17, 2014, 09:27:55 am
Does the Arm/Bypass functions of Ping Sensor actually start/stop the ping or just start/stop the reporting of the result?

arm/bypass has nothing to do with the mechanics running my the device or plugin .. its 100% vera/mios related... so yes it does still ping ... but you can actions simply base on the "armed" condition to make them easy "ignorable"
Title: Re: Ping Sensor
Post by: clippermiami on May 17, 2014, 09:35:15 am
Does the Arm/Bypass functions of Ping Sensor actually start/stop the ping or just start/stop the reporting of the result?

arm/bypass has nothing to do with the mechanics running my the device or plugin .. its 100% vera/mios related... so yes it does still ping ... but you can actions simply base on the "armed" condition to make them easy "ignorable"

Thanks, good to know. I was hoping it actually stopped/started the ping (for system load purposes) but now i know.
Title: Re: Ping Sensor
Post by: nullx8 on May 17, 2014, 09:38:01 am
Thanks, good to know. I was hoping it actually stopped/started the ping (for system load purposes) but now i know.

that would be something truely awesome indeed !!

specially for the ping sensors used to trigger actions .. like check if my phone is in the house and things like this ...
so they could ping like every 15 sec or so with no trouble and if "bypassed" not ping at all or just extend the time or somethings,

sadly change the ping times require lua restart ;( not so cool thing to do for somethings like this
Title: Re: Ping Sensor
Post by: clippermiami on May 17, 2014, 09:51:36 am
Thanks, good to know. I was hoping it actually stopped/started the ping (for system load purposes) but now i know.

that would be something truely awesome indeed !!

specially for the ping sensors used to trigger actions .. like check if my phone is in the house and things like this ...
so they could ping like every 15 sec or so with no trouble and if "bypassed" not ping at all or just extend the time or somethings,

sadly change the ping times require lua restart ;( not so cool thing to do for somethings like this

Exactly what I had in mind. Use VeraProximity or AutoLocator to turn on the Ping very fast, say every 5-10 seconds or so when the device gets inside the geofence. As soon as the ping starts responding you know the device is now on-net and you can register the device as "home" and stop the rapid ping.

But so much for that idea :)
Title: Re: Ping Sensor
Post by: zedrally on June 29, 2014, 05:01:27 am
I've got an unusual situation where the Ping sensor indicates away, while Unix time shows home....

Anyone else experienced this?
Title: Re: Ping Sensor
Post by: konradwalsh on July 10, 2014, 01:45:15 pm
Wow... my Bluetooth on my SGS3 is on all the time. very little battery drain. Maybe the iPhones just don't work that well? Sorry.

I have to agree with that, I have never turn Bluetooth off on any of my Android phones.

Sent from my SM-P600 using Tapatalk

Title: Re: Ping Sensor
Post by: clippermiami on July 20, 2014, 09:54:50 pm
Something very odd. I'm having problems with Vera Proximity so I thought I'd set up a ping sensor for.com wife's phone until I sort out what's happening. I put some logic in a PLEG to read the status of the Ping Sensor and set a Virtual Switch, on for Home, Off for Away. Piece of cake. But the PLEG shows state "1" whether the phone is answering the ping or not. Nothing I did made the PLEG reflect the state the ping sensor. Anyone else seen this?

Title: Re: Ping Sensor
Post by: Cor on July 21, 2014, 05:04:07 pm
My modem is playing up the last couple of weeks.

When I reset the modem all is fine again, no clue why the modem is acting wierd. Anyway I installed the ping sensor and overwrote the files with different files some posts back.

All is working fine , I inserted the Ip adres of 8.8.8.8 and ping count 10.  rebooted my modem and got the warning.... Thanks for this great app!

One question though, what are sensible settings for a relative slow internet connection.
and what does "poll period"   and "device time out" do ? 

I don't know if it helps , but attached a screenshot when I did a speedtest.

Many thanks,
Cor
Title: Re: Ping Sensor
Post by: resq93 on August 07, 2014, 11:51:23 am
Problem with ping sensor today - For some reason when the sensor is tripped it will not allow me to arm (or invert) the sensor. If I try this manually or even via a scene it causes a lua restart shortly thereafter and the state does not change. Using version 0.16 and have these for a while but just started trying the arm/disarm functionality.

Any ideas?

M
Title: Re: Ping Sensor
Post by: Cor on August 07, 2014, 02:30:50 pm
One question though, what are sensible settings for a relative slow internet connection.
and what does "poll period"   and "device time out" do ? 

Anyone?

Thanks,
cor
Title: Re: Ping Sensor
Post by: rvendrame on September 06, 2014, 09:29:07 am
Hello,

Does someone notice the intermittent error bellow at LuaUPnp log (http://<vera-ip>/cgi-bin/cmh/log.sh?Device=LuaUPnP):

06   09/06/14 10:25:38.119   Device_Variable::m_szValue_set device: 28 service: urn:demo-ted-striker:serviceId:PingSensor1 variable: CurrentFailureCount was: 0 now: 0 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2d93c680>
 
Or just me?
Thx!

Title: Re: Ping Sensor
Post by: Octoplayer on September 15, 2014, 06:12:35 pm
@Corr - From a bit of investigation:
Poll Period sets how often the ping will be sent.
Device Timeout is the total time with no response before the alarm trips.
It is linked to the AllowedFailure Count under Advanced... so if you set Polling to 15s, and Timeout to 60s, then the count will be set to 5.

Conversely, set AllowedFailure to 'n' and the Timeout will be set to 15 x (n-1).

@Zedrally
There is another timeout, which is for each individual ping, and for Linux this is twice the Round Trip Time.
I have an IP wifi camera which has varying response times, and intermittently I get the same symptoms as you, standard ping says connected, but Vera notifies me it is offline. I suspect that if the plugin ping gets a rapid response, say 5ms, it looks for a short response thereafter, (10ms). If the subsequent responses are outside that, it will flag a failure.
It may be that forcing the timeout to a fixed 1s timeout value (ping -W 1 ...) would fix that, but I have not worked out how to edit the code (yet).

Title: Re: Ping Sensor
Post by: Cor on September 24, 2014, 03:54:55 am
@Corr - From a bit of investigation:
Poll Period sets how often the ping will be sent.
Device Timeout is the total time with no response before the alarm trips.
It is linked to the AllowedFailure Count under Advanced... so if you set Polling to 15s, and Timeout to 60s, then the count will be set to 5.

Thanks,   I think I get it:

So , if I set ping count=10,  poll period=60 , device timeout=30

would mean:
Every 60 seconds 10 pings are send.
At least 1 ping have to come back within 30 seconds, if not , I will get a "red" state.

Is this correct?

Thanks for your help ,
Cor
Title: Re: Ping Sensor
Post by: Octoplayer on September 24, 2014, 04:10:47 am
Cor,
Not quite; I think you will find that if you set ping to 10 and poll to 60, then the app will set the timeout to 600 and will ping once every 60s.
If you then set the timeout to 30 and go back to look at the max allowed failures count will have been set to 3 (30/10).





Title: Re: Ping Sensor
Post by: Cor on September 24, 2014, 08:39:46 am
hmmm , complicated.

I have now set
count=6
period=15
timeout=60


Allowed failure under the advance tab is 4 ( 60/15) , that makes sense.
Every 15 seconds a ping will be send.
4 pings are ok when they are not returned, after a 5th ping not returned , I get the red state

I just don't see the reason for the ping count, since every period ( 15 seconds) a ping will ben send.
it is now set at 6 , but what will be the diffeerence when I set it to 1 or 100? 


Thanks for helping me understand.

Cor
Title: Re: Ping Sensor
Post by: Octoplayer on September 24, 2014, 11:12:34 am
Cor,
I agree, the interdependence of the Ping Count and the Timeout, on separate screens, is confusing. You only need to set one of them, the other will be automatically updated.

If you have changed the Allowed Failure Count to 6, I would suspect that you will find the timeout is now 6 x 15 = 90s.
If you set it to 1, the timeout will go to 15s, set it to 100, timeout will be 1500s  :)

Title: Re: Ping Sensor
Post by: Cor on September 24, 2014, 03:43:05 pm
Hmmm , are we talking about the same version?

I didn't change the "allowed failure" manually , this was done by vera.
The 3 variables in the "settings" tab , don't change automatically , whatever I insert there remains.

Attached 2 screenshots.

Quote
I think you will find that if you set ping to 10 and poll to 60, then the app will set the timeout to 600 and will ping once every 60s.
When I read your posts , my settings wouldn't be possible.
Device timeout should be 90 if I read your posts correctly.

Thanks,
Cor
Title: Re: Ping Sensor
Post by: Octoplayer on September 24, 2014, 04:17:40 pm
Cor,
Ahh - that could explain something, my version only has 2 variables in the Settings screen (see screen shot).

I have version 0.16 of the Ping Plugin, but just going to look in the Apps Store to see if there is a later version, I cannot find it at all now!

Apologies for any confusion... which version do you have?

Title: Re: Ping Sensor
Post by: integlikewhoa on September 24, 2014, 05:57:43 pm
Cor,
Ahh - that could explain something, my version only has 2 variables in the Settings screen (see screen shot).

I have version 0.16 of the Ping Plugin, but just going to look in the Apps Store to see if there is a later version, I cannot find it at all now!

Apologies for any confusion... which version do you have?

There is around 26 pages of info here and somewhere in the middle there is instructions on installing some "EXTRA" features for beta testing. Many including myself have installed it. So your version might be the latest in the app store, but his might look different as he has made some changes.

Look a few pages back and youll find some files to download and add to this plugin to add these features.
Title: Re: Ping Sensor
Post by: Cor on September 25, 2014, 02:56:15 am
Ahhh ... it makes sensenow :-)

The files for this extra funtionality can be found in post #350

I also found near that post this explanation on the ping count. 


The Ping Count allows you to specify how many ping (ICMP) requests get sent in each check, and if any one of those requests gets a reply, the check returns true.  By default, the Ping Count is 1, which I found to be overly sensitive across many networks (especially wireless networks).  I would recommend a setting of somewhere between 3 and 5, though particularly flaky wireless networks might benefit from a number as high as 8 or 10.

Title: Re: Ping Sensor
Post by: Aaron on October 09, 2014, 02:46:02 pm
What setting are you guys finding that work well? I think it might be best to separate by OS type & version

I have Android 4.4.2 and still trying to find a good settings.
Title: Re: Ping Sensor
Post by: Aaron on October 17, 2014, 06:07:15 pm
I'm having issues... seems like I'm getting ping failures but then it is not checking for 5 more minutes... when it works again.

Can you help me understand what settings I need to have it send 5 Pings every 30 seconds, and allow for 2 pings to fail?

thx!
Title: Re: Ping Sensor
Post by: Octoplayer on November 04, 2014, 08:16:53 am
Aaron,
I have been looking again in the code, as I was getting similar behaviour, and strange results in the graphing files.
If you are using the sensor in "Inverted" mode, this may be your issue as well. (I am monitoring a Webcam, so have inverted it to give a Green icon when it is online). The device is outside, and may be busy recording video, so I ping every 50s, with 200s timeout, giving AllowedFailures=4.  (I am now using the variant with the extra ping count, but don't think that affects this bit of the logic).

When I turn it on, it starts returning pings. The code inverts the ping return, INCREMENTS the Current Failure Count, until the count reaches 4, and only then does it clear the sensor.
However, a single failed ping immediately resets the count, and hence trips the sensor.

i.e. the Invert function also inverts the operation of the fail count - which does not really make sense.

I will have a go at moving the invert logic to the output values, instead of inverting the input. I have not previously modded a device, so it may be some time  :)
Title: Re: Ping Sensor
Post by: Aaron on November 04, 2014, 03:57:37 pm
Aaron,
I have been looking again in the code, as I was getting similar behaviour, and strange results in the graphing files.
If you are using the sensor in "Inverted" mode, this may be your issue as well. (I am monitoring a Webcam, so have inverted it to give a Green icon when it is online). The device is outside, and may be busy recording video, so I ping every 50s, with 200s timeout, giving AllowedFailures=4.  (I am now using the variant with the extra ping count, but don't think that affects this bit of the logic).

When I turn it on, it starts returning pings. The code inverts the ping return, INCREMENTS the Current Failure Count, until the count reaches 4, and only then does it clear the sensor.
However, a single failed ping immediately resets the count, and hence trips the sensor.

i.e. the Invert function also inverts the operation of the fail count - which does not really make sense.

I will have a go at moving the invert logic to the output values, instead of inverting the input. I have not previously modded a device, so it may be some time  :)

Thank you for running through that, and helping!  I have always ran using Invert which might be why it was inconsistent... we'll see... I just changed it to Normal to see if that fixes the issue.
Title: Re: Ping Sensor
Post by: integlikewhoa on November 04, 2014, 05:16:33 pm
Aaron,
I have been looking again in the code, as I was getting similar behaviour, and strange results in the graphing files.
If you are using the sensor in "Inverted" mode, this may be your issue as well. (I am monitoring a Webcam, so have inverted it to give a Green icon when it is online). The device is outside, and may be busy recording video, so I ping every 50s, with 200s timeout, giving AllowedFailures=4.  (I am now using the variant with the extra ping count, but don't think that affects this bit of the logic).

When I turn it on, it starts returning pings. The code inverts the ping return, INCREMENTS the Current Failure Count, until the count reaches 4, and only then does it clear the sensor.
However, a single failed ping immediately resets the count, and hence trips the sensor.

i.e. the Invert function also inverts the operation of the fail count - which does not really make sense.

I will have a go at moving the invert logic to the output values, instead of inverting the input. I have not previously modded a device, so it may be some time  :)

Thank you for running through that, and helping!  I have always ran using Invert which might be why it was inconsistent... we'll see... I just changed it to Normal to see if that fixes the issue.

Well I can't say I understand everything but I run mine inverted and now wonder how much better would it work for me if I swapped it around. Seems to work ok right now, but anything I can do to speed up response and improve accuracy is a plus.
Title: Re: Ping Sensor
Post by: Octoplayer on November 06, 2014, 04:56:49 am
Hi,
"Stopping Invert Mode tripping instantly"
I have modified the PingSensor code so that "invert" mode regains the original logic of being able to miss one or more ping replies without tripping instantly, just like in "normal" mode. I have based this mod on Shanew's posting #350 with the pingcount variable.

The code was inverting the ping result, which also meant that the CurrentFailureCount logic was "inverted" - ie a single fail meant it would trip, but it would take multiple successful pings to clear the trip. I have moved the invert to work on the tripped variable, so the counting logic is the same in both normal and tripped modes.

I have listed the mods to the I_pingsensor.xml file, including comments on the before and after lines, in case anyone wants to check what I have done. I have also uploaded the complete package, with the xml tidied up.

In ExecutePing function: minor wording change (cos I got confused when testing when I saw abnormal results  :-\)
Code: [Select]
     -- log("abnormal exit while ping execution. ErrorCode: " .. tostring(returnCode))--KJH 4Nov - No response is not necessarily abnormal if device is offline
        log("No Response from ping execution. ErrorCode: " .. tostring(returnCode))

In SetResult:
Code: [Select]
  --local function setResult(parentDevice, pingResult) -- Nov4 - invert parameter is now needed in here
    local function setResult(parentDevice, pingResult, invert)

  -- if (origTripped == "1" and pingResult == "0" and currentFailureCount &lt; tonumber(allowedFailure)) then
      if (origTripped ~= invert and pingResult == "0" and currentFailureCount &lt; tonumber(allowedFailure)) then

In SetResult:
Code: [Select]
local PingEffect = invertResult(pingResult, invert) -- KJH 4Nov added line to Invert Pingresult now if appropriate
 
      -- if (origTripped  ~= pingResult) then -- KJH 4Nov Now the count logic has been dealt with, we can invert the trip
if (origTripped  ~= PingEffect) then -- KJH 4Nov - use Effective result
        local time = os.time(os.date('*t'))

     -- luup.variable_set(SECURITY_SID, "Tripped", pingResult, parentDevice) --KJH 4Nov Dont output direct result
        luup.variable_set(SECURITY_SID, "Tripped", PingEffect, parentDevice)--KJH 4Nov Output effective result
        luup.variable_set(HADEVICE_SID, "LastUpdate", time, parentDevice)

    -- if ((pingResult == "1") and (origTripped == "0")) then -- KJH 4Nov Extra test not needed, have already checked they are not equal
        if (origTripped == "0") then -- KJH 4Nov Was not tripped, but now is, so record timestamp
          luup.variable_set(SECURITY_SID, "LastTrip", time, parentDevice)
        end
      end
    end
code]
And in RefreshCache, defer the inversion:
[code]
    -- setResult(PARENT_DEVICE, invertResult(executePing(address, pingcount), invert)) --Original line
        setResult(PARENT_DEVICE, executePing(address, pingcount), invert) -- KJH 4Nov- removed inversion of ping
Title: Re: Ping Sensor
Post by: integlikewhoa on November 06, 2014, 01:07:38 pm
Hi,
"Stopping Invert Mode tripping instantly"
I have modified the PingSensor code so that "invert" mode regains the original logic of being able to miss one or more ping replies without tripping instantly, just like in "normal" mode. I have based this mod on Shanew's posting #350 with the pingcount variable.

Why, thank you very much for your contribution to the community.
Title: Re: Ping Sensor
Post by: Aaron on November 15, 2014, 09:23:29 am
Has anyone been testing Octo's code updates? No feedback seems strange - even just "working fine here" would be helpful. If it is working fine then Maybe suggest getting it published on MIOS Apps site?
Title: Re: Ping Sensor
Post by: integlikewhoa on November 15, 2014, 11:43:12 am
^^^^^  ahahah sorry!

I installed it right away and been using it in invert with no problems.
Title: Re: Ping Sensor
Post by: Octoplayer on November 15, 2014, 05:49:57 pm
Thanks Aaron & integlikewhoa - I have been using for a couple of weeks or so now - it does seem to have solved the problems I was having with a single flaky response tripping my alerts.

I am using it in both Inverted and normal mode - seems stable in both.

Cheers.
Title: Re: Ping Sensor
Post by: mda on November 22, 2014, 04:32:48 pm
Has anyone been testing Octo's code updates?

One small thing i noticed: The "Device Timeout" field on the Setting tab does not seem to stick (reverts to 0) and I can not find that variable on the Advanced Tab to set it directly.
Title: Re: Ping Sensor
Post by: Octoplayer on November 22, 2014, 05:56:54 pm
Quote
The "Device Timeout" field on the Setting tab does not seem to stick (reverts to 0)

Are you changing the "AllowedFailures" value on the Advanced tab to zero? 

- if you change that on 'Advanced' it will set the set the Timeout on 'Settings' to: N x PollPeriod. (and vice versa).
Title: Re: Ping Sensor
Post by: Octoplayer on November 22, 2014, 05:58:13 pm
(PS - that's nothing to do with the changes I made  ;D)

Title: Re: Ping Sensor
Post by: mda on November 23, 2014, 01:08:09 am
Are you changing the "AllowedFailures" value on the Advanced tab to zero? 

- if you change that on 'Advanced' it will set the set the Timeout on 'Settings' to: N x PollPeriod. (and vice versa).

I am a bit confused... Based on this http://forum.micasaverde.com/index.php/topic,1997.msg122669.html#msg122669 I thought Device Timeout is how long (in seconds) it waits for each ping to return before declaring that one ping failed? (Sorry, i am easily confused  :) )

Thanks.
Title: Re: Ping Sensor
Post by: Octoplayer on November 24, 2014, 06:48:31 am
mda,
The Ping Timeout and Device Timeout are different things:

(Assuming you have the later versions of the code with the 'Ping Count' option on the settings screen)  - the code will  'ping' with a burst of  'count' pings to the given address. The pings are sent with the default 1sec interval. So for a count of 5, after  about 5sec (Actually 4s + the timeout or response time), that ping command will have either passed or failed. That's the PING timeout.

If was no reply from that burst, the FailedCount is incremented. Otherwise, a response was received, so the FailedCount is reset to zero.

That ping command is sent again every 'Poll Period' (e.g. 20s). When/if 'FailedCount' exceeds the AllowedFailures limit (e.g. 4), then the Ping Sensor is triggered (or cleared in invert mode). This is the DEVICE Timeout, and is thus the 'AllowedFailures' value times the 'Poll Period'.

In this example 'Device Timeout' would be 80 seconds. If you change that to, say, 120s, the AllowedFailures would be changed to 6.

HTH
Octoplayer
Title: Re: Ping Sensor
Post by: Ramias on November 24, 2014, 03:12:44 pm
Sorry I am pretty slow :)

I have a few web cams all powered via the same PoE injector.

I have the PoE injector plugged in via an Aeon switch so i can power cycle it if/when any one of the cams stops responding to pings (yes, I know one camera hanging will cause me to reboot all of my cameras.  I am ok with that).

So I have created multiple ping sensor devices.  Each of those are triggers for the same scene that turns my switch off, waits 5 seconds, and turns the switch back on.

I want to avoid a loop where one camera trips the scene, which will momentarily kill every camera until they all reboot; but I don't want cameras in the reboot loop to cause the scene to fire again a few seconds later.

Should I set poll period to say 120 seconds?  The cameras can reboot and respond to pings faster than that so I could avoid a loop.

Or is there a better way to do this?  I know I could get crazy and use PLEG but I want to keep this as simple as possible.

Thanks
Title: Re: Ping Sensor
Post by: mda on November 24, 2014, 03:21:36 pm
mda,
The Ping Timeout and Device Timeout are different things:...

Ahh, that makes perfect sense. Thanks !
Title: Re: Ping Sensor
Post by: Octoplayer on November 27, 2014, 10:37:32 am
@ Ramius,
Quote
Should I set poll period to say 120 seconds?  The cameras can reboot and respond to pings faster than that so I could avoid a loop

I would be tempted to set the condition to say a 30s Poll Period, with a Device timeout of 120s (equivalent to AllowedFail count of 4).

That will give your cameras time to reboot, and also provide some resilience against missed pings in the normal course of events.

Octoplayer
Title: Re: Ping Sensor
Post by: shotgun29 on November 29, 2014, 06:42:42 am
Hello Don't know if this is the right place to post my question i will try.I started using the ping sensor 2 week ago to ping my iphone when i came home,to open my danalock z wave look for that it works perfect.
when i press my going away scene i changes the status of the ping sensor to arm. when i then come home after 2 min i change it back to bypass. But it still ping my iphone all the time. I thing this is causing my scene to be run slower. Can i stop the ping sensor from ping my iphone and only doing it when the arm is akrive?

System= Ping Sensor version 0,16 micasaverde 2 latest firmware
Title: Re: Ping Sensor
Post by: nullx8 on November 29, 2014, 06:49:55 am
But it still ping my iphone all the time. I thing this is causing my scene to be run slower. Can i stop the ping sensor from ping my iphone and only doing it when the arm is akrive?

no it always do the ping .. you would need to change the code to combine the ping action with armed status.

in short "NO" it does always ping ;)
Title: Re: Ping Sensor
Post by: shotgun29 on November 29, 2014, 08:43:58 am
so witch setting should i use to only make it ping every 10 sec and only 1 ping ?
Title: Re: Ping Sensor
Post by: shanew on November 29, 2014, 10:42:26 am
Octoplayer,

Without trying it out, this looks awesome.  When I added the pingcount feature, I knew there would likely be a need for just what you've coded up here, but I was so frustrated just getting pingcount to work that I didn't follow through.

Is there any place (other than this forum) where all these changes are getting tracked / managed so that there aren't all these individual mods floating around?  I have some concern that people may start stepping on each others toes.  (This should not be taken as an offer on my part to volunteer, since I've been in "don't touch it if it ain't broke mode" for about six months with my Vera).

Hi,
"Stopping Invert Mode tripping instantly"
I have modified the PingSensor code so that "invert" mode regains the original logic of being able to miss one or more ping replies without tripping instantly, just like in "normal" mode. I have based this mod on Shanew's posting #350 with the pingcount variable.

The code was inverting the ping result, which also meant that the CurrentFailureCount logic was "inverted" - ie a single fail meant it would trip, but it would take multiple successful pings to clear the trip. I have moved the invert to work on the tripped variable, so the counting logic is the same in both normal and tripped modes.
Title: Re: Ping Sensor
Post by: shanew on November 29, 2014, 10:50:56 am
so witch setting should i use to only make it ping every 10 sec and only 1 ping ?

In theory, you'd set the Poll Period to 10, but Vera isn't really reliable at performing events below a certain delay (I don't recall what that number is, but I think it's somewhere between 15-30 seconds, depending on how much else your Vera is doing).  In other words, you can set it to 10, but it may not actually turn out to perform that way.

In the non-modded version, the ping count at each "test" is hard-coded to 1.  In the modded version, it's set to 1 by default, but you can check the PingCount variable in the advanced tab of your device and set it to 1 manually if necessary.
Title: Re: Ping Sensor
Post by: Octoplayer on November 29, 2014, 12:32:27 pm
Shanew,
Quote
Is there any place (other than this forum) where all these changes are getting tracked / managed so that there aren't all these individual mods floating around

I don't know of any other place to manage this, but then, I had missed your mod until someone pointed out why I was getting confused - as I was running on the Mios published version.

As the changes so far complement the original, and would not stop anyone with the MIOS version from working, I would love to see them taken on as and issued as an update - rather than publishing a forked version. I guess that is a question for TedStriker, as the OP, if he would be happy to take on the changes, or for someone else to take on maintenance.

Cheers

Title: Re: Ping Sensor
Post by: Aaron on November 29, 2014, 12:34:31 pm
I don't think Ted is around, nor has been for a long time.

I suggest whomever wants to own the code send it in for publishing on MIOS apps store. Just call it Ping v2 or something. :)
Title: Re: Ping Sensor
Post by: squatingyeti on December 10, 2014, 08:52:01 pm
So, I've just discovered the ping app on the mios site is different than the edited one people seem to be using here. With that said, how on earth do I set the plugin up? I've copied over the 5 files into the luup files under develop apps. Now I'm at a loss for how to go forward  :-[ What do I need to do to set this plugin up and start pinging a couple phones? I just don't see a settings page or anything to input my info. I'm UI7 btw and I think I just go to create device under develop apps? Just not sure if I use D_PingSensor, I_PingSensor or how to get to the config.

Appreciate the help.


Also, my god the spam control stuff to post is a nightmare. I dunno what those freakin letters are and stop asking me these questions lol

EDIT: NVM, I got it all figured out. Things were just in a little different place than the original wiki had. Now I just gotta figure out the settings for what works best.

oh yeah, and have it speak this nightmare captcha to me
Title: Re: Ping Sensor
Post by: squatingyeti on December 11, 2014, 09:16:54 am
I lied, I haven't figured this thing out. I'm trying to ping my phone so my vera knows when I'm home or away. However, I'm not sure how to set it to track that. I can see in the settings where it trips, but does it reset on its own or do I have to make a separate setup for the phone being gone?
Title: Re: Ping Sensor
Post by: nullx8 on December 11, 2014, 09:31:15 am
I lied, I haven't figured this thing out. I'm trying to ping my phone so my vera knows when I'm home or away. However, I'm not sure how to set it to track that. I can see in the settings where it trips, but does it reset on its own or do I have to make a separate setup for the phone being gone?

no it will switch back to not-tripped by itself
Title: Re: Ping Sensor
Post by: Octoplayer on December 11, 2014, 09:36:21 am
@squatingyeti
The "Tripped" flag will be set when pings are received, and cleared when they stop.
(Vice versa if you set the "Invert" button.)

Not sure if there is a better way to install - but I started with the MIOS Version, and added an instance, then uploaded the later files which overwrote the old version.

HTH
Octo
Title: Re: Ping Sensor
Post by: Aaron on December 11, 2014, 09:18:51 pm
Right now Ping Sensor is not working correctly for me... it is going crazy.

I have Vera Alerts getting a notification with EVERY ping success and failure... see the screenshots for the inconsistent timing of the pings.

My setting are...
Poll Period = 15
Device Timeout = 90

seems like I'm getting a lot of failures - but I was not before today.

Title: Re: Ping Sensor
Post by: nullx8 on December 11, 2014, 11:00:20 pm
Aaron: it does look like this with my iOS decices as well, as they immideatly back to sleep after recieving push or other things.

Do you use the ping sensor as home/away switch ?


Sent from my iPhone using Tapatalk
Title: Re: Ping Sensor
Post by: Aaron on December 12, 2014, 12:16:03 am
Aaron: it does look like this with my iOS decices as well, as they immideatly back to sleep after recieving push or other things.

Do you use the ping sensor as home/away switch ?

Yes I do... and have been for a long time. But today things seem wonky and it is going crazy. I've rebooted vera, router, phone... nothing is helping.

What Ping Sensor settings are you guys using - and finding work well for you?
Title: Re: Ping Sensor
Post by: nullx8 on December 12, 2014, 01:46:34 am
well thats generally not really a wise choice of action.

i have a Virtual "away switch"
all my luup code checks against the status of this switch.

its being turned off also by a ping switch (if armed)
or my car (vehicle tracking, via another virtual switch)
or the garage door lock beeing unlocked via Pin
or simply me turn it of and on.

by this way you have alot more control of your arm/disarm behavour and you can control this kind of things.

if your device is android you can just set it to never disconnect the wifi .. that would solvew the problem, but its not really a wise way of doing that.
Title: Re: Ping Sensor
Post by: Aaron on December 12, 2014, 02:02:50 am
@Octo
I suspect there is some sort of bug in your code.
I "fixed" my issue by removing your version and going back to .16 via MIOS App store. Been working as expected since I did.


@nullx8
Ping Sensor devices are not used directly, or as the sole means of determining Occupancy. A MultiSwitch, is set via both PLEG logic from multiple sources or using a UI manually - then PLEG uses that to determine Occupancy. When I'm home, Ping is the only reliable and easy way to determine who is home. I've not setup WIAB logic, it is simply to complicated and PLEG is tough enough to troubleshoot. Though, none of that matters to the problem I posted. There is some strange bug in the Ping Sensor code Octo posted I've only now hit after using it for some time.

Title: Re: Ping Sensor
Post by: j3390659 on December 14, 2014, 01:08:18 am
Newbie here.

I had setup a scene when I turned on my samsung tv between 8pm to 2am, it will trigger the backlight at the back of the tv.

I also setup a scene to turn off the backlight when the tv is off.

Vera Edge with UI7, ping sensor and LDM-15.

I had added  the following LUU code to the scene:

local function checkTime()
     local pStart = "07:00"   -- Start of time period
     local pEnd = "02:00"     -- End of time period
     local allow = true       -- true runs scene during period, false blocks it
     local hS, mS = string.match(pStart,"(%d+)%:(%d+)")
     local mStart = (hS * 60) + mS
     local hE, mE = string.match(pEnd,"(%d+)%:(%d+)")
     local mEnd = (hE * 60) + mE
     local tNow = os.date("*t")
     local mNow = (tNow.hour * 60) + tNow.min
     if mEnd >= mStart then
          return (((mNow >= mStart) and (mNow <= mEnd)) == allow)
     else
          return (((mNow >= mStart) or (mNow <= mEnd)) == allow)
     end
end

local function checkDay()
     local dFirst = 1         -- Start day of period (1-7) Sunday = 1
     local dLast = 7          -- End day of period (1-7) Sunday = 1
     local allow = true       -- true runs scene during period, false blocks it
     local tNow = os.date("*t")
     local dNow = tNow.wday
     if dLast >= dFirst then
          return (((dNow >= dFirst) and (dNow <= dLast)) == allow)
     else
          return (((dNow >= dFirst) or (dNow <= dLast)) == allow)
     end
end

return checkTime() and checkDay()

I don't know much about coding.  The above code was copied from the script forum.

I have 2 problems.

1.  The backlight will turn on regardless of when I turn on the tv.
2.  When I switch input on the tv, the backlight will go off.

Any idea why would these happen? 

Thanks for the help.
Title: Re: Ping Sensor
Post by: Cor on December 16, 2014, 04:46:43 am
What the hell!!?!??

Since yesterday the ping sensor says that my cellphones keeps getting off my network ........

I took a look now what's going on ( it was functioning fine for the last 6 months) and I noticed that the version of the ping sensor has changed.

It went back to a previous version where there were only 2 boxes with variables I could insert, instead of the 3 ( I uploaded months ago the files from post# 350.)

Anyone has an idea how or why this could have happened?

I uploaded the files again, and it seems to be ok now , but Iwould like to know why.

Thanks,
Cor
Title: Re: Ping Sensor
Post by: Otje on December 16, 2014, 05:29:33 am
Hi Cor

 i am not sure but maybe it is caused by autoupdate in the apps section. some apps do automatically update..
Title: Re: Ping Sensor
Post by: Cor on December 16, 2014, 05:51:40 am
I just checked and the autoupdate is disabled for this app.

Cor
Title: Re: Ping Sensor
Post by: Armedmetallica on December 16, 2014, 07:53:36 am
well thats generally not really a wise choice of action.

i have a Virtual "away switch"
all my luup code checks against the status of this switch.

its being turned off also by a ping switch (if armed)
or my car (vehicle tracking, via another virtual switch)
or the garage door lock beeing unlocked via Pin
or simply me turn it of and on.

by this way you have alot more control of your arm/disarm behavour and you can control this kind of things.

if your device is android you can just set it to never disconnect the wifi .. that would solvew the problem, but its not really a wise way of doing that.


How do you do the vehicle tracking? Very interested
Title: Re: Ping Sensor
Post by: Aaron on December 16, 2014, 09:43:41 am
What the hell!!?!??

Since yesterday the ping sensor says that my cellphones keeps getting off my network ........

I took a look now what's going on ( it was functioning fine for the last 6 months) and I noticed that the version of the ping sensor has changed.

It went back to a previous version where there were only 2 boxes with variables I could insert, instead of the 3 ( I uploaded months ago the files from post# 350.)

Anyone has an idea how or why this could have happened?

I uploaded the files again, and it seems to be ok now , but Iwould like to know why.

Thanks,
Cor
I'm having issues also, starting about a week ago. I was using the code octo modded and since rolled back...  But still having problems with it not seeing my phone a few times a day. With octos code it was missing constantly... 20-30 times a day

Sent from my HTC6525LVW using Tapatalk

Title: Re: Ping Sensor
Post by: Cor on December 16, 2014, 10:48:10 am
@ Aaron , yep, sounds like the same , it was working good , and since I came home yesterday , lots of "false" warnings , due to the ping sensor not "sensing"my phone. Although everytime my phone was on my local network.

As said, today I found out , the plugin rolled back to the original version with different settings as well.

I now have uploaded the modded files again and inserted  the "correct" settings for my phone , and it seems to be Ok again.

But so wierd that the plugin went back to a previous version.

Cor
Title: Re: Ping Sensor
Post by: integlikewhoa on December 16, 2014, 05:30:09 pm
well thats generally not really a wise choice of action.

i have a Virtual "away switch"
all my luup code checks against the status of this switch.

its being turned off also by a ping switch (if armed)
or my car (vehicle tracking, via another virtual switch)
or the garage door lock beeing unlocked via Pin
or simply me turn it of and on.

by this way you have alot more control of your arm/disarm behavour and you can control this kind of things.

if your device is android you can just set it to never disconnect the wifi .. that would solvew the problem, but its not really a wise way of doing that.


How do you do the vehicle tracking? Very interested

I'm also interested to know his setup. We have discussed this on the forums before and I think the best way was an old phone with a charger wired to it hidden in the glove box. I think the old phone (no 3g service required) has a built in battery to keep it alive threw the night and you can set it up connect to home wifi when in range and use the ping sensor off that.
a broken screen 20.00 phone or prepaid phone. Anything that will connect to wireless when in range.
Title: Re: Ping Sensor
Post by: Armedmetallica on December 16, 2014, 07:52:46 pm
well thats generally not really a wise choice of action.

i have a Virtual "away switch"
all my luup code checks against the status of this switch.

its being turned off also by a ping switch (if armed)
or my car (vehicle tracking, via another virtual switch)
or the garage door lock beeing unlocked via Pin
or simply me turn it of and on.

by this way you have alot more control of your arm/disarm behavour and you can control this kind of things.

if your device is android you can just set it to never disconnect the wifi .. that would solvew the problem, but its not really a wise way of doing that.


How do you do the vehicle tracking? Very interested

I'm also interested to know his setup. We have discussed this on the forums before and I think the best way was an old phone with a charger wired to it hidden in the glove box. I think the old phone (no 3g service required) has a built in battery to keep it alive threw the night and you can set it up connect to home wifi when in range and use the ping sensor off that.
a broken screen 20.00 phone or prepaid phone. Anything that will connect to wireless when in range.

I'm actually thinking of getting a $15 line added to a T-mobile Simple Choice plan. Keep it hidden and permanently in the car. I can use tasker and or trigger to signify on network/off network. Or even GPS geofences. So many ways to do it. just wonder what others have done.

I think the best is probably RFID. All the others can give false positives. But RFID is probably way too expensive.
Title: Re: Ping Sensor
Post by: integlikewhoa on December 16, 2014, 11:11:27 pm
well thats generally not really a wise choice of action.

i have a Virtual "away switch"
all my luup code checks against the status of this switch.

its being turned off also by a ping switch (if armed)
or my car (vehicle tracking, via another virtual switch)
or the garage door lock beeing unlocked via Pin
or simply me turn it of and on.

by this way you have alot more control of your arm/disarm behavour and you can control this kind of things.

if your device is android you can just set it to never disconnect the wifi .. that would solvew the problem, but its not really a wise way of doing that.


How do you do the vehicle tracking? Very interested

I'm also interested to know his setup. We have discussed this on the forums before and I think the best way was an old phone with a charger wired to it hidden in the glove box. I think the old phone (no 3g service required) has a built in battery to keep it alive threw the night and you can set it up connect to home wifi when in range and use the ping sensor off that.
a broken screen 20.00 phone or prepaid phone. Anything that will connect to wireless when in range.

I'm actually thinking of getting a $15 line added to a T-mobile Simple Choice plan. Keep it hidden and permanently in the car. I can use tasker and or trigger to signify on network/off network. Or even GPS geofences. So many ways to do it. just wonder what others have done.

I think the best is probably RFID. All the others can give false positives. But RFID is probably way too expensive.

I guess it depends on what your trying to do. For me spending 15.00 a month for each one of my vehicles (4) is not what I'm looking for ( I also probley wouldn't have a Vera if I wanted to pay a monthly fee's either).  And unless your trying to use it for security and track down a stolen vehicle probley is not going to help much with home automation. Geofences and tasker have limited use and wouldn't even be what I would use to track a stolen vehicle.

For home automation tracking people (which already have and carry cell phones with a data plan) work better. I currently use vera proximity (used to use tasker before this came out), Ping sensor, and Blue Iris geofence on both mine and my wifes phone with PLEG making the change when 2 of the 3 sensors trip to prevent false positives or negatives. 

To know only if a car is home or not a 3G connection is not needed and would take longer to fire by geofence then by Ping or MAC association. Also Geofence is less reliable. Mac Association or Ping works more like an alarm sensor. If the conenction is lost (phone dies, freezes up, quit working, get dissabled) it trips.  Geofence and tasker or others requires the opposite, phone to be on, working, have reception ect..

So again it all depends on what your end goal is. People pay big money on vehicle tracking for security, alarms, and the like but I can't see tasker being used to located your vehicle, tell you which direction its going, how fast, if the ignition is on or not. There is better apps to use for that purpose.

http://www.mycartracks.com/ just for one example. 
Title: Re: Ping Sensor
Post by: Aaron on December 17, 2014, 12:05:35 am
Does mycartracks send notifications when the phone enters or exits a given geofence?

I use a combo of Tasker and Ping Sensor...  While not perfect it works.  I tried Auto Vera and VeraProximity...  But neither were reliable,  even with GPS on.    counter to what I would have guessed Tasker using Network Location was more accurate and more reliable.

I'm going to add MAC detection in my router to add another method.

I wish VeraProximity was reliable for me.

Sent from my HTC6525LVW using Tapatalk

Title: Re: Ping Sensor
Post by: integlikewhoa on December 17, 2014, 02:24:03 am
Does mycartracks send notifications when the phone enters or exits a given geofence?

I use a combo of Tasker and Ping Sensor...  While not perfect it works.  I tried Auto Vera and VeraProximity...  But neither were reliable,  even with GPS on.    counter to what I would have guessed Tasker using Network Location was more accurate and more reliable.

I'm going to add MAC detection in my router to add another method.

I wish VeraProximity was reliable for me.

Sent from my HTC6525LVW using Tapatalk

My cartracks is does but it's not made for that and I wouldn't suggest using it for geofence. 

My experience is it's not geofence apps. It's the phone and it's GPS and service in a said area. I currently use 2 Geofences along with ping sensor (I stopped using the DDWRT mac detection recently). The geofences even tho different apps are both just about as reliable which is so so. Thats why ping and these work great. Out of 3 I can make it solid. 

Title: Re: Ping Sensor
Post by: Armedmetallica on December 17, 2014, 10:43:08 am
well thats generally not really a wise choice of action.

i have a Virtual "away switch"
all my luup code checks against the status of this switch.

its being turned off also by a ping switch (if armed)
or my car (vehicle tracking, via another virtual switch)
or the garage door lock beeing unlocked via Pin
or simply me turn it of and on.

by this way you have alot more control of your arm/disarm behavour and you can control this kind of things.

if your device is android you can just set it to never disconnect the wifi .. that would solvew the problem, but its not really a wise way of doing that.


How do you do the vehicle tracking? Very interested

I'm also interested to know his setup. We have discussed this on the forums before and I think the best way was an old phone with a charger wired to it hidden in the glove box. I think the old phone (no 3g service required) has a built in battery to keep it alive threw the night and you can set it up connect to home wifi when in range and use the ping sensor off that.
a broken screen 20.00 phone or prepaid phone. Anything that will connect to wireless when in range.

I'm actually thinking of getting a $15 line added to a T-mobile Simple Choice plan. Keep it hidden and permanently in the car. I can use tasker and or trigger to signify on network/off network. Or even GPS geofences. So many ways to do it. just wonder what others have done.

I think the best is probably RFID. All the others can give false positives. But RFID is probably way too expensive.

I guess it depends on what your trying to do. For me spending 15.00 a month for each one of my vehicles (4) is not what I'm looking for ( I also probley wouldn't have a Vera if I wanted to pay a monthly fee's either).  And unless your trying to use it for security and track down a stolen vehicle probley is not going to help much with home automation. Geofences and tasker have limited use and wouldn't even be what I would use to track a stolen vehicle.

For home automation tracking people (which already have and carry cell phones with a data plan) work better. I currently use vera proximity (used to use tasker before this came out), Ping sensor, and Blue Iris geofence on both mine and my wifes phone with PLEG making the change when 2 of the 3 sensors trip to prevent false positives or negatives. 

To know only if a car is home or not a 3G connection is not needed and would take longer to fire by geofence then by Ping or MAC association. Also Geofence is less reliable. Mac Association or Ping works more like an alarm sensor. If the conenction is lost (phone dies, freezes up, quit working, get dissabled) it trips.  Geofence and tasker or others requires the opposite, phone to be on, working, have reception ect..

So again it all depends on what your end goal is. People pay big money on vehicle tracking for security, alarms, and the like but I can't see tasker being used to located your vehicle, tell you which direction its going, how fast, if the ignition is on or not. There is better apps to use for that purpose.

http://www.mycartracks.com/ just for one example.

Yes - all of this makes sense. I was just floating the idea of a car/phone since i'd seen a couple of Nexus 7 installs in cars. To me, a tablet in a car w.o. internet is only marginally better than the GPS nav HU that I have now (where everything is integrated with the car's electronics). I'd rather have a HU that's integrated than a tablet that has not internet. Plus I really only have one car that hauls the family; the other is my daily commuter that I really don't care much about.

So using the data connection to somehow integrate w. Vera was thought #2; and thought #3 was using Android device manager to locate a missing car. lo-tech, but better than nothing. and damned if I pay $40 or whatever for a service like On-Star.

My other caveat that makes things somewhat? difficult is that I'm trying to keep Vera behind a FW (remote access via VPN). But a lot of the really cool things seem to require Vera being open.
Title: Re: Ping Sensor
Post by: integlikewhoa on December 17, 2014, 02:01:47 pm
Yes - all of this makes sense. I was just floating the idea of a car/phone since i'd seen a couple of Nexus 7 installs in cars. To me, a tablet in a car w.o. internet is only marginally better than the GPS nav HU that I have now (where everything is integrated with the car's electronics). I'd rather have a HU that's integrated than a tablet that has not internet. Plus I really only have one car that hauls the family; the other is my daily commuter that I really don't care much about.

So using the data connection to somehow integrate w. Vera was thought #2; and thought #3 was using Android device manager to locate a missing car. lo-tech, but better than nothing. and damned if I pay $40 or whatever for a service like On-Star.

My other caveat that makes things somewhat? difficult is that I'm trying to keep Vera behind a FW (remote access via VPN). But a lot of the really cool things seem to require Vera being open.

Ahh yes, a tablet mounted for other automotive purposes and Android device services for location all make more sense with why you would pay the monthly fee. Keep us updated.
Title: Re: Ping Sensor
Post by: Armedmetallica on December 17, 2014, 02:24:26 pm
Yes - all of this makes sense. I was just floating the idea of a car/phone since i'd seen a couple of Nexus 7 installs in cars. To me, a tablet in a car w.o. internet is only marginally better than the GPS nav HU that I have now (where everything is integrated with the car's electronics). I'd rather have a HU that's integrated than a tablet that has not internet. Plus I really only have one car that hauls the family; the other is my daily commuter that I really don't care much about.

So using the data connection to somehow integrate w. Vera was thought #2; and thought #3 was using Android device manager to locate a missing car. lo-tech, but better than nothing. and damned if I pay $40 or whatever for a service like On-Star.

My other caveat that makes things somewhat? difficult is that I'm trying to keep Vera behind a FW (remote access via VPN). But a lot of the really cool things seem to require Vera being open.

Ahh yes, a tablet mounted for other automotive purposes and Android device services for location all make more sense with why you would pay the monthly fee. Keep us updated.

These are the posts that got my wheels turning: http://www.reddit.com/r/DIY/comments/2jp696/i_installed_a_nexus_7_in_my_car_it_looks_awesome/

http://imgur.com/a/IuJod

Not sure I can take it to that level though. I like your track the person instead of a vehicle approach. Now, if only I can condition my wife to keep her phone on her person AND viable (charged) at all times.
Title: Re: Ping Sensor
Post by: goldriver on December 18, 2014, 11:41:56 am
Does anyone have any idea of the battery consumption on an iphone if it's being ping every 15 seconds ?
Title: Re: Ping Sensor
Post by: Aaron on December 18, 2014, 01:11:57 pm
Does anyone have any idea of the battery consumption on an iphone if it's being ping every 15 seconds ?

you iphone is doing a million times than responding to a ping for a millisecond ever 15 seconds.

it will make zero difference
Title: Re: Ping Sensor
Post by: clippermiami on December 26, 2014, 10:48:00 am
Anyone have any idea how much load this sensor places on Vera --- Memory % and CPU % for LuaUPnP? I'm using two Ping Sensors on one pf my Veras that currently runs about 117% Memory for LuaUPnP so I'm curious if removing them will have a meaningful impact on the load.
Title: Re: Ping Sensor
Post by: shotgun29 on December 27, 2014, 02:03:58 pm
Dont no if this is the right place or if it should be in the z-wave lock section. I am using the ping sensor to open my danalock door lock when i come home only problem is it seem to be trigger a restart of my micasaverde 2 like when you save, so i becomes unresponsive for 20 sek. i dont now if this is the lock or the ping sensor. has anyone experienced this?

Title: Re: Ping Sensor
Post by: integlikewhoa on December 27, 2014, 06:17:13 pm
Dont no if this is the right place or if it should be in the z-wave lock section. I am using the ping sensor to open my danalock door lock when i come home only problem is it seem to be trigger a restart of my micasaverde 2 like when you save, so i becomes unresponsive for 20 sek. i dont now if this is the lock or the ping sensor. has anyone experienced this?

Restarts could really be anything but is usually a sign of something overloading or hanging up the vera. Being the Vera 2 is old and slow, what else you running?

Start by disabling one thing at a time to see when it stops. Is it only when the ping sees you or is the act of the scene?
Un install and reinstall one thing at a time to see.
Title: Re: Ping Sensor
Post by: jolerius on December 31, 2014, 11:28:36 am
I can't get this to work. I have set up the ip on my phone and 300s poll. It automatically set timeout to 180000s.

But now I was out for a walk and checked my sensor and it did say my phone was home all the time even tough I had it with me. And I have static ip on it through my router.

What am I doing wrong??
Title: Re: Ping Sensor
Post by: squatingyeti on December 31, 2014, 03:26:53 pm
Woah, that timeout is the probably your problem. You're likely getting back before the timeout is up and able to say you were really gone.

A different issue, I can't seem to add another ping sensor to ping a different phone. Well, I can add one, but it seems to be running an older version of pingsensor instead of the files I have uploaded. What way should I go about adding a second ping sensor so it uses the updated files? Whenever I go to the apps and pingsensor to add another, it creates another sensor, but I can see it's using D_PingSensor.json and not D_PingSensor_UI7.json like the functioning sensor.
Title: Re: Ping Sensor
Post by: integlikewhoa on December 31, 2014, 07:20:56 pm
I can't get this to work. I have set up the ip on my phone and 300s poll. It automatically set timeout to 180000s.

But now I was out for a walk and checked my sensor and it did say my phone was home all the time even tough I had it with me. And I have static ip on it through my router.

What am I doing wrong??

Your polling is 5 min. (300 secs is 5 min.)  and your timeout is 2.08 days (180000 secs is 3000 minutes or 50 hours or 2.08 days).

You need to go for a lot longer walk if you want it to trip. Maybe 2.5 day walk.

OR

You need to set to like 10 to 30 sec poll times and 30 to 90 sec timeout.

Lower the numbers the faster it will work, but you might get false alarms if you go to low. I have mine at 10 and 20 but recommend/ most common is 30 and 90 I would say.
Title: Re: Ping Sensor
Post by: jolerius on December 31, 2014, 08:54:12 pm
I figured that.. But my timeout sets itself depending on the polling.. So how can I lower both values??
Title: Re: Ping Sensor
Post by: integlikewhoa on December 31, 2014, 09:18:49 pm
I figured that.. But my timeout sets itself depending on the polling.. So how can I lower both values??

Change the polling first to 20 then set the timeout. Mine will let me set the time out to anything higher then the polling.

If I set the polling to 10 then try and set the timeout to 5 it will change it to 10.

EDIT:
The timeout has to be set in multiples of the polling. So if polling is 10 then time out can be 10,20,30,40,50
If polling is 15 then timeout can be 15,30,45,60
Title: Re: Ping Sensor
Post by: jolerius on January 01, 2015, 04:56:16 am
I figured that.. But my timeout sets itself depending on the polling.. So how can I lower both values??

Change the polling first to 20 then set the timeout. Mine will let me set the time out to anything higher then the polling.

If I set the polling to 10 then try and set the timeout to 5 it will change it to 10.

EDIT:
The timeout has to be set in multiples of the polling. So if polling is 10 then time out can be 10,20,30,40,50
If polling is 15 then timeout can be 15,30,45,60

No, that doesnt work. Regardless of what i set the polling to, the timeout automatically sets itself to 60*polling.
So if i set polling to 30 the timeout sets itself to 1800.
Is this strange? or is it supposed to be like this?
Title: Re: Ping Sensor
Post by: squatingyeti on January 01, 2015, 10:33:35 am
It's probably being set based on the number of pings that are being sent. Pingcount. If you're saying send X pings with a polling time of Y, it creates the necessary timeout.
Title: Re: Ping Sensor
Post by: jolerius on January 01, 2015, 10:39:30 am
But I don't have the ability to set ping count. How do I do that??
Title: Re: Ping Sensor
Post by: Aaron on January 01, 2015, 11:02:25 am
Guys
Make sure you are using the latest version. If you are having issues inputting settings, us the advanced tab to do it.
Also,  I found ping unreliable and I tried all sorts of settings and multiple phones. Reliability issues were due to the phones and/or Wifi combos... not the plug-in. For wired  computers is works fine.
My solution for phone/Occupancy is to use in combination with code on the router to detect the phones Mac address.
The router tells vera when the phone is home (10 second interval) and to be set as 'away'  both the ping (2 min interval) and the router must show the phone gone. This seems to be pretty good and survive phone reboots when needed.
I also use Tasker with Authomation HD to send home / away  triggers based on location detection.
All of these together seems pretty good... Not perfect.
I think the only way to get perfect would be to use bluetooth beacons all around your house /property.
Even using VeraProximity and Auto Location apps are totally unreliable for me...  Due to Google location services, not the apps themselves
Title: Re: Ping Sensor
Post by: jolerius on January 01, 2015, 11:13:15 am
I wanna use it to turn of unnecessary things when neither me or my wife is home. And turn it back on when one of us is home.

And I would rather use a solution with no apps on our phones. No problem on mine. But she wants to keep her simple
Title: Re: Ping Sensor
Post by: Aaron on January 01, 2015, 11:20:10 am
Ping works fine if you don't mind...
 timing variances of a minute or two
Potential reliability issues - it could miss a cycle or two, thus increasing your timing variance.

Again, no perfect solution.
I put Tasker know my wife's phone,  it runs in the background, she doesn't even know it is there
Title: Re: Ping Sensor
Post by: jolerius on January 01, 2015, 11:22:41 am
Hehe, that's a way to do it..

But what numbers should I put where to make it ping every 30 sec with a timeout on 60 sec?? How many ping counts and where do I set it??
Title: Re: Ping Sensor
Post by: hfleejr on January 02, 2015, 08:06:54 pm

I'm taking one more run at using Ping Sensor in a second home.  The goal is to ping an external website using the Invert option.  If the ping is unsuccessful (e.g. Tripped), I want to reset the DSL modem by triggering a scene to turn off then turn on the electrical outlet for the modem.  I'm polling every hr by setting the Poll Period to 3600 secs.   I downloaded the last version of the app from the Install Apps screen and updated with the files in reply #350 within this thread.

In some cases, the DSL connection may be down for an extended period due to the remote location.  So if the poll is unsuccessful, I'd like the system to reset the electrical outlet every hour until it comes back up.  The problem is the tripped flag will remain tripped until a poll is successful and therefore not trigger the execution of the scene.

So, can I add LUUP code to the trigger for the scene to reset the Tripped variable back to 0 (untripped)?  The Ping Sensor is 89.  From the xml code, it looks like the serviceId is PingSensor1.  I tried the following code, but I must be missing something as this doesn't reset the Tripped variable.  I would appreciate any feedback/assistance.

luup.variable_set("urn:demo-ted-striker:serviceId:PingSensor1","Tripped",0,89)
Title: Re: Ping Sensor
Post by: hfleejr on January 06, 2015, 03:57:42 pm
After looking at the xml, I realized that I needed to use the service id for the Security Sensor instead of the Ping Sensor and that the value for the variable is a string.  So, this code works to reset the Tripped flag so that subsequent polls will trigger the scene if the new poll is tripped as well.

luup.variable_set("urn:micasaverde-com:serviceId:SecuritySensor1","Tripped","0",89)

I plan to put this in a function and use with the luup.call_delay function to delay resetting the tripped flag until a few seconds before the next poll.
Title: Re: Ping Sensor
Post by: blingal on January 07, 2015, 08:23:00 pm
how would I get the value of the "Tripped" variable?

ive tried "luup.variable_get("urn:upnp-org:serviceId:SecuritySensor1", "Tripped", 157)" and "luup.variable_get("urn:upnp-org:serviceId:Switchpower1", "Tripped", 157)" and a few other variations but cant get a value out  >:(

Title: Re: Ping Sensor
Post by: hfleejr on January 07, 2015, 08:37:20 pm
Try the folowing instead. 

luup.variable_get("urn:micasaverde-com:serviceId:SecuritySensor1","Tripped",157)
Title: Re: Ping Sensor
Post by: kyb2012 on January 18, 2015, 04:43:40 pm
This plugin is great and I heavily rely on it.
Just recently, I've been having issues with the sensors not updating their status properly.  It seems to also be impacting my XBMC State plugin. 
Even when the device that I'm trying to ping is online, the Ping Sensor does not get tripped.  (I'm using it in inverted mode.)  I'm using the latest version from the App Store (v0.17).  I've tried completely uninstalling and re-installing the plugin.  I've ssh'ed into my Vera and tried the ping commands directly from there to confirm that it's reachable from Vera.
From the logs, I can see that the Ping command appear to be successful:
06   01/18/15 13:23:46.001   Device_Variable::m_szValue_set device: 191 service: urn:demo-ted-striker:serviceId:PingSensor1 variable: CurrentFailureCount was: 0 now: 0 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2f48f680>
06   01/18/15 13:23:46.002   Device_Variable::m_szValue_set device: 190 service: urn:demo-ted-striker:serviceId:PingSensor1 variable: CurrentFailureCount was: 0 now: 0 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2f28f680>
06   01/18/15 13:23:46.101   Device_Variable::m_szValue_set device: 192 service: urn:demo-ted-striker:serviceId:PingSensor1 variable: CurrentFailureCount was: 0 now: 0 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2f68f680>
But the status of the sensor still shows as tripped.

Also, in my XBMC State Plugin, which I believe uses the Ping Sensor, also seems to get an incorrect status from the Ping Sensor.  Because on the control panel for the plugin, it shows "Computer:  down", while on the Advanced tab, the variable for PingStatus says "up".  Any help would be appreciated.

Title: Re: Ping Sensor
Post by: paulcusick3 on January 20, 2015, 05:23:50 pm
This plugin is great and I heavily rely on it.


Mine also stopped working recently.  UI7, but worked UI7 before.  Wife is ready to disown me.
Title: Re: Ping Sensor
Post by: YzRacer on January 20, 2015, 05:35:05 pm
It's currently working well for me on UI7. I tried several of the different suggestions from this thread and what I found best is not to use inverted mode. It seems to me that inverted mode isn't just switching the tripped/not tripped indication, but the fashion in which the sensor switches between tripped/not tripped. If I use inverted, then the number of allowed failures would need to be exceeded for it to be not tripped, and that is a bad option when you are trying to determine home/away on a phone or portable device.
Title: Re: Ping Sensor
Post by: paulcusick3 on January 22, 2015, 09:30:38 am
It's currently working well for me on UI7. I tried several of the different suggestions from this thread and what I found best is not to use inverted mode. It seems to me that inverted mode isn't just switching the tripped/not tripped indication, but the fashion in which the sensor switches between tripped/not tripped. If I use inverted, then the number of allowed failures would need to be exceeded for it to be not tripped, and that is a bad option when you are trying to determine home/away on a phone or portable device.

I'm not using inverted.  Still not working for me.  I just uninstalled app, reboot, re-installed, reconfigured.... still no dice.  It had been working well for a year+ and on UI7 since October.  It stopped working sometime in early January. 

Am i alone?
Title: Re: Ping Sensor
Post by: integlikewhoa on January 22, 2015, 12:46:24 pm
It's currently working well for me on UI7. I tried several of the different suggestions from this thread and what I found best is not to use inverted mode. It seems to me that inverted mode isn't just switching the tripped/not tripped indication, but the fashion in which the sensor switches between tripped/not tripped. If I use inverted, then the number of allowed failures would need to be exceeded for it to be not tripped, and that is a bad option when you are trying to determine home/away on a phone or portable device.

I'm not using inverted.  Still not working for me.  I just uninstalled app, reboot, re-installed, reconfigured.... still no dice.  It had been working well for a year+ and on UI7 since October.  It stopped working sometime in early January. 

Am i alone?

I have also been having problems. It will say its tripped and I can open a command prompt and ping the devices just fine. I reload LUUP and it shows un tripped just fine Until some time down the road both phones do the same again. It's all devices at the same time.
Title: Re: Ping Sensor
Post by: RichardTSchaefer on January 22, 2015, 01:50:46 pm
Quote
I have also been having problems. It will say its tripped and I can open a command prompt and ping the devices just fine. I reload LUUP and it shows un tripped just fine Until some time down the road both phones do the same again. It's all devices at the same time.
This can also be caused by low memory ... the Ping plugin does not differentiate between not enough resources to run the OS command ping or if the OS level ping failed to respond to the ping.

i.e. Failure of the Ping Plugin does not mean the device is not available, it only means Vera can talk to it!.

Title: Re: Ping Sensor
Post by: integlikewhoa on January 22, 2015, 02:40:28 pm
Quote
I have also been having problems. It will say its tripped and I can open a command prompt and ping the devices just fine. I reload LUUP and it shows un tripped just fine Until some time down the road both phones do the same again. It's all devices at the same time.
This can also be caused by low memory ... the Ping plugin does not differentiate between not enough resources to run the OS command ping or if the OS level ping failed to respond to the ping.

i.e. Failure of the Ping Plugin does not mean the device is not available, it only means Vera can talk to it!.

Sounds like that very well could be my issue. Other Issues I have also seem to point in the same direction. This is on a LITE, but I also own an EDGE. Altho I don't use it due to USB (alarm panel) and a few other deivces that don't support it yet.
Title: Re: Ping Sensor
Post by: paulcusick3 on January 23, 2015, 02:58:40 pm
Quote
I have also been having problems. It will say its tripped and I can open a command prompt and ping the devices just fine. I reload LUUP and it shows un tripped just fine Until some time down the road both phones do the same again. It's all devices at the same time.
This can also be caused by low memory ... the Ping plugin does not differentiate between not enough resources to run the OS command ping or if the OS level ping failed to respond to the ping.

i.e. Failure of the Ping Plugin does not mean the device is not available, it only means Vera can talk to it!.

I bet mine is memory too;  Clean up and seems to be working. Thank you.
Title: Re: Ping Sensor
Post by: MikeH on February 02, 2015, 05:34:20 am
I just downloaded this app for the first time.  Can someone point me to the latest instructions on setting it up? Thanks.
Title: Re: Ping Sensor
Post by: nullx8 on February 04, 2015, 05:14:49 am
just cklick to the settings icon on the newly created device .. add IP and time you want to check on ..

close save reload and you done
Title: Re: Ping Sensor
Post by: MikeH on February 04, 2015, 12:35:58 pm
Thanks Nullx8! I got it working.
Title: Re: Ping Sensor
Post by: Octoplayer on February 06, 2015, 03:09:38 pm
@Octo
I suspect there is some sort of bug in your code.
I "fixed" my issue by removing your version and going back to .16 via MIOS App store. Been working as expected since I did.


Hi,
I noticed my webcam started dropping connections end of last year, but put it down to cold weather. I have just noticed the pingsensor has stopped working reliably on monitoring other devices where I know there is a connection, so I came back to the forum (must have ignored a notification and so been missing all the recent posts). I had not changed my code, but I notice that something has updated Vera, as I now have a J_pingsensor_u17.js file, and a U17Check attribute in the Advanced setting tab.
The I_PingSensor.xml is the same, and had been working fine for 2-3 months. I guess that MIOS have pushed a U17 compatibility file at some point, I cannot see anything in there that would affect the correction I had to the Invert logic, but I cannot work out would it could be, so I am going to back out the updated version and go back to Stock version. :-(
Title: Re: Ping Sensor
Post by: Octoplayer on February 07, 2015, 05:30:40 pm
Quote
I am going to back out the updated version and go back to Stock version

I have now downloaded the stock version from MIOS, and notice that it is v0.17 from mid December, so that was almost certainly the cause of the problem as it overwrote the modded versions. It seems to have dropped the "pingcount" variable, so there may have been a declaration mismatch that caused a memory leak (which I was getting warnings about).
v0.17 initially caused a massive number of restarts, flashing lights, and overloaded my email alert quota, then suddenly settled down and has been ok today.
I had a look in the 0.17 code, and notice that the fix for the invert logic is in there, so in invert mode it does not trigger on just one missed ping, so I am happy  :)
Title: Re: Ping Sensor
Post by: Aaron on February 19, 2015, 01:39:07 am
Octo
Is .17 working OK for you on UI5?
Title: Re: Ping Sensor
Post by: Octoplayer on February 19, 2015, 02:00:46 pm
@Aaron,
Quote
Is .17 working OK for you on UI5?
No, in the last couple of days I have noticed a large number of dropouts (cold weather again - seem to make my connection marginal). I looked at the code on the train today, and noticed that the Invert logic in 0.17 has changed the invert handling slightly, but is still incorrect. A single missed ping in invert mode will trip the sensor. I have drafted a two-line change, and have just logged in to upload it when I saw a notification on this post.

Will test it first, and let you know if it fixes the invert problem.

Octo
Title: Re: Ping Sensor
Post by: Octoplayer on February 20, 2015, 09:47:51 am
Quote
Reply #388
Hi all,
I have now checked the invert code again in v0.17, and realised it does still need a patch to make the inverted ping logic work correctly. Otherwise in invert mode a single missed ping will trip the sensor instantly, but it will take a number of successful pings to clear the trip.
The basics are the same as per post #388, so we check if we have reached the maximum number of missed pings first, and only then invert the response.

If you just want to have Inverted mode working correctly - The modified code is attached, it has the U17 mod in there, so should also work for that, but I am still on U15, so cannot confirm that. As usual, download the file, go to the Apps > Develop > Luup files, browse and up load the file, then restart.

For anyone who wants to see the changes, they are:
In InitSettings:
Code: [Select]
   
   --invert = invert or 0 
      invert = invert or "0"   -- Octo - should be string, not integer for consistency
 
The SetReult function includes several modded / new lines:
Code: [Select]
--    local function setResult(parentDevice, pingResult)
    local function setResult(parentDevice, pingResult, invert) --Octo
      -- Store the current ping result only when it has changed
      local origTripped = luup.variable_get(SECURITY_SID, "Tripped", parentDevice) or "0"
      local allowedFailure = luup.variable_get(PING_SID, "AllowedFailure", parentDevice) or 0

      -- If pingresult is positive, always reset currentFailureCount
      if (pingResult == "1") then
        currentFailureCount = 0
        luup.variable_set(PING_SID, "CurrentFailureCount", 0, parentDevice)
      end
 
      -- Last result was positive, current result is negative, and the allowed failures is not reached
      -- keep pingresult positive as long allowedFailure is not reached
   --if (origTripped == "1" and pingResult == "0" and currentFailureCount &lt; tonumber(allowedFailure)) then
      if (origTripped ~= invert and pingResult == "0" and currentFailureCount &lt; tonumber(allowedFailure)) then
        pingResult = "1"
        currentFailureCount = currentFailureCount + 1
        luup.variable_set(PING_SID, "CurrentFailureCount", currentFailureCount, parentDevice)
        log("ping failed, failure = " .. currentFailureCount .. "/".. allowedFailure)
      end

      debug("Ping Result raw:" .. pingResult ..", CurrentFails: " .. currentFailureCount .. ", invert:" .. invert)
      local pingEffect = invertResult(pingResult, invert)  --Octo - have set/reset current failure count, so can NOW invert
      debug("Ping Enabled, Inverted?, Result:" .. pingEffect .. ", OrigTripped: ".. origTripped )
   
--    if (origTripped  ~= pingResult) then
      if (origTripped  ~= pingEffect) then -- Octo
        local time = os.time(os.date('*t'))

--      luup.variable_set(SECURITY_SID, "Tripped", pingEffect, parentDevice)
        luup.variable_set(SECURITY_SID, "Tripped", pingResult, parentDevice)
        luup.variable_set(HADEVICE_SID, "LastUpdate", time, parentDevice)

--     if ((pingResult == "1") and (origTripped == "0")) then
        if ((pingEffect == "1") and (origTripped == "0")) then
          luup.variable_set(SECURITY_SID, "LastTrip", time, parentDevice)
        end
      end
    end
And in refresh call the call becomes:
Code: [Select]
      --  setResult(PARENT_DEVICE, invertResult(executePing(address), invert))  --octoplayer - this was inverting too soon
          setResult(PARENT_DEVICE, executePing(address), invert)                      -- defer inversion until AFTER failed count
 

Title: Re: Ping Sensor
Post by: YzRacer on February 23, 2015, 04:10:43 pm
Thank you for sharing! Once I figured out that the invert mode was not working properly I just switched all of my logic in PLEG to use Ping Sensor in normal mode. I am on 0.17 with UI7 and it's working well as long as I configure it using the advanced tab. I am having good luck with 30 second poll, 4 pings, 4 failures for 2 minute timeouts and 90 second poll, 4 pings, 4 failures for devices I don't follow closely.

What I do see is a lot of errors on sensor response time in the Luup log. I suspect this may be normal due to the nature of this plugin and the time it takes to do more than just a couple of pings.
Title: Re: Ping Sensor
Post by: jeylites on June 03, 2015, 11:45:00 pm
Hi Guys,

I'm trying to get the Ping Sensor to work on Vera Edge (Ui7). I'm able to type the IP address, and have control on Normal, Invert, Arm, Bypass but  when the IP address the Ping Sensor is pinging into trip, it doesn't send any notification or nothing shows up on logs. Is there something I'm not doing right?
Title: Re: Ping Sensor
Post by: integlikewhoa on June 05, 2015, 01:23:24 am
Use the advanced settings instead.
Title: Re: Ping Sensor
Post by: dinkeldorf on August 05, 2015, 12:22:48 am
Great plug in! Using it on some key pieces of infrastructure to determine at a glance  what's up. Esp handy when not at home & don't have fing available at a glance.

What I've found is some devices respond to command line pings but not from the plugin. Using the advanced tab, test it out with devices that respond (synology, myq, netatmo) however Sonos, Hue and some others don't. Thoughts? Is the protocol different from command line (OS X console) to this plugin? I can't imagine why it would block vera.
Title: Re: Ping Sensor
Post by: mostlychris on August 05, 2015, 02:45:41 pm
Having read 32 pages on this topic, I don't see a way to add a second instance of the ping monitor in UI7.  How do I do this using the plugin that was installed from the vera app?
Title: Re: Ping Sensor
Post by: mostlychris on August 05, 2015, 03:17:55 pm
Answered my own question.  I added the device under the develop apps section.
Title: Re: Ping Sensor
Post by: oren45 on August 06, 2015, 03:02:48 am
Hi

Can you please explain how you did it?
I also want to add a second instance of the ping monitor in UI7.

Thanks!
Title: Re: Ping Sensor
Post by: squatingyeti on August 06, 2015, 04:49:26 pm
Answered my own question.  I added the device under the develop apps section.

what were the steps you took to do so? I tried to add a second sensor and it didn't seem to want to work. Thanks!
Title: Re: Ping Sensor
Post by: fredjchavez on August 13, 2015, 10:11:47 am
Agree...would be really helpful to walk us through the steps to add a second ping device. Thank you.


-Freddy
Title: Re: Ping Sensor
Post by: integlikewhoa on August 14, 2015, 12:09:44 am
Agree...would be really helpful to walk us through the steps to add a second ping device. Thank you.


-Freddy

People this is nothing special on how to create more then one of the same plugin in UI7. Ping sensor or something else. Open VERA UI on a webpage.

Go to Apps, My apps, Ping Sensor, Click "Create Another" and done.
Title: Re: Ping Sensor
Post by: MNB on August 16, 2015, 10:07:51 am
@integlikawhoa, thank-you for the screen shot and yes I would normally expect to be able to added additional Ping Devices however I currently do not have that option (see attached) any suggestions would be greatly appreciated. Mike

Agree...would be really helpful to walk us through the steps to add a second ping device. Thank you.


-Freddy

People this is nothing special on how to create more then one of the same plugin in UI7. Ping sensor or something else. Open VERA UI on a webpage.

Go to Apps, My apps, Ping Sensor, Click "Create Another" and done.
Title: Re: Ping Sensor
Post by: integlikewhoa on August 17, 2015, 10:34:15 am
@integlikawhoa, thank-you for the screen shot and yes I would normally expect to be able to added additional Ping Devices however I currently do not have that option (see attached) any suggestions would be greatly appreciated. Mike

Agree...would be really helpful to walk us through the steps to add a second ping device. Thank you.


-Freddy


Maybe try a force update (even tho you on latest) via http or reinstall app.

What model vera unit is this on?

People this is nothing special on how to create more then one of the same plugin in UI7. Ping sensor or something else. Open VERA UI on a webpage.

Go to Apps, My apps, Ping Sensor, Click "Create Another" and done.
Title: Re: Ping Sensor
Post by: MNB on August 17, 2015, 06:14:32 pm
@integlikewhoa, I had already tried uninstalling and reinstall the app with the same success (no way of creating additional ping devices). I'm on a Vera Edge machine with Version 1.7.1248 firmware, I also look at other apps that I have installed and do have the ability to create additional app devices so it not necessarily a problem with other apps only Ping.. Any help would be greatly appreciated. Mike
Title: Re: Ping Sensor
Post by: JS007 on August 17, 2015, 07:39:27 pm
@integlikewhoa, I had already tried uninstalling and reinstall the app with the same success (no way of creating additional ping devices). I'm on a Vera Edge machine with Version 1.7.1248 firmware, I also look at other apps that I have installed and do have the ability to create additional app devices so it not necessarily a problem with other apps only Ping.. Any help would be greatly appreciated. Mike

weird, I just looked on my vera edge and it has on the myapps page "Create Another", not sure why missing from yours, my firmware is 1.7.1320 though....

it's right above the "help" line where yours is missing

my ping app shows same version as yours - 0.17
Title: Re: Ping Sensor
Post by: integlikewhoa on August 17, 2015, 10:36:14 pm
@integlikewhoa, I had already tried uninstalling and reinstall the app with the same success (no way of creating additional ping devices). I'm on a Vera Edge machine with Version 1.7.1248 firmware, I also look at other apps that I have installed and do have the ability to create additional app devices so it not necessarily a problem with other apps only Ping.. Any help would be greatly appreciated. Mike

Have no idea really then. Are you running u or uploading custom ping sensor files or just app store?
Title: Re: Ping Sensor
Post by: MNB on August 18, 2015, 04:00:01 pm
Downloaded via app store. I just rechecked to verify that nothing changed overnight which it did not, I'll put a ticket in to see if Vera Inc can help. Mike
Title: Re: Ping Sensor
Post by: gwichman on August 19, 2015, 06:54:42 pm
same problem here.. no way to add a second ping sensor.. version 1.7.1320
Title: Re: Ping Sensor
Post by: JS007 on August 19, 2015, 08:09:56 pm
same problem here.. no way to add a second ping sensor.. version 1.7.1320

I just uninstalled my ping app and reinstalled from app store, and the create another is no longer there, so it must be when installed on this firmware, now to reload my backup :)

edit : after the vera restore from the backup the create another was back
Title: Re: Ping Sensor
Post by: integlikewhoa on August 19, 2015, 08:26:15 pm
That could make sense, I have had mine installed for along time.
Title: Re: Ping Sensor
Post by: B3rt on August 30, 2015, 02:41:10 pm
The ping sensor is not working with the latest firmware (after a clean install/setup)

I did a factory reset and added all devices/plugins/etc manually (no backup restore) and found the ping sensor is not working as it should be.
- i cannot add more devices
- also IP to ping stays on 127.0.0.1 in settings menu, all other settings in this menu are also not updated.
There is no error etc, it simply does not work as before.

Note, i run last firmware (vera edge) and a CLEAN install/setup, no upgrade or backup restore!

Hope this can be fixed.
Title: Re: Ping Sensor
Post by: integlikewhoa on August 30, 2015, 09:16:00 pm
The ping sensor is not working with the latest firmware (after a clean install/setup)

I did a factory reset and added all devices/plugins/etc manually (no backup restore) and found the ping sensor is not working as it should be.
- i cannot add more devices
- also IP to ping stays on 127.0.0.1 in settings menu, all other settings in this menu are also not updated.
There is no error etc, it simply does not work as before.

Note, i run last firmware (vera edge) and a CLEAN install/setup, no upgrade or backup restore!

Hope this can be fixed.

it works for me. That update has been out for almost 3 weeks. I have 2 edges and 1 lite all on the latest and running ping sensor.
Title: Re: Ping Sensor
Post by: B3rt on August 31, 2015, 03:57:33 am
but did you update or a clean install?

When i updated it worked, but i did a factory reset and installed all pugins and code new, then it does not work anymore.

Title: Re: Ping Sensor
Post by: JS007 on September 02, 2015, 06:07:53 am
but did you update or a clean install?

When i updated it worked, but i did a factory reset and installed all pugins and code new, then it does not work anymore.

I installed the WOLPlusPing plugin and not seeing the create another button there either, I think something is not right when installing plugins fresh
Title: Re: Ping Sensor
Post by: Spanners on September 03, 2015, 06:21:51 am
same problem here.. no way to add a second ping sensor.. version 1.7.1320

Same for me. Version 0.17 on 1.7.649

Installed, Ping Sensor works fine but unable to add another instance. :(

Title: Re: Ping Sensor
Post by: B3rt on September 03, 2015, 06:46:48 am
it is also not possible to set an IP to ping.
It pings only itself (localhost)....
Title: Re: Ping Sensor
Post by: integlikewhoa on September 03, 2015, 10:38:45 am
it is also not possible to set an IP to ping.
It pings only itself (localhost)....

LOL, that would be kind of pointless.

You need to go to the change the IP in the setting or advanced settings
Title: Re: Ping Sensor
Post by: ryanjennings on September 03, 2015, 10:53:28 am
I am also having trouble with adding devices.  I am running veralite with 1.7.649.  I installed the app yesterday on a slightly older firmware.  When it didn't work I updated to 1.7.649. 

I also see the trouble with the local ip.  It seemed like it reverted back to 127.0.0.1.  I have changed it several times, but it keeps going back to 127.0.0.1.
Title: Re: Ping Sensor
Post by: B3rt on September 03, 2015, 11:02:12 am
i know, but this does not work..

The IP entered in settings is ignored, when the device is offline (off) it still pings according to the plugin.
Also when entered in settings it is not saved, so it pings only itself (locahost).

This addon is at the moment 'fucked up', it can only be used once and the IP to ping cannot be set.
Hope this will be fixed as quickly as possible, i use the addon a lot in my scenes and i cannot use it now...
Title: Re: Ping Sensor
Post by: JS007 on September 03, 2015, 11:25:44 am
http://<vera_ip>:3480/data_request?id=update_plugin&Plugin=<device_id>

be nice if there was a command like this to "create another"

anyone know if there is?
Title: Re: Ping Sensor
Post by: integlikewhoa on September 03, 2015, 12:05:52 pm
i know, but this does not work..

The IP entered in settings is ignored, when the device is offline (off) it still pings according to the plugin.
Also when entered in settings it is not saved, so it pings only itself (locahost).

This addon is at the moment 'fucked up', it can only be used once and the IP to ping cannot be set.
Hope this will be fixed as quickly as possible, i use the addon a lot in my scenes and i cannot use it now...

If your this worried about it,
I would remove the ping sensor run a backup of everything.
Downgrade ui7 to a really old version.   
Install ping sensor and reinstall your backup.
Upgrade to the latest

Now your only upgrading not doing a fresh install.
Title: Re: Ping Sensor
Post by: CudaNet on September 04, 2015, 12:35:07 pm
Running .619, had the plugin installed for sometime and I can install multiples... Sensor(s) work and record/report last tripped BUT wandering over to settings (within device) returns 'Error executing function PingSensor.PingSensorSettings():

Just sayin'
Title: Re: Ping Sensor
Post by: gwichman on September 08, 2015, 07:58:14 pm
same thing here.. can't set the IP.. it stays on localhost.

useless
Title: Re: Ping Sensor
Post by: B3rt on September 09, 2015, 03:45:49 am
i fixed it, this worked for me:

- remove ALL ping devices your created.... (not the plugin)
- make sure there is no update, press update button (if present) and also activate auto update afterwarts
- login as user into your unit
- create a new ping device using this ping plugin

When done check if you can create an other ping device, if this is now possible the problem is gone.

This fixed it for me, dunno if it will fix the problems for others aswell

I created now 6 devices and all are configurable and working...
Title: Re: Ping Sensor
Post by: gwichman on September 11, 2015, 04:48:52 pm
No luck for me..

i tried what you outlined and while i can successfully add more then one device now, they both seem to revert to 127.0.0.1 for the IP address everytime.
Title: Re: Ping Sensor
Post by: B3rt on September 11, 2015, 05:38:26 pm
did you update the plugin?

I noticed a update yesterday (or today) of this plugin.

Note: you must set the IP in the settings tab, NOT in the advanced tab!
Title: Re: Ping Sensor
Post by: gwichman on September 11, 2015, 08:07:25 pm
yes well i did click the button :).. and did set it in the setting tab.. it didn't work.. current version 0.17

perplexed, just now i went ahead and clicked uninstall, rebooted the controller entirely, and went back in to install the ping addon. It's listed as version 0.36 and says it was Updated 2015-09-11 05:20:40. Interesting.. I don't think it was updating both automatically and manually before :(

anyways, i clicked install, went to the installed apps, clicked create device twice (waiting between each to give it time), and entered my IP. Hey there is a "save and reload" button on that screen now.. that wasn't there before! Clicked it.. went into Devices and armed it. things already look better.

So far the IP is sticking. So far the icon in devices is no longer red probably because it's not able to ping my phone because i'm not there.
Title: Re: Ping Sensor
Post by: mostlychris on September 17, 2015, 08:21:04 am
Has anyone else noticed that the timeout seems to be ignored on the ping sensor, at least in the latest firmware version for the Edge?  I use the ping sensor to determine if we are home or not and it is failing within what seems to be the poll period time and not the timeout period.  Is there a fix for this?
Title: Re: Ping Sensor
Post by: squatingyeti on September 22, 2015, 08:18:03 am
Does anyone know the effect of running two ping devices with a 30 second poll period on a vera lite? I know previously in the thread there was a little discussion about this, but I was just wondering. I wouldn't think just pinging 2 devices would take hardly any CPU time or resources, but I've seen stranger things with vera lol.

For those having problems with adding a second ping sensor: After you add the sensor, refresh your devices page. After you change a setting in the advanced category for the new ping sensor, go out and refresh again. Give it a minute or so. It took a few tries for mine to sort itself out and I kept thinking it wasn't taking anything. After some patience, it was.
Title: Re: Ping Sensor
Post by: akbooer on September 22, 2015, 08:56:41 am
I have a VeraLite running UI5 with two ping sensorsNo problems. No visible impact on CPU load or network performance.

Title: Re: Ping Sensor
Post by: gwichman on October 11, 2015, 01:09:18 pm
Is it possible to ping an iphone 6s running the latest IOS? Because my ping sensor isn't pinging it while it DOES work for my Android device (LG G3) and i'm trying to troubleshoot this. I clearly have the correct IP entered and yet, nada.
Title: Re: Ping Sensor
Post by: integlikewhoa on October 11, 2015, 10:28:10 pm
Is it possible to ping an iphone 6s running the latest IOS? Because my ping sensor isn't pinging it while it DOES work for my Android device (LG G3) and i'm trying to troubleshoot this. I clearly have the correct IP entered and yet, nada.

Even before the latest ios Apples in my house never work right with a ping sensor. They usually work for a bit then say they left or go to sleep even tho there are still home and on wifi.

I resorted to iphone locator plugin along with geofence for my iphones.
Title: Re: Ping Sensor
Post by: gwichman on October 12, 2015, 02:43:21 pm
thanks i'll check it out!
Title: Re: Ping Sensor
Post by: Scoutmedic on October 23, 2015, 12:41:46 pm
Is it possible to ping an iphone 6s running the latest IOS? Because my ping sensor isn't pinging it while it DOES work for my Android device (LG G3) and i'm trying to troubleshoot this. I clearly have the correct IP entered and yet, nada.

Even before the latest ios Apples in my house never work right with a ping sensor. They usually work for a bit then say they left or go to sleep even tho there are still home and on wifi.

I resorted to iphone locator plugin along with geofence for my iphones.

Did you notice any change in battery life on your phone with the iPhone locator plugin? The idea of the ping sensor takes the power load off of the phone and puts it on Vera.
Title: Re: Ping Sensor
Post by: alpha1 on November 24, 2015, 02:24:08 am
Since the latest update i am unable to change the Polling time or the Timeout Times.

Anyone else having this issue?

Title: Re: Ping Sensor
Post by: B3rt on November 27, 2015, 09:47:52 am
yep same problem here.

Only 15 seconds poll en 0 timeout.

Also i dont inderstand how this time out works, when i enter 15 seconds poll period and i enter 10 seconds timeout it is automaticly change to 15
So for some strange reason it is multiplied so poll times is muliplied with what i enter.

Is this normal?!?
Title: Re: Ping Sensor
Post by: clippermiami on November 27, 2015, 10:29:02 am
Is it possible to ping an iphone 6s running the latest IOS? Because my ping sensor isn't pinging it while it DOES work for my Android device (LG G3) and i'm trying to troubleshoot this. I clearly have the correct IP entered and yet, nada.

Even before the latest ios Apples in my house never work right with a ping sensor. They usually work for a bit then say they left or go to sleep even tho there are still home and on wifi.

I resorted to iphone locator plugin along with geofence for my iphones.

Did you notice any change in battery life on your phone with the iPhone locator plugin? The idea of the ping sensor takes the power load off of the phone and puts it on Vera.

I tried replacing the iPhone Locator with Ping Sensor but got some reason the Wi-Fi on my daughter's iPhone hours to sleep, only periodically waking up.
Title: Re: Ping Sensor
Post by: B3rt on November 27, 2015, 10:39:06 am
I tried replacing the iPhone Locator with Ping Sensor but got some reason the Wi-Fi on my daughter's iPhone hours to sleep, only periodically waking up.

This is normal for an iphone.
As soon as the screensaver kicks in wifi is disabled and it fallsback to 3/4G to save energy, when you unlock the phone wifi immidiatly kicks in again.
There is no way to enable wifi when the phone is locked on iphone without jailbreaking it.
Title: Re: Ping Sensor
Post by: clippermiami on November 27, 2015, 03:35:11 pm
I tried replacing the iPhone Locator with Ping Sensor but got some reason the Wi-Fi on my daughter's iPhone hours to sleep, only periodically waking up.

This is normal for an iphone.
As soon as the screensaver kicks in wifi is disabled and it fallsback to 3/4G to save energy, when you unlock the phone wifi immidiatly kicks in again.
There is no way to enable wifi when the phone is locked on iphone without jailbreaking it.

Another "We know whats best for you" improvement :) Like Google/Android and some of their "security" tricks :)
Title: Re: Ping Sensor
Post by: konsta on December 11, 2015, 11:28:26 am
yep same problem here.

Only 15 seconds poll en 0 timeout.

Also i dont inderstand how this time out works, when i enter 15 seconds poll period and i enter 10 seconds timeout it is automaticly change to 15
So for some strange reason it is multiplied so poll times is muliplied with what i enter.

Is this normal?!?


Try to change variable "AllowedFailure" in Advanced. For example if you enter "Period"=15, and "AllowedFailure"=4, this will mean that if Pind is faild for 4 times (60 sec 15*4) then sensor will be "Tripped" to 0.
Title: Re: Ping Sensor
Post by: Octoplayer on January 02, 2016, 08:17:03 am
Hi,
I have been noticing the folllowing error message in my logs from the Ping Sensor. Finally got round to debugging it...
 "LuaInterface::CallFunction_Timer device 130 refreshCache took 10 seconds"

It only seems to have started since going to UI7 - although I cannot be sure of that, and seems to be caused by the ping command not timing out before the command reschedules itself. My fix is to force the ping to wait only 2sec for a response by adding the -w 2 option to the command...
Code: [Select]
      local returnCode = os.execute("ping -c 1 -w 2 " .. address)
The complete replacement file is attached for Ping Sensor V0.36, including a previous fix for the ping inversion behaviour and for default values. Just upload the file... Apps > Develop Apps > Luup Files. Then drag and drop the file onto the upload box.
***Correction - This version of the file had a typo - see later post for fixed version  ***
Happy New Year

Octoplayer
Title: Re: Ping Sensor
Post by: integlikewhoa on January 02, 2016, 11:26:07 am
Hi,
I have been noticing the folllowing error message in my logs from the Ping Sensor. Finally got round to debugging it...
 "LuaInterface::CallFunction_Timer device 130 refreshCache took 10 seconds"

It only seems to have started since going to UI7 - although I cannot be sure of that, and seems to be caused by the ping command not timing out before the command reschedules itself. My fix is to force the ping to wait only 2sec for a response by adding the -w 2 option to the command...
Code: [Select]
      local returnCode = os.execute("ping -c 1 -w 2" .. address)
The complete replacement file is attached for Ping Sensor V0.36, including a previous fix for the ping inversion behaviour and for default values. Just upload the file... Apps > Develop Apps > Luup Files. Then drag and drop the file onto the upload box.

Happy New Year

Octoplayer

I just installed this and done a reboot and now it don't work anymore. I'm still investigating, but proceed with caution!
Title: Re: Ping Sensor
Post by: Octoplayer on January 02, 2016, 03:57:30 pm
integlikewhoa... Sorry for any inconvenience, not sure why the change should stop anything working.
I can post the original version from 0.36 if you want to revert.

Title: Re: Ping Sensor
Post by: integlikewhoa on January 02, 2016, 06:38:17 pm
integlikewhoa... Sorry for any inconvenience, not sure why the change should stop anything working.
I can post the original version from 0.36 if you want to revert.

I saved the old file before hand, and I have reverted and it went back to working.

I tried a few things including invert and checking IP's and no change from on or off network. For now I'm back to old version and it's working good as it was before. Maybe someone else can see if it was only me or not. I think I was full stock before this change. 
Title: Re: Ping Sensor
Post by: Octoplayer on January 03, 2016, 07:28:17 am
Quote
it went back to working

Can you say what "it" was - the entire Vera, or the Ping sensor?
and not working in terms of not running, not appearing, not detecting target...?

Cheers
Title: Re: Ping Sensor
Post by: integlikewhoa on January 03, 2016, 01:00:35 pm
Quote
it went back to working

Can you say what "it" was - the entire Vera, or the Ping sensor?
and not working in terms of not running, not appearing, not detecting target...?

Cheers

After installing your file my ping sensor always showed away even tho 3 devices were connected. I tired several things and no matter if the devices were on the network or not it always showed not tripped or away.

I have more then one vera in more then one house. I grabbed the .XML file from another vera that had the ping sensor installed and dragged and dropped it to install back on my vera here and the ping sensor now detects my devices properly and the plugin is working again.

So to put it simple the ping sensor don't function for me with your new .xml file installed, but it does with the normal files.

I am now back running the stock .xml file.

Title: Re: Ping Sensor
Post by: Octoplayer on January 03, 2016, 05:37:34 pm
Hi,
ooops :-[

Sorry - when copying the change in - I dropped a space, so
Code: [Select]
-w 2 " .. ip became
Code: [Select]
-w 2" .. ipThat concatenated the 2 with the IP, with the result that the ping would always fail ( but at least not time out).

Corrected version attached...
Title: Re: Ping Sensor
Post by: integlikewhoa on January 03, 2016, 10:04:51 pm
Hi,
ooops :-[

Sorry - when copying the change in - I dropped a space, so
Code: [Select]
-w 2 " .. ip became
Code: [Select]
-w 2" .. ipThat concatenated the 2 with the IP, with the result that the ping would always fail ( but at least not time out).

Corrected version attached...

Much better.

Tested a few min and seems to be working correctly or atleast not failing out the gate like before. I will report back if I have any issues.

Thanks,
Title: Re: Ping Sensor
Post by: integlikewhoa on January 04, 2016, 11:00:50 pm
Well might have spoke to soon. Today it stopped working and I was forced to reboot VERA to get it working again on all 3 devices I have using it.

It's to early to tell if it was related only to this ping sensor or not, but I haven't had any issues until now and this is the only update I have done.
Title: Re: Ping Sensor
Post by: integlikewhoa on January 08, 2016, 01:47:30 pm
I found 2 days later is did the same now. The ping sensor just stays untripped even when we are on WIFI. A reload Luup will fix it but 2 days after it happens again. I have reverted back to the stock file and will update in several days if the problem has returned. 
Title: Re: Ping Sensor
Post by: lingerba on January 11, 2016, 08:53:44 pm
For what it is worth, I am having this same issue with the ping sensor.  I have the same resolution (restarting luup) to get it working again.

I must mention that I only started having this issue when installing/testing new versions of the Honeywell TCC app (see http://forum.micasaverde.com/index.php/topic,30125.525.html).  If I revert back to a very old beta version of this app, the ping sensors work fine.  I seem to be the only person that is testing that is having this issue...
Title: Re: Ping Sensor
Post by: morgi23 on January 19, 2016, 06:07:11 am
I found 2 days later is did the same now. The ping sensor just stays untripped even when we are on WIFI. A reload Luup will fix it but 2 days after it happens again. I have reverted back to the stock file and will update in several days if the problem has returned.

Hi,

What controller are you using? VeraEdge, Lite? Which UI?
I had those same problems when my controller memory was exceeded (using veralite with UI7). I used to get "cannot write user data" message in the main dashboard and when this happen, both of my ping sensor's devices did not function well.
when I upgraded to VeraEdge those problems been solved.
Title: Re: Ping Sensor
Post by: integlikewhoa on January 19, 2016, 10:26:29 am
I found 2 days later is did the same now. The ping sensor just stays untripped even when we are on WIFI. A reload Luup will fix it but 2 days after it happens again. I have reverted back to the stock file and will update in several days if the problem has returned.

Hi,

What controller are you using? VeraEdge, Lite? Which UI?
I had those same problems when my controller memory was exceeded (using veralite with UI7). I used to get "cannot write user data" message in the main dashboard and when this happen, both of my ping sensor's devices did not function well.
when I upgraded to VeraEdge those problems been solved.

This test was on a vera edge. I have 3 houses and all were upgraded from lites over a year ago. I also have vera plus on pre oder now.
Title: Re: Ping Sensor
Post by: morgi23 on January 19, 2016, 03:52:15 pm

This test was on a vera edge. I have 3 houses and all were upgraded from lites over a year ago. I also have vera plus on pre oder now.


 :-\
When using the TOP command through SSH, what is the memory consumption of your controller?
Do you get any "cannot write user data" messages on your dashboard?
Title: Re: Ping Sensor
Post by: integlikewhoa on January 19, 2016, 04:26:37 pm

This test was on a vera edge. I have 3 houses and all were upgraded from lites over a year ago. I also have vera plus on pre oder now.


 :-\
When using the TOP command through SSH, what is the memory consumption of your controller?
Do you get any "cannot write user data" messages on your dashboard?

I'm familiar with the "Cannot write user data" as I do have that problem on an edge now. I have a trouble ticket in for that issue at a vacation house and when that issue arises you loose alot of things, notifications and others. That problem comes and goes.

The ping sensor issue was tested on my home unit that doesn't have this issue.
The ping sensor was working fine and is currently working fine with the stock .xml file. The problem only happened after I tested "Octoplayer" new .XML file a few post's back. I have since reverted back to stock .xml file and no issues since.

So my testing with the PING sensor plugin is completed.
Title: Re: Ping Sensor
Post by: johnnyw55 on February 22, 2016, 07:14:06 pm
Relatively new to all this.. but just wondering if there is a work around for this, right now I have my iPhone set up on a static IP, and when my phone connects to the wifi the system switches a virtual switch and runs a scene that I am home and everything turns on accordingly, which is awesome. I was hoping to have it so when my device leaves the network that it switches the virtual switch to away and turns everything off. Which it does.. but also does when my device i suppose goes into sleep mode? when the screen is off, shortly after the wifi must go into a sleep mode which tricks the system into thinking I'm away. Once I touch the home button and the screen turns back on, it thinks I'm back home again. Is this a problem that is just indicative to using a mobile device as a switch? I had been reading about using installing DD-WRT on my router and applying a script which does basically the same thing, but on a higher level? its a little more complicated to do. but is that the only way around this problem?
Title: Re: Ping Sensor
Post by: integlikewhoa on February 22, 2016, 07:24:31 pm
Relatively new to all this.. but just wondering if there is a work around for this, right now I have my iPhone set up on a static IP, and when my phone connects to the wifi the system switches a virtual switch and runs a scene that I am home and everything turns on accordingly, which is awesome. I was hoping to have it so when my device leaves the network that it switches the virtual switch to away and turns everything off. Which it does.. but also does when my device i suppose goes into sleep mode? when the screen is off, shortly after the wifi must go into a sleep mode which tricks the system into thinking I'm away. Once I touch the home button and the screen turns back on, it thinks I'm back home again. Is this a problem that is just indicative to using a mobile device as a switch? I had been reading about using installing DD-WRT on my router and applying a script which does basically the same thing, but on a higher level? its a little more complicated to do. but is that the only way around this problem?

Get rid of your iphone is the only fix I know of it for this.

I have used botht he ddwrt and this ping sensor with iphones and andriods. iPhones when asleep don't respond so neither works right with an iphone. Andriod phones I have no problems with either solution. Actually found the ping to be better as ddwrt held on to my device for too long before it finally decided to say it wasn't on the network. Ping said I was away sooner. Both worked the same when getting home.

The iphone locator plugin seems to be the only reliable one, but takes some setting up for the poll settings to not drain battery and it's not as accurate (saying your home and away right as you pull up) but it works.
Title: Re: Ping Sensor
Post by: johnnyw55 on February 22, 2016, 08:53:09 pm

Get rid of your iphone is the only fix I know of it for this.


haha thanks! I've been reading up and I think your correct, the only other way really is to jailbreak the phone and you can change it, so the wifi doesn't go into sleep mode.. maybe.. might be time for a note 5 lol
Title: Re: Ping Sensor
Post by: integlikewhoa on February 22, 2016, 11:19:41 pm

Get rid of your iphone is the only fix I know of it for this.


haha thanks! I've been reading up and I think your correct, the only other way really is to jailbreak the phone and you can change it, so the wifi doesn't go into sleep mode.. maybe.. might be time for a note 5 lol

Liquid cooled S7 and S7 edge was just announced. Huge battery, wireless charging, quick charge there is a whole list of reasons not to won a iphone.  ;D
Title: Re: Ping Sensor
Post by: morgi23 on February 23, 2016, 10:17:48 am
Relatively new to all this.. but just wondering if there is a work around for this, right now I have my iPhone set up on a static IP, and when my phone connects to the wifi the system switches a virtual switch and runs a scene that I am home and everything turns on accordingly, which is awesome. I was hoping to have it so when my device leaves the network that it switches the virtual switch to away and turns everything off. Which it does.. but also does when my device i suppose goes into sleep mode? when the screen is off, shortly after the wifi must go into a sleep mode which tricks the system into thinking I'm away. Once I touch the home button and the screen turns back on, it thinks I'm back home again. Is this a problem that is just indicative to using a mobile device as a switch? I had been reading about using installing DD-WRT on my router and applying a script which does basically the same thing, but on a higher level? its a little more complicated to do. but is that the only way around this problem?

You can try to do it in combination with iPhone Locator plugin like this:
- When Ping Sensor device is not triggered, I unmute the iPhone Locator plugin to verify that the phone is really away from home (poll every 60 sec).
- If both, Ping sensor and iPhone Locator plugins are False, my virtual switch is turns off. If not, virtual switch stay on.
- Same thing for my wife iPhone as well.
- When both our virtual switches are off, the house goes into Away mode.
- When the house is on Away mode, both our iPhone Locator devices are muted in order to save battery life.
- The house goes into Home mode when Ping Sensor is get triggered again.

Hope this is clear
Title: Re: Ping Sensor
Post by: tomgru on February 27, 2016, 12:49:05 pm

Get rid of your iphone is the only fix I know of it for this.


haha thanks! I've been reading up and I think your correct, the only other way really is to jailbreak the phone and you can change it, so the wifi doesn't go into sleep mode.. maybe.. might be time for a note 5 lol

Liquid cooled S7 and S7 edge was just announced. Huge battery, wireless charging, quick charge there is a whole list of reasons not to won a iphone.  ;D

I think this is the next thing I'm going to try out!  Couple of questions...

I'm pretty sure I'm getting the new Samsung, but am currently a Windows Phone user.  Any one have any experience with them?

Also, most at @integlikewhoa, since I think you do this today... All I really want to try is turning OFF text notifications (with picture) from motion at my front door using Blue Iris.  I don't need these when I'm home.

Create a profile in BI that is "home and away".  When Ping sensor sees my phone, switch BI to home (need to figure out how to do that!).

Am I missing anything?  With that simple need, is the Ping sensor enough?  I'm not worried about a few mistakes, etc.

Thanks!
Title: Re: Ping Sensor
Post by: integlikewhoa on February 27, 2016, 04:52:22 pm
I used to use PLEG for all the Logic control on this.

I have virtual switches that are for
wife vera proximity geofence,
my vera proimity geofence,
Wife Blueiris geofence
My Blueiris Geofence
wife master Home/away
my master home/away
Along with a PING sensor for each of us.


I use PLEG to watch the ping senssor and the geofences and then switch the master home/away button on or off for each of us.

If I'm not home and ping turns on turn the master switch for me on. Or if two of the three says I'm (maybe my wifi was off for tethering) home then say I'm home. 
If 2 of the three sensors say I have left then flip the master switch off. (just incase my phone is off or wifi down, or I reboot the phone or something ping alone won't say I left)

In blueiris, under the devices in the options I have it run a Http:// command to flip the virtual switch (blueiris geofence) on and off so vera sees my blueiris geofence status.
Vera proximity on my phone directly controls that virtual switch.

Ping has its own switch.

The masters can now be used for a number of things in PLEG. Turn on lights when I get home, unlock doors, or what ever. I use that info to have PLEG send an Http:// back to blueiris to change the  profile.

I have 4 profiles

Anyone home and day
Anyone Home and Night
No One Home day
No one home Night

PLEG conditions check the master switches for me and the wife (and I have a guest virtual switch that is a Virtual manual button incase I leave someone at home I turn it on in my Imperihome App)
I also use the day and night sensor.

I have 4 conditions that says if either switch is on and it's day Send the http://
So on for each of the other 3. 

The Http you send is via advaced and lua code. The lua code is

luup.inet.wget("BlueIrisIP:PORT/admin?profile=1&lock=2&user=XXXXX&pw=XXXXX")

Enter your IP's:port for local machine. Enter the user and password for BI in the place of the x's

and The profile=1 in this case is for profile one change that for 1-7 for each for each the profiles you use or create. the lock=2 is to lock that profile so it will stay on that profile until the next http change. if not it will time out (little green clock) and default back to what you have set. Blueiris has the timing and options in it's settings on that. But I lock it. using that "Lock=2"

To go the other way and have Blueiris trigger a multiswitch so when blueiris geo says you home have it flip a virtual switch on you use the following http

http://VeraLocalIP:3480/data_request?id=lu_action&DeviceNum=XXX&serviceId=urn:dcineco-com:serviceId:MSwitch1&action=SetStatus2&newStatus2=1

In the above you set your vera IP, your multiswitch Device number (where the xx's are) and at the end after set status and new status you put the number of the button you want to change on the virtual multiswitch. In this case it's button #2. And at the very end you use "0" for off and "1" for on depending if you coming home or leaving.
Title: Re: Ping Sensor
Post by: new2me07 on March 12, 2016, 11:32:37 am
The simple fix would be to set the timeout to 15 minutes then in the mail setting have it check your email every 15 minutes hence connecting to wifi and vera will see you are home. I think poll period is 15 seconds. Im not home but you get the idea.
Title: Re: Ping Sensor
Post by: integlikewhoa on March 12, 2016, 12:16:58 pm
The simple fix would be to set the timeout to 15 minutes then in the mail setting have it check your email every 15 minutes hence connecting to wifi and vera will see you are home. I think poll period is 15 seconds. Im not home but you get the idea.

Which post was this in response to?
Title: Re: Ping Sensor
Post by: new2me07 on March 12, 2016, 06:28:44 pm
Relatively new to all this.. but just wondering if there is a work around for this, right now I have my iPhone set up on a static IP, and when my phone connects to the wifi the system switches a virtual switch and runs a scene that I am home and everything turns on accordingly, which is awesome. I was hoping to have it so when my device leaves the network that it switches the virtual switch to away and turns everything off. Which it does.. but also does when my device i suppose goes into sleep mode? when the screen is off, shortly after the wifi must go into a sleep mode which tricks the system into thinking I'm away. Once I touch the home button and the screen turns back on, it thinks I'm back home again. Is this a problem that is just indicative to using a mobile device as a switch? I had been reading about using installing DD-WRT on my router and applying a script which does basically the same thing, but on a higher level? its a little more complicated to do. but is that the only way around this problem?

This one... guess I should quote more...  :-\

Title: Re: Ping Sensor
Post by: integlikewhoa on March 12, 2016, 07:19:40 pm
Relatively new to all this.. but just wondering if there is a work around for this, right now I have my iPhone set up on a static IP, and when my phone connects to the wifi the system switches a virtual switch and runs a scene that I am home and everything turns on accordingly, which is awesome. I was hoping to have it so when my device leaves the network that it switches the virtual switch to away and turns everything off. Which it does.. but also does when my device i suppose goes into sleep mode? when the screen is off, shortly after the wifi must go into a sleep mode which tricks the system into thinking I'm away. Once I touch the home button and the screen turns back on, it thinks I'm back home again. Is this a problem that is just indicative to using a mobile device as a switch? I had been reading about using installing DD-WRT on my router and applying a script which does basically the same thing, but on a higher level? its a little more complicated to do. but is that the only way around this problem?

This one... guess I should quote more...  :-\

The problem is when u leave home it could be 15min after your gone until it knows your gone. That's a long time for me atleast to lock up and turn evetything off.
Title: Re: Ping Sensor
Post by: new2me07 on March 13, 2016, 04:26:24 pm
Relatively new to all this.. but just wondering if there is a work around for this, right now I have my iPhone set up on a static IP, and when my phone connects to the wifi the system switches a virtual switch and runs a scene that I am home and everything turns on accordingly, which is awesome. I was hoping to have it so when my device leaves the network that it switches the virtual switch to away and turns everything off. Which it does.. but also does when my device i suppose goes into sleep mode? when the screen is off, shortly after the wifi must go into a sleep mode which tricks the system into thinking I'm away. Once I touch the home button and the screen turns back on, it thinks I'm back home again. Is this a problem that is just indicative to using a mobile device as a switch? I had been reading about using installing DD-WRT on my router and applying a script which does basically the same thing, but on a higher level? its a little more complicated to do. but is that the only way around this problem?

This one... guess I should quote more...  :-\

The problem is when u leave home it could be 15min after your gone until it knows your gone. That's a long time for me atleast to lock up and turn evetything off.

It is indeed a trade off, I'm trading that 15 minutes of possible electricity usage for battery life on the phone, with apps using gps for geo-fencing. Most lights should be off within 5 minutes based on motion events but they're all LED so I feel its rather negligible in terms of energy consumption and I feel and when we leave, we press the lock button on the zwave lock which in turn arms the security system. There's a different variable for manually locking (from the inside) and locking from the outside that keeps all this from happening when we come in the door and then lock it.

I cant use tasker, and I have an apple airport so no DD-WRT sadly, but I have never found an explicit occupancy need to look elsewhere.
Title: Re: Ping Sensor
Post by: integlikewhoa on March 13, 2016, 07:36:59 pm
It is indeed a trade off, I'm trading that 15 minutes of possible electricity usage for battery life on the phone, with apps using gps for geo-fencing. Most lights should be off within 5 minutes based on motion events but they're all LED so I feel its rather negligible in terms of energy consumption and I feel and when we leave, we press the lock button on the zwave lock which in turn arms the security system. There's a different variable for manually locking (from the inside) and locking from the outside that keeps all this from happening when we come in the door and then lock it.

I cant use tasker, and I have an apple airport so no DD-WRT sadly, but I have never found an explicit occupancy need to look elsewhere.

The problem is clearly Apple pains. To many overpriced apple devices with limited functionality. Hard part is now working around that to get them to work how they should from the start.

On andriod I can shut off all GPS or battery usage while connected to wifi and as soon as the phone disconnects from WIFI (any wifi so work, home, friends, public, parents, so almost anytime your not moving) it starts checking for location. I can also set that checking process to slow down the further out you are from the house.

You can do this a bit on iphones using the Find My Iphone Plugin here. Only thing I wasn't able to do it shut off completely while connected to wifi and that was a problem because arriving home I wanted it to be polling fast to trip as soon as I got home but there is no option say slow polling to 15 min while I'm home but trip asap when I leave. Again you can be 15min away from home before it even knows u left. But you can modify polling time based on the distance you are from home. So I was able to slow polling down when at work out of town or what ever based on distance.
Title: Re: Ping Sensor
Post by: marcjw on March 13, 2016, 11:08:02 pm
Well this sucks big time.  I just discovered why my newly installed Ping plugin wasn't working worth crap.  My phone!  Or should I say the latest Android version on my phone - Marshmallow.  Marshmallow now has a wonderful "feature" called Doze that turns off all communication to the phone (except incoming calls) if the phone has been totally idle for an hour.  And it can't be disabled.  Swell.  Thanks Google.  So much for Ping sensor.  Or Geofencing.

I've actually known about this for awhile.  After I for Android 6.0 (Marshmallow) I noticed that I wasn't being notified of new gmail and SMS if my phone had been laying around for awhile.  In checking the Google support forums I learned that it was Doze that was causing this and that there's a few billion people that are royally pissed off about this.  I learned to live with the gmail and SMS thing by keeping my phone plugged in when I go to bed (Doze is disabled when charging).  But now to find out that ordinary pings also fail when Doze kicks in really burns my arse.  Thanks again Google.  Now my Android is nothing more than an Iphone when it comes to pinging.
Title: Re: Ping Sensor
Post by: integlikewhoa on March 13, 2016, 11:31:30 pm
I think this is only on nexus devices....... Tasker would be your quick solution. Downgrading software is another.

Your gmail should be fixed easy by turning off optimization for that app. Ping not as easy.
Title: Re: Ping Sensor
Post by: marcjw on March 14, 2016, 08:37:48 pm
I think this is only on nexus devices....... Tasker would be your quick solution. Downgrading software is another.
Your gmail should be fixed easy by turning off optimization for that app. Ping not as easy.

Yes, I have the Nexus 6 but I'm pretty sure that any phone upgraded to Marshmallow would experience the same issues.
According to the Tasker forums I follow Doze is a problem with it as well.
Downgrading is something to which I've been giving strong consideration.  For me.  But the wife would never allow that for hers.
Un-optimizing doesn't work for wifi or gmail or G+.  Known issue.

And I used to really like Android.
Title: Re: Ping Sensor
Post by: charettepa on March 16, 2016, 11:57:21 pm
I used to use PLEG for all the Logic control on this.

I have virtual switches that are for
wife vera proximity geofence,
my vera proimity geofence,
Wife Blueiris geofence
My Blueiris Geofence
wife master Home/away
my master home/away
Along with a PING sensor for each of us.


I use PLEG to watch the ping senssor and the geofences and then switch the master home/away button on or off for each of us.

If I'm not home and ping turns on turn the master switch for me on. Or if two of the three says I'm (maybe my wifi was off for tethering) home then say I'm home. 
If 2 of the three sensors say I have left then flip the master switch off. (just incase my phone is off or wifi down, or I reboot the phone or something ping alone won't say I left)

In blueiris, under the devices in the options I have it run a Http:// command to flip the virtual switch (blueiris geofence) on and off so vera sees my blueiris geofence status.
Vera proximity on my phone directly controls that virtual switch.

Ping has its own switch.

The masters can now be used for a number of things in PLEG. Turn on lights when I get home, unlock doors, or what ever. I use that info to have PLEG send an Http:// back to blueiris to change the  profile.

I have 4 profiles

Anyone home and day
Anyone Home and Night
No One Home day
No one home Night

PLEG conditions check the master switches for me and the wife (and I have a guest virtual switch that is a Virtual manual button incase I leave someone at home I turn it on in my Imperihome App)
I also use the day and night sensor.

I have 4 conditions that says if either switch is on and it's day Send the http://
So on for each of the other 3. 

The Http you send is via advaced and lua code. The lua code is

luup.inet.wget("BlueIrisIP:PORT/admin?profile=1&lock=2&user=XXXXX&pw=XXXXX")

Enter your IP's:port for local machine. Enter the user and password for BI in the place of the x's

and The profile=1 in this case is for profile one change that for 1-7 for each for each the profiles you use or create. the lock=2 is to lock that profile so it will stay on that profile until the next http change. if not it will time out (little green clock) and default back to what you have set. Blueiris has the timing and options in it's settings on that. But I lock it. using that "Lock=2"

To go the other way and have Blueiris trigger a multiswitch so when blueiris geo says you home have it flip a virtual switch on you use the following http

http://VeraLocalIP:3480/data_request?id=lu_action&DeviceNum=XXX&serviceId=urn:dcineco-com:serviceId:MSwitch1&action=SetStatus2&newStatus2=1

In the above you set your vera IP, your multiswitch Device number (where the xx's are) and at the end after set status and new status you put the number of the button you want to change on the virtual multiswitch. In this case it's button #2. And at the very end you use "0" for off and "1" for on depending if you coming home or leaving.

what are you doing to check individual geofence status for you and your wife?
i have been wanting to do the same
but i cant find any geofence status
Title: Re: Ping Sensor
Post by: integlikewhoa on March 17, 2016, 12:08:20 am
what are you doing to check individual geofence status for you and your wife?
i have been wanting to do the same
but i cant find any geofence status

Vera Proximity on Andriod

iPhone Locator on CrApples.
Title: Re: Ping Sensor
Post by: charettepa on March 17, 2016, 12:39:02 am
thanks

just installed it
how much is the key to buy it?
Title: Re: Ping Sensor
Post by: integlikewhoa on March 17, 2016, 10:16:24 am
thanks

just installed it
how much is the key to buy it?

5.50 each device I think. But I  can't remember. Check the forum section  for vera proximity. You can get help and answers here http://forum.micasaverde.com/index.php/topic,24896.0.html
Title: Re: Ping Sensor
Post by: rockendoublez on March 29, 2016, 12:57:47 pm
I am running ui5 on veralite and the plugin seems to be working great. I do have a couple of questions i couldn't quite figure out by reading this thread.
poll period = how often it runs the ping?
device timeout = if ping fails it will retry in x seconds ? (please correct me if i'm misunderstanding)

I'm using this to reboot my router if it locks up.
I've been able to set a scene to turn off the power to my router if the ping fails, then turn on after a 5 second delay. (plugin set to poll period = 30 sec and device timout =5 sec)
So far the if i unplug cable from my router to my switch to simulate a ping fail, vera will power off my router, but i can't get it turn it back on.
I suspect that the plugin is still "tripped" causing my scene to keep running? i'm not 100% sure.

Does anyone have any suggestions i can try?

Thanks!
Title: Re: Ping Sensor
Post by: integlikewhoa on March 29, 2016, 04:34:29 pm
I am running ui5 on veralite and the plugin seems to be working great. I do have a couple of questions i couldn't quite figure out by reading this thread.
poll period = how often it runs the ping?
device timeout = if ping fails it will retry in x seconds ? (please correct me if i'm misunderstanding)

I'm using this to reboot my router if it locks up.
I've been able to set a scene to turn off the power to my router if the ping fails, then turn on after a 5 second delay. (plugin set to poll period = 30 sec and device timout =5 sec)
So far the if i unplug cable from my router to my switch to simulate a ping fail, vera will power off my router, but i can't get it turn it back on.
I suspect that the plugin is still "tripped" causing my scene to keep running? i'm not 100% sure.

Does anyone have any suggestions i can try?

Thanks!

You need to set your logic up better. Make sure that your power down scene only runs every 10 min or 20 min or some time between. That way if it powers down once it will give it a chance to come back online before it does it again.

So if you setup a scene to run when the ping stops detecting then once the internet drops it will run the scene power down, set a 20 or 30sec delay on the same scene to then power back up but make sure the scene won't do this again for 10 plus mins. That will allow time during rebooting while there is still no ping.
Title: Re: Ping Sensor
Post by: rockendoublez on March 29, 2016, 08:24:33 pm
Sounds like a plan,

I'll give that a shot. thank  you!
Title: Re: Ping Sensor
Post by: KennyCoolHeat on April 11, 2016, 04:33:08 pm
Hi everyone,
I am using ping sensor in combo with proximity on my mobile phone for " Home / Away " control. My ping sensor is working great but it logs alerts with every change of state. Is there any way to turn off these alerts?
Thanks,
Kenny
Title: Re: Ping Sensor
Post by: Scoutmedic on April 13, 2016, 07:59:18 pm
Has nothing to do with the Ping sensor, but I wonder if you could set up a Tile via bluetooth and the new Vera (with bluetooth) to determine home/away status.

Don't know anything about them, but it's a thought.
Title: Re: Ping Sensor
Post by: integlikewhoa on April 13, 2016, 11:01:47 pm
Has nothing to do with the Ping sensor, but I wonder if you could set up a Tile via bluetooth and the new Vera (with bluetooth) to determine home/away status.

Don't know anything about them, but it's a thought.

I have several Bluetooth devices, from smart watches to speakers. I don't have a very big house and its even single story but none of my device will even work from one side to the other. Let alone if I go to the garage, patio or take out the trash. Even if there was bluetooth AP's like there is for wifi, wifi they have more use then me trying to build a large bluetooth network.

I can't see bluetooth replacing presence and I don't see the need for it. The ping sensor works great except with iphones, which would probley have the same problem with bluetooth also. 
Title: Re: Ping Sensor
Post by: Quixote on September 18, 2016, 08:22:04 pm
Well this sucks big time.  I just discovered why my newly installed Ping plugin wasn't working worth crap.  My phone!  Or should I say the latest Android version on my phone - Marshmallow.  Marshmallow now has a wonderful "feature" called Doze that turns off all communication to the phone (except incoming calls) if the phone has been totally idle for an hour.  And it can't be disabled.  Swell.  Thanks Google.  So much for Ping sensor.  Or Geofencing.

I've actually known about this for awhile.  After I for Android 6.0 (Marshmallow) I noticed that I wasn't being notified of new gmail and SMS if my phone had been laying around for awhile.  In checking the Google support forums I learned that it was Doze that was causing this and that there's a few billion people that are royally pissed off about this.  I learned to live with the gmail and SMS thing by keeping my phone plugged in when I go to bed (Doze is disabled when charging).  But now to find out that ordinary pings also fail when Doze kicks in really burns my arse.  Thanks again Google.  Now my Android is nothing more than an Iphone when it comes to pinging.

Hey, did anyone figure out a workaround for this yet? Is this plugin still current?
Thanks.
Title: Re: Ping Sensor
Post by: Mike Yeager on September 18, 2016, 08:33:38 pm
I use the ping sensor and noticed this. Since I've been working on 'wasp in a box', I now hold the multiswitch setting unless a door has been opened in the past 10 minutes. Still not perfect, but combined with other means of tracking occupancy, it's working out ok.
Title: Re: Ping Sensor
Post by: Niso on September 23, 2016, 10:07:47 am
I'm new to Vera and Ping Sensor, but would really like this to work. I have some problems installing Ping Sensor. If I install it under Apps/Luup Files (version 1.4) and then create a new device, it complains about the D_PingSensor.xml file "GET_LANG(system_error,System error)". If I install Ping Sensor from the "Install Apps" library I get the following message:

GET_LANG(system_error,System error) : Device: 36. Fail to load implementation file D_Codeset_1112.xml.lzo

I'm running version 1.7.2138 on a new Vera Plus and I have installed a RFXtrx433 on the USB port for my Nexa devices. I'm Swedish, but the only thing I can see regarding language settings is under Location.

Any idea?
Title: Re: Ping Sensor
Post by: Cor on November 19, 2016, 03:24:20 pm
Hello,

I am installing a Vera + ( I came from a vera 3 with UI5) and just installed this plugin.
on the UI5 vesrion I had 3 options , ping count , poll period and device timeout.

The first option is not there on my vera+, maybe not important.

I wan't to set up a trigger to reset my modem. The idea is to ping google ( 8.8.4.4) and when the ping doesn't work for some time reset the modem.

I don't want the scene to reset the modem immediately after not recieving 1 ping , since sometimes my internet connection is a bit unstable.

What would be a good setup for the ping sensor plugin?
poll period and device timeout?

On the UI5 I also had the ping sensor in "inverted mode"

Thanks,
Cor
Title: Re: Ping Sensor
Post by: col8eral on November 23, 2016, 12:39:58 pm
Does this work on UI7?

I have installed, set to arm, put the IP address of my router.  Nothing appears in logs.  I set all notification types and still nothing.  Any tips for getting this to work.
Title: Re: Ping Sensor
Post by: Cor on November 24, 2016, 07:55:05 pm
Yes , my ping sensor just tripped  ;D on UI7

But I am not sure yet what a good setup for the ping sensor is , if anyone has some input ,
Thanks,

Quote
Hello,

I am installing a Vera + ( I came from a vera 3 with UI5) and just installed this plugin.
on the UI5 vesrion I had 3 options , ping count , poll period and device timeout.

The first option is not there on my vera+, maybe not important.

I wan't to set up a trigger to reset my modem. The idea is to ping google ( 8.8.4.4) and when the ping doesn't work for some time reset the modem.

I don't want the scene to reset the modem immediately after not recieving 1 ping , since sometimes my internet connection is a bit unstable.

What would be a good setup for the ping sensor plugin?
poll period and device timeout?

On the UI5 I also had the ping sensor in "inverted mode"

Thanks,
Cor
Title: Re: Ping Sensor
Post by: Cor on November 27, 2016, 02:31:49 pm
No one can give me a hint what some reasonable settings are for :

Poll Period   
Device Timeout   


I don't want to overload my network and my internet connection , I just want something which checks now and than if my internet connection is still working.

Thanks,
Cor
Title: Re: Ping Sensor
Post by: col8eral on November 27, 2016, 02:42:39 pm
I'd like to know if it works with UI7. I tried but couldn't get it to work.
Title: Re: Ping Sensor
Post by: Cor on November 27, 2016, 02:58:10 pm
A post before I wrote it worked on UI7.  If you can post your settings that would be usefull.

You have any sensible settings for the  :
Poll Period   
Device Timeout   

??

Cor
Title: Re: Ping Sensor
Post by: sparkydave on December 14, 2016, 11:07:18 pm
I'm keen to find out if anyone has successfully used this to reboot a modem as well.  I want to set it up so that if the Vera doesnt detect internet connectivity for say 5mins, then trigger a switch to turn off for 30 seconds, then back on again.  Hopefully by having the ping time set to 5mins, there is enough time for the modem to establish internet again so everything is good by the time the Vera tries the ping again.

Hoping for someones feedback soon....
Title: Re: Ping Sensor
Post by: clippermiami on December 15, 2016, 08:59:18 am
I'm keen to find out if anyone has successfully used this to reboot a modem as well.  I want to set it up so that if the Vera doesnt detect internet connectivity for say 5mins, then trigger a switch to turn off for 30 seconds, then back on again.  Hopefully by having the ping time set to 5mins, there is enough time for the modem to establish internet again so everything is good by the time the Vera tries the ping again.

Hoping for someones feedback soon....

I have one set up something like what you want to do I think. I have a box with two GE/Jasco outlets in it, one of them powers the AT&T router the other powers the Netgear Wireless Access Point.

I have a ping sensor polling the AT&T Uplink IP address. If the poll fails for more than 20 minutes, a PLEG timeout-timer expires. This  a) disables the ping sensor; b) turns off the GE/Jasco outlet powering the AT&T router; c) starts a one minute timer in PLEG; d) when this timer expires it turns on the GE/Jasco outlet, restarts the PLEG timeout-timer and  and re-enables the ping sensor with everything back at square one. I'd actually prefer to reboot the router rather than power cycle it but there doesn't appear to be any way to do that using a Vera HTTP command. fortunately we don't lose the uplink very often and it usually comes back in 30 minutes or less.

The Access Point gets power cycled by a PLEG schedule once every week just for grins and it also allows me to cycle it remotely if the need arises.

Hope this helps
Title: Re: Ping Sensor
Post by: Cor on December 15, 2016, 01:52:59 pm

I have a ping sensor polling the AT&T Uplink IP address. If the poll fails for more than 20 minutes,

What have you setup at:
Poll Period   
Device Timeout 

?

Thanks,
Cor
Title: Re: Ping Sensor
Post by: Newzwaver on December 30, 2016, 07:06:55 am
Hi All,

I need help.  I am trying to use the ping sensor as a way to adjust heat and lights in my kids rooms.  However I have not been able to get Vera to report the correct state of the phone (i.e. the sensor will report the phone as being on the server and it is not or it is and the sensors state is not on).  I have changed the invert to report the correct state and then it still happens.  I noticed the earlier versions had two extra files S_AwarenessSensor.xml and I_AwarenessSensor.xml.  The plugin you download from the plugin store doesn't.  DO i need the files?  How do i get this to work correctly? 

Thanks
Title: Re: Ping Sensor
Post by: clippermiami on March 05, 2017, 03:45:58 pm
Does Ping Sensor work with FQDN or only physical IP addresses? I made some changes to configuration today and in the process I replaced some IP addresses with FQDN and it appears to not have worked.
Title: Re: Ping Sensor
Post by: ojovilla on April 25, 2017, 04:35:46 pm
I downloaded and installed ping sensor from the vera app store. I do not see any options for adding multiple devices?
Title: Re: Ping Sensor
Post by: Mike Yeager on April 25, 2017, 08:42:55 pm
You add multiple ping sensors....   :)
Title: Re: Ping Sensor
Post by: Don Phillips on April 25, 2017, 09:26:09 pm
+1 to Mike - only because of all the bad karma  8)
Title: Re: Ping Sensor
Post by: Mike Yeager on April 26, 2017, 04:01:47 pm
I have no idea what's with the karma thing other than I had a run in with an idiot a while back....
Title: Re: Ping Sensor
Post by: twiseva on April 27, 2017, 09:04:03 am
So, trying to setup a decent geofencing setup based on iphone location and LAN pings. I have to use the LAN part as my daughters phone when at school in her locker wonders into my home zone (its not far away).

My issue is that the pings are not very reliable. For example, right now my iphone is home and on my local network. I can ping from my desktop. The ping plugin is not seeing the iphone (tripped -== 0). I have a 15 sec poll and 0 for device timeout. I am using a specific local IP address (statically assigned to my iPhone). My test was to remove from network (turn of wifi) and then add it back on. Like 5 minutes later, the ping sensor still thinks my phone is not pingable (but it is).

Any thoughts? Places I could look at for issues?

CHeers, Tony.
Title: Re: Ping Sensor
Post by: Sorin on April 27, 2017, 09:44:29 am
I have no idea what's with the karma thing other than I had a run in with an idiot a while back....


Fixed  ;D
Title: Re: Ping Sensor
Post by: Don Phillips on April 27, 2017, 08:11:30 pm
Since Mike's karma has been fixed, can I have my +1 back?  ;D
Title: Re: Ping Sensor
Post by: Mike Yeager on April 27, 2017, 09:38:21 pm
Thanks...  I wasn't worried about it though. It doesn't affect anything as far as I know.   ;D ;D ;D ;D
Title: Re: Ping Sensor
Post by: MNB on April 28, 2017, 04:27:55 pm
@twiseva, were you successful in getting ping to work for you? I am trying to do something similar with my iPhone but I also seem to be getting erratic results, of those of you who have gotten your ping sensor to work, can you provide what you've solution was e.g. Poll Period and Device Timeout settings are you using virtual switches and are you using PLEG conditions and/or device to monitor. Also for slow witted I'm assuming that a tripped sensor (red running man) = successful IP address pinged. Mike
Title: Re: Ping Sensor
Post by: MNB on April 28, 2017, 04:49:53 pm
@clippermiami, would you be so kind and share your PLEG solution for rebooting your router/access point? thanxs in advance
Title: Re: Ping Sensor
Post by: Mike Yeager on April 28, 2017, 09:31:52 pm
Yes, the red running man showing the sensor tripped means it's got you. I have mine set to poll every 90 seconds and I allow 3 failures before it untrips. I am using an android phone so I can't speak for iPhones, but I've read they have wifi sleep issues. My android seems to sleep even though I've told it not to so I use PLEG to monitor for the tripped sensor for 10 minutes AFTER a door is opened and to set a multiswitch (virtual device). If the wifi on the phone goes to sleep and the door hasn't been opened recently, the sensor untrips, but the multiswitch stays set. It's not perfect, but I'm still tweaking it....
Title: Re: Ping Sensor
Post by: MNB on April 29, 2017, 10:35:14 am
@Mike Yeager, thanxs for the comeback, question how do you set for 3 failures and what do you set the device timeout to? I've setup a watch variable via Datayours to monitor the Ping device to see what the duration of non-detect I have (The phone in question has been home for the last 2 days). It kind of sounds like you've created a "Wasp in the box" scenario as you've described using PLEG, Mike
Title: Re: Ping Sensor
Post by: Mike Yeager on April 30, 2017, 11:36:02 am
Under the advanced settings, set the period variable for the frequency of polling and the allowed failure variable for number of negative polls before untripping. I'm working towards a wasp in the box type setup but I've still got work to do.  :)
Title: Re: Ping Sensor
Post by: MNB on April 30, 2017, 02:17:16 pm
@Mike Yeager, thanxs for advice, I see that when you enter the number of "AllowedFailure" that it basically multiplies the "Poll Number" value which works for me in other words if your polling your device every 60 sec and enter 2 in the "AllowedFailure" the value that gets populated in "Device Timeout" = 120 (60 sec x 2).
Title: Re: Ping Sensor
Post by: ojovilla on May 01, 2017, 12:32:35 pm
You add multiple ping sensors....   :)

 :-\ hmm, forgive me if I am lost , but how exactly do you accomplish this? I do not see any such options, and don't know how to do this . These are the only options I have , but I have seen different screen shots on this forums, do I have a wrong version installed ?

Title: Re: Ping Sensor
Post by: MNB on May 01, 2017, 07:26:07 pm
@ojovilla you need to go to the advance>Parms tabs there you will be presented with the variables.
Title: Re: Ping Sensor
Post by: Mike Yeager on May 01, 2017, 10:04:28 pm
If you're trying to add another ping sensor, go back to the APPS tab, select the ping sensor plugin and add another instance from there. You don't add another instance from the sensor itself. Sorry if this seems vague, it's been a very long day...
Title: Re: Ping Sensor
Post by: ojovilla on May 01, 2017, 11:57:11 pm
If you're trying to add another ping sensor, go back to the APPS tab, select the ping sensor plugin and add another instance from there. You don't add another instance from the sensor itself. Sorry if this seems vague, it's been a very long day...

Got it! thanks, way more helpful than your last post  :)
Title: Re: Ping Sensor
Post by: Mike Yeager on May 02, 2017, 07:12:34 pm
Well, I didn't realize you needed to know how to do it, just what to do. :)
Title: Re: Ping Sensor
Post by: twiseva on May 04, 2017, 07:00:26 pm
@twiseva, were you successful in getting ping to work for you? I am trying to do something similar with my iPhone but I also seem to be getting erratic results, of those of you who have gotten your ping sensor to work, can you provide what you've solution was e.g. Poll Period and Device Timeout settings are you using virtual switches and are you using PLEG conditions and/or device to monitor. Also for slow witted I'm assuming that a tripped sensor (red running man) = successful IP address pinged. Mike

No, no luck -- I am going to try and debug this some more this upcoming weekend. Not had much time recently. I am also using PLEG to set a virtual switch to avoid the sleep issue. However, the pings is not working right so that's kinda useless right now.
Title: Re: Ping Sensor
Post by: Mike Yeager on May 05, 2017, 09:12:14 pm
The iPhone has it's own issue with pinging. There are threads here concerning that. Android has a setting that you have to change to prevent wifi sleep, but it doesn't always work as expected either. I'm still tweaking a "wasp in the box" setup to address this, but I haven't worked on it much lately... Too busy with other things...
Title: Re: Ping Sensor
Post by: twiseva on May 05, 2017, 10:32:35 pm
@twiseva, were you successful in getting ping to work for you? I am trying to do something similar with my iPhone but I also seem to be getting erratic results, of those of you who have gotten your ping sensor to work, can you provide what you've solution was e.g. Poll Period and Device Timeout settings are you using virtual switches and are you using PLEG conditions and/or device to monitor. Also for slow witted I'm assuming that a tripped sensor (red running man) = successful IP address pinged. Mike

No, no luck -- I am going to try and debug this some more this upcoming weekend. Not had much time recently. I am also using PLEG to set a virtual switch to avoid the sleep issue. However, the pings is not working right so that's kinda useless right now.

So a little more information -- but no solution yet :-(

I basically wrote some LUA code to do the ping thinking that the plugin was buggy. Kicked it off every 30 sec (via a timed scene) or so and it seemed to work well. However, after some time (say 10 or so calls - it varies), the LUA call os.execute started returning -1 and never went back to normal. This command lets you do a 'ping' on the Vera box.  Initially it returns 0 for a SUCCESS and 256 for a FAILURE. A -1 seems to indicate a failure of the os.execute call itself.

I did this in the Vera scenes and also within PLEG -- both had the same issue. This is the behavior I saw with the plugin -- works for a while, then stops. If it is using os.execute I could see it having the same issues.

Now I did in in a command line LUA script on the Vera itself and all was fine and ran as expected for a long period of time. So no issues outside of Vera executable.

Also a LUA Restart fixes it for a while -- again a behavior I saw in the plugin.

All leads me to believe there is some issue within Vera running the os.execute command repeatedly (I tried using 'ls' as the command and there was the same issue). Possibly some resource limitation or exhaustion? Not really sure -- I tried to look at verbose logging and it didn't help. I am wondering about file descriptor limits maybe ... ??

@MNB -- Are you using a VeraLite by any chance?

Anyone have any thoughts or ideas -- either what the issue is or another approach for getting ping to work?

For kicks here is the code I am running (Yes I am no Lua expert for sure :-)):

--------------

pingRtn=os.execute("ping -c 1 -w 1 192.168.2.110")
luup.log ("VIRTUALPING DEBUG: Ping OS cmd: " .. pingCmd .. ", return value is: " .. pingRtn)

-- OS returns a zero on success. Non-zero on other scenarios
if pingRtn == 0 then
   -- Set virtual switch to 'ON'
   luup.log ("VIRTUALPING DEBUG: Ping SUCCESSFUL for IP: " .. targetIP)
   setTargetRtn=luup.call_action("urn:upnp-org:serviceId:VSwitch1", "SetTarget", {newTargetValue = "1"}, targetVirtalSwitch)
   pingSuccess = true
else
   -- Set virtual switch to 'OFF'
   setTargetRtn=luup.call_action("urn:upnp-org:serviceId:VSwitch1", "SetTarget", {newTargetValue = "0"}, targetVirtalSwitch)
   luup.log ("VIRTUALPING DEBUG: Ping FAILED for IP: " .. targetIP)
   pingSuccess = false
end

return (pingSuccess)

-----------

And These are the logs I see:

<Snip> About 10 or so good PINGS prior to these.

50      05/05/17 22:16:21.206   luup_log:132: VIRTUALPING DEBUG: Ping FAILED for IP: 192.168.2.110 <0x2ac92310>
50      05/05/17 22:16:31.264   luup_log:132: VIRTUALPING DEBUG: Ping OS cmd: ping -c 1 -w 1 192.168.2.110, return value is: 0 <0x2ac92310>
50      05/05/17 22:16:31.265   luup_log:132: VIRTUALPING DEBUG: Ping SUCCESSFUL for IP: 192.168.2.110 <0x2ac92310>
50      05/05/17 22:16:42.199   luup_log:132: VIRTUALPING DEBUG: Ping OS cmd: ping -c 1 -w 1 192.168.2.110, return value is: 256 <0x2ac92310>
50      05/05/17 22:16:42.283   luup_log:132: VIRTUALPING DEBUG: Ping FAILED for IP: 192.168.2.110 <0x2ac92310>
50      05/05/17 22:16:53.166   luup_log:132: VIRTUALPING DEBUG: Ping OS cmd: ping -c 1 -w 1 192.168.2.110, return value is: 256 <0x2ac92310>
50      05/05/17 22:16:53.170   luup_log:132: VIRTUALPING DEBUG: Ping FAILED for IP: 192.168.2.110 <0x2ac92310>
50      05/05/17 22:17:03.345   luup_log:132: VIRTUALPING DEBUG: Ping OS cmd: ping -c 1 -w 1 192.168.2.110, return value is: -1 <0x2ac92310>
50      05/05/17 22:17:03.349   luup_log:132: VIRTUALPING DEBUG: Ping FAILED for IP: 192.168.2.110 <0x2ac92310>
50      05/05/17 22:17:14.229   luup_log:132: VIRTUALPING DEBUG: Ping OS cmd: ping -c 1 -w 1 192.168.2.110, return value is: 256 <0x2ac92310>
50      05/05/17 22:17:14.238   luup_log:132: VIRTUALPING DEBUG: Ping FAILED for IP: 192.168.2.110 <0x2ac92310>
50      05/05/17 22:17:25.189   luup_log:132: VIRTUALPING DEBUG: Ping OS cmd: ping -c 1 -w 1 192.168.2.110, return value is: 256 <0x2ac92310>
50      05/05/17 22:17:25.193   luup_log:132: VIRTUALPING DEBUG: Ping FAILED for IP: 192.168.2.110 <0x2ac92310>
50      05/05/17 22:17:36.163   luup_log:132: VIRTUALPING DEBUG: Ping OS cmd: ping -c 1 -w 1 192.168.2.110, return value is: 256 <0x2ac92310>
50      05/05/17 22:17:36.167   luup_log:132: VIRTUALPING DEBUG: Ping FAILED for IP: 192.168.2.110 <0x2ac92310>
50      05/05/17 22:17:46.167   luup_log:132: VIRTUALPING DEBUG: Ping OS cmd: ping -c 1 -w 1 192.168.2.110, return value is: 0 <0x2ac92310>
50      05/05/17 22:17:46.168   luup_log:132: VIRTUALPING DEBUG: Ping SUCCESSFUL for IP: 192.168.2.110 <0x2ac92310>
50      05/05/17 22:17:56.294   luup_log:132: VIRTUALPING DEBUG: Ping OS cmd: ping -c 1 -w 1 192.168.2.110, return value is: 0 <0x2ac92310>
50      05/05/17 22:17:56.295   luup_log:132: VIRTUALPING DEBUG: Ping SUCCESSFUL for IP: 192.168.2.110 <0x2ac92310>
50      05/05/17 22:18:06.175   luup_log:132: VIRTUALPING DEBUG: Ping OS cmd: ping -c 1 -w 1 192.168.2.110, return value is: -1 <0x2ac92310>
50      05/05/17 22:18:06.239   luup_log:132: VIRTUALPING DEBUG: Ping FAILED for IP: 192.168.2.110 <0x2ac92310>
50      05/05/17 22:18:16.202   luup_log:132: VIRTUALPING DEBUG: Ping OS cmd: ping -c 1 -w 1 192.168.2.110, return value is: -1 <0x2ac92310>
50      05/05/17 22:18:16.206   luup_log:132: VIRTUALPING DEBUG: Ping FAILED for IP: 192.168.2.110 <0x2ac92310>
50      05/05/17 22:18:26.185   luup_log:132: VIRTUALPING DEBUG: Ping OS cmd: ping -c 1 -w 1 192.168.2.110, return value is: -1 <0x2ac92310>
50      05/05/17 22:18:26.189   luup_log:132: VIRTUALPING DEBUG: Ping FAILED for IP: 192.168.2.110 <0x2ac92310>
50      05/05/17 22:18:36.175   luup_log:132: VIRTUALPING DEBUG: Ping OS cmd: ping -c 1 -w 1 192.168.2.110, return value is: -1 <0x2ac92310>
50      05/05/17 22:18:36.179   luup_log:132: VIRTUALPING DEBUG: Ping FAILED for IP: 192.168.2.110 <0x2ac92310>

<Snip> Everything after this returns -1.
Title: Re: Ping Sensor
Post by: twiseva on May 06, 2017, 08:38:48 pm
Edit:

WARNING: My Vera lite stopped working a day or so after this script ... I can't think of why but a warning up front if you plan on using this. Possibly remove the logging in the LUA? Not really why my Vera lite stopped working but it may have something to do with this and the logging possibly eating the disk space -- I could not recover it :-( On the other hand I have an excuse to get a VeraPlus!

--------------

Ok, so I didn't find the root cause of the issue I saw BUT have a work around that will get you 'ping' working if you have the same issue. I figured that the os.execute is having some issues so came up with use of a Lua command that is NOT os.execute! I used the io.* set of functions and had a Vera-side script put the status of a ping into these files with the hope the io suite didn't have the same issue.

There are two parts -- one on the Vera itself (you need to log into Vera to do this), and the other through the usual Vera UI.

PART 1: On the Vera (You'll need to understand UNIX somewhat to do this part -- it's pretty easy if you do or even if you are technically minded)

1. Set up a script on the Vera itself and run it via crontab. I have this running every minute. The smallest period possible in crontab. If you need something smaller you could add a sleep and just run this script continuously. I have attached a pingiphones.sh script as an example (this it what I am using). And added this to the crontab as follows (using crontab -e):

* * * * * /root/ping/pingiphones.sh

2. This script outputs the result of the pings to files. One per ping target. In my case, three different iPhones.  The simple .sh file is attached -- it pings three iphones. Change as needed.

PART 2: On the Vera UI

A. Set up a scene to run periodically (I used 15 secs but what ever you need -- remember the script runs only once per minute). Update the attached Lua code's first two variables to the file name you create in pingiphones.sh and the virtual switch device id (find it in Advanced). This Lua code does ONE file only. So I have 1 scene per iPhone and change the file name and virtual switch device IDs in each. Everything else stays the same.

A bit of a pain honestly but I have run it for a couple of hours and it seems to have no issues like os.execute did. Virtual switches are getting set as expected (within a minute or two depending on exact timing of the crontab and scene execution).

I'll run it over night to see if any issues come up ...

Cheers, Tony.

Title: Re: Ping Sensor
Post by: MNB on May 08, 2017, 07:52:11 pm
Tony, looking at your LUA file I notice that you have the same local variable called twice "local pingFD" my editor highlighted whilst I was reviewing it. Did you perchance get it working and how successful were you?

I tried a different route using an RPI3 as a Bluetooth and Wifi detector which works great on my iPhone, however the Wifi seemed to be less reliable as it seems to go to sleep (e.g. when the display is off) however BT seemed to work more reliable but it range  limited (depends what's in between the  RPI3 and IPhone). I was having a the RPI3 sending a http data_request command to VERA to run a specific scene Home/Not Home that would turn ON/OFF a virtual switch, I found that the RPI3 log was showing a BT response every minute however VERA was turning the Virtual switch ON initially and then the next minute is turned it OFF as if toggling the first time turned it ON but re-toggling it the second time turns it OFF not sure what to do yet other than every other minute I have Home switch ON.. Mike

Update: It helps if one reads the documentation re "Virtual Switch" the default setting to turn ON a switch is "-1" which implies a toggle action where as "1" keeps the switch ON until a proper "0" is used to turn said switch OFF. thanxs @RexBeckett for your users guide...
Title: Re: Ping Sensor
Post by: Don Phillips on May 08, 2017, 08:07:49 pm
I have had good experience with iPhone locator. It knows when either of our phones are home and sets the Home/Away House Mode reliability. I also have it set a virtual switch that displays on VeraMate only when that person is home. Similarly, I have a No One Home virtual switch that displays in VeraMate only when it is on. We can tell in a glance what is happening.
Title: Re: Ping Sensor
Post by: twiseva on May 08, 2017, 08:26:39 pm
So as a possible WARNING -- My Veralite basically went 'bad' a day later after implementing the script (which worked fine -- I'll check the LUA @MNB if I need to redo it on my new VeraPlus). Possibly my logging ran it out of space? Not sure and the processes outlined to bring it back to life do not work unfortunately -- needs a XP emulator or XP. Emulator is only available under Win 7 and didn't work for me on my laptop (everything else is at Win 10 where it also doesn't work).

I am a little upset that the veralite can not be reset to factory defaults via the reset button but needs a convoluted firmware flash via an XP-only toolset. So basically the Veralite is bricked for some reason -- and even if my script did run it out of space, you should be able to reset to factory settings. Hopefully the newer ones do.

I am hoping the ping plugin works on my new vera!
Title: Re: Ping Sensor
Post by: MNB on May 08, 2017, 09:15:29 pm
Don, I too had used iphone locator, but it also suffers when the iPhone goes to sleep unless you've figured out how to keep Wifi awake rather than wake on Lan that the current IOS seems to have adopted? I noticed that when I ping my phone I get a number of "Request timed out." msgs, when I turn on my RPI3 app I can see how often or not often WiFi returns a ping reply can you confirm? Mike

Tom, my condolences to your Veralite.. To answer your original question, I'm currently using a Vera Edge and am hoping to convert to the latest to VeraSecure when ever it should arrive.. I know "Time is relative especially when its in Vera Time!"
Title: Re: Ping Sensor
Post by: Don Phillips on May 08, 2017, 09:23:03 pm
Don, I too had used iphone locator, but it also suffers when the iPhone goes to sleep unless you've figured out how to keep Wifi awake rather than wake on Lan that the current IOS seems to have adopted? I noticed that when I ping my phone I get a number of "Request timed out." msgs, when I turn on my RPI3 app I can see how often or not often WiFi returns a ping reply can you confirm? Mike

I have not had that experience.  Here is my distance data for a week.  Its location is being captured by Vera.
Title: Re: Ping Sensor
Post by: MNB on May 09, 2017, 09:11:47 am
Don, thanxs for the comeback. Nice graph pray tell how did you create it and how is distance captured? Looking at your graph it shows that your phone (s) are not awake all of the time there is a large time periods where there is no reporting it looks like during the day your on your phone for instance on May 3 you were on your phone early morning sometime around ~6:00 your phone went to sleep and then woke up and went back asleep around 23:00 and didn't awake until the following morning around 7:00am. What scale is the distance? Mike
Title: Re: Ping Sensor
Post by: Don Phillips on May 09, 2017, 07:03:55 pm
I use datamine2 and the distance is miles. Very slick plug-in. Distance is captured from the iPhone Locator plug-in.

Attached is a day's data.  As you can see, the phones are reported as 0ish miles over night. iPhone locator pings both phones every 5 minutes and I do get e-mails and my gets VeraMate alerts all night so I think it works very well over night.

My wife left the house around 7 am, me around 7:15. It shows me coming home for lunch for an hour and back to work until 5:30, and my wife returning at 6.

I am pretty sure iPhone Locator is reporting distance accurately, especially since I have not had any Home/Away issues both overnight and when we are away.

Title: Re: Ping Sensor
Post by: MNB on May 10, 2017, 04:21:56 pm
Don, thanxs for update, I just installed DataMine2 and it seems to work great, it is a little more adjustable than DataYours. without the Y axis label it wasn't clear that it was distance. I will reinstall iPhone Locator and confirm your findings. I had been ping every minute whereas iPhone seems to ping every 5 minutes. Out of curiosity I assume your using the latest version of iPhones? Thanxs for sharing your results as it provides a baseline of what your achieving. Mike
Title: Re: Ping Sensor
Post by: Don Phillips on May 10, 2017, 05:49:16 pm
We both have an iPhone 6 with the latest iOS.
Title: Re: Ping Sensor
Post by: MNB on May 10, 2017, 06:44:29 pm
Thanxs Don... quick DataMine 2 questions; I seem to be getting two Y-Axis values in my graphs, pray tell how does one turn one of them off and secondly is there a way to control the scale values e.g. having whole numbers vs fraction of minutes? Mike
Title: Re: Ping Sensor
Post by: Don Phillips on May 10, 2017, 09:54:38 pm
The 2 scales have something to do with the data, especially when you have divergent data.  For instance, if you track wind speed and temperature, you will see both scales.  I am not sure how to address it - I just keep playing until I a useful graph.

I am not sure you can control scale, but you can set a multiple of the data. So if one is in tenths of a unit, and the other is 10's of a unit, you can scale either the first up by 10, or the second down by 1/10th.

I just keep playing with it (that's what she said).
Title: Re: Ping Sensor
Post by: MNB on May 11, 2017, 10:04:03 am
Don, thanxs for input and humor!  :P The reason I've belabored this is as you can see from my graph ping seems to be the least reliable means of determining one's presence with Bluetooth (BT) being second followed with iPhone locator App being the most (before you ask no I did not leave home whilst doing this). My question is how/what is the iPhone locator app achieving this (which I believe is a question asked in the iphone locator app) feat? Mike

Update: I copied this post to the iPhone Locator thread as this discussion morphed from Ping to iPhone Locator apps.
Title: Re: Ping Sensor
Post by: Don Phillips on May 11, 2017, 04:18:39 pm
From what I understand, and amg0 can correct me, when iPhone Locator pings the phone, it is using iCloud which reports to Vera your GPS coordinates.  Based upon the latitude and longitude you entered as home, Locator calculates your distance and that is what Datamine is capturing. If Locator is set to 5 minutes (like me), I get 5 minute distance datapoints.  For instance, today, I had to run to the office to get something, got coffee, then I went to a class. At lunch, I went to a drive through, drove around a little, and returned to the class. After class, I ran to the post office, then went home.  So you can see last night, all night, iCloud was not 100% accurate on my phone's location but close enough not to trigger me being gone.

I am not sure what Locator keeps under distance when iCloud cannot find the phone. Perhaps distance is recorded as 0. Maybe it does nothing and the distance value is not changed.

(by the way, I did not copy my response to the Locator page because this discussion is as much about the ping sensor and blue tooth as it is about Locator).
 
Title: Re: Ping Sensor
Post by: MNB on May 12, 2017, 10:56:42 am
Hey Don, thanxs for the explanation I started also graph my iPhone Locator distance to monitor. I have notice that even when the phone is sitting in the same place that there are minor variation in distance (rotation-wobble of the earth  ;D anomalies) probably from how the signals are picked up via xmission towers. iCloud must be doing something different in the background when the iPhone goes to sleep as seen whilst using ping vs Iphone Locator plugins.
Title: Re: Ping Sensor
Post by: Don Phillips on May 12, 2017, 06:45:53 pm
Yes, I noticed wobbles also. You can also use the map in Locator to watch the phone and sometimes, you will see the location dot move a few feet for a while, and move back. Given the GPS signals are 23k miles in the sky, and weather can affect these signals, I am not surprised we have wobble.  I still think this is amazing technology.

Here is a screenshot of my Locator. It shows my phone is outside my neightbor Susie's condo.  Just before this, my phone was shown in my garage.  My home pin is in the living room.
Title: Re: Ping Sensor
Post by: twiseva on May 17, 2017, 07:21:53 pm
So to those interested, upgrading to a VeraPLUS now has the ping sensor working fine. So I am assuming something in the underlying hardware as I am assuming the firmware/code is the same. Possibly more memory or something like that? I'll keep an eye on it and see if it goes bad after a longer period of time but looks good now for multiple days -- previously went bad after say 10 pings or so.
Title: Re: Ping Sensor
Post by: Shorty on October 01, 2017, 12:30:57 pm
I am running UI7 on a vera3 and have the ping sensor installed.

2 Questions.

1.  I am trying to set the poll period and device timeout.  Poll period accepts the value without issue however when I attempt to enter the device timeout, it multiplies the value I enter with the poll period.  For example if I want it to poll every 60 seconds and time out at 5, I enter 60 then TAB the 5 TAB and the 5 automagically turns into 300. 

Likewise 60/1 becomes 60/60 etc.  The only value for device timeout that sticks is 0 (mathematically makes sense).  I tried to go with it and try a decimal (ie 60/0.1) but it ignores the decimal and treats it as a whole number and behaves the same (60/.01 returns 60/60).
Anyone else experiencing this or am I just lucky?

2.  Is there anyway to limit or autodelete the logs?  After 1 day it has accumulated 1500+ records.  I'm concerned this will grow large and cause problems if I don't manually delete the logs.  The logs are very useful as I am using the plugin to check for internet connectivity at a remote location but I don't want to clog things up.  Perhaps the amount of data used for logs is negligible...?
Title: Re: Ping Sensor
Post by: Shorty on October 05, 2017, 01:24:56 pm
I have noticed something else odd....

When I attempt to change the poll period under the settings tab it does not stick.  I click "save and reload" then hit back and click save on that screen but when I go back it reverts to 15 seconds.  I can get it to stick by changing it under the variables tab.  Is there a way to change the timeout period under the variables tab?  I don't see anything listed but perhaps it can be added?

Also I am manually deleting the log records for fear they may accumulate and bog vera down.  Is there a way to change the amount of records viewed to a higher number?  The highest option is 50 and I have 15000 records accumulated.  Just getting this up to 100 would help greatly.

Any help would be appreciated.
Title: Re: Ping Sensor
Post by: Shorty on October 05, 2017, 02:03:06 pm
I found this in the J_PingSensor_UI7.js file (approximately half way down)

function PingSensorSettings(deviceID) {
      try {
         init();
         
         var period  = api.getDeviceState(deviceID,  pingsensor_svs, 'Period');
         var address  = api.getDeviceState(deviceID,  pingsensor_svs, 'Address');
         var timeout  = api.getDeviceState(deviceID,  pingsensor_svs, 'AllowedFailure')*period;

To this novice it appears it is setting timeout variable as AllowedFailure multiplied by period.  So this is causing the multiplication.  Is there a reason for this?  I don't want to change it and cause problems.
         
Title: Re: Ping Sensor
Post by: additude on October 16, 2017, 12:43:17 pm
I've installed Ping Sensor on one Vera Plus with firmware 1.7.3232 and I've combined all the updated files to include Ping Count, Inverse, etc. and I feel that I have a stable install.

I installed the app from the Install Apps interface and I've uploaded the updated files thru Develop Apps / Upload.

I made a few minor text cleanup changes to formatting for the Settings table but that's it.

Then I've downloaded each of the files used for Ping Sensor in my UI7 Vera Plus and I've put them all into a zip file.

It will also have the pre UI7 files as well.

I think this will provide a single repository at this point for all of the updated files that others here have graciously updated.

I hope this helps.

* Updated Zip File 10-20-17
Title: Re: Ping Sensor
Post by: additude on November 11, 2017, 12:01:35 pm
I've made a few "Cosmetic" display changes to the UI7 files.
Title: Re: Ping Sensor
Post by: Majimus on September 05, 2018, 02:09:58 am
I've been using the ping sensor with various devices and some scripting to replace the non working geolocation feature of the vera.  Some devices do not respond to ping reliably (android), these devices will however respond to an "arping".

I've modified the ping sensor to send an arping if the regular ping fails, this works great for me. Maybe plugin dev could consider making that small addition.

Here is my addition.

Code: [Select]
if( returnCode ~= 0) then
  returnCode = os.execute("arping -f -w 3 -I br-wan " .. address)
end

YMMV

edit: do check the interface though...
Title: Re: Ping Sensor
Post by: ElYoM29200 on January 11, 2019, 11:40:32 am
I've been using the ping sensor with various devices and some scripting to replace the non working geolocation feature of the vera.  Some devices do not respond to ping reliably (android), these devices will however respond to an "arping".

I've modified the ping sensor to send an arping if the regular ping fails, this works great for me. Maybe plugin dev could consider making that small addition.

Here is my addition.

Code: [Select]
if( returnCode ~= 0) then
  returnCode = os.execute("arping -f -w 3 -I br-wan " .. address)
end

YMMV

edit: do check the interface though...

Hello, I'm interested in your modification of the plugin. Can you tell me in which file and where exactly to insert this piece of code? Thank you.  :)
Title: Re: Ping Sensor
Post by: col8eral on January 11, 2019, 11:58:11 am
Thi could b what I am looking for.  Could you kindly explain what each of the extensions to the arping code mean and do?
Thank you
Title: Re: Ping Sensor
Post by: Octoplayer on January 11, 2019, 12:35:12 pm
Hi Col8eral,
Best place is to look at the MANual page for arping,  https://linux.die.net/man/8/arping (https://linux.die.net/man/8/arping)
From this the command:
  Finishes when / if a reply is received
  Waits for a max of 3 secs
  uses the br-WAN Interface device

The extra code goes in the i_Pingsensor.xml file, in the ExecutePing function (about halfway down).

ARPing works with a very similar format to Ping, but at a lower network level, so it sometimes succeeds where the Ping fails, e.g. due to firewall settings.
Other than a tiny bit of extra network traffic, this code is harmless and can be used anyway...

HTH
Octo


Title: Re: Ping Sensor
Post by: col8eral on January 11, 2019, 12:42:53 pm
Many thanks for the explanation I'll certainly give it a go thank you
Title: Re: Ping Sensor
Post by: ElYoM29200 on January 11, 2019, 01:57:19 pm
Hello Octoplayer,

Thank you for the explanations.

Is this how the code should be inserted?

Code: [Select]
local function executePing(address)
      local returnCode = os.execute("ping -c 1 -w 2 " .. address) --Octo 2/1/16 - count of 1 ping, wait 2s before timeout
      if( returnCode ~= 0) then
       returnCode = os.execute("arping -f -w 3 -I br-wan " .. address)
      end
      if (returnCode == 0) then
        -- we did not reach the host
        return "1"
      else
        -- we reached the host
        log("Ping Failed. ErrorCode: " .. tostring(returnCode)) -- (negative logic)
        return "0"
      end
    end
Title: Re: Ping Sensor
Post by: ElYoM29200 on January 11, 2019, 03:15:30 pm
OK, thank you very much. ;)

PS : Your attachment is empty, no file in the zip.
Title: Re: Ping Sensor
Post by: Octoplayer on January 12, 2019, 09:06:25 am
Yep, That is what I have got...

I have added that with a comment and Additudes' changes to a new repository (attached).
I have uploaded it to my vera with no ill effect, but my Ping gets a response anyway, so it has not a full test cycle.

Octo

(re-posting... hopefully with the files included in the zip this time).
Title: Re: Ping Sensor
Post by: ElYoM29200 on January 12, 2019, 08:49:30 pm
This time is the right one. All files are present in the zip archive. Thanks for sharing Octoplayer. ;)
Title: Re: Ping Sensor
Post by: Octoplayer on January 29, 2019, 08:06:45 pm
FWIW: Being doing some investigation with the ARping option, as it was flagging responses from a device I know is off.
Still not found that one (may be PC starting up for Windows updates), but I did notice that I was getting system warnings in the logfile that 
Code: [Select]
LuaInterface::CallFunction_Timer device 82 refreshCache took 6 seconds
I dont know why it was taking 5-6 seconds on a timed-out device, I suspect that the response time (RTT) was getting long, so Ping reached its 2s timeout, then ARPing took another 3 s.

I have changed the -w parameter to 1s, and added a count of 1 (-c 1) to the ARping command line. This is working in the altUI command test, and has got rid of the warning in the error log.
Octo
Code: [Select]
returnCode = os.execute("arping -f -c 1 -w 1 -I br-wan " .. address)
Title: Re: Ping Sensor
Post by: Majimus on January 30, 2019, 02:54:23 pm
Hello Everyone,

I am somehow just seeing the responses to this.  There were some other modifications to the code, I will post them later.

Best,

Majimus