'Check if received code by the pilight-daemon.
If the code matches the receive on/off codes of this switch the switch
state is changed accordingly.'

def _handle_code(self, call):

    if any(self._code_on_receive):
        for on_code in self._code_on_receive:
            if on_code.match(call.data):
                on_code.run(switch=self, turn_on=True)
                break
    if any(self._code_off_receive):
        for off_code in self._code_off_receive:
            if off_code.match(call.data):
                off_code.run(switch=self, turn_on=False)
                break
