I live in an area with a lot of internet loss.
My actuall router is not compatible with a 3G/4G LTE dongle to automaticly switch between networks.
I will change it soon.
But for now, i need to know if there is a way to detect an internet deconnection to automaticly turn off/on the plug off my modem.
Is there a reliable way for Homey to detect internet disconnection ?
Don’t know. Haven’t tried yet. If it’s using just a IP/port, then it shouldn’t matter if it’s a local IP or not.
The http request flow app could call a server outside your network if NetScan doesn’t work.
I would just try some of these apps if you can call such a IP.
So the app seems to work fine, but Google has not opened the used port.
You can check if you can set another port in the app/device or try some other public IPs. Perhaps your internet provider has some static IPs you can use, then the traffic is only in your provider network and not depending on access to www-servers.
What device did you use? IP address or TCP port?
I don’t know what kind of connection check is used for IP (ping?).
I tried the port-devicetype with 18.104.22.168 port 53 (DNS port). This seems to work even though DNS port 53 uses UDP and not TCP.
I used the IP device. Ping doesn’t use ports afaik
If you use the TCP port device, you can, well, monitor an open or closed port at a specified IP.
But nonetheless, using a TCP device for let’s say google DNS IP’s or whatever you’d like makes sense!
Using netscan TCP device works for both www.athom.com:80 IP’s
Thanks for the hint, Ronny
Homey runs its own DNS server (for whatever reason). If that has been configured to use caching, it might be possible that it returns a result from cache instead of performing a full lookup, giving the false impression that an internet connection is present even if it’s not.
You can use https://ipv4.icanhazip.com. The response is very simple. If your internet connection is working this server responds with your external ip address.
You can best use the HomeyScript fetch command for this
The Netscan app doesn’t use ping because that requires privileged low level access to sockets that is not available to a Homey app.
The main differences between the two types is what errors determine a good connection. One accepts a rejection as a valid connection and the other one doesn’t. The IP connection method actually tries to connect to port 1.
Basically this is the actions if the original Netscan app and I have just continued with the same approach.
The best approach is to make a connection to port 80, e.g. a web page.