WOL with Ping Sensor

The off button is setup to only trigger when the off button is triggered (pressed). It sends a command to tell the computer to sleep. The luup code is setup inside the trigger and not in the main luup section of the scene. It will not get triggered if the status changes. I have tested this and it works with out issue.

  • Garrett

Correct. It will not have any issues if the computer is only told to sleep and never hibernates.

Try it with hibernate.

If it works perfectly for a few days, then it must be something on my end. But I tell you, without your plugin, using separate WOL and ping sensors mine works flawless. Only when Iā€™ve introduced the OFF button trigger on your device does it go haywire. .

How are you implementing the hibernate command in the scene? Are you adding it into the trigger itself or into the luup section of the scene?

Unfortunately I do not use hibernate and it has been disabled on my machines.

  • Garrett

I use MCE and have a dedicated scene for hibernate that makes the call in the scene code. This way if Iā€™m using VeraMoble i can execute it directly. Only works while logged in, but thatā€™s the only case I need for now.

I then use a dedicated Combination Switch to act as a device button so that other scenes can trigger it. The hibernate scene listens to the trigger on that device. So ā€œrunningā€ the scene, or triggering that device will signal MCE to hibernate.

When I wire up to your plugin, I simply add a trigger to the hibernate scene that listens for the off button press. If I was to add the code to the trigger, then I would have to do so for every trigger. Not manageable!

You can have the trigger run the scene via a luup call. But it sounds to me that this plugin may not be for you.

  • Garrett

It is my opinion that you should not have code in the triggers unless you are attempting to have a blocking mechanism or need to have specific code for that event.

You say this plug in is not for me. What you are saying is its not for everyone and only works for ā€œsleepā€ because it doesnā€™t do exactly what it says.

Everything Iā€™ve reported is revealing to you a seriously fatal edge case that you are just inches away from solving.

If youā€™re gonna do something, do it right. Testing code on best case scenarios is asking for trouble. Weā€™d all love for everyone to have ideal environments so that everything behaves as we expect. But that is almost never the case. I say to you that I am NOT the worst case scenario.

I have done the testing for you, and if I was your QA department, I would not let you release this plugin. If you do plan to fix it, then I suggest enabling hibernate on one of your computers (preferably the slowest one) and increasing your ping rate to see what happens with a hibernate action on the off button (reguardless of how itā€™s done). Only after you have tested this yourself and made corrections will I try this plugin again.

Iā€™m having problems triggering WOL with the ping sensor plugin. I want the ping sensor to activate my scene to wake one of my PCs if it is off. I have the following luup script.

[code]local lul_tmp = luup.variable_get(ā€œurn:micasaverde-com:serviceId:MotionSensor:1ā€,ā€œStatusā€,0)

if (lul_tmp==ā€œTrippedā€)

then

luup.call_action(ā€œurn:schemas-holczer-com:serviceid:WOL:1ā€,ā€œRunSceneā€,{SceneNum = ā€œ5ā€ }, 0)

end[/code]

Newbie looking for assistance.
Thanks

The serivceId string is incorrect. You can see the correct one to use in the wiki samples, on code.mios.com, as well a various scene scripting posts in the forum.

Hi,

I am using this WOL with ping sensor to bring up my system and check on the status and it works a charm.
however i am having problem of using the OFF button to switch of my windows 8 PC.

I saw that eventghost is the way. but I am lost on how to configure this to work.
mind to share in details the steps and code on how to do this?

thanks

One way would be use the EventGhost Vera plugin: http://forum.micasaverde.com/index.php/topic,7881.0.html to monitor when you get a Vera.Lounge.HTPC.OFF event, for example. That event just needs to be paired to the shutdown command in EventGhost.

[quote=ā€œwoodchild, post:69, topic:172491ā€]Hi,

I am using this WOL with ping sensor to bring up my system and check on the status and it works a charm.
however i am having problem of using the OFF button to switch of my windows 8 PC.

I saw that eventghost is the way. but I am lost on how to configure this to work.
mind to share in details the steps and code on how to do this?

thanks[/quote]

I setup eventghost to use the web server plugin. I use a url like so for the machine that is running eventghost:

http://computer_ip:port/eventghost.html?SleepPC

The html file I just created with an empty html template. But you do not have to have the html file it could be just this:

http://computer_ip:port/?SleepPC

Eventghost will see that a SleepPC request was issued and you can take that request to have it trigger the suspend or shutdown command for windows.

For the off button a created a scene to listen to the off trigger event of the wol plus ping device. So you would create a scene say ā€œMediaPC Offā€ and have a trigger to use the wol plus ping sensor device and the trigger event would be ā€œA device is triggered on or offā€ and the trigger mode would be ā€œDevice is triggered offā€. I than add the following luup code for that trigger:

-- Issue sleep command to MediaPC via Eventghost http local http = require("socket.http") http.TIMEOUT=5 result, statuscode, content = socket.http.request("http://computer_ip:port/eventghost.html?SleepPC") log("Result"..result)

  • Garrett

Hi Garrett. Thanks for developing this plugin.

Iā€™m finding the ping result is often false alerting for me. Does your plugin do just a single ping test? It may be more reliable if multiple pings are done (configurable count number), and then only report the server is down (off) if all pings time out.

Iā€™ve no experience in developing plugins, so Iā€™m not sure how your plugin works or if it would relatively easy to extend the functionality.

jtmoore.

Have a look at the post here which includes the custimisation you are referring too.
http://forum.micasaverde.com/index.php/topic,11641.msg85492.html#msg85492

[quote=ā€œjtmoore, post:72, topic:172491ā€]Hi Garrett. Thanks for developing this plugin.

Iā€™m finding the ping result is often false alerting for me. Does your plugin do just a single ping test? It may be more reliable if multiple pings are done (configurable count number), and then only report the server is down (off) if all pings time out.

Iā€™ve no experience in developing plugins, so Iā€™m not sure how your plugin works or if it would relatively easy to extend the functionality.

jtmoore.[/quote]

What type of device are you issuing a ping to? I can add a variable to set the ping count. However, depending on how many times you want to issue a ping, it can take long to issue the command.

  • Garrett

[quote=ā€œgarrettwp, post:74, topic:172491ā€]What type of device are you issuing a ping to? I can add a variable to set the ping count. However, depending on how many times you want to issue a ping, it can take long to issue the command.

  • Garrett[/quote]

Hi Garret. I havenā€™t yet tried installing the alternative version that Brientim referred me to, to see if that behaves differently.
The target server is a NAS on same LAN as my Vera lite. The NAS is a Netgear ReadyNAS Pro. I was thinking 4 pings would be sufficient, and only alert if all 4 ping attempts failed.
Of course, I could just have an intermittent LAN problem, so I will have one of my PCs run a continuous ping and log results for comparison.
Thanks.
Jtmoore.

The post that Brientim pointed to I believe is the current version in the app market. The ping command has an option on the ping counts. I added a value that allowed you to set this. So if you set the ping count to 4, it will ping four times and report weather all four times failed or not. Would this be good enough? This can slow the command down a little bit, but should be ok if set to a low number like 5 or less. The default value is 1.

  • Garrett

The app market version is showing version 1.0. I can see values for Period, Enable, and Invert, but I do not see one for ping count. A count of 5 would be good enough for me.

Jtmoore.

jtmoore,

I have not submitted the new changes yet as I just added them and need to test it. Odd I thought I posted version 1.1. Iā€™ll submit the new version in a few days once I know things are working ok.

  • Garrett

Uploaded new version to the app store for approval. New version allows you to set the ping count. The default is 1, I would recommend no more than 5. It can be set via the advance tab under the ā€œcountā€ variable.

  • Garrett

Hi Garrett

Re this post: http://forum.micasaverde.com/index.php/topic,1997.msg103766.html#msg103766

Iā€™m assuming you are just setting the ping count in the ping command rather than delaying and doing another single ping. Would it be difficult to do separate pings with an adjustable interval between them?