[RELEASE] Device Watchdog

Ahh ok, I must look into this a little closer and get some advice, maybe I have some faulty drivers or bad joins.

Or the driver/device just doesn't support it. Not all do. Just ask the developer of the driver.

Ok, thank you very much sir. I will see if I can reach out to the right people.

1 Like

Stock HE drivers which don't:

  • Nue light switch
  • Generic zigbee outlet
  • St presence sensor

Edited to clarify

1 Like

Well that just about explains it, look at my drivers the stock drivers are the ones that have this issue. I just posted this up. Wonder why this isn't standard at least in the stock drivers, it's valuable information to know your device is communicating with the hub.
https://community.hubitat.com/t/last-activity-not-updating/68522

Hi all, excuse my ignorance, this is a pretty long thread. I'm trying to get my head around device watchdog. In summary I want to be able to see which devices are offline. How do I configure this because I don't completely understand some of the language used. Any screenshots and step by steps would be appreciated :+1::+1:

Running a Special Tracking Report, when there is no data, the report seems to bring back the device(s) that were on a previous report.

What led to this discovery:

  • An automated report was run reporting 2 devices as “not present”.
  • Updated the devices to be present
  • Ran the report and it reported 1 device as “not present” that was actually present
  • Updated the report - removed one of the parameters
  • Same 1 device was reported with the previous 2 parameters
  • Updated the report so that it would report “present” (state of all devices)
  • Ran the report and it reported all devices as “present”
  • Updated the report so that it would report “not present” (no devices in that state)
  • The report provided the “present” status of the 2 devices from the automated report, but with only the selected parameter

Logs:

Configuration:

Result:

I can't seem to reproduce this. Devices are showing up like they should. Once thing that is standing out from your screenshot though, you have windows that are 'present'? Just seems like something that shouldn't have a presence attribute. :man_shrugging:

Haha! When you think bout it, totally agree!!! I want to make sure my windows are still there! :rofl:

In reality, I have sensors on the windows that tell me if they are open or closed. The report lets me know if any of them fell off the Zigbee mesh which they do often, being Xiaomi (non-standard) Zigbee devices...

Darn... And when you run a report with no devices in the state, it comes back with nothing like it should? If I find out anything more or am able to reproduce otherwise, I’ll let you know!

They did.

I almost asked you if your windows visit other houses! lol

Hopefully this gets worked out.

1 Like

Lol. They come and go as they please. Gets to be a problem though in the middle of winter... Heating costs go up when they sneak out during the night! :rofl:

1 Like

G'day Bryan,

Been using the app for a while now, very useful to keep on top of devices that have run out of battery or lost comm's in any way.

I go into some detail below about my setup, but essentially I want request an enhancement, to allow triggering of the report generation with a switch (like you can already), but to not have the push notifications sent. I'm thinking leave the existing setting for the switch selection, adding an extra setting select a second switch that will only trigger updates to the report / tile attributes, but not send a push notification. Hopefully this request hasn't been made already, apologies if it has...

Background...
I have setup tiles on a dashboard to display the various report attributes. I have also included a switch used to trigger the reports to run, adding this to the same dashboard. This all works fine, i.e. flicking the switch on the dashboard triggers the reports and the tiles update on the dashboard.

Part of the DW Configuration:

Like I said earlier, am thinking the existing configuration settings could remain as-is, perhaps a second switch selection could be added after the push notifications device selection, allowing selection of a switch for report / attribute updates only.

Thanks,
Simon

1 Like

New version...

2.4.0 - 05/24/21 - Added second switch option to Run Reports on Demand, fixed typo with Activity push

1 Like

Wow!! What a quick turnaround. I'll try it out in the next few days and let you know how it goes...

Simon

I got a little impatient / excited :slight_smile: Works perfectly! Great job Bryan!

Thanks again,
Simon

1 Like

I think there needs to be a 1-2 second delay between the refresh being issued and when it checks for and generates the report. For settings here is my logic, since the check is daily (24hrs) I bumped the activity time down to 22 hours so anything that was refreshed the day before and not checked in again since will get tested again (otherwise they might show last activity was 23h 59mins ago and be considered fine). I have the refresh time to 20 hours for same reason, to make sure anything gets refreshed that should be, although that could probably be 22hrs as well and still work.

I have noticed that although the devices get sent a refresh the app does not wait for the device to actually respond to the refresh command so they still show on the initial report. If I run the report again right after they are no longer showing. I setup a test child app with just one device so the log would not be a mile long and I reduced the activity times to force this device to show up. I also enabled heavy logging on the device driver so you can see when it responding to the refresh commands (which is quick but not quick enough because the app doesn't wait).

First run of the report

Second run after the device has had time to refresh

1 Like

New version...

2.4.1 - 06/23/21 - Added a pause to refresh (behind the scenes)

1 Like

Well I thought that would work but there might be something with the pauseExecution that pauses everything else. Even if I edit the code and up the pause to 10 seconds it still doesn't work right even though the device has clearly refreshed before that. Either that or the built in getLastActivity() is getting stale values. I am going to try again with an even longer delay and see if it will work and report back. EDIT: Even with a 30 second pause same results, if I then run the report again right away the devices comes back fine and shows the last activity around 30 seconds ago. It has to be something with the pauseExecution. I know in JavaScript pausing is frowned upon because it basically halts everything while it waits.

I will try later today to put in a RunIn delay to the activity check instead of using the pause and see if that fixes it. Instead of you making a bunch of updates I can figure out what fixes it and let you know if you dont mind.

I have also noticed that the comparison for the report only uses the hours value and if the hours are equal it passes (no report). So if the device was at 23h 59m and your "Number of hours for Devices to be considered inactive" was set to 23 it would pass even though it has been inactive for longer than 23 hours. Not sure if this is intentional or not? With this design if you have the hours set to 23 or 24 and the last refresh was from the app during a daily run it would likely take 2 days of inactivity (if the device stops responding) before a device is reported.

It only pauses AFTER all refresh commands have been sent. Pausing can't effect anything outside of this app, so the refresh will update the device. Halting everything within the app is exactly what it is suppose to do.

pauseExecution is fine in Groovy and is used in a few different places within this app. I also use it in other apps without issue.

Working as designed. If you have devices that are that sensitive to inactivity, I'd suggest you either lower the hours or run this report multiple times a day. Maybe once in the morning and then again at night.

No need to change code that has worked perfect for years. :wink:

I removed that one 3 second pause and modified a little bit of other code to do a runIn delay of 3 seconds and like this it works as expected. Two device get called to refresh and when it checks them 3 seconds later they pass. I am convinced it has something to do with the pause.

Snip of code changes (might have other side effects but it solves this one issue)