fasttimes Posted August 13, 2012 Posted August 13, 2012 Is there a way for a program to determine if the internet is available? Sometimes I need to restart my model & router, which are both connected to a Insteon switch. If the internet is not working, I would like to have a program power cycle those devices. Thanks,
Michel Kohanim Posted August 14, 2012 Posted August 14, 2012 Hi fasttimes, Unfortunately not. With kind regards, Michel
Xathros Posted August 14, 2012 Posted August 14, 2012 Michel- I'm not sure if this is possible or not but here goes: Can I use the network resources module to send a REST command using my DynDNS domain name/port to set a variable on the ISY itself ? Wait a few seconds and test the var to see if it's been set and if not then power cycle the modem/router. I think that as long as I have the ISY using an external DNS server and not my router for cached DNS, this should prove internet connectivity. I've been know to talk to myself at times, why shouldn't the ISY ? -Xathros
Michel Kohanim Posted August 14, 2012 Posted August 14, 2012 Hi Xathros, The only problem I see is the likelihood for infinite loop. This said, you should give it a try and let us know as well! And, I though I was the only one talking to myself!!! With kind regards, Michel
Xathros Posted August 15, 2012 Posted August 15, 2012 Michel- So far so good. I have the following resource rule that will set iVar 37 (i.InternetTest) to 1 when called: So here is how it works: TestInternetAccess If $s.InternetTestEnabled is 1 Then Repeat Every 30 minutes $i.InternetTest = 0 Resource 'SetInternetTestTo1' Wait 5 seconds Run Program 'CheckInternetTest' (If) Else - No Actions - (To add one, press 'Action') When s.InternetTestEnabled is 1, this program will first set i.InternetTest to 0 then attempt to set i.InternetTest to 1 via a rest call to the ISY's DyNDNS address. If successful, then internet access is available, if failed then execute a program to power cycle network equipment. CheckInternetTest If $i.InternetTest is 1 Then - No Actions - (To add one, press 'Action') <> Else <> <> So far I have tested this remotely and it seems to work. I need to test again this evening when I get home to see it it shows fail when I take my cable modem offline. (Can't do that remotely...) Things to consider: You must have the Network Resources Module. ISY MUST be accessible via a DomainName or DynDNS Name. ISY Should use Internet based DNS server in static settings rather than your Router/Gateway's DNS Cache. This ensures that the ISY actually needs to go out to the Internet to find itself based on your domain name/DynDNS address since many routers will cache DNS and resolve their external IP to their internal IP, you may get a successful test when the modem is actually offline. I will follow up on this tonight or tomorrow with my final test results. EDIT: My testing last night shows this method to work. I'm not set up with my network equipment on an Insteon switch and probably won't bother with that as I hardly ever need to reboot that stuff but my cable goes offline once a month or so (upstream) so I am monitoring my uplink and sent out a notification on Internet restored. -Xathros
Xathros Posted August 15, 2012 Posted August 15, 2012 The only problem I see is the likelihood for infinite loop. This said, you should give it a try and let us know as well! Michel- I'm not seeing the possibility for a loop/race condition here. Based on my example above, do you see any issues ? -Xathros
TJF1960 Posted August 15, 2012 Posted August 15, 2012 Xathros, Very clever! I can confirm that removing the RG6 cable from the cable modem and testing the network command returns an error and does not update the variable. Once the cable is restored and the command is retested a positive confirmation is returned and the variable is updated. At least it does work here on my system with Comcast internet. Thanks, Tim
Xathros Posted August 15, 2012 Posted August 15, 2012 Xathros, Very clever! I can confirm that removing the RG6 cable from the cable modem and testing the network command returns an error and does not update the variable. Once the cable is restored and the command is retested a positive confirmation is returned and the variable is updated. At least it does work here on my system with Comcast internet. Thanks, Tim Tim- Thank you for testing. Its not so much the ISP I was worried about as your router attempting to be helpful and caching DNS when we don't want it to. -Xathros
Michel Kohanim Posted August 15, 2012 Posted August 15, 2012 Hi Xathros, Looks good! With kind regards, Michel
apostolakisl Posted August 15, 2012 Posted August 15, 2012 On subject but slightly different. First off, clever! My experience has been that flaky modems and routers are a function of flaky power supplies. I put my modem, router, and ISY all on an ATX power supply and have gone years without a single reboot (prior to that reboots were needed). aside from when the UPS that it was plugged into died.
Xathros Posted August 16, 2012 Posted August 16, 2012 On subject but slightly different. First off, clever! My experience has been that flaky modems and routers are a function of flaky power supplies. I put my modem, router, and ISY all on an ATX power supply and have gone years without a single reboot (prior to that reboots were needed). aside from when the UPS that it was plugged into died. Thank you! Like you, I hardly ever need to reboot my modem/router. I have quite a few clients however that have to reboot DSL modems to get back online once in a while and I attribute that to the ISP not their modems. In one vacation home, I installed a mechanical timer switch on the modem/router to power down/up once a day just in case. This means about 15 mins of downtime everyday but its usually in the wee hours of the morning unless there has been a power outage to throw off the timer. When I come across one of these where I have an ISY installed, I will be using the ISY to monitor and reset. -Xathros
apostolakisl Posted August 16, 2012 Posted August 16, 2012 On subject but slightly different. First off, clever! My experience has been that flaky modems and routers are a function of flaky power supplies. I put my modem, router, and ISY all on an ATX power supply and have gone years without a single reboot (prior to that reboots were needed). aside from when the UPS that it was plugged into died. Thank you! Like you, I hardly ever need to reboot my modem/router. I have quite a few clients however that have to reboot DSL modems to get back online once in a while and I attribute that to the ISP not their modems. In one vacation home, I installed a mechanical timer switch on the modem/router to power down/up once a day just in case. This means about 15 mins of downtime everyday but its usually in the wee hours of the morning unless there has been a power outage to throw off the timer. When I come across one of these where I have an ISY installed, I will be using the ISY to monitor and reset. -Xathros I had DSL at the office and I used to have to reboot once per month. Then I put an ATX power supply at the office as well. Same modem never again needed a reboot. . . I mean never, and that was for 2 years until I moved offices and got uverse at the new office.
Xathros Posted August 16, 2012 Posted August 16, 2012 I'll have to try replacing the supply at one of my problem locations with a good regulated supply and see if things change. Very likely that the little wall warts are not capable of filtering minor line disturbances like a good supply. -Xathros
apostolakisl Posted August 16, 2012 Posted August 16, 2012 I'll have to try replacing the supply at one of my problem locations with a good regulated supply and see if things change. Very likely that the little wall warts are not capable of filtering minor line disturbances like a good supply. -Xathros I don't think it is a bad idea to at least give it a try. If it makes no difference, then you can always go back to the old wall wart and use you nice power supply for something else. I will also add that the office dsl modem was 7 years old when it went all flaky on me. So it would appear that the power supply suffered some damage either just from time in operation or a spike hit it, or a bunch of little spikes over time got it. No idea, but I thought it was the modem at first, and clearly I was wrong. Just glad I tried changing the power out first.
TJF1960 Posted September 21, 2012 Posted September 21, 2012 Xathros, out of curiosity is this method of testing the internet connection still working for you? If so what version are you on, still 3.2.6? Thanks, Tim
Xathros Posted September 21, 2012 Posted September 21, 2012 Hi Tim- I just retested and it is still working for me on FW 3.3.2. Out of 5 tests, I had one fail (timeout) which I chalk up to my crappy internet connection. -Xathros
cgreenle Posted November 6, 2013 Posted November 6, 2013 Thanks for this solution! In my case however I cannot reach my home from the web due to being behind multiple NATs. So I took your solution and added to it a little. Since the ISY doesn't have the ability to ping, I wrote some REST services for my windows server at the house. When the /Services/REST/isy/iNetCheck is called on the server, it pings Google. If the pings are successful the REST service on my server then calls the REST service on the ISY to set the i.InternetTest variable to 1. Doubt this would work for everyone but let me know and I'll share the project. It's a C# ASP.Net project. It also requires that the PC be running 24/7. That however isn't an issue for me since my server never shuts off due to RAID, PVR Services, etc. Thanks again!! Chris
ferdies Posted November 9, 2013 Posted November 9, 2013 Hi, Just to get clarification. Is this program running 24x7 every 30 minutes? Will this not tax ISY? And with regard to variable "InternetTestEnabled". Is this used only to initiate the program? How is it being initiated. Thanks.
ferdies Posted November 9, 2013 Posted November 9, 2013 Thanks for this solution! In my case however I cannot reach my home from the web due to being behind multiple NATs. So I took your solution and added to it a little. Since the ISY doesn't have the ability to ping, I wrote some REST services for my windows server at the house. When the /Services/REST/isy/iNetCheck is called on the server, it pings Google. If the pings are successful the REST service on my server then calls the REST service on the ISY to set the i.InternetTest variable to 1. Doubt this would work for everyone but let me know and I'll share the project. It's a C# ASP.Net project. It also requires that the PC be running 24/7. That however isn't an issue for me since my server never shuts off due to RAID, PVR Services, etc. Thanks again!! Chris Hi, Would you be able to share your C# ASP.Net project? Would it work on Ubuntu server? Thanks.
Xathros Posted November 9, 2013 Posted November 9, 2013 Hi, Just to get clarification. Is this program running 24x7 every 30 minutes? Will this not tax ISY? And with regard to variable "InternetTestEnabled". Is this used only to initiate the program? How is it being initiated. Thanks. it's a very quick ad simple test. Not hard work for the ISY by any means. The enabled mvar is used to enable or disable the test program. The test is initiated by my startup program and then runs on its own from there. -Xathros
ferdies Posted November 9, 2013 Posted November 9, 2013 Thanks for the reply. One additional question - shouldn't be the initialization of $i.InternetTest outside of the Repeat program? Otherwise, "Else Statement" of CheckInternetTest will be executed every 30 minutes? Let me know if I read the program incorrectly. Thanks.
Xathros Posted November 9, 2013 Posted November 9, 2013 ferdies- No. The If section is looking at $i.internetTestEnabled while the then section is setting $i.InternetTest. Two different variables. -Xathros
ferdies Posted November 9, 2013 Posted November 9, 2013 Yes, I am actually referring i.InternetTest variable (which is being initialized to 0 every 30 minutes). Thus, resulting to execute "Else" statement CheckInternetTest as i.InternetTest changes to 0 in the Repeat Statement. Thanks.
Xathros Posted November 11, 2013 Posted November 11, 2013 In this case it's ok since the mvar is an integer (not state) the second program does no trigger from the first when set to 0. Instead, I have to call the second program from the first (Run If) -Xathros
ffpllc Posted February 20, 2015 Posted February 20, 2015 Hi! This is exactly what I'm looking for, I've got a rental house that is in another state and I use the ISY to control the thermostats. It works great but occasionally the house's cable modem conks out. I've got all the pieces I need to have the ISY reboot the cable modem when the internet is no longer available, I've got an insteon power outlet with the cable modem plugged into it, I purchased the network module for the ISY and the ISY is reachable by dns name,. I guess the problem I have is that I'm not well versed enough in the network module to figure out what goes where in the posts. I think I correctly setup the InternetTest resource (see screenshot) but now I don't know how to do the rest. Would it be possible to get screenshots of the different pieces that need to be configured for this to work? Or maybe more of a description of which piece goes where for us newbie? Thanks in advance this is exactly what I'd like to do. Regards, Stephan
Recommended Posts