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.
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.
Display a red / green circle (similar to motion sensors) to indicate the presence of a device
Active / Inactive Buttons (even this should work similar to the motion sensors āArmedā and āBypassā)
Show up as a sensor in the scene-events.
A custom icon should be displayed instead of the na.gif
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
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.
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.
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!!
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.
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.
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!!
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.