[RELEASE] Device Activity Check - Get notifications for "inactive" devices

(Putting this at the top to make it easier to find...explanation of the app is below.)

This app is available on GitHub and is also available from Hubitat Package Manager:

To install, just add the app from the above (raw link: https://raw.githubusercontent.com/RMoRobert/Hubitat/master/apps/DeviceActivityCheck/DeviceActivityCheck2.groovy) to "Apps Code." Or, find it in Hubitat Package Manager.


App Description:

While there have been at least a couple apps with similar purposes, none did exactly what I was looking for, so I decided to write one to meet my own simple need: get notified daily at a specific time (or on an arbitrary schedule you could set up with a rule -- or not at all and only when you look at the report) if specific devices haven't "checked in" (generated activity) in a while. Additionally, I wanted to be able to configure different "thresholds" (inactivity timeouts) for different devices while keeping them all part of the same report/notification. A couple other methods for inclusion in a report are also available, including battery level.

Enter: Device Activity Check. Here's a screenshot with a most of the options exposed:

While there is a way to "manually" view the report or trigger the notification (which will only get sent if anything is actually "inactive" or otherwise meets the report criteria), sending an automated notification is the primary purpose of this app. There is no Dashboard integration (it would be easy enough for me to add an HTML endpoint you could feed to an attribute tile or an entire HTML page you could link to and display if this is a need anyone has, but I might suggest Device Watchdog instead). Just thought I'd share what I wrote for myself in case anyone else was interested!

Documentation:

Let me know if you have any questions, but the general idea is:

  1. Choose the devices you want to "monitor" (Device Activity Check doesn't actually "monitor" or subscribe to any of their events; instead, it evaluates the criteria at the time the report or notification is generated).
  2. Optionally, you can create multiple "groups" of devices with the "Add new group" button, which will enable you to configure different intervals (or inactivity detection methods: "Last Activity At," battery, etc.) for different sets of devices. If you only want one interval/type for all selected devices, you do not need to do this.
  3. Choose your notification device (for example, your phone/tablet with the Hubitat app or another service) for the "Send notification with list of inactive devices to this device:" field.
  4. Optionally (but you probably want this), configure a daily time at which to send the notifications. The notification will be sent only if there are inactive devices according to your criteria.
  5. Optionally, choose a switch, where the notification will also be sent when the switch is turned on, again only if there are devices to report. This is how you could automate sending reports via more complex criteria you create in a Rule Machine rule, etc., instead of relying on the app's built-in daily schedule.

Other options:

  • "Include last activity time in notifications": if configured, inactive devices will also display their last activity date/time in the notifications. Un-select this option to show only the list of devices.
  • "View current report": will show list of "inactive" devices (manual alternative to using notifications; may be useful to consult when configuring app for first time to see what devices are listed)
  • "Test Notification Now": will send notification (using the same criteria for the daily schedule or switch--only if there are inactive devices to report). May be useful for testing.
  • Advanced options: configure logging or restrict sending of notifications to only specific modes (may be useful if using the "switch" option but you want to restrict notifications at certain times).

License:

This code is licensed under the Apache 2.0 license, as seen in the code and also available online: Apache License, Version 2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

38 Likes

This is a fantastic app. Exactly what I've been looking for as battery monitoring on zigbee devices is hit and miss. Good amount of customisation too!

Awesome to see you're supporting the Hubitat Package Manager - that is a real game changer with the search functionality.

Hey @bertabcd1234

I've started to see an error when triggering the report/notifcation. Here is a copy of the logs:

At present I have two groups with different periods. The only thing which has recently changed is the addition of some devices. I have removed them but the error still remains.

Any ideas?

UPDATE: A screenshot from the error within the app:

Hmm, not sure. Could you PM me (or post here if you don't care that everyone can see your device names and whatnot) a screenshot of the app status page? I mean from the cogs/gear icon in the upper right and am particularly looking for the "Settings" and "Application State" section. Thanks!

Appreciate you having a look:

I installed it through the Hubitat Package Manager so if you need me to reinstall, just let me know.

Thanks

Hmm, so it thinks there's a third group. That should display in the UI, and you should be able to click in to that and use the "Remove group" option (follow through to confirm...I made it harder than one click to do this due to some...accidents...in testing). I'll look into making it not error out on empty groups. If you don't see a group listed in the UI at all, I'm not sure why.

1 Like

That would be it, there is a Group 3 with no devices in it. I will populate or properly remove this group. Thanks for the trouble shooting!

UPDATE: Issue has been resolved - it was definitely the empty group.

1 Like

Released a small bugfix (1.0.1) to address unhandled errors if the group is "empty" (no devices selected) and also one I saw that would happen if you didn't select a notification device (though I'd recommend choosing one, but I guess if you only want to use the app for in-app reports, you don't need to).

1 Like

Hello,
So I have a pond pump powered by a Zooz Relay that consistently pops the circuit breakers. That is currently being fixed but in meantime I want to be notified when the pump goes offline; I used a rule so the relay is pinged every 5 minutes and I want to use your app to notify me when that happens. However after I set it up it does not automatically send me a notification if it is offline, I have to manually click the button for it to send. This is how your app is set up at the moment. I would greatly appreciate any help you can provide.!

This is how it is set up at the moment.
Screenshot_2020-06-28 Device Activity Check|690x431

Not sure, so I'll throw out a few ideas:

As written, that should send a notification at 9 AM. You can check the "Scheduled Jobs" section of the "App Status" (gear/cogs icon) page to see if anything is listed there. It will check only at this time, not constantly based on the selected interval if that's what you were expecting (this avoids excessive device subscriptions and whatnot). If you wanted a more freqent schedule, see below.

I also see you have the "Any time this switch is turned on" option selected with the same devices. You may have a reason for that, but that is more or less intended to be used to replace or supplement the daily scheduled check (e.g., you could use a virtual switch and a rule that turns it on multiple times a day). Selecting the same devices there seems unusual to me, as if they do in fact turn on, you already know they're responding and wouldn't need DAC to check for you.

The only other thing I can think of is that DAC looks at the "Last Activity At" field on the device page. If for some reason your devices still generate events when they're not really online, then it will mess up these checks. Most built-in Z-Wave and Zigbee devices don't do this; some community or LAN drivers may, though I personally consider that bad practice. (If you see the device in "View Current Report" or when doing "Test Notification Now," this is not the issue, at least not at that particular time.)

Hello,
I want your program to notify me when the pond pump goes on within 15 minutes or so. So I've disabled the scheduled notifications at 9 AM. Anyways I set up the rule machine to ask for a update every five minutes so it updates "Last Activity At" for that time and I asked your program to notify me every six minutes.

So I'm not supposed to select the same device for the "Or any time this switch is turned on:" section? I interpreted that part as it will send me a notification if it is offline even though it is supposed to be on.

I've tested if the device still sends events even when it lost power and it doesn't so it isn't that.
-Thanks

The "or any time this switch is turned on " option is to supplement (or replace) the time-based check. Devices you actually want to check do not belong there. In your case, I'd create a virtual switch and have a rule that turns that switch on every so often (and then back off), which will "trigger" my app to perform a check. You wouldn't need to fill in a time.

It also sounds like you might be wanting this app to work sort of backwards: it notifies you if a device has not had activity within the specified time. This is to assist users with finding devices that aren't responding, possibly due to network or device problems. If you just want to be notified every time a switch turns on, Rule Machine and probably even the Notifications app (both built in) could handle that.

Oh I see I think I will try creating a virtual switch then.

Yeah sorry maybe I'm not being clear enough. I do want your app to notify me when the device has not had activity within the time period, this being five minutes. There is no switch turning on at all, the pump is supposed to stay on 24/7 (except for brief moments) but the circuit breaker keeps on popping and the device loses power and I want to be notified when that happens so I can reset the breaker.

Update: I've released version 1.2, which adds:

  • ability to ignore disabled devices, which are now excluded by default (since they are certainly not going to be generating any activity on the hub as far as the driver is concerned) -- I actually meant to release a 1.1 version with this feature but apparently kept it to myself :slight_smile:
  • ability to monitor devices/drivers that use the "presence" attribute as a self-monitored proxy for online/offline status instead of "Last Activity At" data, as a few popular community drivers have started doing

As before, available on the GitHub links in the first post or Hubitat Package Manager.

Hi @bertabcd1234

I recently found your "Activity Check" app and it definitely fits the bill. Thank you for sharing.

I do have a question though; Is there a way to perform a Hubitat action for a notification. A low battery on a temperature sensor is not something I want to generate a Twilio message?

I mostly use one of two methods of notification:

  1. Inovelli Color bulb (yellow = take a look, Orange = Take a look quickly, Red = too late go fix it) :slight_smile:

  2. Pretty much the same as 1 but I use a Inovelli Red dimmer LED strip.

I would not like to do away with the ability to send a Twilio notification but I will likely not use it for the current batch of battery operated sensors.

Thanks
John

1 Like

Hmm, directly there isn't, but I suppose I could add a "turn on this switch if there's something in the report" option, which you could then use with RM or any app of your choice to do whatever action you really want.

That would be great. I don't think such an addition would cause the app to be over complex. One of the reasons I like your app so much is the simplicity.

Thanks for the app!

I second this - it would be very useful for making visual notifications.

It is grate update, but before this update,
I got pushed messages without the child app name on it.

Now I have no idea how to get the push notification without the child app name on it.
Please help
Thanks

The notification has always included the child app name (ever since I publicly released the app as version 1.0), so nothing would have changed with that recently. There is an option to also include the hub name. This is under "Advanced Options":

"Include hub name in reports"

Maybe you inadvertently checked this box and are noticing that change? If so, unchecking it should address the issue.