From f78246e686186a097aa7528e5e5e6d1281c40b93 Mon Sep 17 00:00:00 2001 From: Jan Losinski Date: Fri, 9 Dec 2016 08:19:14 +0100 Subject: [PATCH] Pilight receive match fix for bug 4637 (#4639) * Pilight: dont protocol as list in COMMAND_SCHEMA As described in bug #4637 the protocol should not be wrapped in a list in the spec of COMMAND_SCHEMA because this causes the component to never successfully match any received rf code. As pointed ot in PR #4639 the easiest way to do this, is to not derive COMMAND_SCHEMA from RF_CODE_SCHEMA and specify protocol as simple string there. This fixes bug #4637. Signed-off-by: Jan Losinski * Pilight: Add "unitcode" to command schema. This adds "unitcode" to the COMMAND_SCHEMA. It is used for example in the brennenstuhl protocol of pilight. Signed-off-by: Jan Losinski --- homeassistant/components/switch/pilight.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/switch/pilight.py b/homeassistant/components/switch/pilight.py index 6e16c9fa2e5..a052848cb21 100644 --- a/homeassistant/components/switch/pilight.py +++ b/homeassistant/components/switch/pilight.py @@ -11,7 +11,8 @@ import voluptuous as vol import homeassistant.helpers.config_validation as cv import homeassistant.components.pilight as pilight from homeassistant.components.switch import (SwitchDevice, PLATFORM_SCHEMA) -from homeassistant.const import (CONF_NAME, CONF_ID, CONF_SWITCHES, CONF_STATE) +from homeassistant.const import (CONF_NAME, CONF_ID, CONF_SWITCHES, CONF_STATE, + CONF_PROTOCOL) _LOGGER = logging.getLogger(__name__) @@ -21,13 +22,16 @@ CONF_ON_CODE = 'on_code' CONF_ON_CODE_RECIEVE = 'on_code_receive' CONF_SYSTEMCODE = 'systemcode' CONF_UNIT = 'unit' +CONF_UNITCODE = 'unitcode' DEPENDENCIES = ['pilight'] -COMMAND_SCHEMA = pilight.RF_CODE_SCHEMA.extend({ +COMMAND_SCHEMA = vol.Schema({ + vol.Optional(CONF_PROTOCOL): cv.string, vol.Optional('on'): cv.positive_int, vol.Optional('off'): cv.positive_int, vol.Optional(CONF_UNIT): cv.positive_int, + vol.Optional(CONF_UNITCODE): cv.positive_int, vol.Optional(CONF_ID): cv.positive_int, vol.Optional(CONF_STATE): cv.string, vol.Optional(CONF_SYSTEMCODE): cv.positive_int,