Question about subscribe and unsubscribe

My use case is for an activity check, like Device Activity Check or Device Health Status, to track the activity of each device. I’m performing the checks for activity once per day by using getLastActivity(). I thought it would be cool if, once the device was deemed as “inactive”, it would subscribe to every event for the device using:

void subscribe(DeviceWrapper device, String handlerMethod, Map options = null)

and then in the handler, send me a notification that the device is back online and unsubscribe that handler. So the handler would only get called for the very first event and wouldn’t bog down the system when the device was “healthy”.

The app will have more than one device and there are additional subscriptions for certain devices, so I can’t use either the parameterless unsubscribe or the device-specific one:

void unsubscribe(DeviceWrapper device)

In other words, I want to unsubscribe from this particular handler for one particular device, but leave all of the other ones intact.

There are other ways I can implement this (e.g. unsubscribe everything when the device becomes “inactive” and then resubscribe everything whenever it becomes “healthy” again), but I feel this would be the cleanest way to do it, if it’s possible.