Need Rule - Refresh if Last Activity > x time

I'm using Device Watchdog to report any device that has not had activity within 24 hours. This is helpful to determine if a device has dropped off the network from dead battery, or is otherwise not communicating (happens few times per year).

I currently have a rule that sends referesh() to ALL my devices that accept refresh(). I do this 2x daily based on time of day. I also have a virtual switch that triggers the action (to refresh everything).

With as many devices as I have (over 200), running a massive refresh() seriously bogs down my zwave network for several minutes - and still responses from some devices get lost in traffic (or are never received).

What I'd like is to only send a refresh() to devices that have not had activity in past x hours.

Here's my current rule:

For reference Device Watchdog turns on "The Poller" virtual switch if any device has not had activity.

I'd say this is a custom app...

now if I just knew how to write apps...