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

Ideas, hints and questions are welcome.

Wiki has been updated http://wiki.micasaverde.com/index.php/Ping_Sensor_Plugin

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

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.