self.machine.switches.*¶
-
class
mpf.devices.switch.
Switch
(self_inner, *args, **kwargs)¶ Bases:
mpf.core.system_wide_device.SystemWideDevice
A switch in a pinball machine.
Accessing switches in code
The device collection which contains the switches in your machine is available via
self.machine.switches
. For example, to access one called "foo", you would useself.machine.switches.foo
. You can also access switches in dictionary form, e.g.self.machine.switches['foo']
.You can also get devices by tag or hardware number. See the DeviceCollection documentation for details.
Methods & Attributes
Switches have the following methods & attributes available. Note that methods & attributes inherited from base classes are not included here.
-
add_handler
(callback, state=1, ms=0, return_info=False, callback_kwargs=None)¶ Add switch handler for this switch.
-
get_configured_switch
()¶ Reconfigure switch.
-
hw_state
= None¶ The physical hardware state of the switch. 1 = active, 0 = inactive. This is what the actual hardware is reporting and does not consider whether a switch is NC or NO.
-
remove_handler
(callback, state=1, ms=0)¶ Remove switch handler for this switch.
-
state
= None¶ The logical state of a switch. 1 = active, 0 = inactive. This takes into consideration the NC or NO settings for the switch.
-