Internet Connection

Any advice on the best way to check from a Lua process if the internet connection to Vera is up. Do I just attempt an http request to, say, Google and check the result or is there a better way?

Hi,

i’m not 100% sure what you mean but this might help…

Have you seen the Ping Sensor plugin, i understand this can be set up to point to an external address, which can then show you visually via the UI if your connection (at least to that address is up/active)

Presumably you want to know that “the Internet” is up because you want to get to a particular host on the Internet. Can you send your HTTP request to that specific host? Probably more accurate than checking a neutral third party like Google.

But yeah, doing an HTTP request is quite reasonable, to answer your question. Pick a URL with a reasonably small response.

Thanks guys.

My motivation is to know if I can send email notifications of alarms when unoccupied or to send an sms via a gsm device attached to Vera if the connection is not available. I guess I could just try the email send and if this errors, use sms but I thought it might also be useful to receive an sms notification if the connection is down (for a specified duration). The ping option to a site that responds to ping sounds like a good option.

Twostep,

Would that actually do what you want? If the internet connection is down, how would the SMS message get from the router to the SMS provider so that it could be delivered to you? Conceptually you could do some form of globalcache ip → serial → cell lashup or outbound dial. Those seem rather complex.

You might be better served to set this up in the opposite and select an http-based monitoring service on the internet that can periodically load the web ui (or at least the base redirection page) from vera. That way, if the connection went down you would still get the notification. It would also cover many of the hung/stopped responding/became VERY slow error cases as well.

If you wanted to be fancy about it, many of the services would let you poll your internet router separately so then you could tell if the problem was “outside the house” or “inside the house”.

Cheers!
–hal

Hi Hal,

I do have a gsm modem connected direct to Vera via a usb/serial cable and have written some Lua to send sms through it. I could forsee a situation where less important notifications could come to me via email but where, say, I wanted to receive intrusion alerts I could send alerts via the attached modem and via an sms gateway. If the internet connection is down (not such a problem these days I admit) I should still receive notification. It would be nice to be able to reboot Vera remotely but I haven’t researched that on the forum yet. I don’tt intend to get too anal about this. Being new to Vera I guess I am experimenting to a degree so bear with me.

[quote=“futzle, post:3, topic:173798”]Presumably you want to know that “the Internet” is up because you want to get to a particular host on the Internet. Can you send your HTTP request to that specific host? Probably more accurate than checking a neutral third party like Google.

But yeah, doing an HTTP request is quite reasonable, to answer your question. Pick a URL with a reasonably small response.[/quote]

How can we set up the Ping Plug in with un url? È.g. Google.

Thank you
Matteo

Google 74.125.227.12

Ahh… excellent.

Yes, http get is probably the cleanest. Ideally, scrape it for a known text string in the metadata. Google’s homepage is an excellent candidate as it is small, highly available, and (other than the doodle) basically unchanging over time.

You could also use Googles public DNS
8.8.8.8 and 8.8.4.4

If you have a static IP on your home internet connection, you could also potentially ping that (assuming it is allowed by your provider)

One install or plugin that I’d like to see is a generic ADSL (uPnP) modem/router - see here (http://forum.micasaverde.com/index.php/topic,12969.msg95697.html#msg95697) - theoretically it should be straight forward to do for those with the skills, but I liked the idea of seeing (via a single dashboard device)

a) if my Internet connection is up, (icon changes/when tripped)
b) how many device/IPs are connected
c) link uptime
d) inbound/outbound bandwidth utilisation
e) external/source IP address(es)

Most of these are retrievable via Luup/uPnP - plus others so I could go on, but I’ll keep it simple for now…

Anyway, I don’t think I’m asking too much; or am I ? :wink: