diff --git a/homeassistant/components/sensor/template.py b/homeassistant/components/sensor/template.py index 8cf3083d7ede89..fdd0ef9c2ad686 100644 --- a/homeassistant/components/sensor/template.py +++ b/homeassistant/components/sensor/template.py @@ -13,7 +13,8 @@ from homeassistant.components.sensor import ENTITY_ID_FORMAT, PLATFORM_SCHEMA from homeassistant.const import ( ATTR_FRIENDLY_NAME, ATTR_UNIT_OF_MEASUREMENT, CONF_VALUE_TEMPLATE, - ATTR_ENTITY_ID, CONF_SENSORS, EVENT_HOMEASSISTANT_START) + CONF_ICON_TEMPLATE, ATTR_ENTITY_ID, CONF_SENSORS, + EVENT_HOMEASSISTANT_START) from homeassistant.exceptions import TemplateError import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entity import Entity, async_generate_entity_id @@ -22,8 +23,6 @@ _LOGGER = logging.getLogger(__name__) -CONF_ICON_TEMPLATE = 'icon_template' - SENSOR_SCHEMA = vol.Schema({ vol.Required(CONF_VALUE_TEMPLATE): cv.template, vol.Optional(CONF_ICON_TEMPLATE): cv.template, diff --git a/homeassistant/components/switch/template.py b/homeassistant/components/switch/template.py index 6fc6e63e93f7ed..fc076f32e883e0 100644 --- a/homeassistant/components/switch/template.py +++ b/homeassistant/components/switch/template.py @@ -13,8 +13,8 @@ from homeassistant.components.switch import ( ENTITY_ID_FORMAT, SwitchDevice, PLATFORM_SCHEMA) from homeassistant.const import ( - ATTR_FRIENDLY_NAME, CONF_VALUE_TEMPLATE, STATE_OFF, STATE_ON, - ATTR_ENTITY_ID, CONF_SWITCHES, EVENT_HOMEASSISTANT_START) + ATTR_FRIENDLY_NAME, CONF_VALUE_TEMPLATE, CONF_ICON_TEMPLATE, STATE_OFF, + STATE_ON, ATTR_ENTITY_ID, CONF_SWITCHES, EVENT_HOMEASSISTANT_START) from homeassistant.exceptions import TemplateError import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entity import async_generate_entity_id @@ -25,8 +25,6 @@ _LOGGER = logging.getLogger(__name__) _VALID_STATES = [STATE_ON, STATE_OFF, 'true', 'false'] -CONF_ICON_TEMPLATE = 'icon_template' - ON_ACTION = 'turn_on' OFF_ACTION = 'turn_off' diff --git a/homeassistant/const.py b/homeassistant/const.py index bef4a9387f547b..e1fef274d0f753 100644 --- a/homeassistant/const.py +++ b/homeassistant/const.py @@ -105,6 +105,7 @@ CONF_HOST = 'host' CONF_HOSTS = 'hosts' CONF_ICON = 'icon' +CONF_ICON_TEMPLATE = 'icon_template' CONF_INCLUDE = 'include' CONF_ID = 'id' CONF_LATITUDE = 'latitude'