Please participate in the MPF User Survey 2018.
Config file section
|Valid in machine config files||YES|
|Valid in mode config files||YES|
Specifies timed switches which are used to post events when a switch is active for a continuous amount of time.
Here’s an example. This example is actually built-in to MPF via the MPF default config file, so if you want to use these flipper cradle events, you don’t have to enter them yourself as they’re already there.
timed_switches: flipper_cradle: switch_tags: left_flipper, right_flipper time: 3s events_when_active: flipper_cradle events_when_released: flipper_cradle_release
Like other devices in MPF, the format is:
timed_switches: name_of_your_timed_switch: <settings> some_other_timed_switch: <settings>
The following settings can be used in each named timed switch section:
A list of switches (or a single switch) that will be used for these timed switch
settings. Note that you can use
switch_tags: instead of
Single value, type:
time string (Instructions for entering time strings).
How long a switch must be continuously active before the
events_when_active are posted.
Single value, either
inactive. Default is
Controls whether the
events_when_active: are posted when the switch is active for
time: amount, or whether it’s flipped and the events are posted when the switch
inactive for the time amount.
A single event, or list of events, that’s posted once a switch is continuously active for
time: setting. If you have multiple switches. this event will only be posted once,
even if a second switch becomes active for that time while the first is still active.
If you don’t enter any events here, an event will automatically be posted in the format
<name_of_this_timed_switch>_active. In other words, in the example at the top of this
page, the timed switch entry is called “flipper_cradle”, so the automatically-created
event would be called flipper_cradle_active, but since that config has an
events_when_active: flipper_cradle entry, then the event will just be
A single event, or list of events, that will be posted when a timed switch is released. Unlike the active events which are only posted when the switch is continuously active for that period of time, the released events are posted immediately.
If you’ve defined multiple switches and two switches go active, the release event will not be posted until all the switches are released.