diff --git a/homeassistant/components/switch/rpi_rf.py b/homeassistant/components/switch/rpi_rf.py index 866fea0df0b..0a6d487c331 100644 --- a/homeassistant/components/switch/rpi_rf.py +++ b/homeassistant/components/switch/rpi_rf.py @@ -27,8 +27,10 @@ DEFAULT_PROTOCOL = 1 DEFAULT_SIGNAL_REPETITIONS = 10 SWITCH_SCHEMA = vol.Schema({ - vol.Required(CONF_CODE_OFF): cv.positive_int, - vol.Required(CONF_CODE_ON): cv.positive_int, + vol.Required(CONF_CODE_OFF): + vol.All(cv.ensure_list_csv, [cv.positive_int]), + vol.Required(CONF_CODE_ON): + vol.All(cv.ensure_list_csv, [cv.positive_int]), vol.Optional(CONF_PULSELENGTH): cv.positive_int, vol.Optional(CONF_SIGNAL_REPETITIONS, default=DEFAULT_SIGNAL_REPETITIONS): cv.positive_int, @@ -101,13 +103,12 @@ class RPiRFSwitch(SwitchDevice): """Return true if device is on.""" return self._state - def _send_code(self, code, protocol, pulselength): - """Send the code with a specified pulselength.""" - _LOGGER.info("Sending code: %s", code) - res = self._rfdevice.tx_code(code, protocol, pulselength) - if not res: - _LOGGER.error("Sending code %s failed", code) - return res + def _send_code(self, code_list, protocol, pulselength): + """Send the code(s) with a specified pulselength.""" + _LOGGER.info("Sending code(s): %s", code_list) + for code in code_list: + self._rfdevice.tx_code(code, protocol, pulselength) + return True def turn_on(self): """Turn the switch on."""