Skip to content

Mode Start Sequence

Here's what happens when a mode starts:

  1. One of the events in the mode's start_events: is posted.

  2. The mode's start() method responds since it's registered as a handler for those events.

    1. If the mode is currently active, this process ends.
    2. If a callback kwarg is included in the event, it's saved for later use.
    3. Any kwargs that were attached to the event which started the mode are saved for later use.
  3. Any devices that are configured in this mode's config that are not already created are created now.

  4. Any events listed in the mode's stop_events: setting are registered and will call the mode's stop() method if they're posted.

    1. These events are registered with the priority of the mode +1, so they are called first.
  5. Any registered mode start_methods are called one-by-one. These are called with the mode, the mode's config, and the mode's priority as kwargs.

  6. Any device control_events from the mode config are registered

  7. A queue event is posted called mode_(mode_name)_starting .

  8. The mode's _started() method is the callback for the starting queue event and is called when that event is complete.

  9. Mode timers are started.

  10. An event mode_(mode_name)_started is posted.

  11. The mode's _mode_started_callback() method is the callback for the started event, so it's called once that event is complete.

  12. The mode's mode_start() method is called. (This is the method that can be subclassed to run custom mode code.)

    1. Any kwargs that were passed along with the event that started the mode are passed to the mode_start() method.
  13. If a start callback was passed with the event that started the mode, 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