I want to do a task after there has been no activity on a collection of motion sensors for a specific period of time. What’s the best pattern to accomplish that? I’ve come up with two:
Subscribe to the inactive event. On inactive, use runIn() to schedule a method that checks in the future to see if there have been any state changes. If there have been NO state changes, do my task.
Subscribe to both inactive and active. On inactive, schedule my task with runIn(). On active, unschedule my task with unschedule().
Which is the “right” way?