diff --git a/homeassistant/components/abode.py b/homeassistant/components/abode.py index ab13c1534bc..581045c3790 100644 --- a/homeassistant/components/abode.py +++ b/homeassistant/components/abode.py @@ -10,24 +10,23 @@ from functools import partial from os import path import voluptuous as vol -from requests.exceptions import HTTPError, ConnectTimeout -from homeassistant.helpers import discovery -from homeassistant.helpers import config_validation as cv -from homeassistant.helpers.entity import Entity + from homeassistant.config import load_yaml_config_file -from homeassistant.const import (ATTR_ATTRIBUTION, ATTR_DATE, ATTR_TIME, - ATTR_ENTITY_ID, CONF_USERNAME, CONF_PASSWORD, - CONF_EXCLUDE, CONF_NAME, - EVENT_HOMEASSISTANT_STOP, - EVENT_HOMEASSISTANT_START) +from homeassistant.const import ( + ATTR_ATTRIBUTION, ATTR_DATE, ATTR_TIME, ATTR_ENTITY_ID, CONF_USERNAME, + CONF_PASSWORD, CONF_EXCLUDE, CONF_NAME, CONF_LIGHTS, + EVENT_HOMEASSISTANT_STOP, EVENT_HOMEASSISTANT_START) +from homeassistant.helpers import config_validation as cv +from homeassistant.helpers import discovery +from homeassistant.helpers.entity import Entity +from requests.exceptions import HTTPError, ConnectTimeout REQUIREMENTS = ['abodepy==0.12.1'] _LOGGER = logging.getLogger(__name__) CONF_ATTRIBUTION = "Data provided by goabode.com" -CONF_LIGHTS = "lights" -CONF_POLLING = "polling" +CONF_POLLING = 'polling' DOMAIN = 'abode' @@ -93,10 +92,9 @@ class AbodeSystem(object): def __init__(self, username, password, name, polling, exclude, lights): """Initialize the system.""" import abodepy - self.abode = abodepy.Abode(username, password, - auto_login=True, - get_devices=True, - get_automations=True) + self.abode = abodepy.Abode( + username, password, auto_login=True, get_devices=True, + get_automations=True) self.name = name self.polling = polling self.exclude = exclude @@ -210,7 +208,7 @@ def setup_hass_services(hass): def setup_hass_events(hass): - """Home assistant start and stop callbacks.""" + """Home Assistant start and stop callbacks.""" def startup(event): """Listen for push events.""" hass.data[DOMAIN].abode.events.start() diff --git a/homeassistant/components/light/template.py b/homeassistant/components/light/template.py index 26ae0517955..ce004d994b2 100644 --- a/homeassistant/components/light/template.py +++ b/homeassistant/components/light/template.py @@ -14,8 +14,7 @@ from homeassistant.components.light import ( ATTR_BRIGHTNESS, ENTITY_ID_FORMAT, Light, SUPPORT_BRIGHTNESS) from homeassistant.const import ( CONF_VALUE_TEMPLATE, CONF_ENTITY_ID, CONF_FRIENDLY_NAME, STATE_ON, - STATE_OFF, EVENT_HOMEASSISTANT_START, MATCH_ALL -) + STATE_OFF, EVENT_HOMEASSISTANT_START, MATCH_ALL, CONF_LIGHTS) from homeassistant.helpers.config_validation import PLATFORM_SCHEMA from homeassistant.exceptions import TemplateError import homeassistant.helpers.config_validation as cv @@ -27,13 +26,11 @@ from homeassistant.helpers.script import Script _LOGGER = logging.getLogger(__name__) _VALID_STATES = [STATE_ON, STATE_OFF, 'true', 'false'] -CONF_LIGHTS = 'lights' CONF_ON_ACTION = 'turn_on' CONF_OFF_ACTION = 'turn_off' CONF_LEVEL_ACTION = 'set_level' CONF_LEVEL_TEMPLATE = 'level_template' - LIGHT_SCHEMA = vol.Schema({ vol.Required(CONF_ON_ACTION): cv.SCRIPT_SCHEMA, vol.Required(CONF_OFF_ACTION): cv.SCRIPT_SCHEMA, @@ -51,7 +48,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ @asyncio.coroutine def async_setup_platform(hass, config, async_add_devices, discovery_info=None): - """Set up Template Lights.""" + """Set up the Template Lights.""" lights = [] for device, device_config in config[CONF_LIGHTS].items(): diff --git a/homeassistant/components/switch/flux.py b/homeassistant/components/switch/flux.py index e8bd592cee8..4df8f792a4b 100644 --- a/homeassistant/components/switch/flux.py +++ b/homeassistant/components/switch/flux.py @@ -13,7 +13,7 @@ import voluptuous as vol from homeassistant.components.light import is_on, turn_on from homeassistant.components.switch import DOMAIN, SwitchDevice -from homeassistant.const import CONF_NAME, CONF_PLATFORM +from homeassistant.const import CONF_NAME, CONF_PLATFORM, CONF_LIGHTS from homeassistant.helpers.event import track_time_change from homeassistant.helpers.sun import get_astral_event_date from homeassistant.util import slugify @@ -27,7 +27,6 @@ DEPENDENCIES = ['light'] _LOGGER = logging.getLogger(__name__) -CONF_LIGHTS = 'lights' CONF_START_TIME = 'start_time' CONF_STOP_TIME = 'stop_time' CONF_START_CT = 'start_colortemp' diff --git a/homeassistant/components/vera.py b/homeassistant/components/vera.py index 7a018a6502d..a26e1efb553 100644 --- a/homeassistant/components/vera.py +++ b/homeassistant/components/vera.py @@ -8,16 +8,15 @@ import logging from collections import defaultdict import voluptuous as vol - from requests.exceptions import RequestException from homeassistant.util.dt import utc_from_timestamp -from homeassistant.util import (convert, slugify) +from homeassistant.util import convert, slugify from homeassistant.helpers import discovery from homeassistant.helpers import config_validation as cv from homeassistant.const import ( ATTR_ARMED, ATTR_BATTERY_LEVEL, ATTR_LAST_TRIP_TIME, ATTR_TRIPPED, - EVENT_HOMEASSISTANT_STOP) + EVENT_HOMEASSISTANT_STOP, CONF_LIGHTS, CONF_EXCLUDE) from homeassistant.helpers.entity import Entity REQUIREMENTS = ['pyvera==0.2.37'] @@ -29,8 +28,6 @@ DOMAIN = 'vera' VERA_CONTROLLER = None CONF_CONTROLLER = 'vera_controller_url' -CONF_EXCLUDE = 'exclude' -CONF_LIGHTS = 'lights' VERA_ID_FORMAT = '{}_{}' diff --git a/homeassistant/const.py b/homeassistant/const.py index 349261242d5..fa2b2ad707b 100644 --- a/homeassistant/const.py +++ b/homeassistant/const.py @@ -113,6 +113,7 @@ CONF_ID = 'id' CONF_IP_ADDRESS = 'ip_address' CONF_LATITUDE = 'latitude' CONF_LONGITUDE = 'longitude' +CONF_LIGHTS = 'lights' CONF_MAC = 'mac' CONF_METHOD = 'method' CONF_MINIMUM = 'minimum'