def process_switch(self, switch, data):
        """Processes a switch event received from the OSC client."""

        # if the switch name is not valid and we're on WPC hardware, let's try
        # it as a number
        if (switch not in self.machine.switches and self.wpc and
                self.machine.switches.config['number_str']('S' + str(switch))):
            switch = self.machine.switches.config['number_str']('S' +
                                                            str(switch)).name

        if switch in self.machine.switches:
            self.machine.switch_controller.process_switch(name=switch,
                                                          state=int(data[0]),
                                                          logical=True)
        else:
            self.log.debug("Received OSC command for invalid switch '%s'. "
                           "Ignoring...", switch)
dataset/ETHPy150Open missionpinball/mpf/mpf/plugins/osc.py/OSC.process_switch/original