Trigger a rule when the hub goes offline?

Hi
How can I define a rule that triggers when the hub goes offline ?
I want to switch on a smart plug (which turns on my 4G modem) if the hub goes offline (lost main internet connection)

Ideas anyone ?

one issue here is that, in order to turn a switch on or off you need the hub to be active…

The hub is active. Its just not Connected to the internet.
This is exactly like any other local processing - eg you also want to be able to switch on/off a bulb independently of internet access, and this is supported

1 Like

True, however the only App that can run locally on the ST Hub is Smart Lighting. I have never seen where ST has exposed the Hub Online/Offline status as a local Event that SmartLighting can use in an automation. Therefore, it is highly unlikely that you will be able to accomplish this with what is possible today with ST’s limited local processing capabilities.

1 Like

Right, but the problem is the trigger.

At the time of this writing, the only code that could run locally was the official smart lighting feature and some parts of a smart home monitor. But none of those have an “Internet is not available” trigger. :disappointed_relieved:

That said, this is a common use case, and if you take smartthings out of the equation it’s easy enough to do.

There are devices sold which are smart Wi-Fi pocket sockets That regularly ping a site on the Internet and if they can’t reach it they reboot themselves.

Outside of the smart things world, these are used to restart modems.

Anyway, you can find discussion in the following thread.

Trigger routine on Internet lost?

Seems it is possible to check the hub status thanks to the location.hub[0].status but indeed this has to run in a local execution to work.

https://docs.smartthings.com/en/latest/ref-docs/hub-ref.html

They did not document status property but since it appears in the IDE I gave it a try and it returned me “ACTIVE”.

1 Like

Yes, but since all custom code runs in the cloud, you can’t write your own smart app or piston to check this as they will not be available to run if the Internet is not available.

It has to be a condition you can check in the official smart lights feature.

To test this, unplug your hub from the Internet and see if it works then.

2 Likes