Auto Refresh Devices with Battery Threshold Filter

Hi all,

Has anyone else run into issues with devices not showing an up-to-date status in the Hubitat UI? For example, my Yale lock with a Z-Wave module will often report as unlocked when it’s clearly locked. A manual refresh usually fixes it, but it’s not exactly a scalable solution.

To help with this, I put together a small custom app that:

  • Automatically refreshes selected devices at a configurable interval
  • Skips devices that are below a specific battery threshold (to avoid draining them further)

You can check out the code here (sorry I can't add a link and didn't want to paste the code):
https://gist.github.com/chutch3/2662014539066e1219280678ec9d5169

I’d love to hear if others are seeing similar issues—and if this approach works for you too. Suggestions or improvements welcome!

Welcome to the community!

I have just used a Webcore piston to do refreshes in the past, as it is pretty easy with a device list local variable and a for each device loop.

The main use of refresh for me was to refresh Zigbee temp sensors to get them to report more often. Now, using kkossev's driver, I can set the reporting config in the device so a refresh is no longer needed.

The only other use I had for refresh was with a Broadlink device, that for some reason would become unresponsive at times. A refresh timer fixed the issue to keep it always working, though I only had that issue with one specific Broadlink device. I may not even need it anymore, but I just let it roll.

Still, this app could be useful for people who have a variety of issues with devices that a refresh can fix. I was going to mention that not every device has a refresh, but I see in your code you do check for the device having a refresh command available.

I'm sure some will say the very need to do a refresh indicates an underlying issue that should be fixed directly, but it isn't always obvious what the issue is. If nothing else this app is a good work-around until the real problem can be fixed with a new driver or something, assuming the issue even can be fixed.

I'm sure some will say the very need to do a refresh indicates an underlying issue that should be fixed directly, but it isn't always obvious what the issue is. If nothing else this app is a good work-around until the real problem can be fixed with a new driver or something, assuming the issue even can be fixed.

Yeah I totally agree and I was thinking the same thing but to your point I have been having a hell of time figuring what's causing the issue. I am still learning how to do debugging with hubitat and zwave. If you have any tips and tricks to share I would appreciate it