This documentation is for an unreleased version of MPF!

This is the developer documentation for MPF 0.54, 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.shot_group.ShotGroup(*args, **kwargs)

Bases: mpf.core.mode_device.ModeDevice

Represents a group of shots in a pinball machine by grouping together multiple Shot class devices.

This is used so you get get “group-level” functionality, like shot rotation, shot group completion, etc. This would be used for a group of rollover lanes, a bank of standups, etc.

Accessing shot_groups in code

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

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

Methods & Attributes

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


Return common state if all shots in this group are in the same state.

Will return None otherwise.


Disable all member shots.


Disable shot rotation.

If disabled, rotation events do not actually rotate the shots.


Enable all member shots.


Enable shot rotation.

If disabled, rotation events do not actually rotate the shots.


Handle disable control event.


Handle disable rotation control event.


Handle enable control event.


Handle enable_rotation control event.


Handle reset control event.


Handle restart control event.

event_rotate(direction=None, **kwargs)

Handle rotate control event.


Handle rotate left control event.


Handle rotate right control event.

format_log_line(msg, context, error_no) → str

Return a formatted log line with log link and context.


Get the value of a placeholder.

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

Raise a ConfigFileError exception.


Reset all member shots.


Restart all member shots.


Rotate (or “shift”) the state of all the shots in this group.

This is used for things like lane change, where hitting the flipper button shifts all the states of the shots in the group to the left or right.

This method actually transfers the current state of each shot profile to the left or the right, and the shot on the end rolls over to the taret on the other end.

Parameters:direction – String that specifies whether the rotation direction is to the left or right. Values are ‘right’ or ‘left’. Default of None will cause the shot group to rotate in the direction as specified by the rotation_pattern.

Note that this shot group must, and rotation_events for this shot group, must both be enabled for the rotation events to work.


Rotate the state of the shots to the left.

This method is the same as calling rotate(‘left’)


Rotate the state of the shots to the right.

This method is the same as calling rotate(‘right’)

subscribe_attribute(item, machine)

Subscribe to an attribute.