This documentation is for an unreleased version of MPF!

This is the developer documentation for MPF 0.51, which is the “dev” (next) release of MPF that is a work-in-progress. Use the “Read the Docs” link in the lower left corner to view the developer docs for the version of MPF you’re using.


class mpf.devices.autofire.AutofireCoil(*args, **kwargs)

Bases: mpf.core.system_wide_device.SystemWideDevice

Autofire coils which fire based on switch hits with a hardware rule.

Coils in the pinball machine which should fire automatically based on switch hits using defined hardware switch rules.

Autofire coils work with rules written to the hardware pinball controller that allow them to respond “instantly” to switch hits versus waiting for the lag of USB and the host computer.

Examples of Autofire Coils are pop bumpers, slingshots, and kicking targets. (Flippers use the same autofire rules under the hood, but flipper devices have their own device type in MPF.

Accessing autofires in code

The device collection which contains the autofires in your machine is available via self.machine.autofires. For example, to access one called “foo”, you would use self.machine.autofires.foo. You can also access autofires in dictionary form, e.g. self.machine.autofires['foo'].

You can also get devices by tag or hardware number. See the DeviceCollection documentation for details.

Methods & Attributes

Autofires have the following methods & attributes available. Note that methods & attributes inherited from base classes are not included here.


Disable the autofire device.

This is typically called at the end of a ball and when a tilt event happens.

Parameters:**kwargs – Not used, just included so this method can be used as an event callback.

Enable the autofire device.

This causes the coil to respond to the switch hits. This is typically called when a ball starts to enable the slingshots, pops, etc.

Note that there are several options for both the coil and the switch which can be incorporated into this rule, including recycle times, switch debounce, reversing the switch (fire the coil when the switch goes inactive), etc. These rules vary by hardware platform. See the user documentation for the hardware platform for details.

Parameters:**kwargs – Not used, just included so this method can be used as an event callback.
raise_config_error(msg, error_no, *, context=None)

Raise a ConfigFileError exception.