'Initialize the switch.'

def __init__(self, hass, name, code_on, code_off, code_on_receive, code_off_receive):

    self._hass = hass
    self._name = name
    self._state = False
    self._code_on = code_on
    self._code_off = code_off
    self._code_on_receive = []
    self._code_off_receive = []
    for (code_list, conf) in ((self._code_on_receive, code_on_receive), (self._code_off_receive, code_off_receive)):
        for code in conf:
            echo = code.pop(CONF_ECHO, True)
            code_list.append(_ReceiveHandle(code, echo))
    if (any(self._code_on_receive) or any(self._code_off_receive)):
        hass.bus.listen(pilight.EVENT, self._handle_code)
