(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:
- 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).
- 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.
- 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.
- 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.
- 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.