how to : vera detecting that the internet connexion is lost ?

Hello, hello,

My purpose :
My vera 3 is in a house where I do not go so often… Then I need to keep OK the internet connexion, so that I can monitor the house !
But as the house is somehow far in the countryside, the adsl box regularly loose the synchro. And up to now, the adsl box doens’t come back alone to work : it is only when someone set the contact off/on that it restarts OK.
And I can’t ask my neighbours to do that so often !

So I imagined the following soltion :
If my vera3 is able to detect that the internet connexion is lost (through a regular checking, every hour for instance), I can command by the vera an electric off/on of the the adsl box, which hopefully brings back the internet connexion, and then the vera itself is also back on the net !

But for that, I need a way to automatically detect, by the vera3, if the internet connexion is OK… I have of course looked and searched… And didn’t find anything… Do you have any way ??

Big thanks !

Some folk use the Ping plugin in conjunction with the Program Logic Event Generator (PLEG). It has been discussed a lot on this forum.

It is also possible using Lua code in a scene but, if you are not familiar with Lua, there would be a learning curve…

In either case, checking for a response from Google’s DNS ( 8.8.8.8 ) works for me.

@flyonearth,

Concerning this

If my vera3 is able to detect that the internet connexion is lost (through a regular checking, every hour for instance), I can command by the vera an electric off/on of the the adsl box, which hopefully brings back the internet connexion, and then the vera itself is also back on the net !

Please can you say how you remotely run the electricity OFF/0n of the Adsl box from the Vera If you have lost the internet connection ?

Thanks

Please can you day how you remotely run the ?lectricity OFF/0n of the Adsl box from the Vera If you have lost the internet connection ?

You wouldn’t need internet access to have a scene or PLEG cycle the router’s power using a Z-Wave outlet or switch when it detected a loss of network.

Got it , Thanks a lot

In anticipation of another question, here is one way to ping Google’s DNS using Lua code:

local ping = os.execute("ping -c 1 8.8.8.8") if ping ~= 0 then luup.log("Ping Check: Network down - restarting router.") return true else luup.log("Ping Check: Network OK.") return false end

If inserted into a scene’s Luup section, this would allow the scene to run only if the network was down. The scene actions could be an immediate switch off of the router’s power with a delayed action to turn it back on after 30 seconds. The scene could be scheduled to run at appropriate intervals.

Note that this code will allow a power-cycle if any ping fails. This may be too sensitive for practical use. It may be necessary to count the fails and only allow the power-cycle when some limit is reached. This is what the Ping plugin does so why not use that?

Whichever route you take, consider what will happen if Vera restarts while the router is turned off. A scene’s delayed action will get lost so the router would remain off. PLEG is smarter and will still execute the delayed action. You could incorporate a failsafe into the ping scene that checks the state of the router’s power switch and turns it on if it is off.

Big big thanks to all !

It seems I have everything I need to start, with all your inputs… Except the internet connection as I have not yet come back to my countryside house !
I will tell you exactly how it finaly goes after success.

Thanks again