Check for Internet Connectivity?

I know stuff like this had been asked a few years ago without positive resolution, but perhaps now…

My internet went down for awhile today. Issue was the cable company. When it came back up, ST sent the notification “Your hub is online”.

So what I’m looking for is to either a) leverage that, or b) use some sort of scheduled net connectivity thing, to trigger an Alexa announcement saying “your Internet connection is back online”.

For (b), I’m imagining one of the http web Requestors running, say, every 15 minutes to connect to a fixed IP address at my cable company. If it gets a 200 (success) return, it does nothing. If it gets a 404 or other error, it sets a virtual switch to ‘off’.

Then when the web comes back online, Alexa sees that switch as off. It has an automation that, if the switch is off, makes the announcement and turns the switch on.

First issue I’m seeing is in scheduling an event (the connect to external ip address) to repeat multiple times an hour. Used to be doable in Webcore….

Guess I have some exploring to do. Meantime, anyone who knows either a path forward or a reason why this is currently not possible - feel free to chime in!

While not entirely what you’re looking for, Glen, I have the KeepConnect device at both of my locations. What you might find interesting is the description on their website about how it works: the rationale behind a full HTTPS request with 200 (success) return vs. other methods commonly used like a ‘Ping’ request. They have advanced features that handle each of those, plus being able to navigate around a DNS failure, as well. It’s interesting reading…

3 Likes

Two methods I can think of

  1. There are purpose built plugs for exactly this purpose, they are typically used to reboot a router after Internet connection goes out, but you can use them for other things as well. There are old threads about them, but they would still apply, because the discussion is about the physical device, not smartthings Integration. Some of them call their own company’s URL, others allow you to pick a URL of your choice. Some have a single plug, some have two sockets.

Once you have that, you ought to be able to make some kind of MacGyver integration to smartthings by having a device come on which SmartThings would recognize as coming on.

Here’s a popular model that’s currently available on Amazon

https://www.amazon.com/Connect-Monitors-Connectivity-Required-Necessary/dp/B07MCRQPCS/

Personally, I prefer the features on the following brand, but it does cost more:

https://www.amazon.com/5Gstore-App-Controled-Remote-Power-Switch/dp/B0831T2DYV/

  1. if you have an android phone, you can probably have Tasker set up to respond to the specific notification that you receive. But I’ll have to leave those details to somebody who’s using that method for something.
2 Likes

Using the Rules API, you can have something happen on a recurring interval. Here is an example:

{
  "name": "Every 15 min Temp copy to Number Field 2",
  "actions": [
        {
            "every": {
                "interval": {
                    "value": {
                        "integer": 15
                    },
                    "unit": "Minute"
                },
			  "actions": [
					  {
						"command": {
						  "devices": [
							"id number field device"
						  ],
						  "commands": [
							{
							  "component": "main",
							  "capability": "legendabsolute60149.numberFieldTwo",
							  "command": "setNumberFieldTwo",
							  "arguments": [
								{

You could also use an Edge driver like the Edge Counter Utility to accumulate a specific amount of time and then trigger an event when that amount has been reached. You then reset the timer to zero and the process repeats. Here is an example I use to notify when a gate has been left open.










You could also use “seconds timer” of the (EDGE Driver-Mc): Aplicaciones Virtuales Mc (virtual Switch Mirror, Virtual Calendar and virtual Switch Board…) driver to count the amount of elapsed time and then trigger the URL polling when the timer turns off. When set to infinite mode, it will run continuously turning on then off then on, etc.

3 Likes

Using one of the devices that @Barkis or @JDRoberts mentioned, you could get something like the Third Reality Smart Nightlight to plug into the router reboot device. It runs Matter over Wi-Fi and you could simply have a Routine that monitors a change in on/off state for the device and use a virtual momentary switch to trigger an Alexa routine to make the announcement.

2 Likes

I think I’m going to create a batch file on my PC. It will run every 10 or 15 minutes. It will ping three addresses, one of which will be 8.8.8.8 (google) along with my cable internet provider. Any successful ping will end the batch file. If all three are unsuccessful, it will make a call to an Edge HTTP switch to turn it off.

From there, if we’re not in sleep/night time, when the connect comes back up Alexa will see the switch is off. It will make the announcement, then flip the switch to on.

3 Likes

I made my virtual device. I set up the Alexa routine. I created my batch file. I have the CLI ready to roll. I have my personal access token. I have my device ID. I have successfully told this device to turn on or off from the command line using CLI.

One step remaining: how do I invoke CLI commands from within an MS-DOS style batch file?
NEVER MIND: I got it. I had to close the command window I’d been using as it did not know from the CLI. When running the batch file now, it opens a new command window where the CLI is known.

EDIT: not quite finished yet. The CLI is an API, going via the web.
I need a direct link locally to the hub.

EDIT 2: I’m going to try to finesse this, by manipulating the batch file timing. Perhaps store some sort of global variable, or a delay. Because the batch file is working, but not getting a chance to talk to Smartthings.

1 Like