Ping Sensor

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 ā†’ [url=http://wiki.micasaverde.com/index.php/Ping_Sensor_Plugin]http://wiki.micasaverde.com/index.php/Ping_Sensor_Plugin[/url]

Ideas, hints and questions are welcome.

Wiki has been updated [url=http://wiki.micasaverde.com/index.php/Ping_Sensor_Plugin]http://wiki.micasaverde.com/index.php/Ping_Sensor_Plugin[/url]

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

What impact does the sensor have on the stability and responsiveness of vera?

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 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 :wink:

Have you made different experiences?

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ā€.

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?

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! ;))

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.

Thanks for the flowers :wink:

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.

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.

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!! :slight_smile:

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 [url=http://wiki.micasaverde.com/index.php/Ping_Sensor_Plugin]http://wiki.micasaverde.com/index.php/Ping_Sensor_Plugin[/url]

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

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.

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.

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!!

That one great plugin!
Ted, whatā€™s the purpose of awareness service?
It seems that functionality doesnā€™t use it directly.

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.