How to detect that hub is not internet connected

My mesh router unit in my laundry room, that my hub is direct connected to is down. Of course I didn't realize that until I was out of town. This takes out talking to the hub w/ app.

I'm hoping someone else has solved this issue but using a different computer and periodically pinging the Hubitat hub and if it doesn't respond...try a few times and then send you a notification to your phone.

I'm trying to learn docker and thinking a linux partition on my desktop could do it...

On a side note it would be really nice if the hub flashed green when no ethernet connection..
solid green in my mind says EVERYTHING is great.

Any help and suggestions appreciated,
Tim

1 Like

The good news is that the hub will continue on its merry way without the internet, but without having a working router I’m not sure that anything besides the zwave/zigbee devices it is controlling will be able to see it. So no way that I can see to get a message to/from it if the main router is out. If it is only the satellite that is out, and the main router is still working then of course any device on the network (including another hub) could attempt a ping an report. I have all of my hubs running dual connections (WiFi dongle and wired Ethernet) so, in theory, as long as the main router was up I should be able to communicate to the hub and let it tell me which connections are active.

If you're thinking of using Docker, or have any other machine where you can run Node Red...

Set up a node red flow with http-in node. Those listen for a request at a specific URL, so for example, :1880/heartbeat

That node feeds a trigger node that is set to send nothing when it receives a message, wait x minutes before sending the last message received, and reset the delay when each message is received.

The next node(s) would be too send some sort of notification... Email, SMS, etc.

On the Hubitat make a rule that makes a http request to http://<noderedIP>:1880/heartbeat more frequently than every x minutes.

As long as the Hubitat has network connectivity to the machine running node red, the notification never gets sent. Every time the Hubitat makes the http call successfully, the trigger node gets its timer reset.

If it's possible for your hub to lose internet but not LAN, just extend the idea to ping an internet IP from the Hubitat, and use the successful ping return as the trigger to make the http call to node red. When the ping fails, the trigger node won't get reset, and the notification will be sent.

2 Likes

Since this depends on a job running every minute to prevent the notification, I realized this also works to detect if the hub completely locks up.

AFAIK my hub has never lost its network connectivity, and I can't remember the last time it locked up, but I decided to set this up just in case.

In Hubitat:

In Node-Red:

The first node listens for the http request. The second node holds the message 2 minutes and gets reset every time a new message arrives. If no message arrives for 2 minutes, the message passes to the last two nodes which set up my notification message and pass it to my notification server.

I intentionally set this up with a short fuse so that it will fire when I reboot the hub. That way I get a periodic test that the process is working.

The trigger node is set up like this:

@Alan_F What is the node type for your first node? I'm using a ping node and don't know if this wold be better. Thanks

It looks like he is using the "http in" node.

thanks for the excellent responses...i really need to learn docker and node-red
in my case the main ethernet hub was up so it could check...but that wouldn't work as pointed out if the main one was out
Wondering ....could the hubitat app do a background check every 30 mins and notify you if it cant talk to it...thoughts ?

You mean the mobile app I assume. I wonder if there's a way to do it with Homekit and an automated routine on your iPhone?

As @JBrown said, it is a 'http in' node. It sets up an endpoint in Node Red where you can receive various http requests. It's great for triggering flows. I use local endpoints on the Hubitat side and 'http in' nodes on the Node Red side to have them talk to each other.

You can do a lot more with the http in / get node. You can pass arguments like "http://<noderedip>:1880/my_http_in_node?command=foo&device=bar&stuff=things"

If it received that request, the node would pass msg.req.query.command = foo, msg.req.query.device=bar, msg.req.query.stuff=things

and then you can use all of that information downstream in the flow. On the Hubitat side you can of course use hub and local variables in the http request to populate the request string.

You could ping the Hubitat from the node-red side rather than use the http request. I do that for a bunch of LAN devices. The flow for those waits for them to fail for a certain amount of time and also notifies me when they come back online. However, as noted earlier, using the inbound request from the Hubitat has the advantage of tripping the notification if the Hubitat stops processing jobs, even if the LAN interface is up and responding to pings.

Edit: Fixed the URL examples. The forum didn't like the IP placeholder being inside those < > brackets without escaping them as suggested by @thebearmay

1 Like

Can also use the backslash to escape the character:
\<some text\>

1 Like

Yes the mobile app. HomeKit is another technology I know nothing about. Is it possible to use HomeKit to accomplish this? Ie a period ping of a device? Do you need a Mac to develop home kit? On the other hand the app has everything .. knows how to connect to hub, knows how to do notifications. … seems like a very useful festure

If you're not already using it I wouldn't bother for this. I was thinking there might be an easy way with the shortcuts app to see if it was still connected to the hub but honestly I'm not that familiar with it. You do need some sort of homekit controller - can be apple tv, iPod mini, etc.

I use this

Hmm. WhatsUo Looks very powerful
I don’t see a phone app
How exactly do you use it?

I have it on my windows server and it both emails me and send sms after a device fails x number of polls. I actually have an older unlimited version before charging started.

1 Like

Hubitat has a virtual device called Hubitat Ping. You can use that device to send a ping to any valid IP address, whether it is on your own LAN or on the greater Internet. You have to establish a separate virtual device for each address you wish to ping as the device remembers the address last accessed. The device returns various data, but the only thing that is really necessary is the Present/Not Present notification.

You can use the ping status of a device as a trigger in a rule in Rule Machine. For example, if you ping a DNS server on the Internet such as Cloudfare (1.1.1.1) or Google (8.8.8.8), a "Present" status indicated you are connected to the Internet. If you get a "Not Present" notification, you can use that to trigger a reboot of your modem and router. Since Zigbee and Z-wave switches connected directly to Hubitat can be turned off and then back on sometime later, they can be used to reboot your Internet devices. I suggest turning off both devices, then turn the modem back on 30 seconds later and then wait another 30 seconds before turning the router on. Just do not use WiFi connected switches; you can turn them off, but you won't be able to turn them back on with the router offline.

This works best if your modem, router, and Hubitat are all supplied by an Uninterruptible Power Supply (UPS). That way, you can continue to have Internet access even if the mains power goes off-line temporarily.

Other addresses you may wish to ping are the router gateway IP address which on my router is 192.168.1.1. If you cannot reach it, you can try rebooting the router without rebooting the modem.

You can also ping the Hubitat hub and any bridges (Hue, Lutron Pro, etc. ) that you might have connected to Hubitat. Sometimes my Amazon Echo devices lose WiFi connection with the router, so I can ping them and reboot them automatically if needed. To do this, each device will have to have a IP address reservation (static IP) on your router.

3 Likes

Hi, I'm not finding the a Ping device under Devices->Virtual ..where is that?

found it - installed w HPM

3 Likes

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.