Warning

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.

self.machine.diverters.*

class mpf.devices.diverter.Diverter(*args, **kwargs)

Bases: mpf.core.system_wide_device.SystemWideDevice

Represents a diverter in a pinball machine.

Args: Same as the Device parent class.

Accessing diverters in code

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

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

Methods & Attributes

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

activate(**kwargs)

Physically activate this diverter’s coil.

deactivate(**kwargs)

Deactivate this diverter.

This method will disable the activation_coil, and (optionally) if it’s configured with a deactivation coil, it will pulse it.

disable(auto=False, **kwargs)

Disable this diverter.

This method will remove the hardware rule if this diverter is activated via a hardware switch.

Parameters:
  • auto – Boolean value which is used to indicate whether this diverter disabled itself automatically. This is passed to the event which is posted.
  • **kwargs – This is here because this disable method is called by whatever event the game programmer specifies in their machine configuration file, so we don’t know what event that might be or whether it has random kwargs attached to it.
enable(auto=False, **kwargs)

Enable this diverter.

Parameters:
  • auto – Boolean value which is used to indicate whether this diverter enabled itself automatically. This is passed to the event which is posted.
  • **kwargs – unused

If an ‘activation_switches’ is configured, then this method writes a hardware autofire rule to the pinball controller which fires the diverter coil when the switch is activated.

If no activation_switches is specified, then the diverter is activated immediately.

raise_config_error(msg, error_no, *, context=None)

Raise a ConfigFileError exception.

reset(**kwargs)

Reset and deactivate the diverter.

schedule_deactivation()

Schedule a delay to deactivate this diverter.