bluesky / ophyd

hardware abstraction in Python with an emphasis on EPICS
https://blueskyproject.io/ophyd
BSD 3-Clause "New" or "Revised" License
51 stars 79 forks source link

SubscriptionStatus that waits for state to be stable #1142

Closed DominicOram closed 1 year ago

DominicOram commented 1 year ago

We have a usecase where we would like to wait on a PV being a certain state and staying at that state for a given length of time. If in that time it changes to a different state we want to restart the timer for it to be stable.

It was suggested on slack that we could implement this with a SubscriptionStatus like object that rather than marking itself as done when the user function is True, starts a cancelable timer to do it and if it gets a False back from the user function cancels the timer.

We would also need to make sure that we do not spawn multiple timers.