Related Config File Sections

MPF’s switch device represents a switch in a pinball machine. This device is used for switches, including cabinet buttons, rollovers, targets, optos, trough switches, DIP switches, etc.

MPF supports all types of switches found in all generations of pinball machines, including matrix switches, direct switches, Fliptronics switches, switches connected to I/O boards, etc.

Switches only have two states: active and inactive. (We don’t say “open” or “closed” because sometimes switches are normally-closed which mean they’re actually active when they’re open.) In MPF, you configure your switches in the switches: section of your machine configuration file, including options (like whether the switch is “active” when it’s in the open state or the closed state.)

You can also configure debounce settings for each switch, which controls how MPF responds to switch events. Saying that a switch has to be “debounced” means that the pinball controller makes sure the switch is actually in its current state for a few milliseconds before it send the switch event to MPF. This can be useful to filter out unwanted or phantom switch events which might happen due to electrical interference or other little weird things.

Most switches in pinball machines are debounced except for the ones that you absolutely want to fire instantly, like flipper switches and the switches attached to automatically fired coils like slingshots and pop bumpers.

Monitorable Properties

For config placeholders and conditional events, the prefix for switches is device.switches.<name>.

Numeric value which represents the logic state of this switch. 0 is inactive, 1 is active.
How many times this switch has activated within it’s configured ignore_window_ms:. (These activations are ignored.)