Mode Stop Sequence
Here's what happens behind-the-scenes when a mode stops.
An event listed in the mode's
stop_events:setting is posted.
This is handled by the mode's
- If the mode is not active, this process ends.
- If a callback argument was passed, it's saved now for later use
- Other kwargs are saved for later use
Switch handlers registered by that mode are removed.
Timers set in that mode are stopped and removed.
Delays set in that mode are cleared.
An queue event is posted: mode_
Once that queue is clear, the mode's
_stopped()method is called.
Any mode stop_methods registered for that mode are called one-by-one. (mode stop_methods are based on anything that gets returned from the call to the mode's start_methods when the mode starts).
An event mode_
Once any handlers for that event have finished, the mode's
_mode_stopped_callback()method is called.
Mode event handlers are removed.
Devices that were created as part of this mode are removed.
mode_stop()method is called. (This is the method that can be subclassed in custom mode code for things you want to run when the mode stops.)
- If kwargs were passed as part of the event in Step 1,
they're included in the call to
- If kwargs were passed as part of the event in Step 1, they're included in the call to
If a callback was saved in Step 2, it's called now.
Something missing or wrong? You can fix it!
This website is edited by people like you! Is something wrong or missing? Is something out of date, or can you explain it better?
Please help us! You can fix it yourself and be an official "open source" contributor!
It's easy! See our Beginner's guide to editing the docs.
Page navigation via the keyboard: < >
You can navigate this site via the keyboard. There are two modes:
General navigation, when search is not focused:
- F , S , / : open search dialog
- P , , : go to previous page
- N , . : go to next page
While using the search function:
- Down , Up : select next / previous result
- Esc , Tab : close search
- Enter : go to highlighted page in the results