Monitoring if Hub is Offline


#1

After reading through dozens of threads I’m a little worried that this may not exist…

I have one goal:
If my hub is offline, notify me somehow outside of needing to be on the iOS app ideally by firing a momentary switch and get an IFTTT email.

The hub does have an “inactive” event that fires but on a separate thread it seemed that was not accessible by custom smart apps.

Thank you everyone and if I missed a plainly easy solution to this one, my bad.


Device not reporting in for a set amount of time
(Kraeg) #2

Not easy to do, as its the hub which would send you the alert - if its offline, it cant!

Also in terms of powerloss, it wouldnt be able to send the message as your internet will likely be down too. I know some UPS devices are able to send email, so you could wire your hub into a UPS then use IFTTT to get an alert from a UPS to your phone? I’ve not personally done it, but its possible I should think. Just remember to put your internet router and wireless (if separate) on the same UPS - so the message can still get out.

Someone else might have a more simple solution.

Kraeg


#3

Thanks @kraegd for the response. It looks like even when the hub is offline, the inactivity event still gets logged when you look at the hub’s events in the IDE. My thought was that a smart app in the cloud could see this event triggered and then that would fire the IFTTT action.

What I came up with, and huge thank you to @craig, was this device inactivity monitor:

I modified so that there are 2 thresholds, one for hours that an individual device has no events and the second for hours that all devices have been offline. Im going to keep an eye on the timing of normal events that come through, but for my system it looks like the largest gap is about 2 hours when nothing at all reports (temp/humidity/etc). I’ll make the system down threshold 3 hours which would then trigger my IFTTT email saying the system is down. It’s not real time like the hub itself reports out, but close enough for most of my use cases plus I also wanted a device inactivity monitor as well!


(Craig) #4

Did you add code to monitor the hub too? That’s really cool (hadn’t thought about that). I’ll add that to the central app if you don’t mind (I’ll call you out as the author obviously).


#5

@craig I’m definitely just getting my feet wet in Smartthings programming and Groovy and not sure how to monitor the Hub. Can a smartapp monitor the hub events? If so that would be perfect! To identify the “Hub is inactive” event the moment that it happens.

I stumbled across a thread that said those events were “internal” and not able to be accessed. That may have been outdated, I hope so.

Thanks again for this great app.


(Craig) #6

I think I misread your above statement. I’m not sure if the app runs locally or not. You could attempt to look for ALL devices to have not checked in for X hours and make an assumption hub is down if that happens. Now IF the app runs in the cloud that should trigger but who knows.


#7

From what I could gather, all custom apps run in the cloud (there was a long thread and even a petition about the Rule Machine app being allowed to run locally). When the hub is offline for any reason we know there is a push notification that goes out 5 minutes after activity stops, there is an associated event in the hubs event list, do you know if that event can be subscribed to? That would be best case scenario. Otherwise the inactivity of all devices is a nice proxy, although has a delay.

Would you mind having a look at this thread I started as well? It relates to events that are not picked up using your app. It causes devices (particularly Smarthings own sensors) to appear idle when they are in fact reporting new events, the values just are not different from their last report (temperature/etc) so they are grayed out and not visible by the app as it is written now.

Thank you!


#8

@craig here is an example of a sensor that is being marked as idle for 2 hours by the app, but has had activity recently. Is there a way to check for those events that have been grayed out?


(Austin Pritchett) #9

What about instead of using a SmartThings SmartApp, use an internal web service to try to HTTP GET the hub? You’d need to set the hub for a static IP. I’m not fully sure if this would work. Also, a ping might work as well.