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!