diff --git a/homeassistant/__main__.py b/homeassistant/__main__.py index 5351bcf7983..f35e0c1c1f0 100644 --- a/homeassistant/__main__.py +++ b/homeassistant/__main__.py @@ -1,18 +1,18 @@ """ Starts home assistant. """ from __future__ import print_function -from multiprocessing import Process +import argparse +import os import signal import sys import threading -import os -import argparse import time +from multiprocessing import Process -from homeassistant import bootstrap import homeassistant.config as config_util -from homeassistant.const import (__version__, EVENT_HOMEASSISTANT_START, - RESTART_EXIT_CODE) +from homeassistant import bootstrap +from homeassistant.const import ( + EVENT_HOMEASSISTANT_START, RESTART_EXIT_CODE, __version__) def validate_python(): diff --git a/homeassistant/bootstrap.py b/homeassistant/bootstrap.py index 3f88c6f4388..802da19e938 100644 --- a/homeassistant/bootstrap.py +++ b/homeassistant/bootstrap.py @@ -9,27 +9,27 @@ After bootstrapping you can add your own components or start by calling homeassistant.start_home_assistant(bus) """ -from collections import defaultdict import logging import logging.handlers import os import shutil import sys +from collections import defaultdict -import homeassistant.core as core -import homeassistant.util.dt as date_util -import homeassistant.util.package as pkg_util -import homeassistant.util.location as loc_util -import homeassistant.config as config_util -import homeassistant.loader as loader import homeassistant.components as core_components import homeassistant.components.group as group +import homeassistant.config as config_util +import homeassistant.core as core +import homeassistant.loader as loader +import homeassistant.util.dt as date_util +import homeassistant.util.location as loc_util +import homeassistant.util.package as pkg_util +from homeassistant.const import ( + CONF_CUSTOMIZE, CONF_LATITUDE, CONF_LONGITUDE, CONF_NAME, + CONF_TEMPERATURE_UNIT, CONF_TIME_ZONE, EVENT_COMPONENT_LOADED, + TEMP_CELCIUS, TEMP_FAHRENHEIT, __version__) from homeassistant.helpers import event_decorators, service from homeassistant.helpers.entity import Entity -from homeassistant.const import ( - __version__, EVENT_COMPONENT_LOADED, CONF_LATITUDE, CONF_LONGITUDE, - CONF_TEMPERATURE_UNIT, CONF_NAME, CONF_TIME_ZONE, CONF_CUSTOMIZE, - TEMP_CELCIUS, TEMP_FAHRENHEIT) _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/alarm_control_panel/alarmdotcom.py b/homeassistant/components/alarm_control_panel/alarmdotcom.py index dea8151cb80..b563d57a686 100644 --- a/homeassistant/components/alarm_control_panel/alarmdotcom.py +++ b/homeassistant/components/alarm_control_panel/alarmdotcom.py @@ -9,11 +9,9 @@ https://home-assistant.io/components/alarm_control_panel.alarmdotcom/ import logging import homeassistant.components.alarm_control_panel as alarm -from homeassistant.const import CONF_USERNAME, CONF_PASSWORD - from homeassistant.const import ( - STATE_UNKNOWN, - STATE_ALARM_DISARMED, STATE_ALARM_ARMED_HOME, STATE_ALARM_ARMED_AWAY) + CONF_PASSWORD, CONF_USERNAME, STATE_ALARM_ARMED_AWAY, + STATE_ALARM_ARMED_HOME, STATE_ALARM_DISARMED, STATE_UNKNOWN) _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/alarm_control_panel/manual.py b/homeassistant/components/alarm_control_panel/manual.py index 2658e005aea..a6e280d1dd1 100644 --- a/homeassistant/components/alarm_control_panel/manual.py +++ b/homeassistant/components/alarm_control_panel/manual.py @@ -6,15 +6,15 @@ Support for manual alarms. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/alarm_control_panel.manual/ """ -import logging import datetime -import homeassistant.components.alarm_control_panel as alarm -from homeassistant.helpers.event import track_point_in_time -import homeassistant.util.dt as dt_util +import logging +import homeassistant.components.alarm_control_panel as alarm +import homeassistant.util.dt as dt_util from homeassistant.const import ( - STATE_ALARM_DISARMED, STATE_ALARM_ARMED_HOME, STATE_ALARM_ARMED_AWAY, + STATE_ALARM_ARMED_AWAY, STATE_ALARM_ARMED_HOME, STATE_ALARM_DISARMED, STATE_ALARM_PENDING, STATE_ALARM_TRIGGERED) +from homeassistant.helpers.event import track_point_in_time _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/alarm_control_panel/mqtt.py b/homeassistant/components/alarm_control_panel/mqtt.py index 168b220db1a..7ba6ba057ed 100644 --- a/homeassistant/components/alarm_control_panel/mqtt.py +++ b/homeassistant/components/alarm_control_panel/mqtt.py @@ -7,11 +7,11 @@ For more details about this platform, please refer to the documentation at https://home-assistant.io/components/alarm_control_panel.mqtt/ """ import logging -import homeassistant.components.mqtt as mqtt -import homeassistant.components.alarm_control_panel as alarm +import homeassistant.components.alarm_control_panel as alarm +import homeassistant.components.mqtt as mqtt from homeassistant.const import ( - STATE_ALARM_DISARMED, STATE_ALARM_ARMED_HOME, STATE_ALARM_ARMED_AWAY, + STATE_ALARM_ARMED_AWAY, STATE_ALARM_ARMED_HOME, STATE_ALARM_DISARMED, STATE_ALARM_PENDING, STATE_ALARM_TRIGGERED, STATE_UNKNOWN) _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/alarm_control_panel/nx584.py b/homeassistant/components/alarm_control_panel/nx584.py index c77fab341de..e696ec682b2 100644 --- a/homeassistant/components/alarm_control_panel/nx584.py +++ b/homeassistant/components/alarm_control_panel/nx584.py @@ -7,12 +7,13 @@ For more details about this platform, please refer to the documentation at https://home-assistant.io/components/alarm_control_panel.nx584/ """ import logging + import requests -from homeassistant.const import (STATE_UNKNOWN, STATE_ALARM_DISARMED, - STATE_ALARM_ARMED_HOME, - STATE_ALARM_ARMED_AWAY) import homeassistant.components.alarm_control_panel as alarm +from homeassistant.const import ( + STATE_ALARM_ARMED_AWAY, STATE_ALARM_ARMED_HOME, STATE_ALARM_DISARMED, + STATE_UNKNOWN) REQUIREMENTS = ['pynx584==0.2'] diff --git a/homeassistant/components/alarm_control_panel/verisure.py b/homeassistant/components/alarm_control_panel/verisure.py index ecedd163d0b..40df158dce9 100644 --- a/homeassistant/components/alarm_control_panel/verisure.py +++ b/homeassistant/components/alarm_control_panel/verisure.py @@ -8,12 +8,11 @@ https://home-assistant.io/components/verisure/ """ import logging -import homeassistant.components.verisure as verisure import homeassistant.components.alarm_control_panel as alarm - +import homeassistant.components.verisure as verisure from homeassistant.const import ( - STATE_UNKNOWN, - STATE_ALARM_DISARMED, STATE_ALARM_ARMED_HOME, STATE_ALARM_ARMED_AWAY) + STATE_ALARM_ARMED_AWAY, STATE_ALARM_ARMED_HOME, STATE_ALARM_DISARMED, + STATE_UNKNOWN) _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/alexa.py b/homeassistant/components/alexa.py index 66ac9de0b43..5678aa509b7 100644 --- a/homeassistant/components/alexa.py +++ b/homeassistant/components/alexa.py @@ -10,8 +10,8 @@ import enum import logging from homeassistant.const import HTTP_OK, HTTP_UNPROCESSABLE_ENTITY -from homeassistant.util import template from homeassistant.helpers.service import call_from_config +from homeassistant.util import template DOMAIN = 'alexa' DEPENDENCIES = ['http'] diff --git a/homeassistant/components/api.py b/homeassistant/components/api.py index 1a84f222443..e9c25ca5dac 100644 --- a/homeassistant/components/api.py +++ b/homeassistant/components/api.py @@ -6,26 +6,24 @@ Provides a Rest API for Home Assistant. For more details about the RESTful API, please refer to the documentation at https://home-assistant.io/developers/api/ """ -import re -import logging -import threading import json +import logging +import re +import threading import homeassistant.core as ha -from homeassistant.exceptions import TemplateError -from homeassistant.helpers.state import TrackStates import homeassistant.remote as rem -from homeassistant.util import template from homeassistant.bootstrap import ERROR_LOG_FILENAME from homeassistant.const import ( - URL_API, URL_API_STATES, URL_API_EVENTS, URL_API_SERVICES, URL_API_STREAM, - URL_API_EVENT_FORWARD, URL_API_STATES_ENTITY, URL_API_COMPONENTS, - URL_API_CONFIG, URL_API_ERROR_LOG, URL_API_LOG_OUT, - URL_API_TEMPLATE, EVENT_TIME_CHANGED, EVENT_HOMEASSISTANT_STOP, MATCH_ALL, - HTTP_OK, HTTP_CREATED, HTTP_BAD_REQUEST, HTTP_NOT_FOUND, - HTTP_UNPROCESSABLE_ENTITY, HTTP_HEADER_CONTENT_TYPE, - CONTENT_TYPE_TEXT_PLAIN) - + CONTENT_TYPE_TEXT_PLAIN, EVENT_HOMEASSISTANT_STOP, EVENT_TIME_CHANGED, + HTTP_BAD_REQUEST, HTTP_CREATED, HTTP_HEADER_CONTENT_TYPE, HTTP_NOT_FOUND, + HTTP_OK, HTTP_UNPROCESSABLE_ENTITY, MATCH_ALL, URL_API, URL_API_COMPONENTS, + URL_API_CONFIG, URL_API_ERROR_LOG, URL_API_EVENT_FORWARD, URL_API_EVENTS, + URL_API_LOG_OUT, URL_API_SERVICES, URL_API_STATES, URL_API_STATES_ENTITY, + URL_API_STREAM, URL_API_TEMPLATE) +from homeassistant.exceptions import TemplateError +from homeassistant.helpers.state import TrackStates +from homeassistant.util import template DOMAIN = 'api' DEPENDENCIES = ['http'] diff --git a/homeassistant/components/arduino.py b/homeassistant/components/arduino.py index f7f6240b44e..05db57394dd 100644 --- a/homeassistant/components/arduino.py +++ b/homeassistant/components/arduino.py @@ -9,9 +9,9 @@ https://home-assistant.io/components/arduino/ """ import logging +from homeassistant.const import ( + EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP) from homeassistant.helpers import validate_config -from homeassistant.const import (EVENT_HOMEASSISTANT_START, - EVENT_HOMEASSISTANT_STOP) DOMAIN = "arduino" REQUIREMENTS = ['PyMata==2.07a'] diff --git a/homeassistant/components/automation/numeric_state.py b/homeassistant/components/automation/numeric_state.py index 61e68aa8e8e..96ab2121688 100644 --- a/homeassistant/components/automation/numeric_state.py +++ b/homeassistant/components/automation/numeric_state.py @@ -6,14 +6,13 @@ Offers numeric state listening automation rules. For more details about this automation rule, please refer to the documentation at https://home-assistant.io/components/automation/#numeric-state-trigger """ -from functools import partial import logging +from functools import partial from homeassistant.const import CONF_VALUE_TEMPLATE from homeassistant.helpers.event import track_state_change from homeassistant.util import template - CONF_ENTITY_ID = "entity_id" CONF_BELOW = "below" CONF_ABOVE = "above" diff --git a/homeassistant/components/automation/state.py b/homeassistant/components/automation/state.py index bcf498f509a..1eaa9e5c240 100644 --- a/homeassistant/components/automation/state.py +++ b/homeassistant/components/automation/state.py @@ -8,9 +8,8 @@ at https://home-assistant.io/components/automation/#state-trigger """ import logging -from homeassistant.helpers.event import track_state_change from homeassistant.const import MATCH_ALL - +from homeassistant.helpers.event import track_state_change CONF_ENTITY_ID = "entity_id" CONF_FROM = "from" diff --git a/homeassistant/components/automation/sun.py b/homeassistant/components/automation/sun.py index 6abb59eede6..9cd50fedbd9 100644 --- a/homeassistant/components/automation/sun.py +++ b/homeassistant/components/automation/sun.py @@ -9,9 +9,9 @@ at https://home-assistant.io/components/automation/#sun-trigger import logging from datetime import timedelta +import homeassistant.util.dt as dt_util from homeassistant.components import sun from homeassistant.helpers.event import track_sunrise, track_sunset -import homeassistant.util.dt as dt_util DEPENDENCIES = ['sun'] diff --git a/homeassistant/components/automation/zone.py b/homeassistant/components/automation/zone.py index f0f800bd313..7dc551de32c 100644 --- a/homeassistant/components/automation/zone.py +++ b/homeassistant/components/automation/zone.py @@ -9,10 +9,9 @@ at https://home-assistant.io/components/automation/#zone-trigger import logging from homeassistant.components import zone -from homeassistant.helpers.event import track_state_change from homeassistant.const import ( ATTR_GPS_ACCURACY, ATTR_LATITUDE, ATTR_LONGITUDE, MATCH_ALL) - +from homeassistant.helpers.event import track_state_change CONF_ENTITY_ID = "entity_id" CONF_ZONE = "zone" diff --git a/homeassistant/components/binary_sensor/apcupsd.py b/homeassistant/components/binary_sensor/apcupsd.py index 796a2a0df70..6d3ddb2c2fa 100644 --- a/homeassistant/components/binary_sensor/apcupsd.py +++ b/homeassistant/components/binary_sensor/apcupsd.py @@ -6,8 +6,8 @@ Provides a binary sensor to track online status of a UPS. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/binary_sensor.apcupsd/ """ -from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components import apcupsd +from homeassistant.components.binary_sensor import BinarySensorDevice DEPENDENCIES = [apcupsd.DOMAIN] DEFAULT_NAME = "UPS Online Status" diff --git a/homeassistant/components/binary_sensor/arest.py b/homeassistant/components/binary_sensor/arest.py index 7eafca9f2ae..3a7eac35bb5 100644 --- a/homeassistant/components/binary_sensor/arest.py +++ b/homeassistant/components/binary_sensor/arest.py @@ -6,13 +6,13 @@ The arest sensor will consume an exposed aREST API of a device. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/binary_sensor.arest/ """ -from datetime import timedelta import logging +from datetime import timedelta import requests -from homeassistant.util import Throttle from homeassistant.components.binary_sensor import BinarySensorDevice +from homeassistant.util import Throttle _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/binary_sensor/command_sensor.py b/homeassistant/components/binary_sensor/command_sensor.py index d69417a6a73..45b950cec8f 100644 --- a/homeassistant/components/binary_sensor/command_sensor.py +++ b/homeassistant/components/binary_sensor/command_sensor.py @@ -10,9 +10,9 @@ https://home-assistant.io/components/binary_sensor.command/ import logging from datetime import timedelta -from homeassistant.const import CONF_VALUE_TEMPLATE from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.sensor.command_sensor import CommandSensorData +from homeassistant.const import CONF_VALUE_TEMPLATE from homeassistant.util import template _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/binary_sensor/mqtt.py b/homeassistant/components/binary_sensor/mqtt.py index 916f1226c82..e8f09e80ae2 100644 --- a/homeassistant/components/binary_sensor/mqtt.py +++ b/homeassistant/components/binary_sensor/mqtt.py @@ -8,10 +8,10 @@ https://home-assistant.io/components/binary_sensor.mqtt/ """ import logging -from homeassistant.const import CONF_VALUE_TEMPLATE -from homeassistant.components.binary_sensor import BinarySensorDevice -from homeassistant.util import template import homeassistant.components.mqtt as mqtt +from homeassistant.components.binary_sensor import BinarySensorDevice +from homeassistant.const import CONF_VALUE_TEMPLATE +from homeassistant.util import template _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/binary_sensor/nest.py b/homeassistant/components/binary_sensor/nest.py index 0c250dcde67..a3c2b252b15 100644 --- a/homeassistant/components/binary_sensor/nest.py +++ b/homeassistant/components/binary_sensor/nest.py @@ -8,10 +8,10 @@ https://home-assistant.io/components/binary_sensor.nest/ """ import logging import socket -import homeassistant.components.nest as nest -from homeassistant.components.sensor.nest import NestSensor +import homeassistant.components.nest as nest from homeassistant.components.binary_sensor import BinarySensorDevice +from homeassistant.components.sensor.nest import NestSensor DEPENDENCIES = ['nest'] BINARY_TYPES = ['fan', diff --git a/homeassistant/components/binary_sensor/nx584.py b/homeassistant/components/binary_sensor/nx584.py index e7294c039c8..f77de7693ce 100644 --- a/homeassistant/components/binary_sensor/nx584.py +++ b/homeassistant/components/binary_sensor/nx584.py @@ -12,8 +12,8 @@ import time import requests -from homeassistant.components.binary_sensor import (BinarySensorDevice, - SENSOR_CLASSES) +from homeassistant.components.binary_sensor import ( + SENSOR_CLASSES, BinarySensorDevice) REQUIREMENTS = ['pynx584==0.2'] _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/binary_sensor/rest.py b/homeassistant/components/binary_sensor/rest.py index 1a592cd905a..a7f0ad72604 100644 --- a/homeassistant/components/binary_sensor/rest.py +++ b/homeassistant/components/binary_sensor/rest.py @@ -8,10 +8,10 @@ https://home-assistant.io/components/binary_sensor.rest/ """ import logging +from homeassistant.components.binary_sensor import BinarySensorDevice +from homeassistant.components.sensor.rest import RestData from homeassistant.const import CONF_VALUE_TEMPLATE from homeassistant.util import template -from homeassistant.components.sensor.rest import RestData -from homeassistant.components.binary_sensor import BinarySensorDevice _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/binary_sensor/rpi_gpio.py b/homeassistant/components/binary_sensor/rpi_gpio.py index 64da1b5ea9f..a43d009e25f 100644 --- a/homeassistant/components/binary_sensor/rpi_gpio.py +++ b/homeassistant/components/binary_sensor/rpi_gpio.py @@ -8,9 +8,10 @@ https://home-assistant.io/components/binary_sensor.rpi_gpio/ """ import logging + import homeassistant.components.rpi_gpio as rpi_gpio from homeassistant.components.binary_sensor import BinarySensorDevice -from homeassistant.const import (DEVICE_DEFAULT_NAME) +from homeassistant.const import DEVICE_DEFAULT_NAME DEFAULT_PULL_MODE = "UP" DEFAULT_BOUNCETIME = 50 diff --git a/homeassistant/components/binary_sensor/zigbee.py b/homeassistant/components/binary_sensor/zigbee.py index 1597cd5004f..6954ed33a82 100644 --- a/homeassistant/components/binary_sensor/zigbee.py +++ b/homeassistant/components/binary_sensor/zigbee.py @@ -10,7 +10,6 @@ from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.zigbee import ( ZigBeeDigitalIn, ZigBeeDigitalInConfig) - DEPENDENCIES = ["zigbee"] diff --git a/homeassistant/components/bloomsky.py b/homeassistant/components/bloomsky.py index fe2ae1cf3ba..f13b9ce85c9 100644 --- a/homeassistant/components/bloomsky.py +++ b/homeassistant/components/bloomsky.py @@ -8,10 +8,12 @@ https://home-assistant.io/components/bloomsky/ """ import logging from datetime import timedelta + import requests -from homeassistant.util import Throttle -from homeassistant.helpers import validate_config + from homeassistant.const import CONF_API_KEY +from homeassistant.helpers import validate_config +from homeassistant.util import Throttle DOMAIN = "bloomsky" BLOOMSKY = None diff --git a/homeassistant/components/camera/bloomsky.py b/homeassistant/components/camera/bloomsky.py index 598059af13f..6e03a136c6b 100644 --- a/homeassistant/components/camera/bloomsky.py +++ b/homeassistant/components/camera/bloomsky.py @@ -7,9 +7,11 @@ For more details about this component, please refer to the documentation at https://home-assistant.io/components/camera.bloomsky/ """ import logging + import requests -from homeassistant.loader import get_component + from homeassistant.components.camera import Camera +from homeassistant.loader import get_component DEPENDENCIES = ["bloomsky"] diff --git a/homeassistant/components/camera/demo.py b/homeassistant/components/camera/demo.py index 0ad992db86d..89d9b9600e8 100644 --- a/homeassistant/components/camera/demo.py +++ b/homeassistant/components/camera/demo.py @@ -4,8 +4,9 @@ homeassistant.components.camera.demo Demo platform that has a fake camera. """ import os -from homeassistant.components.camera import Camera + import homeassistant.util.dt as dt_util +from homeassistant.components.camera import Camera def setup_platform(hass, config, add_devices, discovery_info=None): diff --git a/homeassistant/components/camera/foscam.py b/homeassistant/components/camera/foscam.py index b210e1a2f1b..47ebf1b7d5a 100644 --- a/homeassistant/components/camera/foscam.py +++ b/homeassistant/components/camera/foscam.py @@ -10,8 +10,8 @@ import logging import requests -from homeassistant.helpers import validate_config from homeassistant.components.camera import DOMAIN, Camera +from homeassistant.helpers import validate_config _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/camera/generic.py b/homeassistant/components/camera/generic.py index c81febccc86..514e94db1ef 100644 --- a/homeassistant/components/camera/generic.py +++ b/homeassistant/components/camera/generic.py @@ -11,8 +11,8 @@ import logging import requests from requests.auth import HTTPBasicAuth -from homeassistant.helpers import validate_config from homeassistant.components.camera import DOMAIN, Camera +from homeassistant.helpers import validate_config _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/camera/mjpeg.py b/homeassistant/components/camera/mjpeg.py index 7bbaa4846b5..95bf9813b39 100644 --- a/homeassistant/components/camera/mjpeg.py +++ b/homeassistant/components/camera/mjpeg.py @@ -6,15 +6,15 @@ Support for IP Cameras. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/camera.mjpeg/ """ -from contextlib import closing import logging +from contextlib import closing import requests from requests.auth import HTTPBasicAuth -from homeassistant.helpers import validate_config from homeassistant.components.camera import DOMAIN, Camera from homeassistant.const import HTTP_OK +from homeassistant.helpers import validate_config CONTENT_TYPE_HEADER = 'Content-Type' diff --git a/homeassistant/components/camera/uvc.py b/homeassistant/components/camera/uvc.py index 19cd7c4b4be..a1ae128f4da 100644 --- a/homeassistant/components/camera/uvc.py +++ b/homeassistant/components/camera/uvc.py @@ -11,8 +11,8 @@ import socket import requests -from homeassistant.helpers import validate_config from homeassistant.components.camera import DOMAIN, Camera +from homeassistant.helpers import validate_config REQUIREMENTS = ['uvcclient==0.6'] diff --git a/homeassistant/components/configurator.py b/homeassistant/components/configurator.py index 591cdc0dc61..681cc80cc9c 100644 --- a/homeassistant/components/configurator.py +++ b/homeassistant/components/configurator.py @@ -11,8 +11,8 @@ the user has submitted configuration information. """ import logging -from homeassistant.helpers.entity import generate_entity_id from homeassistant.const import EVENT_TIME_CHANGED +from homeassistant.helpers.entity import generate_entity_id DOMAIN = "configurator" ENTITY_ID_FORMAT = DOMAIN + ".{}" diff --git a/homeassistant/components/conversation.py b/homeassistant/components/conversation.py index 18ddf8fcc8d..9cf70fa2b62 100644 --- a/homeassistant/components/conversation.py +++ b/homeassistant/components/conversation.py @@ -9,10 +9,9 @@ https://home-assistant.io/components/conversation/ import logging import re - from homeassistant import core from homeassistant.const import ( - ATTR_ENTITY_ID, SERVICE_TURN_ON, SERVICE_TURN_OFF) + ATTR_ENTITY_ID, SERVICE_TURN_OFF, SERVICE_TURN_ON) DOMAIN = "conversation" diff --git a/homeassistant/components/demo.py b/homeassistant/components/demo.py index e63f5f49551..9418a037b8d 100644 --- a/homeassistant/components/demo.py +++ b/homeassistant/components/demo.py @@ -6,11 +6,10 @@ Sets up a demo environment that mimics interaction with devices. """ import time -import homeassistant.core as ha import homeassistant.bootstrap as bootstrap +import homeassistant.core as ha import homeassistant.loader as loader -from homeassistant.const import ( - CONF_PLATFORM, ATTR_ENTITY_ID) +from homeassistant.const import ATTR_ENTITY_ID, CONF_PLATFORM DOMAIN = "demo" diff --git a/homeassistant/components/device_sun_light_trigger.py b/homeassistant/components/device_sun_light_trigger.py index 4acf60bc0a2..a8cf5b5d417 100644 --- a/homeassistant/components/device_sun_light_trigger.py +++ b/homeassistant/components/device_sun_light_trigger.py @@ -10,10 +10,11 @@ https://home-assistant.io/components/device_sun_light_trigger/ import logging from datetime import timedelta -from homeassistant.helpers.event import track_point_in_time, track_state_change import homeassistant.util.dt as dt_util from homeassistant.const import STATE_HOME, STATE_NOT_HOME -from . import light, sun, device_tracker, group +from homeassistant.helpers.event import track_point_in_time, track_state_change + +from . import device_tracker, group, light, sun DOMAIN = "device_sun_light_trigger" DEPENDENCIES = ['light', 'device_tracker', 'group', 'sun'] diff --git a/homeassistant/components/device_tracker/actiontec.py b/homeassistant/components/device_tracker/actiontec.py index f363acf1902..d9cb8718a70 100644 --- a/homeassistant/components/device_tracker/actiontec.py +++ b/homeassistant/components/device_tracker/actiontec.py @@ -8,17 +8,17 @@ For more details about this platform, please refer to the documentation at https://home-assistant.io/components/device_tracker.actiontec/ """ import logging -from datetime import timedelta -from collections import namedtuple import re -import threading import telnetlib +import threading +from collections import namedtuple +from datetime import timedelta import homeassistant.util.dt as dt_util -from homeassistant.const import CONF_HOST, CONF_USERNAME, CONF_PASSWORD +from homeassistant.components.device_tracker import DOMAIN +from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME from homeassistant.helpers import validate_config from homeassistant.util import Throttle -from homeassistant.components.device_tracker import DOMAIN # Return cached results if last scan was less then this time ago MIN_TIME_BETWEEN_SCANS = timedelta(seconds=5) diff --git a/homeassistant/components/device_tracker/aruba.py b/homeassistant/components/device_tracker/aruba.py index 6d94ad30d04..4bc3f9e3258 100644 --- a/homeassistant/components/device_tracker/aruba.py +++ b/homeassistant/components/device_tracker/aruba.py @@ -8,14 +8,14 @@ For more details about this platform, please refer to the documentation at https://home-assistant.io/components/device_tracker.aruba/ """ import logging -from datetime import timedelta import re import threading +from datetime import timedelta -from homeassistant.const import CONF_HOST, CONF_USERNAME, CONF_PASSWORD +from homeassistant.components.device_tracker import DOMAIN +from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME from homeassistant.helpers import validate_config from homeassistant.util import Throttle -from homeassistant.components.device_tracker import DOMAIN # Return cached results if last scan was less then this time ago MIN_TIME_BETWEEN_SCANS = timedelta(seconds=10) diff --git a/homeassistant/components/device_tracker/asuswrt.py b/homeassistant/components/device_tracker/asuswrt.py index 472440d7307..d9b6d1a809e 100644 --- a/homeassistant/components/device_tracker/asuswrt.py +++ b/homeassistant/components/device_tracker/asuswrt.py @@ -8,15 +8,15 @@ For more details about this platform, please refer to the documentation at https://home-assistant.io/components/device_tracker.asuswrt/ """ import logging -from datetime import timedelta import re -import threading import telnetlib +import threading +from datetime import timedelta -from homeassistant.const import CONF_HOST, CONF_USERNAME, CONF_PASSWORD +from homeassistant.components.device_tracker import DOMAIN +from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME from homeassistant.helpers import validate_config from homeassistant.util import Throttle -from homeassistant.components.device_tracker import DOMAIN # Return cached results if last scan was less then this time ago MIN_TIME_BETWEEN_SCANS = timedelta(seconds=5) diff --git a/homeassistant/components/device_tracker/ddwrt.py b/homeassistant/components/device_tracker/ddwrt.py index 268c4e5a22f..82a8ed81537 100644 --- a/homeassistant/components/device_tracker/ddwrt.py +++ b/homeassistant/components/device_tracker/ddwrt.py @@ -8,15 +8,16 @@ For more details about this platform, please refer to the documentation at https://home-assistant.io/components/device_tracker.ddwrt/ """ import logging -from datetime import timedelta import re import threading +from datetime import timedelta + import requests -from homeassistant.const import CONF_HOST, CONF_USERNAME, CONF_PASSWORD +from homeassistant.components.device_tracker import DOMAIN +from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME from homeassistant.helpers import validate_config from homeassistant.util import Throttle -from homeassistant.components.device_tracker import DOMAIN # Return cached results if last scan was less then this time ago MIN_TIME_BETWEEN_SCANS = timedelta(seconds=5) diff --git a/homeassistant/components/device_tracker/fritz.py b/homeassistant/components/device_tracker/fritz.py index 9fee2747c0f..3ca3461f557 100644 --- a/homeassistant/components/device_tracker/fritz.py +++ b/homeassistant/components/device_tracker/fritz.py @@ -10,10 +10,10 @@ https://home-assistant.io/components/device_tracker.fritz/ import logging from datetime import timedelta -from homeassistant.const import CONF_HOST, CONF_USERNAME, CONF_PASSWORD +from homeassistant.components.device_tracker import DOMAIN +from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME from homeassistant.helpers import validate_config from homeassistant.util import Throttle -from homeassistant.components.device_tracker import DOMAIN REQUIREMENTS = ['fritzconnection==0.4.6'] diff --git a/homeassistant/components/device_tracker/icloud.py b/homeassistant/components/device_tracker/icloud.py index 76046552551..4b13098dde0 100644 --- a/homeassistant/components/device_tracker/icloud.py +++ b/homeassistant/components/device_tracker/icloud.py @@ -7,9 +7,9 @@ For more details about this platform, please refer to the documentation at https://home-assistant.io/components/device_tracker.icloud/ """ import logging - import re -from homeassistant.const import CONF_USERNAME, CONF_PASSWORD + +from homeassistant.const import CONF_PASSWORD, CONF_USERNAME from homeassistant.helpers.event import track_utc_time_change _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/device_tracker/locative.py b/homeassistant/components/device_tracker/locative.py index 11884829600..d1912b06b3d 100644 --- a/homeassistant/components/device_tracker/locative.py +++ b/homeassistant/components/device_tracker/locative.py @@ -9,9 +9,8 @@ https://home-assistant.io/components/device_tracker.locative/ import logging from functools import partial -from homeassistant.const import ( - HTTP_UNPROCESSABLE_ENTITY, STATE_NOT_HOME) from homeassistant.components.device_tracker import DOMAIN +from homeassistant.const import HTTP_UNPROCESSABLE_ENTITY, STATE_NOT_HOME _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/device_tracker/luci.py b/homeassistant/components/device_tracker/luci.py index 8b3e4eeb3c8..5745138bf8e 100644 --- a/homeassistant/components/device_tracker/luci.py +++ b/homeassistant/components/device_tracker/luci.py @@ -7,17 +7,18 @@ presence. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/device_tracker.luci/ """ -import logging import json -from datetime import timedelta +import logging import re import threading +from datetime import timedelta + import requests -from homeassistant.const import CONF_HOST, CONF_USERNAME, CONF_PASSWORD +from homeassistant.components.device_tracker import DOMAIN +from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME from homeassistant.helpers import validate_config from homeassistant.util import Throttle -from homeassistant.components.device_tracker import DOMAIN # Return cached results if last scan was less then this time ago MIN_TIME_BETWEEN_SCANS = timedelta(seconds=5) diff --git a/homeassistant/components/device_tracker/mqtt.py b/homeassistant/components/device_tracker/mqtt.py index 929deaae669..6fca13e6892 100644 --- a/homeassistant/components/device_tracker/mqtt.py +++ b/homeassistant/components/device_tracker/mqtt.py @@ -7,8 +7,9 @@ For more details about this platform, please refer to the documentation at https://home-assistant.io/components/device_tracker.mqtt/ """ import logging -from homeassistant import util + import homeassistant.components.mqtt as mqtt +from homeassistant import util DEPENDENCIES = ['mqtt'] diff --git a/homeassistant/components/device_tracker/netgear.py b/homeassistant/components/device_tracker/netgear.py index 233622e076e..eebb68c043a 100644 --- a/homeassistant/components/device_tracker/netgear.py +++ b/homeassistant/components/device_tracker/netgear.py @@ -8,12 +8,12 @@ For more details about this platform, please refer to the documentation at https://home-assistant.io/components/device_tracker.netgear/ """ import logging -from datetime import timedelta import threading +from datetime import timedelta -from homeassistant.const import CONF_HOST, CONF_USERNAME, CONF_PASSWORD -from homeassistant.util import Throttle from homeassistant.components.device_tracker import DOMAIN +from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME +from homeassistant.util import Throttle # Return cached results if last scan was less then this time ago MIN_TIME_BETWEEN_SCANS = timedelta(seconds=5) diff --git a/homeassistant/components/device_tracker/nmap_tracker.py b/homeassistant/components/device_tracker/nmap_tracker.py index bc8e8768be0..596986e8bb7 100644 --- a/homeassistant/components/device_tracker/nmap_tracker.py +++ b/homeassistant/components/device_tracker/nmap_tracker.py @@ -7,16 +7,16 @@ For more details about this platform, please refer to the documentation at https://home-assistant.io/components/device_tracker.nmap_scanner/ """ import logging -from datetime import timedelta -from collections import namedtuple -import subprocess import re +import subprocess +from collections import namedtuple +from datetime import timedelta import homeassistant.util.dt as dt_util +from homeassistant.components.device_tracker import DOMAIN from homeassistant.const import CONF_HOSTS from homeassistant.helpers import validate_config from homeassistant.util import Throttle, convert -from homeassistant.components.device_tracker import DOMAIN # Return cached results if last scan was less then this time ago MIN_TIME_BETWEEN_SCANS = timedelta(seconds=5) diff --git a/homeassistant/components/device_tracker/snmp.py b/homeassistant/components/device_tracker/snmp.py index cd0e8239c38..b7b59fbf95a 100644 --- a/homeassistant/components/device_tracker/snmp.py +++ b/homeassistant/components/device_tracker/snmp.py @@ -7,15 +7,15 @@ through SNMP. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/device_tracker.snmp/ """ -import logging -from datetime import timedelta -import threading import binascii +import logging +import threading +from datetime import timedelta +from homeassistant.components.device_tracker import DOMAIN from homeassistant.const import CONF_HOST from homeassistant.helpers import validate_config from homeassistant.util import Throttle -from homeassistant.components.device_tracker import DOMAIN # Return cached results if last scan was less then this time ago MIN_TIME_BETWEEN_SCANS = timedelta(seconds=10) diff --git a/homeassistant/components/device_tracker/thomson.py b/homeassistant/components/device_tracker/thomson.py index 657bb910da2..7c7667400f5 100644 --- a/homeassistant/components/device_tracker/thomson.py +++ b/homeassistant/components/device_tracker/thomson.py @@ -8,15 +8,15 @@ For more details about this platform, please refer to the documentation at https://home-assistant.io/components/device_tracker.thomson/ """ import logging -from datetime import timedelta import re -import threading import telnetlib +import threading +from datetime import timedelta -from homeassistant.const import CONF_HOST, CONF_USERNAME, CONF_PASSWORD +from homeassistant.components.device_tracker import DOMAIN +from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME from homeassistant.helpers import validate_config from homeassistant.util import Throttle -from homeassistant.components.device_tracker import DOMAIN # Return cached results if last scan was less then this time ago MIN_TIME_BETWEEN_SCANS = timedelta(seconds=10) diff --git a/homeassistant/components/device_tracker/tomato.py b/homeassistant/components/device_tracker/tomato.py index c87a50f0981..8f1e956dcb6 100644 --- a/homeassistant/components/device_tracker/tomato.py +++ b/homeassistant/components/device_tracker/tomato.py @@ -7,18 +7,18 @@ presence. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/device_tracker.tomato/ """ -import logging import json -from datetime import timedelta +import logging import re import threading +from datetime import timedelta import requests -from homeassistant.const import CONF_HOST, CONF_USERNAME, CONF_PASSWORD +from homeassistant.components.device_tracker import DOMAIN +from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME from homeassistant.helpers import validate_config from homeassistant.util import Throttle -from homeassistant.components.device_tracker import DOMAIN # Return cached results if last scan was less then this time ago MIN_TIME_BETWEEN_SCANS = timedelta(seconds=5) diff --git a/homeassistant/components/device_tracker/tplink.py b/homeassistant/components/device_tracker/tplink.py index a661dac0c1e..30a920961cb 100755 --- a/homeassistant/components/device_tracker/tplink.py +++ b/homeassistant/components/device_tracker/tplink.py @@ -9,15 +9,16 @@ https://home-assistant.io/components/device_tracker.tplink/ """ import base64 import logging -from datetime import timedelta import re import threading +from datetime import timedelta + import requests -from homeassistant.const import CONF_HOST, CONF_USERNAME, CONF_PASSWORD +from homeassistant.components.device_tracker import DOMAIN +from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME from homeassistant.helpers import validate_config from homeassistant.util import Throttle -from homeassistant.components.device_tracker import DOMAIN # Return cached results if last scan was less then this time ago MIN_TIME_BETWEEN_SCANS = timedelta(seconds=5) diff --git a/homeassistant/components/device_tracker/ubus.py b/homeassistant/components/device_tracker/ubus.py index 0355680a31d..073588008b0 100644 --- a/homeassistant/components/device_tracker/ubus.py +++ b/homeassistant/components/device_tracker/ubus.py @@ -7,17 +7,18 @@ presence. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/device_tracker.ubus/ """ -import logging import json -from datetime import timedelta +import logging import re import threading +from datetime import timedelta + import requests -from homeassistant.const import CONF_HOST, CONF_USERNAME, CONF_PASSWORD +from homeassistant.components.device_tracker import DOMAIN +from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME from homeassistant.helpers import validate_config from homeassistant.util import Throttle -from homeassistant.components.device_tracker import DOMAIN # Return cached results if last scan was less then this time ago MIN_TIME_BETWEEN_SCANS = timedelta(seconds=5) diff --git a/homeassistant/components/discovery.py b/homeassistant/components/discovery.py index cfd6ffd55eb..09816d73f9a 100644 --- a/homeassistant/components/discovery.py +++ b/homeassistant/components/discovery.py @@ -13,8 +13,8 @@ import threading from homeassistant import bootstrap from homeassistant.const import ( - EVENT_HOMEASSISTANT_START, EVENT_PLATFORM_DISCOVERED, - ATTR_SERVICE, ATTR_DISCOVERED) + ATTR_DISCOVERED, ATTR_SERVICE, EVENT_HOMEASSISTANT_START, + EVENT_PLATFORM_DISCOVERED) DOMAIN = "discovery" REQUIREMENTS = ['netdisco==0.5.2'] diff --git a/homeassistant/components/downloader.py b/homeassistant/components/downloader.py index 3926495376c..6fbbd3f9473 100644 --- a/homeassistant/components/downloader.py +++ b/homeassistant/components/downloader.py @@ -6,8 +6,8 @@ Provides functionality to download files. For more details about this component, please refer to the documentation at https://home-assistant.io/components/downloader/ """ -import os import logging +import os import re import threading diff --git a/homeassistant/components/ecobee.py b/homeassistant/components/ecobee.py index 215e32594b5..f2172e7e5b6 100644 --- a/homeassistant/components/ecobee.py +++ b/homeassistant/components/ecobee.py @@ -6,15 +6,15 @@ Ecobee component For more details about this component, please refer to the documentation at https://home-assistant.io/components/ecobee/ """ -from datetime import timedelta import logging import os +from datetime import timedelta -from homeassistant.loader import get_component from homeassistant import bootstrap -from homeassistant.util import Throttle from homeassistant.const import ( - EVENT_PLATFORM_DISCOVERED, ATTR_SERVICE, ATTR_DISCOVERED, CONF_API_KEY) + ATTR_DISCOVERED, ATTR_SERVICE, CONF_API_KEY, EVENT_PLATFORM_DISCOVERED) +from homeassistant.loader import get_component +from homeassistant.util import Throttle DOMAIN = "ecobee" DISCOVER_THERMOSTAT = "ecobee.thermostat" diff --git a/homeassistant/components/graphite.py b/homeassistant/components/graphite.py index 9ebf3a0d7da..49ac6690edf 100644 --- a/homeassistant/components/graphite.py +++ b/homeassistant/components/graphite.py @@ -14,8 +14,7 @@ import threading import time from homeassistant.const import ( - EVENT_STATE_CHANGED, - EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP) + EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP, EVENT_STATE_CHANGED) from homeassistant.helpers import state DOMAIN = "graphite" diff --git a/homeassistant/components/group.py b/homeassistant/components/group.py index 6806adb5253..a851726e69d 100644 --- a/homeassistant/components/group.py +++ b/homeassistant/components/group.py @@ -7,13 +7,12 @@ For more details about this component, please refer to the documentation at https://home-assistant.io/components/group/ """ import homeassistant.core as ha -from homeassistant.helpers.event import track_state_change -from homeassistant.helpers.entity import ( - Entity, split_entity_id, generate_entity_id) from homeassistant.const import ( - ATTR_ENTITY_ID, STATE_ON, STATE_OFF, - STATE_HOME, STATE_NOT_HOME, STATE_OPEN, STATE_CLOSED, - STATE_UNKNOWN, CONF_NAME, CONF_ICON) + ATTR_ENTITY_ID, CONF_ICON, CONF_NAME, STATE_CLOSED, STATE_HOME, + STATE_NOT_HOME, STATE_OFF, STATE_ON, STATE_OPEN, STATE_UNKNOWN) +from homeassistant.helpers.entity import ( + Entity, generate_entity_id, split_entity_id) +from homeassistant.helpers.event import track_state_change DOMAIN = 'group' diff --git a/homeassistant/components/history.py b/homeassistant/components/history.py index d07fc518083..578cb265a27 100644 --- a/homeassistant/components/history.py +++ b/homeassistant/components/history.py @@ -7,12 +7,12 @@ For more details about this component, please refer to the documentation at https://home-assistant.io/components/history/ """ import re +from collections import defaultdict from datetime import timedelta from itertools import groupby -from collections import defaultdict -import homeassistant.util.dt as dt_util import homeassistant.components.recorder as recorder +import homeassistant.util.dt as dt_util from homeassistant.const import HTTP_BAD_REQUEST DOMAIN = 'history' diff --git a/homeassistant/components/http.py b/homeassistant/components/http.py index 073604e3b2c..878d7465128 100644 --- a/homeassistant/components/http.py +++ b/homeassistant/components/http.py @@ -6,30 +6,31 @@ This module provides an API and a HTTP interface for debug purposes. For more details about the RESTful API, please refer to the documentation at https://home-assistant.io/developers/api/ """ -from datetime import timedelta import gzip -from http import cookies -from http.server import SimpleHTTPRequestHandler, HTTPServer import json import logging import os -from socketserver import ThreadingMixIn import ssl import threading import time -from urllib.parse import urlparse, parse_qs +from datetime import timedelta +from http import cookies +from http.server import HTTPServer, SimpleHTTPRequestHandler +from socketserver import ThreadingMixIn +from urllib.parse import parse_qs, urlparse +import homeassistant.bootstrap as bootstrap import homeassistant.core as ha -from homeassistant.const import ( - SERVER_PORT, CONTENT_TYPE_JSON, CONTENT_TYPE_TEXT_PLAIN, - HTTP_HEADER_HA_AUTH, HTTP_HEADER_CONTENT_TYPE, HTTP_HEADER_ACCEPT_ENCODING, - HTTP_HEADER_CONTENT_ENCODING, HTTP_HEADER_VARY, HTTP_HEADER_CONTENT_LENGTH, - HTTP_HEADER_CACHE_CONTROL, HTTP_HEADER_EXPIRES, HTTP_OK, HTTP_UNAUTHORIZED, - HTTP_NOT_FOUND, HTTP_METHOD_NOT_ALLOWED, HTTP_UNPROCESSABLE_ENTITY) import homeassistant.remote as rem import homeassistant.util as util import homeassistant.util.dt as date_util -import homeassistant.bootstrap as bootstrap +from homeassistant.const import ( + CONTENT_TYPE_JSON, CONTENT_TYPE_TEXT_PLAIN, HTTP_HEADER_ACCEPT_ENCODING, + HTTP_HEADER_CACHE_CONTROL, HTTP_HEADER_CONTENT_ENCODING, + HTTP_HEADER_CONTENT_LENGTH, HTTP_HEADER_CONTENT_TYPE, HTTP_HEADER_EXPIRES, + HTTP_HEADER_HA_AUTH, HTTP_HEADER_VARY, HTTP_METHOD_NOT_ALLOWED, + HTTP_NOT_FOUND, HTTP_OK, HTTP_UNAUTHORIZED, HTTP_UNPROCESSABLE_ENTITY, + SERVER_PORT) DOMAIN = "http" diff --git a/homeassistant/components/ifttt.py b/homeassistant/components/ifttt.py index 6f406b24311..765cd000e2c 100644 --- a/homeassistant/components/ifttt.py +++ b/homeassistant/components/ifttt.py @@ -7,6 +7,7 @@ For more details about this component, please refer to the documentation at https://home-assistant.io/components/ifttt/ """ import logging + import requests from homeassistant.helpers import validate_config diff --git a/homeassistant/components/influxdb.py b/homeassistant/components/influxdb.py index b27cdefa9ba..3e19fd8692a 100644 --- a/homeassistant/components/influxdb.py +++ b/homeassistant/components/influxdb.py @@ -7,10 +7,11 @@ For more details about this component, please refer to the documentation at https://home-assistant.io/components/influxdb/ """ import logging + import homeassistant.util as util -from homeassistant.helpers import validate_config +from homeassistant.const import EVENT_STATE_CHANGED, STATE_UNKNOWN from homeassistant.helpers import state as state_helper -from homeassistant.const import (EVENT_STATE_CHANGED, STATE_UNKNOWN) +from homeassistant.helpers import validate_config _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/input_boolean.py b/homeassistant/components/input_boolean.py index 3d3c76459da..fc5a7856604 100644 --- a/homeassistant/components/input_boolean.py +++ b/homeassistant/components/input_boolean.py @@ -9,9 +9,9 @@ at https://home-assistant.io/components/input_boolean/ import logging from homeassistant.const import ( - STATE_ON, SERVICE_TURN_ON, SERVICE_TURN_OFF, ATTR_ENTITY_ID) -from homeassistant.helpers.entity_component import EntityComponent + ATTR_ENTITY_ID, SERVICE_TURN_OFF, SERVICE_TURN_ON, STATE_ON) from homeassistant.helpers.entity import ToggleEntity +from homeassistant.helpers.entity_component import EntityComponent from homeassistant.util import slugify DOMAIN = 'input_boolean' diff --git a/homeassistant/components/input_select.py b/homeassistant/components/input_select.py index a211219581b..a2fdf276bef 100644 --- a/homeassistant/components/input_select.py +++ b/homeassistant/components/input_select.py @@ -9,8 +9,8 @@ at https://home-assistant.io/components/input_select/ import logging from homeassistant.const import ATTR_ENTITY_ID -from homeassistant.helpers.entity_component import EntityComponent from homeassistant.helpers.entity import Entity +from homeassistant.helpers.entity_component import EntityComponent from homeassistant.util import slugify DOMAIN = 'input_select' diff --git a/homeassistant/components/insteon_hub.py b/homeassistant/components/insteon_hub.py index adef1d379cf..c8f26eefd85 100644 --- a/homeassistant/components/insteon_hub.py +++ b/homeassistant/components/insteon_hub.py @@ -7,13 +7,14 @@ For more details about this component, please refer to the documentation at https://home-assistant.io/components/insteon_hub/ """ import logging + import homeassistant.bootstrap as bootstrap -from homeassistant.helpers import validate_config -from homeassistant.loader import get_component -from homeassistant.helpers.entity import ToggleEntity from homeassistant.const import ( - CONF_USERNAME, CONF_PASSWORD, CONF_API_KEY, ATTR_DISCOVERED, - ATTR_SERVICE, EVENT_PLATFORM_DISCOVERED) + ATTR_DISCOVERED, ATTR_SERVICE, CONF_API_KEY, CONF_PASSWORD, CONF_USERNAME, + EVENT_PLATFORM_DISCOVERED) +from homeassistant.helpers import validate_config +from homeassistant.helpers.entity import ToggleEntity +from homeassistant.loader import get_component DOMAIN = "insteon_hub" REQUIREMENTS = ['insteon_hub==0.4.5'] diff --git a/homeassistant/components/isy994.py b/homeassistant/components/isy994.py index 6a0cee5dd17..36a16db0d33 100644 --- a/homeassistant/components/isy994.py +++ b/homeassistant/components/isy994.py @@ -11,12 +11,12 @@ import logging from urllib.parse import urlparse from homeassistant import bootstrap -from homeassistant.loader import get_component +from homeassistant.const import ( + ATTR_DISCOVERED, ATTR_SERVICE, CONF_HOST, CONF_PASSWORD, CONF_USERNAME, + EVENT_HOMEASSISTANT_STOP, EVENT_PLATFORM_DISCOVERED) from homeassistant.helpers import validate_config from homeassistant.helpers.entity import ToggleEntity -from homeassistant.const import ( - CONF_HOST, CONF_USERNAME, CONF_PASSWORD, EVENT_PLATFORM_DISCOVERED, - EVENT_HOMEASSISTANT_STOP, ATTR_SERVICE, ATTR_DISCOVERED) +from homeassistant.loader import get_component DOMAIN = "isy994" REQUIREMENTS = ['PyISY==1.0.5'] diff --git a/homeassistant/components/keyboard.py b/homeassistant/components/keyboard.py index ac6356ab574..b8c1e5f44d5 100644 --- a/homeassistant/components/keyboard.py +++ b/homeassistant/components/keyboard.py @@ -7,10 +7,9 @@ For more details about this component, please refer to the documentation at https://home-assistant.io/components/keyboard/ """ from homeassistant.const import ( - SERVICE_VOLUME_UP, SERVICE_VOLUME_DOWN, SERVICE_VOLUME_MUTE, - SERVICE_MEDIA_NEXT_TRACK, SERVICE_MEDIA_PREVIOUS_TRACK, - SERVICE_MEDIA_PLAY_PAUSE) - + SERVICE_MEDIA_NEXT_TRACK, SERVICE_MEDIA_PLAY_PAUSE, + SERVICE_MEDIA_PREVIOUS_TRACK, SERVICE_VOLUME_DOWN, SERVICE_VOLUME_MUTE, + SERVICE_VOLUME_UP) DOMAIN = "keyboard" REQUIREMENTS = ['pyuserinput==0.1.9'] diff --git a/homeassistant/components/light/blinksticklight.py b/homeassistant/components/light/blinksticklight.py index fae9890c93d..5e2f026aa90 100644 --- a/homeassistant/components/light/blinksticklight.py +++ b/homeassistant/components/light/blinksticklight.py @@ -8,7 +8,7 @@ https://home-assistant.io/components/light.blinksticklight/ """ import logging -from homeassistant.components.light import Light, ATTR_RGB_COLOR +from homeassistant.components.light import ATTR_RGB_COLOR, Light _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/light/demo.py b/homeassistant/components/light/demo.py index 73da0c51a09..fecec2d17d4 100644 --- a/homeassistant/components/light/demo.py +++ b/homeassistant/components/light/demo.py @@ -7,8 +7,7 @@ Demo platform that implements lights. import random from homeassistant.components.light import ( - Light, ATTR_BRIGHTNESS, ATTR_RGB_COLOR, ATTR_COLOR_TEMP) - + ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, ATTR_RGB_COLOR, Light) LIGHT_COLORS = [ [237, 224, 33], diff --git a/homeassistant/components/light/hue.py b/homeassistant/components/light/hue.py index b1843f4bca8..a970a8681c9 100644 --- a/homeassistant/components/light/hue.py +++ b/homeassistant/components/light/hue.py @@ -9,19 +9,19 @@ https://home-assistant.io/components/light.hue/ import json import logging import os -import socket import random +import socket from datetime import timedelta from urllib.parse import urlparse -from homeassistant.loader import get_component import homeassistant.util as util import homeassistant.util.color as color_util -from homeassistant.const import CONF_HOST, CONF_FILENAME, DEVICE_DEFAULT_NAME from homeassistant.components.light import ( - Light, ATTR_BRIGHTNESS, ATTR_XY_COLOR, ATTR_COLOR_TEMP, - ATTR_TRANSITION, ATTR_FLASH, FLASH_LONG, FLASH_SHORT, - ATTR_EFFECT, EFFECT_COLORLOOP, EFFECT_RANDOM, ATTR_RGB_COLOR) + ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, ATTR_EFFECT, ATTR_FLASH, ATTR_RGB_COLOR, + ATTR_TRANSITION, ATTR_XY_COLOR, EFFECT_COLORLOOP, EFFECT_RANDOM, + FLASH_LONG, FLASH_SHORT, Light) +from homeassistant.const import CONF_FILENAME, CONF_HOST, DEVICE_DEFAULT_NAME +from homeassistant.loader import get_component REQUIREMENTS = ['phue==0.8'] MIN_TIME_BETWEEN_SCANS = timedelta(seconds=10) diff --git a/homeassistant/components/light/hyperion.py b/homeassistant/components/light/hyperion.py index fe7d504ed4f..7eb112eccd6 100644 --- a/homeassistant/components/light/hyperion.py +++ b/homeassistant/components/light/hyperion.py @@ -6,12 +6,12 @@ Support for Hyperion remotes. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/light.hyperion/ """ +import json import logging import socket -import json +from homeassistant.components.light import ATTR_RGB_COLOR, Light from homeassistant.const import CONF_HOST -from homeassistant.components.light import (Light, ATTR_RGB_COLOR) _LOGGER = logging.getLogger(__name__) REQUIREMENTS = [] diff --git a/homeassistant/components/light/insteon_hub.py b/homeassistant/components/light/insteon_hub.py index e9f5b995777..6ce17b5622a 100644 --- a/homeassistant/components/light/insteon_hub.py +++ b/homeassistant/components/light/insteon_hub.py @@ -4,7 +4,7 @@ homeassistant.components.light.insteon Support for Insteon Hub lights. """ -from homeassistant.components.insteon_hub import (INSTEON, InsteonToggleDevice) +from homeassistant.components.insteon_hub import INSTEON, InsteonToggleDevice def setup_platform(hass, config, add_devices, discovery_info=None): diff --git a/homeassistant/components/light/isy994.py b/homeassistant/components/light/isy994.py index 6aa604e1b84..6d76ea45c58 100644 --- a/homeassistant/components/light/isy994.py +++ b/homeassistant/components/light/isy994.py @@ -8,10 +8,10 @@ https://home-assistant.io/components/isy994/ """ import logging -from homeassistant.components.isy994 import (ISYDeviceABC, ISY, SENSOR_STRING, - HIDDEN_STRING) +from homeassistant.components.isy994 import ( + HIDDEN_STRING, ISY, SENSOR_STRING, ISYDeviceABC) from homeassistant.components.light import ATTR_BRIGHTNESS -from homeassistant.const import STATE_ON, STATE_OFF +from homeassistant.const import STATE_OFF, STATE_ON def setup_platform(hass, config, add_devices, discovery_info=None): diff --git a/homeassistant/components/light/lifx.py b/homeassistant/components/light/lifx.py index 63c5e923ea6..5d58ca50811 100644 --- a/homeassistant/components/light/lifx.py +++ b/homeassistant/components/light/lifx.py @@ -8,11 +8,12 @@ https://home-assistant.io/components/light.lifx/ """ # pylint: disable=missing-docstring -import logging import colorsys +import logging + +from homeassistant.components.light import ( + ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, ATTR_RGB_COLOR, ATTR_TRANSITION, Light) from homeassistant.helpers.event import track_time_change -from homeassistant.components.light import \ - (Light, ATTR_BRIGHTNESS, ATTR_RGB_COLOR, ATTR_COLOR_TEMP, ATTR_TRANSITION) _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/light/limitlessled.py b/homeassistant/components/light/limitlessled.py index e072c6ce962..5110c3a3570 100644 --- a/homeassistant/components/light/limitlessled.py +++ b/homeassistant/components/light/limitlessled.py @@ -8,12 +8,9 @@ https://home-assistant.io/components/light.limitlessled/ """ import logging -from homeassistant.components.light import (Light, ATTR_BRIGHTNESS, - ATTR_RGB_COLOR, ATTR_EFFECT, - ATTR_COLOR_TEMP, ATTR_TRANSITION, - ATTR_FLASH, FLASH_LONG, - EFFECT_COLORLOOP, EFFECT_WHITE) - +from homeassistant.components.light import ( + ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, ATTR_EFFECT, ATTR_FLASH, ATTR_RGB_COLOR, + ATTR_TRANSITION, EFFECT_COLORLOOP, EFFECT_WHITE, FLASH_LONG, Light) _LOGGER = logging.getLogger(__name__) REQUIREMENTS = ['limitlessled==1.0.0'] diff --git a/homeassistant/components/light/mqtt.py b/homeassistant/components/light/mqtt.py index 3493c04db1b..3c860e074dd 100644 --- a/homeassistant/components/light/mqtt.py +++ b/homeassistant/components/light/mqtt.py @@ -6,12 +6,12 @@ Allows to configure a MQTT light. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/light.mqtt/ """ -from functools import partial import logging +from functools import partial import homeassistant.components.mqtt as mqtt -from homeassistant.components.light import (Light, - ATTR_BRIGHTNESS, ATTR_RGB_COLOR) +from homeassistant.components.light import ( + ATTR_BRIGHTNESS, ATTR_RGB_COLOR, Light) from homeassistant.util.template import render_with_possible_json_value _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/light/mysensors.py b/homeassistant/components/light/mysensors.py index b50446e2f38..3d9d2c14b13 100644 --- a/homeassistant/components/light/mysensors.py +++ b/homeassistant/components/light/mysensors.py @@ -6,17 +6,11 @@ https://home-assistant.io/components/light.mysensors/ """ import logging -from homeassistant.components.light import ( - Light, ATTR_BRIGHTNESS, ATTR_RGB_COLOR) - -from homeassistant.util.color import ( - rgb_hex_to_rgb_list) - -from homeassistant.const import ( - ATTR_BATTERY_LEVEL, - STATE_ON, STATE_OFF) - import homeassistant.components.mysensors as mysensors +from homeassistant.components.light import ( + ATTR_BRIGHTNESS, ATTR_RGB_COLOR, Light) +from homeassistant.const import ATTR_BATTERY_LEVEL, STATE_OFF, STATE_ON +from homeassistant.util.color import rgb_hex_to_rgb_list _LOGGER = logging.getLogger(__name__) ATTR_RGB_WHITE = 'rgb_white' diff --git a/homeassistant/components/light/rfxtrx.py b/homeassistant/components/light/rfxtrx.py index e690283e8d6..60d61c95a42 100644 --- a/homeassistant/components/light/rfxtrx.py +++ b/homeassistant/components/light/rfxtrx.py @@ -7,16 +7,13 @@ For more details about this platform, please refer to the documentation at https://home-assistant.io/components/light.rfxtrx/ """ import logging + import homeassistant.components.rfxtrx as rfxtrx - -from homeassistant.components.light import Light, ATTR_BRIGHTNESS -from homeassistant.util import slugify - -from homeassistant.const import ATTR_ENTITY_ID +from homeassistant.components.light import ATTR_BRIGHTNESS, Light from homeassistant.components.rfxtrx import ( - ATTR_STATE, ATTR_FIREEVENT, ATTR_PACKETID, - ATTR_NAME, EVENT_BUTTON_PRESSED) - + ATTR_FIREEVENT, ATTR_NAME, ATTR_PACKETID, ATTR_STATE, EVENT_BUTTON_PRESSED) +from homeassistant.const import ATTR_ENTITY_ID +from homeassistant.util import slugify DEPENDENCIES = ['rfxtrx'] SIGNAL_REPETITIONS = 1 diff --git a/homeassistant/components/light/scsgate.py b/homeassistant/components/light/scsgate.py index 275e9812ace..e8d104242a5 100644 --- a/homeassistant/components/light/scsgate.py +++ b/homeassistant/components/light/scsgate.py @@ -7,10 +7,9 @@ For more details about this platform, please refer to the documentation at https://home-assistant.io/components/light.scsgate/ """ import logging + import homeassistant.components.scsgate as scsgate - from homeassistant.components.light import Light - from homeassistant.const import ATTR_ENTITY_ID DEPENDENCIES = ['scsgate'] diff --git a/homeassistant/components/light/tellstick.py b/homeassistant/components/light/tellstick.py index 564d95f421b..c0f59abc10b 100644 --- a/homeassistant/components/light/tellstick.py +++ b/homeassistant/components/light/tellstick.py @@ -6,8 +6,9 @@ Support for Tellstick lights. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/light.tellstick/ """ -from homeassistant.components.light import Light, ATTR_BRIGHTNESS +from homeassistant.components.light import ATTR_BRIGHTNESS, Light from homeassistant.const import EVENT_HOMEASSISTANT_STOP + REQUIREMENTS = ['tellcore-py==1.1.2'] SIGNAL_REPETITIONS = 1 diff --git a/homeassistant/components/light/vera.py b/homeassistant/components/light/vera.py index dd5f4f2cbe2..179afa423ee 100644 --- a/homeassistant/components/light/vera.py +++ b/homeassistant/components/light/vera.py @@ -9,18 +9,12 @@ https://home-assistant.io/components/light.vera/ import logging from requests.exceptions import RequestException + import homeassistant.util.dt as dt_util - -from homeassistant.components.light import Light, ATTR_BRIGHTNESS - +from homeassistant.components.light import ATTR_BRIGHTNESS, Light from homeassistant.const import ( - ATTR_BATTERY_LEVEL, - ATTR_TRIPPED, - ATTR_ARMED, - ATTR_LAST_TRIP_TIME, - EVENT_HOMEASSISTANT_STOP, - STATE_ON, - STATE_OFF) + ATTR_ARMED, ATTR_BATTERY_LEVEL, ATTR_LAST_TRIP_TIME, ATTR_TRIPPED, + EVENT_HOMEASSISTANT_STOP, STATE_OFF, STATE_ON) REQUIREMENTS = ['pyvera==0.2.8'] diff --git a/homeassistant/components/light/zigbee.py b/homeassistant/components/light/zigbee.py index fe275804627..5b6fe7fdc40 100644 --- a/homeassistant/components/light/zigbee.py +++ b/homeassistant/components/light/zigbee.py @@ -10,7 +10,6 @@ from homeassistant.components.light import Light from homeassistant.components.zigbee import ( ZigBeeDigitalOut, ZigBeeDigitalOutConfig) - DEPENDENCIES = ["zigbee"] diff --git a/homeassistant/components/light/zwave.py b/homeassistant/components/light/zwave.py index 10d8cdef4d9..86cc7543073 100644 --- a/homeassistant/components/light/zwave.py +++ b/homeassistant/components/light/zwave.py @@ -10,11 +10,11 @@ https://home-assistant.io/components/light.zwave/ # pylint: disable=import-error from threading import Timer -from homeassistant.const import STATE_ON, STATE_OFF -from homeassistant.components.light import Light, ATTR_BRIGHTNESS, DOMAIN +from homeassistant.components.light import ATTR_BRIGHTNESS, DOMAIN, Light from homeassistant.components.zwave import ( - COMMAND_CLASS_SWITCH_MULTILEVEL, TYPE_BYTE, GENRE_USER, NETWORK, - ATTR_NODE_ID, ATTR_VALUE_ID, ZWaveDeviceEntity) + ATTR_NODE_ID, ATTR_VALUE_ID, COMMAND_CLASS_SWITCH_MULTILEVEL, GENRE_USER, + NETWORK, TYPE_BYTE, ZWaveDeviceEntity) +from homeassistant.const import STATE_OFF, STATE_ON def setup_platform(hass, config, add_devices, discovery_info=None): diff --git a/homeassistant/components/lock/verisure.py b/homeassistant/components/lock/verisure.py index 818f8621144..6b73793e612 100644 --- a/homeassistant/components/lock/verisure.py +++ b/homeassistant/components/lock/verisure.py @@ -10,10 +10,7 @@ import logging import homeassistant.components.verisure as verisure from homeassistant.components.lock import LockDevice - -from homeassistant.const import ( - STATE_UNKNOWN, - STATE_LOCKED, STATE_UNLOCKED) +from homeassistant.const import STATE_LOCKED, STATE_UNKNOWN, STATE_UNLOCKED _LOGGER = logging.getLogger(__name__) ATTR_CODE = 'code' diff --git a/homeassistant/components/logbook.py b/homeassistant/components/logbook.py index db1a4be3228..1e66c27686d 100644 --- a/homeassistant/components/logbook.py +++ b/homeassistant/components/logbook.py @@ -7,16 +7,17 @@ For more details about this component, please refer to the documentation at https://home-assistant.io/components/logbook/ """ import logging +import re from datetime import timedelta from itertools import groupby -import re -from homeassistant.core import State, DOMAIN as HA_DOMAIN -from homeassistant.const import ( - EVENT_STATE_CHANGED, STATE_NOT_HOME, STATE_ON, STATE_OFF, - EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP, HTTP_BAD_REQUEST) import homeassistant.util.dt as dt_util from homeassistant.components import recorder, sun +from homeassistant.const import ( + EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP, EVENT_STATE_CHANGED, + HTTP_BAD_REQUEST, STATE_NOT_HOME, STATE_OFF, STATE_ON) +from homeassistant.core import DOMAIN as HA_DOMAIN +from homeassistant.core import State from homeassistant.helpers.entity import split_entity_id from homeassistant.util import template diff --git a/homeassistant/components/media_player/cast.py b/homeassistant/components/media_player/cast.py index 4039c95c7fc..19b1dd46d3c 100644 --- a/homeassistant/components/media_player/cast.py +++ b/homeassistant/components/media_player/cast.py @@ -9,16 +9,14 @@ https://home-assistant.io/components/media_player.cast/ # pylint: disable=import-error import logging -from homeassistant.const import ( - STATE_PLAYING, STATE_PAUSED, STATE_IDLE, STATE_OFF, - STATE_UNKNOWN, CONF_HOST) - from homeassistant.components.media_player import ( - MediaPlayerDevice, - SUPPORT_PAUSE, SUPPORT_VOLUME_SET, SUPPORT_VOLUME_MUTE, - SUPPORT_TURN_ON, SUPPORT_TURN_OFF, SUPPORT_PLAY_MEDIA, - SUPPORT_PREVIOUS_TRACK, SUPPORT_NEXT_TRACK, - MEDIA_TYPE_MUSIC, MEDIA_TYPE_TVSHOW, MEDIA_TYPE_VIDEO) + MEDIA_TYPE_MUSIC, MEDIA_TYPE_TVSHOW, MEDIA_TYPE_VIDEO, SUPPORT_NEXT_TRACK, + SUPPORT_PAUSE, SUPPORT_PLAY_MEDIA, SUPPORT_PREVIOUS_TRACK, + SUPPORT_TURN_OFF, SUPPORT_TURN_ON, SUPPORT_VOLUME_MUTE, SUPPORT_VOLUME_SET, + MediaPlayerDevice) +from homeassistant.const import ( + CONF_HOST, STATE_IDLE, STATE_OFF, STATE_PAUSED, STATE_PLAYING, + STATE_UNKNOWN) REQUIREMENTS = ['pychromecast==0.7.1'] CONF_IGNORE_CEC = 'ignore_cec' diff --git a/homeassistant/components/media_player/demo.py b/homeassistant/components/media_player/demo.py index 98524275a5d..dfe8d781117 100644 --- a/homeassistant/components/media_player/demo.py +++ b/homeassistant/components/media_player/demo.py @@ -3,15 +3,12 @@ homeassistant.components.media_player.demo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Demo implementation of the media player. """ -from homeassistant.const import ( - STATE_PLAYING, STATE_PAUSED, STATE_OFF) - from homeassistant.components.media_player import ( - MediaPlayerDevice, - MEDIA_TYPE_VIDEO, MEDIA_TYPE_MUSIC, MEDIA_TYPE_TVSHOW, - SUPPORT_PAUSE, SUPPORT_VOLUME_SET, SUPPORT_VOLUME_MUTE, - SUPPORT_TURN_ON, SUPPORT_TURN_OFF, SUPPORT_PREVIOUS_TRACK, - SUPPORT_NEXT_TRACK, SUPPORT_PLAY_MEDIA) + MEDIA_TYPE_MUSIC, MEDIA_TYPE_TVSHOW, MEDIA_TYPE_VIDEO, SUPPORT_NEXT_TRACK, + SUPPORT_PAUSE, SUPPORT_PLAY_MEDIA, SUPPORT_PREVIOUS_TRACK, + SUPPORT_TURN_OFF, SUPPORT_TURN_ON, SUPPORT_VOLUME_MUTE, SUPPORT_VOLUME_SET, + MediaPlayerDevice) +from homeassistant.const import STATE_OFF, STATE_PAUSED, STATE_PLAYING # pylint: disable=unused-argument diff --git a/homeassistant/components/media_player/denon.py b/homeassistant/components/media_player/denon.py index 5d4b326f53e..2853dda90ac 100644 --- a/homeassistant/components/media_player/denon.py +++ b/homeassistant/components/media_player/denon.py @@ -6,16 +6,14 @@ Provides an interface to Denon Network Receivers. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/media_player.denon/ """ -import telnetlib import logging +import telnetlib from homeassistant.components.media_player import ( - MediaPlayerDevice, SUPPORT_PAUSE, SUPPORT_VOLUME_SET, - SUPPORT_VOLUME_MUTE, SUPPORT_PREVIOUS_TRACK, SUPPORT_NEXT_TRACK, - SUPPORT_TURN_ON, SUPPORT_TURN_OFF, - DOMAIN) -from homeassistant.const import ( - CONF_HOST, STATE_OFF, STATE_ON, STATE_UNKNOWN) + DOMAIN, SUPPORT_NEXT_TRACK, SUPPORT_PAUSE, SUPPORT_PREVIOUS_TRACK, + SUPPORT_TURN_OFF, SUPPORT_TURN_ON, SUPPORT_VOLUME_MUTE, SUPPORT_VOLUME_SET, + MediaPlayerDevice) +from homeassistant.const import CONF_HOST, STATE_OFF, STATE_ON, STATE_UNKNOWN _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/media_player/firetv.py b/homeassistant/components/media_player/firetv.py index 45e63a4534b..e151f1d516f 100644 --- a/homeassistant/components/media_player/firetv.py +++ b/homeassistant/components/media_player/firetv.py @@ -7,17 +7,15 @@ For more details about this platform, please refer to the documentation at https://home-assistant.io/components/media_player.firetv/ """ import logging + import requests -from homeassistant.const import ( - STATE_PLAYING, STATE_PAUSED, STATE_IDLE, STATE_OFF, - STATE_UNKNOWN, STATE_STANDBY) - from homeassistant.components.media_player import ( - MediaPlayerDevice, - SUPPORT_PAUSE, SUPPORT_VOLUME_SET, - SUPPORT_TURN_ON, SUPPORT_TURN_OFF, - SUPPORT_PREVIOUS_TRACK, SUPPORT_NEXT_TRACK) + SUPPORT_NEXT_TRACK, SUPPORT_PAUSE, SUPPORT_PREVIOUS_TRACK, + SUPPORT_TURN_OFF, SUPPORT_TURN_ON, SUPPORT_VOLUME_SET, MediaPlayerDevice) +from homeassistant.const import ( + STATE_IDLE, STATE_OFF, STATE_PAUSED, STATE_PLAYING, STATE_STANDBY, + STATE_UNKNOWN) SUPPORT_FIRETV = SUPPORT_PAUSE | \ SUPPORT_TURN_ON | SUPPORT_TURN_OFF | SUPPORT_PREVIOUS_TRACK | \ diff --git a/homeassistant/components/media_player/itunes.py b/homeassistant/components/media_player/itunes.py index 1f51885d731..584a692bd57 100644 --- a/homeassistant/components/media_player/itunes.py +++ b/homeassistant/components/media_player/itunes.py @@ -11,12 +11,12 @@ import logging import requests from homeassistant.components.media_player import ( - MediaPlayerDevice, MEDIA_TYPE_MUSIC, MEDIA_TYPE_PLAYLIST, SUPPORT_PAUSE, - SUPPORT_SEEK, SUPPORT_VOLUME_SET, SUPPORT_VOLUME_MUTE, - SUPPORT_PREVIOUS_TRACK, SUPPORT_NEXT_TRACK, SUPPORT_TURN_ON, - SUPPORT_TURN_OFF, SUPPORT_PLAY_MEDIA) + MEDIA_TYPE_MUSIC, MEDIA_TYPE_PLAYLIST, SUPPORT_NEXT_TRACK, SUPPORT_PAUSE, + SUPPORT_PLAY_MEDIA, SUPPORT_PREVIOUS_TRACK, SUPPORT_SEEK, SUPPORT_TURN_OFF, + SUPPORT_TURN_ON, SUPPORT_VOLUME_MUTE, SUPPORT_VOLUME_SET, + MediaPlayerDevice) from homeassistant.const import ( - STATE_IDLE, STATE_PLAYING, STATE_PAUSED, STATE_OFF, STATE_ON) + STATE_IDLE, STATE_OFF, STATE_ON, STATE_PAUSED, STATE_PLAYING) _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/media_player/kodi.py b/homeassistant/components/media_player/kodi.py index 8b8d78fcae3..f7a7e9cf53a 100644 --- a/homeassistant/components/media_player/kodi.py +++ b/homeassistant/components/media_player/kodi.py @@ -6,14 +6,14 @@ Provides an interface to the XBMC/Kodi JSON-RPC API For more details about this platform, please refer to the documentation at https://home-assistant.io/components/media_player.kodi/ """ -import urllib import logging +import urllib from homeassistant.components.media_player import ( - MediaPlayerDevice, SUPPORT_PAUSE, SUPPORT_SEEK, SUPPORT_VOLUME_SET, - SUPPORT_VOLUME_MUTE, SUPPORT_PREVIOUS_TRACK, SUPPORT_NEXT_TRACK) + SUPPORT_NEXT_TRACK, SUPPORT_PAUSE, SUPPORT_PREVIOUS_TRACK, SUPPORT_SEEK, + SUPPORT_VOLUME_MUTE, SUPPORT_VOLUME_SET, MediaPlayerDevice) from homeassistant.const import ( - STATE_IDLE, STATE_PLAYING, STATE_PAUSED, STATE_OFF) + STATE_IDLE, STATE_OFF, STATE_PAUSED, STATE_PLAYING) _LOGGER = logging.getLogger(__name__) REQUIREMENTS = ['jsonrpc-requests==0.1'] diff --git a/homeassistant/components/media_player/mpd.py b/homeassistant/components/media_player/mpd.py index bef707c2711..a4a6c0cac61 100644 --- a/homeassistant/components/media_player/mpd.py +++ b/homeassistant/components/media_player/mpd.py @@ -9,15 +9,11 @@ https://home-assistant.io/components/media_player.mpd/ import logging import socket - -from homeassistant.const import ( - STATE_PLAYING, STATE_PAUSED, STATE_OFF) - from homeassistant.components.media_player import ( - MediaPlayerDevice, - SUPPORT_PAUSE, SUPPORT_VOLUME_SET, SUPPORT_TURN_OFF, - SUPPORT_TURN_ON, SUPPORT_PREVIOUS_TRACK, SUPPORT_NEXT_TRACK, - MEDIA_TYPE_MUSIC) + MEDIA_TYPE_MUSIC, SUPPORT_NEXT_TRACK, SUPPORT_PAUSE, + SUPPORT_PREVIOUS_TRACK, SUPPORT_TURN_OFF, SUPPORT_TURN_ON, + SUPPORT_VOLUME_SET, MediaPlayerDevice) +from homeassistant.const import STATE_OFF, STATE_PAUSED, STATE_PLAYING _LOGGER = logging.getLogger(__name__) REQUIREMENTS = ['python-mpd2==0.5.4'] diff --git a/homeassistant/components/media_player/plex.py b/homeassistant/components/media_player/plex.py index 94af635496d..0d68d7e9c30 100644 --- a/homeassistant/components/media_player/plex.py +++ b/homeassistant/components/media_player/plex.py @@ -6,20 +6,20 @@ Provides an interface to the Plex API. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/media_player.plex/ """ -import os import json import logging +import os from datetime import timedelta from urllib.parse import urlparse -from homeassistant.loader import get_component import homeassistant.util as util from homeassistant.components.media_player import ( - MediaPlayerDevice, SUPPORT_PAUSE, SUPPORT_PREVIOUS_TRACK, - SUPPORT_NEXT_TRACK, MEDIA_TYPE_TVSHOW, MEDIA_TYPE_VIDEO) + MEDIA_TYPE_TVSHOW, MEDIA_TYPE_VIDEO, SUPPORT_NEXT_TRACK, SUPPORT_PAUSE, + SUPPORT_PREVIOUS_TRACK, MediaPlayerDevice) from homeassistant.const import ( - DEVICE_DEFAULT_NAME, STATE_IDLE, STATE_PLAYING, - STATE_PAUSED, STATE_OFF, STATE_UNKNOWN) + DEVICE_DEFAULT_NAME, STATE_IDLE, STATE_OFF, STATE_PAUSED, STATE_PLAYING, + STATE_UNKNOWN) +from homeassistant.loader import get_component REQUIREMENTS = ['plexapi==1.1.0'] MIN_TIME_BETWEEN_SCANS = timedelta(seconds=10) diff --git a/homeassistant/components/media_player/samsungtv.py b/homeassistant/components/media_player/samsungtv.py index 1d2703b0e2e..f7dc7f2a15b 100644 --- a/homeassistant/components/media_player/samsungtv.py +++ b/homeassistant/components/media_player/samsungtv.py @@ -10,14 +10,11 @@ import logging import socket from homeassistant.components.media_player import ( - MediaPlayerDevice, SUPPORT_PAUSE, SUPPORT_VOLUME_STEP, - SUPPORT_VOLUME_MUTE, SUPPORT_PREVIOUS_TRACK, - SUPPORT_NEXT_TRACK, SUPPORT_TURN_OFF, - DOMAIN) + DOMAIN, SUPPORT_NEXT_TRACK, SUPPORT_PAUSE, SUPPORT_PREVIOUS_TRACK, + SUPPORT_TURN_OFF, SUPPORT_VOLUME_MUTE, SUPPORT_VOLUME_STEP, + MediaPlayerDevice) from homeassistant.const import ( - CONF_HOST, CONF_NAME, STATE_OFF, - STATE_ON, STATE_UNKNOWN) - + CONF_HOST, CONF_NAME, STATE_OFF, STATE_ON, STATE_UNKNOWN) from homeassistant.helpers import validate_config CONF_PORT = "port" diff --git a/homeassistant/components/media_player/snapcast.py b/homeassistant/components/media_player/snapcast.py index 23ce1515f39..5c8bd24a79d 100644 --- a/homeassistant/components/media_player/snapcast.py +++ b/homeassistant/components/media_player/snapcast.py @@ -10,12 +10,9 @@ https://home-assistant.io/components/media_player.snapcast/ import logging import socket -from homeassistant.const import ( - STATE_ON, STATE_OFF) - from homeassistant.components.media_player import ( - MediaPlayerDevice, - SUPPORT_VOLUME_SET, SUPPORT_VOLUME_MUTE) + SUPPORT_VOLUME_MUTE, SUPPORT_VOLUME_SET, MediaPlayerDevice) +from homeassistant.const import STATE_OFF, STATE_ON SUPPORT_SNAPCAST = SUPPORT_VOLUME_SET | SUPPORT_VOLUME_MUTE DOMAIN = 'snapcast' diff --git a/homeassistant/components/media_player/sonos.py b/homeassistant/components/media_player/sonos.py index 7a66c3d354c..c0f9133a3d0 100644 --- a/homeassistant/components/media_player/sonos.py +++ b/homeassistant/components/media_player/sonos.py @@ -6,17 +6,15 @@ Provides an interface to Sonos players (via SoCo) For more details about this platform, please refer to the documentation at https://home-assistant.io/components/media_player.sonos/ """ -import logging import datetime +import logging from homeassistant.components.media_player import ( - MediaPlayerDevice, SUPPORT_PAUSE, SUPPORT_SEEK, SUPPORT_VOLUME_SET, - SUPPORT_VOLUME_MUTE, SUPPORT_PREVIOUS_TRACK, SUPPORT_NEXT_TRACK, - MEDIA_TYPE_MUSIC) - + MEDIA_TYPE_MUSIC, SUPPORT_NEXT_TRACK, SUPPORT_PAUSE, + SUPPORT_PREVIOUS_TRACK, SUPPORT_SEEK, SUPPORT_VOLUME_MUTE, + SUPPORT_VOLUME_SET, MediaPlayerDevice) from homeassistant.const import ( - STATE_IDLE, STATE_PLAYING, STATE_PAUSED, STATE_UNKNOWN) - + STATE_IDLE, STATE_PAUSED, STATE_PLAYING, STATE_UNKNOWN) REQUIREMENTS = ['SoCo==0.11.1'] diff --git a/homeassistant/components/media_player/squeezebox.py b/homeassistant/components/media_player/squeezebox.py index 5b0adfc7c4e..457e1bc539a 100644 --- a/homeassistant/components/media_player/squeezebox.py +++ b/homeassistant/components/media_player/squeezebox.py @@ -11,14 +11,12 @@ import telnetlib import urllib.parse from homeassistant.components.media_player import ( - MediaPlayerDevice, SUPPORT_PAUSE, SUPPORT_SEEK, SUPPORT_VOLUME_SET, - SUPPORT_VOLUME_MUTE, SUPPORT_PREVIOUS_TRACK, SUPPORT_NEXT_TRACK, - SUPPORT_TURN_ON, SUPPORT_TURN_OFF, - MEDIA_TYPE_MUSIC, DOMAIN) - + DOMAIN, MEDIA_TYPE_MUSIC, SUPPORT_NEXT_TRACK, SUPPORT_PAUSE, + SUPPORT_PREVIOUS_TRACK, SUPPORT_SEEK, SUPPORT_TURN_OFF, SUPPORT_TURN_ON, + SUPPORT_VOLUME_MUTE, SUPPORT_VOLUME_SET, MediaPlayerDevice) from homeassistant.const import ( - CONF_HOST, CONF_USERNAME, CONF_PASSWORD, - STATE_IDLE, STATE_PLAYING, STATE_PAUSED, STATE_OFF, STATE_UNKNOWN) + CONF_HOST, CONF_PASSWORD, CONF_USERNAME, STATE_IDLE, STATE_OFF, + STATE_PAUSED, STATE_PLAYING, STATE_UNKNOWN) _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/media_player/universal.py b/homeassistant/components/media_player/universal.py index bb5edacd79f..2bc4a8506f6 100644 --- a/homeassistant/components/media_player/universal.py +++ b/homeassistant/components/media_player/universal.py @@ -7,34 +7,28 @@ For more details about this platform, please refer to the documentation at https://home-assistant.io/components/media_player.universal/ """ +import logging # pylint: disable=import-error from copy import copy -import logging - -from homeassistant.helpers.event import track_state_change -from homeassistant.helpers.service import call_from_config - -from homeassistant.const import ( - STATE_IDLE, STATE_ON, STATE_OFF, CONF_NAME, - ATTR_ENTITY_ID, ATTR_ENTITY_PICTURE, - SERVICE_TURN_OFF, SERVICE_TURN_ON, - SERVICE_VOLUME_UP, SERVICE_VOLUME_DOWN, SERVICE_VOLUME_SET, - SERVICE_VOLUME_MUTE, - SERVICE_MEDIA_PLAY_PAUSE, SERVICE_MEDIA_PLAY, SERVICE_MEDIA_PAUSE, - SERVICE_MEDIA_NEXT_TRACK, SERVICE_MEDIA_PREVIOUS_TRACK, SERVICE_MEDIA_SEEK) from homeassistant.components.media_player import ( - MediaPlayerDevice, DOMAIN, - SUPPORT_VOLUME_STEP, SUPPORT_VOLUME_SET, SUPPORT_VOLUME_MUTE, - SUPPORT_TURN_ON, SUPPORT_TURN_OFF, - SERVICE_PLAY_MEDIA, - ATTR_SUPPORTED_MEDIA_COMMANDS, ATTR_MEDIA_VOLUME_MUTED, - ATTR_MEDIA_CONTENT_ID, ATTR_MEDIA_CONTENT_TYPE, ATTR_MEDIA_DURATION, - ATTR_MEDIA_TITLE, ATTR_MEDIA_ARTIST, ATTR_MEDIA_ALBUM_NAME, - ATTR_MEDIA_TRACK, ATTR_MEDIA_SERIES_TITLE, ATTR_MEDIA_ALBUM_ARTIST, - ATTR_MEDIA_SEASON, ATTR_MEDIA_EPISODE, ATTR_MEDIA_CHANNEL, - ATTR_MEDIA_PLAYLIST, ATTR_APP_ID, ATTR_APP_NAME, ATTR_MEDIA_VOLUME_LEVEL, - ATTR_MEDIA_SEEK_POSITION) + ATTR_APP_ID, ATTR_APP_NAME, ATTR_MEDIA_ALBUM_ARTIST, ATTR_MEDIA_ALBUM_NAME, + ATTR_MEDIA_ARTIST, ATTR_MEDIA_CHANNEL, ATTR_MEDIA_CONTENT_ID, + ATTR_MEDIA_CONTENT_TYPE, ATTR_MEDIA_DURATION, ATTR_MEDIA_EPISODE, + ATTR_MEDIA_PLAYLIST, ATTR_MEDIA_SEASON, ATTR_MEDIA_SEEK_POSITION, + ATTR_MEDIA_SERIES_TITLE, ATTR_MEDIA_TITLE, ATTR_MEDIA_TRACK, + ATTR_MEDIA_VOLUME_LEVEL, ATTR_MEDIA_VOLUME_MUTED, + ATTR_SUPPORTED_MEDIA_COMMANDS, DOMAIN, SERVICE_PLAY_MEDIA, + SUPPORT_TURN_OFF, SUPPORT_TURN_ON, SUPPORT_VOLUME_MUTE, SUPPORT_VOLUME_SET, + SUPPORT_VOLUME_STEP, MediaPlayerDevice) +from homeassistant.const import ( + ATTR_ENTITY_ID, ATTR_ENTITY_PICTURE, CONF_NAME, SERVICE_MEDIA_NEXT_TRACK, + SERVICE_MEDIA_PAUSE, SERVICE_MEDIA_PLAY, SERVICE_MEDIA_PLAY_PAUSE, + SERVICE_MEDIA_PREVIOUS_TRACK, SERVICE_MEDIA_SEEK, SERVICE_TURN_OFF, + SERVICE_TURN_ON, SERVICE_VOLUME_DOWN, SERVICE_VOLUME_MUTE, + SERVICE_VOLUME_SET, SERVICE_VOLUME_UP, STATE_IDLE, STATE_OFF, STATE_ON) +from homeassistant.helpers.event import track_state_change +from homeassistant.helpers.service import call_from_config ATTR_ACTIVE_CHILD = 'active_child' diff --git a/homeassistant/components/modbus.py b/homeassistant/components/modbus.py index 6f53c89835a..0c625968f14 100644 --- a/homeassistant/components/modbus.py +++ b/homeassistant/components/modbus.py @@ -8,8 +8,8 @@ https://home-assistant.io/components/modbus/ """ import logging -from homeassistant.const import (EVENT_HOMEASSISTANT_START, - EVENT_HOMEASSISTANT_STOP) +from homeassistant.const import ( + EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP) DOMAIN = "modbus" diff --git a/homeassistant/components/mqtt_eventstream.py b/homeassistant/components/mqtt_eventstream.py index e69639572ca..0574c07ebf9 100644 --- a/homeassistant/components/mqtt_eventstream.py +++ b/homeassistant/components/mqtt_eventstream.py @@ -7,18 +7,14 @@ For more details about this component, please refer to the documentation at https://home-assistant.io/components/mqtt_eventstream.html """ import json -from homeassistant.core import EventOrigin, State + +import homeassistant.loader as loader from homeassistant.components.mqtt import DOMAIN as MQTT_DOMAIN from homeassistant.components.mqtt import SERVICE_PUBLISH as MQTT_SVC_PUBLISH from homeassistant.const import ( - ATTR_SERVICE_DATA, - MATCH_ALL, - EVENT_TIME_CHANGED, - EVENT_CALL_SERVICE, - EVENT_SERVICE_EXECUTED, - EVENT_STATE_CHANGED, -) -import homeassistant.loader as loader + ATTR_SERVICE_DATA, EVENT_CALL_SERVICE, EVENT_SERVICE_EXECUTED, + EVENT_STATE_CHANGED, EVENT_TIME_CHANGED, MATCH_ALL) +from homeassistant.core import EventOrigin, State from homeassistant.remote import JSONEncoder # The domain of your component. Should be equal to the name of your component diff --git a/homeassistant/components/mysensors.py b/homeassistant/components/mysensors.py index 30775c4daae..53987fa1435 100644 --- a/homeassistant/components/mysensors.py +++ b/homeassistant/components/mysensors.py @@ -10,14 +10,11 @@ https://home-assistant.io/components/sensor.mysensors/ """ import logging -from homeassistant.helpers import validate_config import homeassistant.bootstrap as bootstrap - from homeassistant.const import ( - EVENT_HOMEASSISTANT_START, - EVENT_HOMEASSISTANT_STOP, - EVENT_PLATFORM_DISCOVERED, ATTR_SERVICE, ATTR_DISCOVERED, - TEMP_CELCIUS,) + ATTR_DISCOVERED, ATTR_SERVICE, EVENT_HOMEASSISTANT_START, + EVENT_HOMEASSISTANT_STOP, EVENT_PLATFORM_DISCOVERED, TEMP_CELCIUS) +from homeassistant.helpers import validate_config CONF_GATEWAYS = 'gateways' CONF_PORT = 'port' diff --git a/homeassistant/components/nest.py b/homeassistant/components/nest.py index 1b1d940595a..c5daf7e0734 100644 --- a/homeassistant/components/nest.py +++ b/homeassistant/components/nest.py @@ -8,7 +8,7 @@ https://home-assistant.io/components/thermostat.nest/ """ import logging -from homeassistant.const import (CONF_USERNAME, CONF_PASSWORD) +from homeassistant.const import CONF_PASSWORD, CONF_USERNAME REQUIREMENTS = ['python-nest==2.6.0'] DOMAIN = 'nest' diff --git a/homeassistant/components/notify/demo.py b/homeassistant/components/notify/demo.py index c9afabd0a6b..4ff4ec3931c 100644 --- a/homeassistant/components/notify/demo.py +++ b/homeassistant/components/notify/demo.py @@ -6,7 +6,6 @@ Demo notification service. """ from homeassistant.components.notify import ATTR_TITLE, BaseNotificationService - EVENT_NOTIFY = "notify" diff --git a/homeassistant/components/notify/file.py b/homeassistant/components/notify/file.py index 1469ac4558f..5f9befa9510 100644 --- a/homeassistant/components/notify/file.py +++ b/homeassistant/components/notify/file.py @@ -10,9 +10,9 @@ import logging import os import homeassistant.util.dt as dt_util -from homeassistant.helpers import validate_config from homeassistant.components.notify import ( - DOMAIN, ATTR_TITLE, BaseNotificationService) + ATTR_TITLE, DOMAIN, BaseNotificationService) +from homeassistant.helpers import validate_config _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/notify/free_mobile.py b/homeassistant/components/notify/free_mobile.py index 3589dc58658..10ba96e2e73 100644 --- a/homeassistant/components/notify/free_mobile.py +++ b/homeassistant/components/notify/free_mobile.py @@ -7,10 +7,10 @@ For more details about this platform, please refer to the documentation at https://home-assistant.io/components/notify.free_mobile/ """ import logging + +from homeassistant.components.notify import DOMAIN, BaseNotificationService +from homeassistant.const import CONF_ACCESS_TOKEN, CONF_USERNAME from homeassistant.helpers import validate_config -from homeassistant.components.notify import ( - DOMAIN, BaseNotificationService) -from homeassistant.const import CONF_USERNAME, CONF_ACCESS_TOKEN _LOGGER = logging.getLogger(__name__) REQUIREMENTS = ['freesms==0.1.0'] diff --git a/homeassistant/components/notify/googlevoice.py b/homeassistant/components/notify/googlevoice.py index e37586c5cf6..c66ec5e99a3 100644 --- a/homeassistant/components/notify/googlevoice.py +++ b/homeassistant/components/notify/googlevoice.py @@ -7,10 +7,11 @@ For more details about this platform, please refer to the documentation at https://home-assistant.io/components/notify.free_mobile/ """ import logging -from homeassistant.helpers import validate_config + from homeassistant.components.notify import ( - DOMAIN, ATTR_TARGET, BaseNotificationService) -from homeassistant.const import CONF_USERNAME, CONF_PASSWORD + ATTR_TARGET, DOMAIN, BaseNotificationService) +from homeassistant.const import CONF_PASSWORD, CONF_USERNAME +from homeassistant.helpers import validate_config _LOGGER = logging.getLogger(__name__) REQUIREMENTS = ['https://github.com/w1ll1am23/pygooglevoice-sms/archive/' diff --git a/homeassistant/components/notify/instapush.py b/homeassistant/components/notify/instapush.py index fbc9e3cbbbd..d3dd05d7e54 100644 --- a/homeassistant/components/notify/instapush.py +++ b/homeassistant/components/notify/instapush.py @@ -6,15 +6,15 @@ Instapush notification service. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/notify.instapush/ """ -import logging import json +import logging import requests -from homeassistant.helpers import validate_config from homeassistant.components.notify import ( - DOMAIN, ATTR_TITLE, BaseNotificationService) + ATTR_TITLE, DOMAIN, BaseNotificationService) from homeassistant.const import CONF_API_KEY +from homeassistant.helpers import validate_config _LOGGER = logging.getLogger(__name__) _RESOURCE = 'https://api.instapush.im/v1/' diff --git a/homeassistant/components/notify/nma.py b/homeassistant/components/notify/nma.py index 74ed796804c..5133bbf287d 100644 --- a/homeassistant/components/notify/nma.py +++ b/homeassistant/components/notify/nma.py @@ -11,10 +11,10 @@ import xml.etree.ElementTree as ET import requests -from homeassistant.helpers import validate_config from homeassistant.components.notify import ( - DOMAIN, ATTR_TITLE, BaseNotificationService) + ATTR_TITLE, DOMAIN, BaseNotificationService) from homeassistant.const import CONF_API_KEY +from homeassistant.helpers import validate_config _LOGGER = logging.getLogger(__name__) _RESOURCE = 'https://www.notifymyandroid.com/publicapi/' diff --git a/homeassistant/components/notify/pushbullet.py b/homeassistant/components/notify/pushbullet.py index 941a78ac709..c7fbf5478e3 100644 --- a/homeassistant/components/notify/pushbullet.py +++ b/homeassistant/components/notify/pushbullet.py @@ -9,7 +9,7 @@ https://home-assistant.io/components/notify.pushbullet/ import logging from homeassistant.components.notify import ( - ATTR_TITLE, ATTR_TARGET, BaseNotificationService) + ATTR_TARGET, ATTR_TITLE, BaseNotificationService) from homeassistant.const import CONF_API_KEY _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/notify/pushetta.py b/homeassistant/components/notify/pushetta.py index 22bbd5175c6..d2c797d2fd7 100644 --- a/homeassistant/components/notify/pushetta.py +++ b/homeassistant/components/notify/pushetta.py @@ -8,10 +8,10 @@ https://home-assistant.io/components/notify.pushetta/ """ import logging -from homeassistant.helpers import validate_config from homeassistant.components.notify import ( - DOMAIN, ATTR_TITLE, BaseNotificationService) + ATTR_TITLE, DOMAIN, BaseNotificationService) from homeassistant.const import CONF_API_KEY +from homeassistant.helpers import validate_config _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/notify/pushover.py b/homeassistant/components/notify/pushover.py index 7c776300cdb..6eaa1b91643 100644 --- a/homeassistant/components/notify/pushover.py +++ b/homeassistant/components/notify/pushover.py @@ -8,10 +8,10 @@ https://home-assistant.io/components/notify.pushover/ """ import logging -from homeassistant.helpers import validate_config from homeassistant.components.notify import ( - DOMAIN, ATTR_TITLE, BaseNotificationService) + ATTR_TITLE, DOMAIN, BaseNotificationService) from homeassistant.const import CONF_API_KEY +from homeassistant.helpers import validate_config REQUIREMENTS = ['python-pushover==0.2'] _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/notify/rest.py b/homeassistant/components/notify/rest.py index e0bb50216bd..7f5582fd0fe 100644 --- a/homeassistant/components/notify/rest.py +++ b/homeassistant/components/notify/rest.py @@ -7,11 +7,12 @@ For more details about this platform, please refer to the documentation at https://home-assistant.io/components/notify.rest/ """ import logging + import requests -from homeassistant.helpers import validate_config from homeassistant.components.notify import ( - DOMAIN, ATTR_TITLE, ATTR_TARGET, BaseNotificationService) + ATTR_TARGET, ATTR_TITLE, DOMAIN, BaseNotificationService) +from homeassistant.helpers import validate_config _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/notify/slack.py b/homeassistant/components/notify/slack.py index 7a386d8864f..75034aebb32 100644 --- a/homeassistant/components/notify/slack.py +++ b/homeassistant/components/notify/slack.py @@ -8,9 +8,9 @@ https://home-assistant.io/components/notify.slack/ """ import logging -from homeassistant.helpers import validate_config from homeassistant.components.notify import DOMAIN, BaseNotificationService from homeassistant.const import CONF_API_KEY +from homeassistant.helpers import validate_config REQUIREMENTS = ['slacker==0.6.8'] _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/notify/smtp.py b/homeassistant/components/notify/smtp.py index 833fffb9f99..8ee48ed9644 100644 --- a/homeassistant/components/notify/smtp.py +++ b/homeassistant/components/notify/smtp.py @@ -10,9 +10,9 @@ import logging import smtplib from email.mime.text import MIMEText -from homeassistant.helpers import validate_config from homeassistant.components.notify import ( - DOMAIN, ATTR_TITLE, BaseNotificationService) + ATTR_TITLE, DOMAIN, BaseNotificationService) +from homeassistant.helpers import validate_config _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/notify/syslog.py b/homeassistant/components/notify/syslog.py index 56075a6dd09..b568ce7d41c 100644 --- a/homeassistant/components/notify/syslog.py +++ b/homeassistant/components/notify/syslog.py @@ -8,9 +8,9 @@ https://home-assistant.io/components/notify.syslog/ """ import logging -from homeassistant.helpers import validate_config from homeassistant.components.notify import ( - DOMAIN, ATTR_TITLE, BaseNotificationService) + ATTR_TITLE, DOMAIN, BaseNotificationService) +from homeassistant.helpers import validate_config _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/notify/telegram.py b/homeassistant/components/notify/telegram.py index c5dd917cb39..727ba578765 100644 --- a/homeassistant/components/notify/telegram.py +++ b/homeassistant/components/notify/telegram.py @@ -9,10 +9,10 @@ https://home-assistant.io/components/notify.telegram/ import logging import urllib -from homeassistant.helpers import validate_config from homeassistant.components.notify import ( - DOMAIN, ATTR_TITLE, BaseNotificationService) + ATTR_TITLE, DOMAIN, BaseNotificationService) from homeassistant.const import CONF_API_KEY +from homeassistant.helpers import validate_config _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/notify/twitter.py b/homeassistant/components/notify/twitter.py index e2a27d68a05..e0770381d72 100644 --- a/homeassistant/components/notify/twitter.py +++ b/homeassistant/components/notify/twitter.py @@ -7,10 +7,10 @@ For more details about this platform, please refer to the documentation at https://home-assistant.io/components/notify.twitter/ """ import logging -from homeassistant.helpers import validate_config -from homeassistant.components.notify import ( - DOMAIN, BaseNotificationService) + +from homeassistant.components.notify import DOMAIN, BaseNotificationService from homeassistant.const import CONF_ACCESS_TOKEN +from homeassistant.helpers import validate_config _LOGGER = logging.getLogger(__name__) REQUIREMENTS = ['TwitterAPI==2.3.6'] diff --git a/homeassistant/components/notify/xmpp.py b/homeassistant/components/notify/xmpp.py index 4b688fb7a79..9b3bec0b195 100644 --- a/homeassistant/components/notify/xmpp.py +++ b/homeassistant/components/notify/xmpp.py @@ -8,9 +8,9 @@ https://home-assistant.io/components/notify.xmpp/ """ import logging -from homeassistant.helpers import validate_config from homeassistant.components.notify import ( - DOMAIN, ATTR_TITLE, BaseNotificationService) + ATTR_TITLE, DOMAIN, BaseNotificationService) +from homeassistant.helpers import validate_config REQUIREMENTS = ['sleekxmpp==1.3.1', 'dnspython3==1.12.0'] diff --git a/homeassistant/components/proximity.py b/homeassistant/components/proximity.py index 1bad6a7c485..ba52dce91e0 100644 --- a/homeassistant/components/proximity.py +++ b/homeassistant/components/proximity.py @@ -8,8 +8,9 @@ For more details about this component, please refer to the documentation at https://home-assistant.io/components/proximity/ """ import logging -from homeassistant.helpers.event import track_state_change + from homeassistant.helpers.entity import Entity +from homeassistant.helpers.event import track_state_change from homeassistant.util.location import distance DEPENDENCIES = ['zone', 'device_tracker'] diff --git a/homeassistant/components/recorder.py b/homeassistant/components/recorder.py index 5476d082b38..eb30a930cae 100644 --- a/homeassistant/components/recorder.py +++ b/homeassistant/components/recorder.py @@ -7,20 +7,20 @@ to query this database. For more details about this component, please refer to the documentation at https://home-assistant.io/components/recorder/ """ +import atexit +import json import logging -import threading import queue import sqlite3 -from datetime import datetime, date -import json -import atexit +import threading +from datetime import date, datetime -from homeassistant.core import Event, EventOrigin, State import homeassistant.util.dt as dt_util -from homeassistant.remote import JSONEncoder from homeassistant.const import ( - MATCH_ALL, EVENT_TIME_CHANGED, EVENT_STATE_CHANGED, - EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP) + EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP, EVENT_STATE_CHANGED, + EVENT_TIME_CHANGED, MATCH_ALL) +from homeassistant.core import Event, EventOrigin, State +from homeassistant.remote import JSONEncoder DOMAIN = "recorder" diff --git a/homeassistant/components/rfxtrx.py b/homeassistant/components/rfxtrx.py index 60736585c28..4789348c69a 100644 --- a/homeassistant/components/rfxtrx.py +++ b/homeassistant/components/rfxtrx.py @@ -7,6 +7,7 @@ For more details about this component, please refer to the documentation at https://home-assistant.io/components/rfxtrx/ """ import logging + from homeassistant.util import slugify REQUIREMENTS = ['https://github.com/Danielhiversen/pyRFXtrx/archive/0.4.zip' + diff --git a/homeassistant/components/rollershutter/demo.py b/homeassistant/components/rollershutter/demo.py index 4ffeb6be6dd..d4af86d4cab 100644 --- a/homeassistant/components/rollershutter/demo.py +++ b/homeassistant/components/rollershutter/demo.py @@ -3,9 +3,9 @@ homeassistant.components.rollershutter.demo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Demo platform for the rollorshutter component. """ +from homeassistant.components.rollershutter import RollershutterDevice from homeassistant.const import EVENT_TIME_CHANGED from homeassistant.helpers.event import track_utc_time_change -from homeassistant.components.rollershutter import RollershutterDevice def setup_platform(hass, config, add_devices, discovery_info=None): diff --git a/homeassistant/components/rollershutter/mqtt.py b/homeassistant/components/rollershutter/mqtt.py index 2951d772be0..97c8094f865 100644 --- a/homeassistant/components/rollershutter/mqtt.py +++ b/homeassistant/components/rollershutter/mqtt.py @@ -7,9 +7,10 @@ For more details about this platform, please refer to the documentation at https://home-assistant.io/components/rollershutter.mqtt/ """ import logging + import homeassistant.components.mqtt as mqtt -from homeassistant.const import CONF_VALUE_TEMPLATE from homeassistant.components.rollershutter import RollershutterDevice +from homeassistant.const import CONF_VALUE_TEMPLATE from homeassistant.util import template _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/rollershutter/scsgate.py b/homeassistant/components/rollershutter/scsgate.py index e47d1574697..55261a2a617 100644 --- a/homeassistant/components/rollershutter/scsgate.py +++ b/homeassistant/components/rollershutter/scsgate.py @@ -7,10 +7,10 @@ For more details about this platform, please refer to the documentation at https://home-assistant.io/components/rollershutter.scsgate/ """ import logging + import homeassistant.components.scsgate as scsgate from homeassistant.components.rollershutter import RollershutterDevice - DEPENDENCIES = ['scsgate'] diff --git a/homeassistant/components/rpi_gpio.py b/homeassistant/components/rpi_gpio.py index 804cb555ae0..899d51c4cde 100644 --- a/homeassistant/components/rpi_gpio.py +++ b/homeassistant/components/rpi_gpio.py @@ -8,8 +8,10 @@ https://home-assistant.io/components/rpi_gpio/ """ # pylint: disable=import-error import logging -from homeassistant.const import (EVENT_HOMEASSISTANT_START, - EVENT_HOMEASSISTANT_STOP) + +from homeassistant.const import ( + EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP) + REQUIREMENTS = ['RPi.GPIO==0.6.1'] DOMAIN = "rpi_gpio" _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/scene.py b/homeassistant/components/scene.py index ce1a3242542..494c224c416 100644 --- a/homeassistant/components/scene.py +++ b/homeassistant/components/scene.py @@ -9,12 +9,12 @@ https://home-assistant.io/components/scene/ import logging from collections import namedtuple +from homeassistant.const import ( + ATTR_ENTITY_ID, SERVICE_TURN_ON, STATE_OFF, STATE_ON) from homeassistant.core import State from homeassistant.helpers.entity import Entity from homeassistant.helpers.entity_component import EntityComponent from homeassistant.helpers.state import reproduce_state -from homeassistant.const import ( - ATTR_ENTITY_ID, STATE_OFF, STATE_ON, SERVICE_TURN_ON) DOMAIN = 'scene' DEPENDENCIES = ['group'] diff --git a/homeassistant/components/script.py b/homeassistant/components/script.py index 167ddb55957..59b55a1289b 100644 --- a/homeassistant/components/script.py +++ b/homeassistant/components/script.py @@ -8,19 +8,19 @@ For more details about this component, please refer to the documentation at https://home-assistant.io/components/script/ """ import logging +import threading from datetime import timedelta from itertools import islice -import threading -from homeassistant.helpers.entity_component import EntityComponent +import homeassistant.util.dt as date_util +from homeassistant.const import ( + ATTR_ENTITY_ID, EVENT_TIME_CHANGED, SERVICE_TURN_OFF, SERVICE_TURN_ON, + STATE_ON) from homeassistant.helpers.entity import ToggleEntity, split_entity_id +from homeassistant.helpers.entity_component import EntityComponent from homeassistant.helpers.event import track_point_in_utc_time from homeassistant.helpers.service import call_from_config from homeassistant.util import slugify -import homeassistant.util.dt as date_util -from homeassistant.const import ( - ATTR_ENTITY_ID, EVENT_TIME_CHANGED, STATE_ON, SERVICE_TURN_ON, - SERVICE_TURN_OFF) DOMAIN = "script" ENTITY_ID_FORMAT = DOMAIN + '.{}' diff --git a/homeassistant/components/scsgate.py b/homeassistant/components/scsgate.py index 5f913b4f608..ded340eb241 100644 --- a/homeassistant/components/scsgate.py +++ b/homeassistant/components/scsgate.py @@ -8,6 +8,7 @@ https://home-assistant.io/components/scsgate/ """ import logging from threading import Lock + from homeassistant.core import EVENT_HOMEASSISTANT_STOP REQUIREMENTS = ['scsgate==0.1.0'] diff --git a/homeassistant/components/sensor/apcupsd.py b/homeassistant/components/sensor/apcupsd.py index 8a566225438..bed8740a55e 100644 --- a/homeassistant/components/sensor/apcupsd.py +++ b/homeassistant/components/sensor/apcupsd.py @@ -8,9 +8,9 @@ https://home-assistant.io/components/sensor.apcupsd/ """ import logging +from homeassistant.components import apcupsd from homeassistant.const import TEMP_CELCIUS from homeassistant.helpers.entity import Entity -from homeassistant.components import apcupsd DEPENDENCIES = [apcupsd.DOMAIN] DEFAULT_NAME = "UPS Status" diff --git a/homeassistant/components/sensor/arduino.py b/homeassistant/components/sensor/arduino.py index d4020e465c3..a99765808f8 100644 --- a/homeassistant/components/sensor/arduino.py +++ b/homeassistant/components/sensor/arduino.py @@ -10,8 +10,8 @@ https://home-assistant.io/components/sensor.arduino/ import logging import homeassistant.components.arduino as arduino -from homeassistant.helpers.entity import Entity from homeassistant.const import DEVICE_DEFAULT_NAME +from homeassistant.helpers.entity import Entity DEPENDENCIES = ['arduino'] diff --git a/homeassistant/components/sensor/arest.py b/homeassistant/components/sensor/arest.py index dd9281c484a..0a1680c2aa2 100644 --- a/homeassistant/components/sensor/arest.py +++ b/homeassistant/components/sensor/arest.py @@ -6,16 +6,16 @@ The arest sensor will consume an exposed aREST API of a device. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/sensor.arest/ """ -from datetime import timedelta import logging +from datetime import timedelta import requests -from homeassistant.const import (ATTR_UNIT_OF_MEASUREMENT, CONF_VALUE_TEMPLATE, - DEVICE_DEFAULT_NAME) +from homeassistant.const import ( + ATTR_UNIT_OF_MEASUREMENT, CONF_VALUE_TEMPLATE, DEVICE_DEFAULT_NAME) from homeassistant.exceptions import TemplateError from homeassistant.helpers.entity import Entity -from homeassistant.util import template, Throttle +from homeassistant.util import Throttle, template _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/sensor/bitcoin.py b/homeassistant/components/sensor/bitcoin.py index fe17ff574b1..d2b05d774e4 100644 --- a/homeassistant/components/sensor/bitcoin.py +++ b/homeassistant/components/sensor/bitcoin.py @@ -9,9 +9,8 @@ https://home-assistant.io/components/sensor.bitcoin/ import logging from datetime import timedelta -from homeassistant.util import Throttle from homeassistant.helpers.entity import Entity - +from homeassistant.util import Throttle REQUIREMENTS = ['blockchain==1.2.1'] _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/sensor/bloomsky.py b/homeassistant/components/sensor/bloomsky.py index ca7765d6bd6..902b42d6e3f 100644 --- a/homeassistant/components/sensor/bloomsky.py +++ b/homeassistant/components/sensor/bloomsky.py @@ -7,8 +7,9 @@ For more details about this component, please refer to the documentation at https://home-assistant.io/components/sensor.bloomsky/ """ import logging -from homeassistant.loader import get_component + from homeassistant.helpers.entity import Entity +from homeassistant.loader import get_component DEPENDENCIES = ["bloomsky"] diff --git a/homeassistant/components/sensor/command_sensor.py b/homeassistant/components/sensor/command_sensor.py index 95751e73645..a0877ac6888 100644 --- a/homeassistant/components/sensor/command_sensor.py +++ b/homeassistant/components/sensor/command_sensor.py @@ -12,7 +12,7 @@ from datetime import timedelta from homeassistant.const import CONF_VALUE_TEMPLATE from homeassistant.helpers.entity import Entity -from homeassistant.util import template, Throttle +from homeassistant.util import Throttle, template _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/sensor/demo.py b/homeassistant/components/sensor/demo.py index a3b9b8a2692..f0ddbd4a2a0 100644 --- a/homeassistant/components/sensor/demo.py +++ b/homeassistant/components/sensor/demo.py @@ -3,8 +3,8 @@ homeassistant.components.sensor.demo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Demo platform that has a couple of fake sensors. """ +from homeassistant.const import ATTR_BATTERY_LEVEL, TEMP_CELCIUS from homeassistant.helpers.entity import Entity -from homeassistant.const import TEMP_CELCIUS, ATTR_BATTERY_LEVEL # pylint: disable=unused-argument diff --git a/homeassistant/components/sensor/dht.py b/homeassistant/components/sensor/dht.py index 14bb7f6bf99..a3019f2b84d 100644 --- a/homeassistant/components/sensor/dht.py +++ b/homeassistant/components/sensor/dht.py @@ -9,9 +9,9 @@ https://home-assistant.io/components/sensor.dht/ import logging from datetime import timedelta -from homeassistant.util import Throttle from homeassistant.const import TEMP_FAHRENHEIT from homeassistant.helpers.entity import Entity +from homeassistant.util import Throttle # update this requirement to upstream as soon as it supports python3 REQUIREMENTS = ['http://github.com/mala-zaba/Adafruit_Python_DHT/archive/' diff --git a/homeassistant/components/sensor/dweet.py b/homeassistant/components/sensor/dweet.py index 8aa55c847cf..f1b90d59f47 100644 --- a/homeassistant/components/sensor/dweet.py +++ b/homeassistant/components/sensor/dweet.py @@ -6,14 +6,13 @@ Displays values from Dweet.io. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/sensor.dweet/ """ -from datetime import timedelta -import logging import json +import logging +from datetime import timedelta -from homeassistant.util import Throttle -from homeassistant.util import template +from homeassistant.const import CONF_VALUE_TEMPLATE, STATE_UNKNOWN from homeassistant.helpers.entity import Entity -from homeassistant.const import (STATE_UNKNOWN, CONF_VALUE_TEMPLATE) +from homeassistant.util import Throttle, template _LOGGER = logging.getLogger(__name__) REQUIREMENTS = ['dweepy==0.2.0'] diff --git a/homeassistant/components/sensor/ecobee.py b/homeassistant/components/sensor/ecobee.py index a0f6f817d66..39ba1d1ef50 100644 --- a/homeassistant/components/sensor/ecobee.py +++ b/homeassistant/components/sensor/ecobee.py @@ -8,9 +8,9 @@ https://home-assistant.io/components/sensor.ecobee/ """ import logging -from homeassistant.helpers.entity import Entity from homeassistant.components import ecobee from homeassistant.const import TEMP_FAHRENHEIT +from homeassistant.helpers.entity import Entity DEPENDENCIES = ['ecobee'] SENSOR_TYPES = { diff --git a/homeassistant/components/sensor/efergy.py b/homeassistant/components/sensor/efergy.py index 23023b90fe1..71c8f8ed789 100644 --- a/homeassistant/components/sensor/efergy.py +++ b/homeassistant/components/sensor/efergy.py @@ -8,7 +8,8 @@ For more details about this platform, please refer to the documentation at https://home-assistant.io/components/sensor.efergy/ """ import logging -from requests import get, RequestException + +from requests import RequestException, get from homeassistant.helpers.entity import Entity diff --git a/homeassistant/components/sensor/eliqonline.py b/homeassistant/components/sensor/eliqonline.py index 4f30e1efd00..fb5cd0f1211 100644 --- a/homeassistant/components/sensor/eliqonline.py +++ b/homeassistant/components/sensor/eliqonline.py @@ -8,8 +8,9 @@ https://home-assistant.io/components/sensor.eliqonline/ """ import logging from urllib.error import URLError + +from homeassistant.const import CONF_ACCESS_TOKEN, CONF_NAME, STATE_UNKNOWN from homeassistant.helpers.entity import Entity -from homeassistant.const import (STATE_UNKNOWN, CONF_ACCESS_TOKEN, CONF_NAME) _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/sensor/forecast.py b/homeassistant/components/sensor/forecast.py index 8cbc332678e..5e080a341c0 100644 --- a/homeassistant/components/sensor/forecast.py +++ b/homeassistant/components/sensor/forecast.py @@ -9,9 +9,9 @@ https://home-assistant.io/components/sensor.forecast/ import logging from datetime import timedelta -from homeassistant.util import Throttle -from homeassistant.const import (CONF_API_KEY, TEMP_CELCIUS) +from homeassistant.const import CONF_API_KEY, TEMP_CELCIUS from homeassistant.helpers.entity import Entity +from homeassistant.util import Throttle REQUIREMENTS = ['python-forecastio==1.3.3'] _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/sensor/glances.py b/homeassistant/components/sensor/glances.py index eb38e3df265..be46c20ba77 100644 --- a/homeassistant/components/sensor/glances.py +++ b/homeassistant/components/sensor/glances.py @@ -6,14 +6,14 @@ Gathers system information of hosts which running glances. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/sensor.glances/ """ -from datetime import timedelta import logging +from datetime import timedelta import requests -from homeassistant.util import Throttle -from homeassistant.helpers.entity import Entity from homeassistant.const import STATE_UNKNOWN +from homeassistant.helpers.entity import Entity +from homeassistant.util import Throttle _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/sensor/isy994.py b/homeassistant/components/sensor/isy994.py index 9e4ccf4dedb..8ef42ab5b2d 100644 --- a/homeassistant/components/sensor/isy994.py +++ b/homeassistant/components/sensor/isy994.py @@ -8,10 +8,10 @@ https://home-assistant.io/components/isy994/ """ import logging -from homeassistant.components.isy994 import (ISY, ISYDeviceABC, SENSOR_STRING, - HIDDEN_STRING) -from homeassistant.const import (STATE_OPEN, STATE_CLOSED, STATE_HOME, - STATE_NOT_HOME, STATE_ON, STATE_OFF) +from homeassistant.components.isy994 import ( + HIDDEN_STRING, ISY, SENSOR_STRING, ISYDeviceABC) +from homeassistant.const import ( + STATE_CLOSED, STATE_HOME, STATE_NOT_HOME, STATE_OFF, STATE_ON, STATE_OPEN) DEFAULT_HIDDEN_WEATHER = ['Temperature_High', 'Temperature_Low', 'Feels_Like', 'Temperature_Average', 'Pressure', 'Dew_Point', diff --git a/homeassistant/components/sensor/mfi.py b/homeassistant/components/sensor/mfi.py index d361fa9f690..c29d5cea7b8 100644 --- a/homeassistant/components/sensor/mfi.py +++ b/homeassistant/components/sensor/mfi.py @@ -8,11 +8,10 @@ https://home-assistant.io/components/sensor.mfi/ """ import logging -from homeassistant.const import (CONF_USERNAME, CONF_PASSWORD, - TEMP_CELCIUS) from homeassistant.components.sensor import DOMAIN -from homeassistant.helpers.entity import Entity +from homeassistant.const import CONF_PASSWORD, CONF_USERNAME, TEMP_CELCIUS from homeassistant.helpers import validate_config +from homeassistant.helpers.entity import Entity REQUIREMENTS = ['mficlient==0.2.2'] diff --git a/homeassistant/components/sensor/modbus.py b/homeassistant/components/sensor/modbus.py index 269a9f2dc96..2483855c589 100644 --- a/homeassistant/components/sensor/modbus.py +++ b/homeassistant/components/sensor/modbus.py @@ -9,10 +9,9 @@ https://home-assistant.io/components/sensor.modbus/ import logging import homeassistant.components.modbus as modbus -from homeassistant.helpers.entity import Entity from homeassistant.const import ( - TEMP_CELCIUS, TEMP_FAHRENHEIT, - STATE_ON, STATE_OFF) + STATE_OFF, STATE_ON, TEMP_CELCIUS, TEMP_FAHRENHEIT) +from homeassistant.helpers.entity import Entity _LOGGER = logging.getLogger(__name__) DEPENDENCIES = ['modbus'] diff --git a/homeassistant/components/sensor/mqtt.py b/homeassistant/components/sensor/mqtt.py index 032462430e0..1e6a49ad9c4 100644 --- a/homeassistant/components/sensor/mqtt.py +++ b/homeassistant/components/sensor/mqtt.py @@ -7,10 +7,11 @@ For more details about this platform, please refer to the documentation at https://home-assistant.io/components/sensor.mqtt/ """ import logging + +import homeassistant.components.mqtt as mqtt from homeassistant.const import CONF_VALUE_TEMPLATE, STATE_UNKNOWN from homeassistant.helpers.entity import Entity from homeassistant.util import template -import homeassistant.components.mqtt as mqtt _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/sensor/mysensors.py b/homeassistant/components/sensor/mysensors.py index ca4df33462b..d33be7f2903 100644 --- a/homeassistant/components/sensor/mysensors.py +++ b/homeassistant/components/sensor/mysensors.py @@ -6,14 +6,10 @@ https://home-assistant.io/components/sensor.mysensors/ """ import logging -from homeassistant.helpers.entity import Entity - -from homeassistant.const import ( - ATTR_BATTERY_LEVEL, - TEMP_CELCIUS, - STATE_ON, STATE_OFF) - import homeassistant.components.mysensors as mysensors +from homeassistant.const import ( + ATTR_BATTERY_LEVEL, STATE_OFF, STATE_ON, TEMP_CELCIUS) +from homeassistant.helpers.entity import Entity _LOGGER = logging.getLogger(__name__) DEPENDENCIES = [] diff --git a/homeassistant/components/sensor/nest.py b/homeassistant/components/sensor/nest.py index f3a5e5dca7c..8aab84fae6b 100644 --- a/homeassistant/components/sensor/nest.py +++ b/homeassistant/components/sensor/nest.py @@ -8,10 +8,10 @@ https://home-assistant.io/components/sensor.nest/ """ import logging import socket -import homeassistant.components.nest as nest -from homeassistant.helpers.entity import Entity +import homeassistant.components.nest as nest from homeassistant.const import TEMP_CELCIUS +from homeassistant.helpers.entity import Entity DEPENDENCIES = ['nest'] SENSOR_TYPES = ['humidity', diff --git a/homeassistant/components/sensor/netatmo.py b/homeassistant/components/sensor/netatmo.py index 0375fcf4d74..29271b82ea9 100644 --- a/homeassistant/components/sensor/netatmo.py +++ b/homeassistant/components/sensor/netatmo.py @@ -8,11 +8,12 @@ https://home-assistant.io/components/sensor.netatmo/ """ import logging from datetime import timedelta + from homeassistant.components.sensor import DOMAIN -from homeassistant.const import (CONF_API_KEY, CONF_USERNAME, CONF_PASSWORD, - TEMP_CELCIUS) -from homeassistant.helpers.entity import Entity +from homeassistant.const import ( + CONF_API_KEY, CONF_PASSWORD, CONF_USERNAME, TEMP_CELCIUS) from homeassistant.helpers import validate_config +from homeassistant.helpers.entity import Entity from homeassistant.util import Throttle REQUIREMENTS = [ diff --git a/homeassistant/components/sensor/neurio_energy.py b/homeassistant/components/sensor/neurio_energy.py index 9a2b0652789..f3b22c0383c 100644 --- a/homeassistant/components/sensor/neurio_energy.py +++ b/homeassistant/components/sensor/neurio_energy.py @@ -6,6 +6,7 @@ For more details about this platform, please refer to the documentation at https://home-assistant.io/components/sensor.neurio_energy/ """ import logging + import requests.exceptions from homeassistant.helpers.entity import Entity diff --git a/homeassistant/components/sensor/onewire.py b/homeassistant/components/sensor/onewire.py index c1cadb71e19..5a198864c38 100644 --- a/homeassistant/components/sensor/onewire.py +++ b/homeassistant/components/sensor/onewire.py @@ -6,11 +6,12 @@ Support for DS18B20 One Wire Sensors. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/sensor.onewire/ """ -from glob import glob import logging import os import time -from homeassistant.const import TEMP_CELCIUS, STATE_UNKNOWN +from glob import glob + +from homeassistant.const import STATE_UNKNOWN, TEMP_CELCIUS from homeassistant.helpers.entity import Entity BASE_DIR = '/sys/bus/w1/devices/' diff --git a/homeassistant/components/sensor/openweathermap.py b/homeassistant/components/sensor/openweathermap.py index ad5693cab03..49c1eadf36c 100644 --- a/homeassistant/components/sensor/openweathermap.py +++ b/homeassistant/components/sensor/openweathermap.py @@ -9,9 +9,9 @@ https://home-assistant.io/components/sensor.openweathermap/ import logging from datetime import timedelta -from homeassistant.util import Throttle -from homeassistant.const import (CONF_API_KEY, TEMP_CELCIUS, TEMP_FAHRENHEIT) +from homeassistant.const import CONF_API_KEY, TEMP_CELCIUS, TEMP_FAHRENHEIT from homeassistant.helpers.entity import Entity +from homeassistant.util import Throttle REQUIREMENTS = ['pyowm==2.3.0'] _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/sensor/rest.py b/homeassistant/components/sensor/rest.py index fdbc1ab26e3..fb6499366f1 100644 --- a/homeassistant/components/sensor/rest.py +++ b/homeassistant/components/sensor/rest.py @@ -6,13 +6,14 @@ The rest sensor will consume responses sent by an exposed REST API. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/sensor.rest/ """ -from datetime import timedelta import logging +from datetime import timedelta + import requests -from homeassistant.const import (CONF_VALUE_TEMPLATE, STATE_UNKNOWN) -from homeassistant.util import template, Throttle +from homeassistant.const import CONF_VALUE_TEMPLATE, STATE_UNKNOWN from homeassistant.helpers.entity import Entity +from homeassistant.util import Throttle, template _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/sensor/rfxtrx.py b/homeassistant/components/sensor/rfxtrx.py index 80485dfefcf..66e8c9f218e 100644 --- a/homeassistant/components/sensor/rfxtrx.py +++ b/homeassistant/components/sensor/rfxtrx.py @@ -9,9 +9,9 @@ https://home-assistant.io/components/sensor.rfxtrx/ import logging from collections import OrderedDict -from homeassistant.const import (TEMP_CELCIUS) -from homeassistant.helpers.entity import Entity import homeassistant.components.rfxtrx as rfxtrx +from homeassistant.const import TEMP_CELCIUS +from homeassistant.helpers.entity import Entity from homeassistant.util import slugify DEPENDENCIES = ['rfxtrx'] diff --git a/homeassistant/components/sensor/sabnzbd.py b/homeassistant/components/sensor/sabnzbd.py index 6b42453b5d3..5d8de104a5a 100644 --- a/homeassistant/components/sensor/sabnzbd.py +++ b/homeassistant/components/sensor/sabnzbd.py @@ -6,8 +6,8 @@ Monitors SABnzbd NZB client API. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/sensor.sabnzbd/ """ -from datetime import timedelta import logging +from datetime import timedelta from homeassistant.helpers.entity import Entity from homeassistant.util import Throttle diff --git a/homeassistant/components/sensor/speedtest.py b/homeassistant/components/sensor/speedtest.py index 7bb3c77ed09..629495f2be0 100644 --- a/homeassistant/components/sensor/speedtest.py +++ b/homeassistant/components/sensor/speedtest.py @@ -7,15 +7,16 @@ For more details about this platform, please refer to the documentation at https://home-assistant.io/components/sensor.speedtest/ """ import logging -import sys import re +import sys from datetime import timedelta from subprocess import check_output -from homeassistant.util import Throttle + +import homeassistant.util.dt as dt_util +from homeassistant.components.sensor import DOMAIN from homeassistant.helpers.entity import Entity from homeassistant.helpers.event import track_time_change -from homeassistant.components.sensor import DOMAIN -import homeassistant.util.dt as dt_util +from homeassistant.util import Throttle REQUIREMENTS = ['speedtest-cli==0.3.4'] _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/sensor/swiss_public_transport.py b/homeassistant/components/sensor/swiss_public_transport.py index 5304101900b..4d44e58619f 100644 --- a/homeassistant/components/sensor/swiss_public_transport.py +++ b/homeassistant/components/sensor/swiss_public_transport.py @@ -9,11 +9,12 @@ https://home-assistant.io/components/sensor.swiss_public_transport/ """ import logging from datetime import timedelta + import requests -from homeassistant.util import Throttle import homeassistant.util.dt as dt_util from homeassistant.helpers.entity import Entity +from homeassistant.util import Throttle _LOGGER = logging.getLogger(__name__) _RESOURCE = 'http://transport.opendata.ch/v1/' diff --git a/homeassistant/components/sensor/systemmonitor.py b/homeassistant/components/sensor/systemmonitor.py index 63052e71b93..9e191a112b0 100644 --- a/homeassistant/components/sensor/systemmonitor.py +++ b/homeassistant/components/sensor/systemmonitor.py @@ -9,8 +9,8 @@ https://home-assistant.io/components/sensor.systemmonitor/ import logging import homeassistant.util.dt as dt_util +from homeassistant.const import STATE_OFF, STATE_ON from homeassistant.helpers.entity import Entity -from homeassistant.const import STATE_ON, STATE_OFF REQUIREMENTS = ['psutil==3.4.2'] SENSOR_TYPES = { diff --git a/homeassistant/components/sensor/tellduslive.py b/homeassistant/components/sensor/tellduslive.py index fd7679f89bf..001d20ee792 100644 --- a/homeassistant/components/sensor/tellduslive.py +++ b/homeassistant/components/sensor/tellduslive.py @@ -8,14 +8,12 @@ https://home-assistant.io/components/sensor.tellduslive/ """ import logging - from datetime import datetime -from homeassistant.const import (TEMP_CELCIUS, - ATTR_BATTERY_LEVEL, - DEVICE_DEFAULT_NAME) -from homeassistant.helpers.entity import Entity from homeassistant.components import tellduslive +from homeassistant.const import ( + ATTR_BATTERY_LEVEL, DEVICE_DEFAULT_NAME, TEMP_CELCIUS) +from homeassistant.helpers.entity import Entity ATTR_LAST_UPDATED = "time_last_updated" diff --git a/homeassistant/components/sensor/tellstick.py b/homeassistant/components/sensor/tellstick.py index c6993de462d..0b8b80c3388 100644 --- a/homeassistant/components/sensor/tellstick.py +++ b/homeassistant/components/sensor/tellstick.py @@ -9,9 +9,9 @@ https://home-assistant.io/components/sensor.tellstick/ import logging from collections import namedtuple +import homeassistant.util as util from homeassistant.const import TEMP_CELCIUS from homeassistant.helpers.entity import Entity -import homeassistant.util as util DatatypeDescription = namedtuple("DatatypeDescription", ['name', 'unit']) diff --git a/homeassistant/components/sensor/temper.py b/homeassistant/components/sensor/temper.py index fe12053643c..a330ef064c0 100644 --- a/homeassistant/components/sensor/temper.py +++ b/homeassistant/components/sensor/temper.py @@ -7,8 +7,9 @@ For more details about this platform, please refer to the documentation at https://home-assistant.io/components/sensor.temper/ """ import logging -from homeassistant.helpers.entity import Entity + from homeassistant.const import CONF_NAME, DEVICE_DEFAULT_NAME +from homeassistant.helpers.entity import Entity _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/sensor/template.py b/homeassistant/components/sensor/template.py index 17b739f88cc..0b58c075893 100644 --- a/homeassistant/components/sensor/template.py +++ b/homeassistant/components/sensor/template.py @@ -9,17 +9,13 @@ https://home-assistant.io/components/sensor.template/ """ import logging -from homeassistant.helpers.entity import Entity, generate_entity_id -from homeassistant.core import EVENT_STATE_CHANGED -from homeassistant.const import ( - ATTR_FRIENDLY_NAME, - CONF_VALUE_TEMPLATE, - ATTR_UNIT_OF_MEASUREMENT) - -from homeassistant.util import template, slugify -from homeassistant.exceptions import TemplateError - from homeassistant.components.sensor import DOMAIN +from homeassistant.const import ( + ATTR_FRIENDLY_NAME, ATTR_UNIT_OF_MEASUREMENT, CONF_VALUE_TEMPLATE) +from homeassistant.core import EVENT_STATE_CHANGED +from homeassistant.exceptions import TemplateError +from homeassistant.helpers.entity import Entity, generate_entity_id +from homeassistant.util import slugify, template ENTITY_ID_FORMAT = DOMAIN + '.{}' diff --git a/homeassistant/components/sensor/torque.py b/homeassistant/components/sensor/torque.py index e123aa2d18c..c3e5b8541ad 100644 --- a/homeassistant/components/sensor/torque.py +++ b/homeassistant/components/sensor/torque.py @@ -8,10 +8,10 @@ https://home-assistant.io/components/sensor.torque/ """ import re + from homeassistant.const import HTTP_OK from homeassistant.helpers.entity import Entity - DOMAIN = 'torque' DEPENDENCIES = ['http'] SENSOR_EMAIL_FIELD = 'eml' diff --git a/homeassistant/components/sensor/transmission.py b/homeassistant/components/sensor/transmission.py index 26062cbba4d..662394f3b18 100644 --- a/homeassistant/components/sensor/transmission.py +++ b/homeassistant/components/sensor/transmission.py @@ -6,12 +6,12 @@ Monitors Transmission BitTorrent client API. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/sensor.transmission/ """ -from datetime import timedelta import logging +from datetime import timedelta -from homeassistant.const import CONF_HOST, CONF_USERNAME, CONF_PASSWORD -from homeassistant.util import Throttle +from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME from homeassistant.helpers.entity import Entity +from homeassistant.util import Throttle REQUIREMENTS = ['transmissionrpc==0.11'] SENSOR_TYPES = { diff --git a/homeassistant/components/sensor/twitch.py b/homeassistant/components/sensor/twitch.py index 7a65211268e..ea743992fb4 100644 --- a/homeassistant/components/sensor/twitch.py +++ b/homeassistant/components/sensor/twitch.py @@ -6,8 +6,8 @@ A sensor for the Twitch stream status. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/sensor.twitch/ """ -from homeassistant.helpers.entity import Entity from homeassistant.const import ATTR_ENTITY_PICTURE +from homeassistant.helpers.entity import Entity STATE_STREAMING = 'streaming' STATE_OFFLINE = 'offline' diff --git a/homeassistant/components/sensor/vera.py b/homeassistant/components/sensor/vera.py index 8839cdc4e1c..d919b57e2cd 100644 --- a/homeassistant/components/sensor/vera.py +++ b/homeassistant/components/sensor/vera.py @@ -7,13 +7,14 @@ For more details about this platform, please refer to the documentation at https://home-assistant.io/components/sensor.vera/ """ import logging -from requests.exceptions import RequestException -import homeassistant.util.dt as dt_util -from homeassistant.helpers.entity import Entity +from requests.exceptions import RequestException + +import homeassistant.util.dt as dt_util from homeassistant.const import ( - ATTR_BATTERY_LEVEL, ATTR_TRIPPED, ATTR_ARMED, ATTR_LAST_TRIP_TIME, - TEMP_CELCIUS, TEMP_FAHRENHEIT, EVENT_HOMEASSISTANT_STOP) + ATTR_ARMED, ATTR_BATTERY_LEVEL, ATTR_LAST_TRIP_TIME, ATTR_TRIPPED, + EVENT_HOMEASSISTANT_STOP, TEMP_CELCIUS, TEMP_FAHRENHEIT) +from homeassistant.helpers.entity import Entity REQUIREMENTS = ['pyvera==0.2.8'] diff --git a/homeassistant/components/sensor/verisure.py b/homeassistant/components/sensor/verisure.py index 1ba750aa3e9..f397242615d 100644 --- a/homeassistant/components/sensor/verisure.py +++ b/homeassistant/components/sensor/verisure.py @@ -9,9 +9,8 @@ documentation at https://home-assistant.io/components/verisure/ import logging import homeassistant.components.verisure as verisure - -from homeassistant.helpers.entity import Entity from homeassistant.const import TEMP_CELCIUS +from homeassistant.helpers.entity import Entity _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/sensor/wink.py b/homeassistant/components/sensor/wink.py index 71fadff157b..3eca0858433 100644 --- a/homeassistant/components/sensor/wink.py +++ b/homeassistant/components/sensor/wink.py @@ -8,8 +8,8 @@ at https://home-assistant.io/components/sensor.wink/ """ import logging +from homeassistant.const import CONF_ACCESS_TOKEN, STATE_CLOSED, STATE_OPEN from homeassistant.helpers.entity import Entity -from homeassistant.const import CONF_ACCESS_TOKEN, STATE_OPEN, STATE_CLOSED REQUIREMENTS = ['python-wink==0.6.0'] diff --git a/homeassistant/components/sensor/yr.py b/homeassistant/components/sensor/yr.py index 85d90264462..c4a743f21a0 100644 --- a/homeassistant/components/sensor/yr.py +++ b/homeassistant/components/sensor/yr.py @@ -10,11 +10,11 @@ import logging import requests -from homeassistant.const import (ATTR_ENTITY_PICTURE, - CONF_LATITUDE, - CONF_LONGITUDE) +from homeassistant.const import ( + ATTR_ENTITY_PICTURE, CONF_LATITUDE, CONF_LONGITUDE) from homeassistant.helpers.entity import Entity -from homeassistant.util import location, dt as dt_util +from homeassistant.util import dt as dt_util +from homeassistant.util import location _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/sensor/zigbee.py b/homeassistant/components/sensor/zigbee.py index 78023df93f8..1f165e97c44 100644 --- a/homeassistant/components/sensor/zigbee.py +++ b/homeassistant/components/sensor/zigbee.py @@ -10,11 +10,10 @@ https://home-assistant.io/components/sensor.zigbee/ import logging from binascii import hexlify -from homeassistant.core import JobPriority -from homeassistant.const import TEMP_CELCIUS -from homeassistant.helpers.entity import Entity from homeassistant.components import zigbee - +from homeassistant.const import TEMP_CELCIUS +from homeassistant.core import JobPriority +from homeassistant.helpers.entity import Entity DEPENDENCIES = ["zigbee"] _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/sensor/zwave.py b/homeassistant/components/sensor/zwave.py index ddca961f3a5..f011b82b9f3 100644 --- a/homeassistant/components/sensor/zwave.py +++ b/homeassistant/components/sensor/zwave.py @@ -10,17 +10,16 @@ at https://home-assistant.io/components/zwave/ # pylint: disable=import-error import datetime -from homeassistant.helpers.event import track_point_in_time import homeassistant.util.dt as dt_util from homeassistant.components.sensor import DOMAIN -from homeassistant.helpers.entity import Entity from homeassistant.components.zwave import ( - NETWORK, ATTR_NODE_ID, ATTR_VALUE_ID, COMMAND_CLASS_SENSOR_BINARY, - COMMAND_CLASS_SENSOR_MULTILEVEL, COMMAND_CLASS_METER, TYPE_DECIMAL, - COMMAND_CLASS_ALARM, ZWaveDeviceEntity, get_config_value) - + ATTR_NODE_ID, ATTR_VALUE_ID, COMMAND_CLASS_ALARM, COMMAND_CLASS_METER, + COMMAND_CLASS_SENSOR_BINARY, COMMAND_CLASS_SENSOR_MULTILEVEL, NETWORK, + TYPE_DECIMAL, ZWaveDeviceEntity, get_config_value) from homeassistant.const import ( - STATE_ON, STATE_OFF, TEMP_CELCIUS, TEMP_FAHRENHEIT) + STATE_OFF, STATE_ON, TEMP_CELCIUS, TEMP_FAHRENHEIT) +from homeassistant.helpers.entity import Entity +from homeassistant.helpers.event import track_point_in_time PHILIO = '0x013c' PHILIO_SLIM_SENSOR = '0x0002' diff --git a/homeassistant/components/simple_alarm.py b/homeassistant/components/simple_alarm.py index 7c45e199dfc..6fb48e708c5 100644 --- a/homeassistant/components/simple_alarm.py +++ b/homeassistant/components/simple_alarm.py @@ -9,8 +9,8 @@ https://home-assistant.io/components/simple_alarm/ import logging import homeassistant.loader as loader +from homeassistant.const import STATE_HOME, STATE_NOT_HOME, STATE_OFF, STATE_ON from homeassistant.helpers.event import track_state_change -from homeassistant.const import STATE_ON, STATE_OFF, STATE_HOME, STATE_NOT_HOME DOMAIN = "simple_alarm" diff --git a/homeassistant/components/splunk.py b/homeassistant/components/splunk.py index fd9a15b67ae..6db577865eb 100644 --- a/homeassistant/components/splunk.py +++ b/homeassistant/components/splunk.py @@ -13,9 +13,9 @@ import logging import requests import homeassistant.util as util -from homeassistant.helpers import validate_config -from homeassistant.helpers import state as state_helper from homeassistant.const import EVENT_STATE_CHANGED +from homeassistant.helpers import state as state_helper +from homeassistant.helpers import validate_config _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/statsd.py b/homeassistant/components/statsd.py index 640b703d5d9..6dbf1ae8bda 100644 --- a/homeassistant/components/statsd.py +++ b/homeassistant/components/statsd.py @@ -7,6 +7,7 @@ For more details about this component, please refer to the documentation at https://home-assistant.io/components/statsd/ """ import logging + import homeassistant.util as util from homeassistant.const import EVENT_STATE_CHANGED from homeassistant.helpers import state as state_helper diff --git a/homeassistant/components/sun.py b/homeassistant/components/sun.py index 303e352d55a..90b3432ba13 100644 --- a/homeassistant/components/sun.py +++ b/homeassistant/components/sun.py @@ -10,10 +10,11 @@ import logging from datetime import timedelta import homeassistant.util as util -from homeassistant.util import location as location_util, dt as dt_util +from homeassistant.helpers.entity import Entity from homeassistant.helpers.event import ( track_point_in_utc_time, track_utc_time_change) -from homeassistant.helpers.entity import Entity +from homeassistant.util import dt as dt_util +from homeassistant.util import location as location_util REQUIREMENTS = ['astral==0.9'] DOMAIN = "sun" diff --git a/homeassistant/components/switch/arest.py b/homeassistant/components/switch/arest.py index c42295660d4..957ae7bab92 100644 --- a/homeassistant/components/switch/arest.py +++ b/homeassistant/components/switch/arest.py @@ -8,6 +8,7 @@ For more details about this platform, please refer to the documentation at https://home-assistant.io/components/switch.arest/ """ import logging + import requests from homeassistant.components.switch import SwitchDevice diff --git a/homeassistant/components/switch/edimax.py b/homeassistant/components/switch/edimax.py index 25978147853..82a5a2222a4 100644 --- a/homeassistant/components/switch/edimax.py +++ b/homeassistant/components/switch/edimax.py @@ -8,10 +8,10 @@ https://home-assistant.io/components/switch.edimax/ """ import logging +from homeassistant.components.switch import DOMAIN, SwitchDevice +from homeassistant.const import ( + CONF_HOST, CONF_NAME, CONF_PASSWORD, CONF_USERNAME) from homeassistant.helpers import validate_config -from homeassistant.components.switch import SwitchDevice, DOMAIN -from homeassistant.const import CONF_HOST, CONF_USERNAME, CONF_PASSWORD,\ - CONF_NAME # constants DEFAULT_USERNAME = 'admin' diff --git a/homeassistant/components/switch/hikvisioncam.py b/homeassistant/components/switch/hikvisioncam.py index c85aae4a7f0..15ce210f6e9 100644 --- a/homeassistant/components/switch/hikvisioncam.py +++ b/homeassistant/components/switch/hikvisioncam.py @@ -8,9 +8,9 @@ https://home-assistant.io/components/switch.hikvision/ """ import logging +from homeassistant.const import ( + CONF_HOST, CONF_PASSWORD, CONF_USERNAME, STATE_OFF, STATE_ON) from homeassistant.helpers.entity import ToggleEntity -from homeassistant.const import (STATE_ON, STATE_OFF, - CONF_HOST, CONF_USERNAME, CONF_PASSWORD) _LOGGING = logging.getLogger(__name__) REQUIREMENTS = ['hikvision==0.4'] diff --git a/homeassistant/components/switch/isy994.py b/homeassistant/components/switch/isy994.py index c8a04a66709..0ee45aef4db 100644 --- a/homeassistant/components/switch/isy994.py +++ b/homeassistant/components/switch/isy994.py @@ -8,9 +8,11 @@ https://home-assistant.io/components/isy994/ """ import logging -from homeassistant.components.isy994 import (ISY, ISYDeviceABC, SENSOR_STRING, - HIDDEN_STRING) -from homeassistant.const import STATE_ON, STATE_OFF # STATE_OPEN, STATE_CLOSED +from homeassistant.components.isy994 import ( + HIDDEN_STRING, ISY, SENSOR_STRING, ISYDeviceABC) +from homeassistant.const import STATE_OFF, STATE_ON # STATE_OPEN, STATE_CLOSED + + # The frontend doesn't seem to fully support the open and closed states yet. # Once it does, the HA.doors programs should report open and closed instead of # off and on. It appears that on should be open and off should be closed. diff --git a/homeassistant/components/switch/mfi.py b/homeassistant/components/switch/mfi.py index 46cfdb56213..42abe75af60 100644 --- a/homeassistant/components/switch/mfi.py +++ b/homeassistant/components/switch/mfi.py @@ -9,7 +9,7 @@ https://home-assistant.io/components/switch.mfi/ import logging from homeassistant.components.switch import DOMAIN, SwitchDevice -from homeassistant.const import CONF_USERNAME, CONF_PASSWORD +from homeassistant.const import CONF_PASSWORD, CONF_USERNAME from homeassistant.helpers import validate_config REQUIREMENTS = ['mficlient==0.2.2'] diff --git a/homeassistant/components/switch/mqtt.py b/homeassistant/components/switch/mqtt.py index c27709cc522..01360b02bec 100644 --- a/homeassistant/components/switch/mqtt.py +++ b/homeassistant/components/switch/mqtt.py @@ -7,9 +7,10 @@ For more details about this platform, please refer to the documentation at https://home-assistant.io/components/switch.mqtt/ """ import logging + import homeassistant.components.mqtt as mqtt -from homeassistant.const import CONF_VALUE_TEMPLATE from homeassistant.components.switch import SwitchDevice +from homeassistant.const import CONF_VALUE_TEMPLATE from homeassistant.util import template _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/switch/mysensors.py b/homeassistant/components/switch/mysensors.py index 19c8f7112f6..4254158d745 100644 --- a/homeassistant/components/switch/mysensors.py +++ b/homeassistant/components/switch/mysensors.py @@ -6,13 +6,9 @@ https://home-assistant.io/components/switch.mysensors/ """ import logging -from homeassistant.components.switch import SwitchDevice - -from homeassistant.const import ( - ATTR_BATTERY_LEVEL, - STATE_ON, STATE_OFF) - import homeassistant.components.mysensors as mysensors +from homeassistant.components.switch import SwitchDevice +from homeassistant.const import ATTR_BATTERY_LEVEL, STATE_OFF, STATE_ON _LOGGER = logging.getLogger(__name__) DEPENDENCIES = [] diff --git a/homeassistant/components/switch/mystrom.py b/homeassistant/components/switch/mystrom.py index 919ff28e4ef..991726a43f2 100644 --- a/homeassistant/components/switch/mystrom.py +++ b/homeassistant/components/switch/mystrom.py @@ -7,6 +7,7 @@ For more details about this component, please refer to the documentation at https://home-assistant.io/components/switch.mystrom/ """ import logging + import requests from homeassistant.components.switch import SwitchDevice diff --git a/homeassistant/components/switch/rest.py b/homeassistant/components/switch/rest.py index 5c4b9b37e1e..89fbd69682d 100644 --- a/homeassistant/components/switch/rest.py +++ b/homeassistant/components/switch/rest.py @@ -7,6 +7,7 @@ For more details about this platform, please refer to the documentation at https://home-assistant.io/components/switch.rest/ """ import logging + import requests from homeassistant.components.switch import SwitchDevice diff --git a/homeassistant/components/switch/rfxtrx.py b/homeassistant/components/switch/rfxtrx.py index 3e678d70b9e..52cbac2319d 100644 --- a/homeassistant/components/switch/rfxtrx.py +++ b/homeassistant/components/switch/rfxtrx.py @@ -7,16 +7,13 @@ For more details about this platform, please refer to the documentation at https://home-assistant.io/components/switch.rfxtrx/ """ import logging + import homeassistant.components.rfxtrx as rfxtrx - -from homeassistant.components.switch import SwitchDevice -from homeassistant.util import slugify - -from homeassistant.const import ATTR_ENTITY_ID from homeassistant.components.rfxtrx import ( - ATTR_STATE, ATTR_FIREEVENT, ATTR_PACKETID, - ATTR_NAME, EVENT_BUTTON_PRESSED) - + ATTR_FIREEVENT, ATTR_NAME, ATTR_PACKETID, ATTR_STATE, EVENT_BUTTON_PRESSED) +from homeassistant.components.switch import SwitchDevice +from homeassistant.const import ATTR_ENTITY_ID +from homeassistant.util import slugify DEPENDENCIES = ['rfxtrx'] SIGNAL_REPETITIONS = 1 diff --git a/homeassistant/components/switch/rpi_gpio.py b/homeassistant/components/switch/rpi_gpio.py index dffa4682279..6a3f50b0b3f 100644 --- a/homeassistant/components/switch/rpi_gpio.py +++ b/homeassistant/components/switch/rpi_gpio.py @@ -8,9 +8,10 @@ https://home-assistant.io/components/switch.rpi_gpio/ """ import logging + import homeassistant.components.rpi_gpio as rpi_gpio +from homeassistant.const import DEVICE_DEFAULT_NAME from homeassistant.helpers.entity import ToggleEntity -from homeassistant.const import (DEVICE_DEFAULT_NAME) DEFAULT_INVERT_LOGIC = False diff --git a/homeassistant/components/switch/scsgate.py b/homeassistant/components/switch/scsgate.py index 7755168585e..d5808d3d08c 100644 --- a/homeassistant/components/switch/scsgate.py +++ b/homeassistant/components/switch/scsgate.py @@ -7,13 +7,11 @@ For more details about this platform, please refer to the documentation at https://home-assistant.io/components/switch.scsgate/ """ import logging + import homeassistant.components.scsgate as scsgate - from homeassistant.components.switch import SwitchDevice - from homeassistant.const import ATTR_ENTITY_ID - DEPENDENCIES = ['scsgate'] diff --git a/homeassistant/components/switch/template.py b/homeassistant/components/switch/template.py index 589768db9bd..5c8227346ea 100644 --- a/homeassistant/components/switch/template.py +++ b/homeassistant/components/switch/template.py @@ -8,21 +8,14 @@ https://home-assistant.io/components/switch.template/ """ import logging -from homeassistant.helpers.entity import generate_entity_id - -from homeassistant.components.switch import SwitchDevice - -from homeassistant.core import EVENT_STATE_CHANGED +from homeassistant.components.switch import DOMAIN, SwitchDevice from homeassistant.const import ( - STATE_ON, - STATE_OFF, - ATTR_FRIENDLY_NAME, - CONF_VALUE_TEMPLATE) - -from homeassistant.helpers.service import call_from_config -from homeassistant.util import template, slugify + ATTR_FRIENDLY_NAME, CONF_VALUE_TEMPLATE, STATE_OFF, STATE_ON) +from homeassistant.core import EVENT_STATE_CHANGED from homeassistant.exceptions import TemplateError -from homeassistant.components.switch import DOMAIN +from homeassistant.helpers.entity import generate_entity_id +from homeassistant.helpers.service import call_from_config +from homeassistant.util import slugify, template ENTITY_ID_FORMAT = DOMAIN + '.{}' diff --git a/homeassistant/components/switch/transmission.py b/homeassistant/components/switch/transmission.py index 1f0da4a00e0..f7b833a8ae5 100644 --- a/homeassistant/components/switch/transmission.py +++ b/homeassistant/components/switch/transmission.py @@ -8,8 +8,8 @@ https://home-assistant.io/components/switch.transmission/ """ import logging -from homeassistant.const import (CONF_HOST, CONF_USERNAME, CONF_PASSWORD, - STATE_ON, STATE_OFF) +from homeassistant.const import ( + CONF_HOST, CONF_PASSWORD, CONF_USERNAME, STATE_OFF, STATE_ON) from homeassistant.helpers.entity import ToggleEntity _LOGGING = logging.getLogger(__name__) diff --git a/homeassistant/components/switch/vera.py b/homeassistant/components/switch/vera.py index 2f6039b1766..b9b44967aa4 100644 --- a/homeassistant/components/switch/vera.py +++ b/homeassistant/components/switch/vera.py @@ -7,19 +7,14 @@ For more details about this platform, please refer to the documentation at https://home-assistant.io/components/switch.vera/ """ import logging + from requests.exceptions import RequestException + import homeassistant.util.dt as dt_util - from homeassistant.components.switch import SwitchDevice - from homeassistant.const import ( - ATTR_BATTERY_LEVEL, - ATTR_TRIPPED, - ATTR_ARMED, - ATTR_LAST_TRIP_TIME, - EVENT_HOMEASSISTANT_STOP, - STATE_ON, - STATE_OFF) + ATTR_ARMED, ATTR_BATTERY_LEVEL, ATTR_LAST_TRIP_TIME, ATTR_TRIPPED, + EVENT_HOMEASSISTANT_STOP, STATE_OFF, STATE_ON) REQUIREMENTS = ['pyvera==0.2.8'] diff --git a/homeassistant/components/switch/wemo.py b/homeassistant/components/switch/wemo.py index 56823b5ddb3..5d1410e0776 100644 --- a/homeassistant/components/switch/wemo.py +++ b/homeassistant/components/switch/wemo.py @@ -10,7 +10,7 @@ import logging from homeassistant.components.switch import SwitchDevice from homeassistant.const import ( - STATE_ON, STATE_OFF, STATE_STANDBY, EVENT_HOMEASSISTANT_STOP) + EVENT_HOMEASSISTANT_STOP, STATE_OFF, STATE_ON, STATE_STANDBY) REQUIREMENTS = ['pywemo==0.3.12'] _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/switch/zigbee.py b/homeassistant/components/switch/zigbee.py index bec7804dc45..cc7b8003198 100644 --- a/homeassistant/components/switch/zigbee.py +++ b/homeassistant/components/switch/zigbee.py @@ -10,7 +10,6 @@ from homeassistant.components.switch import SwitchDevice from homeassistant.components.zigbee import ( ZigBeeDigitalOut, ZigBeeDigitalOutConfig) - DEPENDENCIES = ["zigbee"] diff --git a/homeassistant/components/switch/zwave.py b/homeassistant/components/switch/zwave.py index 150b8ba42be..6b7dc842589 100644 --- a/homeassistant/components/switch/zwave.py +++ b/homeassistant/components/switch/zwave.py @@ -6,10 +6,10 @@ Zwave platform that handles simple binary switches. """ # Because we do not compile openzwave on CI # pylint: disable=import-error -from homeassistant.components.switch import SwitchDevice, DOMAIN +from homeassistant.components.switch import DOMAIN, SwitchDevice from homeassistant.components.zwave import ( - COMMAND_CLASS_SWITCH_BINARY, TYPE_BOOL, GENRE_USER, NETWORK, - ATTR_NODE_ID, ATTR_VALUE_ID, ZWaveDeviceEntity) + ATTR_NODE_ID, ATTR_VALUE_ID, COMMAND_CLASS_SWITCH_BINARY, GENRE_USER, + NETWORK, TYPE_BOOL, ZWaveDeviceEntity) # pylint: disable=unused-argument diff --git a/homeassistant/components/tellduslive.py b/homeassistant/components/tellduslive.py index 1b602d953b0..2f59ddb24d9 100644 --- a/homeassistant/components/tellduslive.py +++ b/homeassistant/components/tellduslive.py @@ -6,15 +6,15 @@ Tellduslive Component. For more details about this component, please refer to the documentation at https://home-assistant.io/components/tellduslive/ """ -from datetime import timedelta import logging +from datetime import timedelta -from homeassistant.loader import get_component from homeassistant import bootstrap -from homeassistant.util import Throttle -from homeassistant.helpers import validate_config from homeassistant.const import ( - EVENT_PLATFORM_DISCOVERED, ATTR_SERVICE, ATTR_DISCOVERED) + ATTR_DISCOVERED, ATTR_SERVICE, EVENT_PLATFORM_DISCOVERED) +from homeassistant.helpers import validate_config +from homeassistant.loader import get_component +from homeassistant.util import Throttle DOMAIN = "tellduslive" diff --git a/homeassistant/components/thermostat/ecobee.py b/homeassistant/components/thermostat/ecobee.py index 647676563de..f61516f5d0d 100644 --- a/homeassistant/components/thermostat/ecobee.py +++ b/homeassistant/components/thermostat/ecobee.py @@ -9,9 +9,9 @@ https://home-assistant.io/components/thermostat.ecobee/ import logging from homeassistant.components import ecobee -from homeassistant.components.thermostat import (ThermostatDevice, STATE_COOL, - STATE_IDLE, STATE_HEAT) -from homeassistant.const import (TEMP_FAHRENHEIT, STATE_ON, STATE_OFF) +from homeassistant.components.thermostat import ( + STATE_COOL, STATE_HEAT, STATE_IDLE, ThermostatDevice) +from homeassistant.const import STATE_OFF, STATE_ON, TEMP_FAHRENHEIT DEPENDENCIES = ['ecobee'] _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/thermostat/heat_control.py b/homeassistant/components/thermostat/heat_control.py index 7e560a2276f..6e0ddb3ac1a 100644 --- a/homeassistant/components/thermostat/heat_control.py +++ b/homeassistant/components/thermostat/heat_control.py @@ -10,11 +10,11 @@ import logging import homeassistant.util as util from homeassistant.components import switch -from homeassistant.components.thermostat import (ThermostatDevice, STATE_IDLE, - STATE_HEAT) -from homeassistant.helpers.event import track_state_change +from homeassistant.components.thermostat import ( + STATE_HEAT, STATE_IDLE, ThermostatDevice) from homeassistant.const import ( ATTR_UNIT_OF_MEASUREMENT, TEMP_CELCIUS, TEMP_FAHRENHEIT) +from homeassistant.helpers.event import track_state_change DEPENDENCIES = ['switch', 'sensor'] diff --git a/homeassistant/components/thermostat/heatmiser.py b/homeassistant/components/thermostat/heatmiser.py index a7ea7699558..1ad9045a4ec 100644 --- a/homeassistant/components/thermostat/heatmiser.py +++ b/homeassistant/components/thermostat/heatmiser.py @@ -10,6 +10,7 @@ For more details about this platform, please refer to the documentation at https://home-assistant.io/components/thermostat.heatmiser/ """ import logging + from homeassistant.components.thermostat import ThermostatDevice from homeassistant.const import TEMP_CELCIUS diff --git a/homeassistant/components/thermostat/honeywell.py b/homeassistant/components/thermostat/honeywell.py index f8c66cb5c5d..8ef9f39a727 100644 --- a/homeassistant/components/thermostat/honeywell.py +++ b/homeassistant/components/thermostat/honeywell.py @@ -10,8 +10,8 @@ import logging import socket from homeassistant.components.thermostat import ThermostatDevice -from homeassistant.const import (CONF_USERNAME, CONF_PASSWORD, TEMP_CELCIUS, - TEMP_FAHRENHEIT) +from homeassistant.const import ( + CONF_PASSWORD, CONF_USERNAME, TEMP_CELCIUS, TEMP_FAHRENHEIT) REQUIREMENTS = ['evohomeclient==0.2.4', 'somecomfort==0.2.1'] diff --git a/homeassistant/components/thermostat/nest.py b/homeassistant/components/thermostat/nest.py index e0e1f74cdbc..be8df3fcb61 100644 --- a/homeassistant/components/thermostat/nest.py +++ b/homeassistant/components/thermostat/nest.py @@ -6,13 +6,13 @@ Adds support for Nest thermostats. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/thermostat.nest/ """ -import socket import logging +import socket -from homeassistant.components.thermostat import (ThermostatDevice, STATE_COOL, - STATE_IDLE, STATE_HEAT) -from homeassistant.const import (TEMP_CELCIUS) import homeassistant.components.nest as nest +from homeassistant.components.thermostat import ( + STATE_COOL, STATE_HEAT, STATE_IDLE, ThermostatDevice) +from homeassistant.const import TEMP_CELCIUS DEPENDENCIES = ['nest'] diff --git a/homeassistant/components/thermostat/proliphix.py b/homeassistant/components/thermostat/proliphix.py index df223186284..3b643ab4923 100644 --- a/homeassistant/components/thermostat/proliphix.py +++ b/homeassistant/components/thermostat/proliphix.py @@ -6,10 +6,10 @@ The Proliphix NT10e Thermostat is an ethernet connected thermostat. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/thermostat.proliphix/ """ -from homeassistant.components.thermostat import (ThermostatDevice, STATE_COOL, - STATE_IDLE, STATE_HEAT) -from homeassistant.const import (CONF_USERNAME, CONF_PASSWORD, - CONF_HOST, TEMP_FAHRENHEIT) +from homeassistant.components.thermostat import ( + STATE_COOL, STATE_HEAT, STATE_IDLE, ThermostatDevice) +from homeassistant.const import ( + CONF_HOST, CONF_PASSWORD, CONF_USERNAME, TEMP_FAHRENHEIT) REQUIREMENTS = ['proliphix==0.1.0'] diff --git a/homeassistant/components/thermostat/radiotherm.py b/homeassistant/components/thermostat/radiotherm.py index 813bf07fa94..88b3f83425c 100644 --- a/homeassistant/components/thermostat/radiotherm.py +++ b/homeassistant/components/thermostat/radiotherm.py @@ -6,13 +6,13 @@ Adds support for Radio Thermostat wifi-enabled home thermostats. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/thermostat.radiotherm/ """ -import logging import datetime +import logging from urllib.error import URLError -from homeassistant.components.thermostat import (ThermostatDevice, STATE_COOL, - STATE_IDLE, STATE_HEAT) -from homeassistant.const import (CONF_HOST, TEMP_FAHRENHEIT) +from homeassistant.components.thermostat import ( + STATE_COOL, STATE_HEAT, STATE_IDLE, ThermostatDevice) +from homeassistant.const import CONF_HOST, TEMP_FAHRENHEIT REQUIREMENTS = ['radiotherm==1.2'] HOLD_TEMP = 'hold_temp' diff --git a/homeassistant/components/verisure.py b/homeassistant/components/verisure.py index a79e2013ab4..2e8af9b3129 100644 --- a/homeassistant/components/verisure.py +++ b/homeassistant/components/verisure.py @@ -8,19 +8,15 @@ https://home-assistant.io/components/verisure/ """ import logging import time - from datetime import timedelta from homeassistant import bootstrap -from homeassistant.loader import get_component - -from homeassistant.helpers import validate_config -from homeassistant.util import Throttle from homeassistant.const import ( - EVENT_PLATFORM_DISCOVERED, - ATTR_SERVICE, ATTR_DISCOVERED, - CONF_USERNAME, CONF_PASSWORD) - + ATTR_DISCOVERED, ATTR_SERVICE, CONF_PASSWORD, CONF_USERNAME, + EVENT_PLATFORM_DISCOVERED) +from homeassistant.helpers import validate_config +from homeassistant.loader import get_component +from homeassistant.util import Throttle DOMAIN = "verisure" DISCOVER_SENSORS = 'verisure.sensors' diff --git a/homeassistant/components/wink.py b/homeassistant/components/wink.py index ef97e958dc0..85a7e995f98 100644 --- a/homeassistant/components/wink.py +++ b/homeassistant/components/wink.py @@ -8,12 +8,12 @@ https://home-assistant.io/components/wink/ import logging from homeassistant import bootstrap -from homeassistant.loader import get_component +from homeassistant.const import ( + ATTR_DISCOVERED, ATTR_SERVICE, CONF_ACCESS_TOKEN, + EVENT_PLATFORM_DISCOVERED) from homeassistant.helpers import validate_config from homeassistant.helpers.entity import ToggleEntity -from homeassistant.const import ( - EVENT_PLATFORM_DISCOVERED, CONF_ACCESS_TOKEN, - ATTR_SERVICE, ATTR_DISCOVERED) +from homeassistant.loader import get_component DOMAIN = "wink" REQUIREMENTS = ['python-wink==0.6.0'] diff --git a/homeassistant/components/zigbee.py b/homeassistant/components/zigbee.py index 91122c9610c..000ce4e3b6c 100644 --- a/homeassistant/components/zigbee.py +++ b/homeassistant/components/zigbee.py @@ -10,11 +10,10 @@ https://home-assistant.io/components/zigbee/ import logging from binascii import hexlify, unhexlify -from homeassistant.core import JobPriority from homeassistant.const import EVENT_HOMEASSISTANT_STOP +from homeassistant.core import JobPriority from homeassistant.helpers.entity import Entity - DOMAIN = "zigbee" REQUIREMENTS = ("xbee-helper==0.0.6",) diff --git a/homeassistant/components/zwave.py b/homeassistant/components/zwave.py index 8ffdf119caa..49ab2bcaf40 100644 --- a/homeassistant/components/zwave.py +++ b/homeassistant/components/zwave.py @@ -6,17 +6,16 @@ Connects Home Assistant to a Z-Wave network. For more details about this component, please refer to the documentation at https://home-assistant.io/components/zwave/ """ -import sys import os.path - +import sys from pprint import pprint -from homeassistant.util import slugify, convert + from homeassistant import bootstrap from homeassistant.const import ( - EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP, - EVENT_PLATFORM_DISCOVERED, ATTR_SERVICE, ATTR_DISCOVERED, - ATTR_BATTERY_LEVEL, ATTR_LOCATION, ATTR_ENTITY_ID, CONF_CUSTOMIZE) - + ATTR_BATTERY_LEVEL, ATTR_DISCOVERED, ATTR_ENTITY_ID, ATTR_LOCATION, + ATTR_SERVICE, CONF_CUSTOMIZE, EVENT_HOMEASSISTANT_START, + EVENT_HOMEASSISTANT_STOP, EVENT_PLATFORM_DISCOVERED) +from homeassistant.util import convert, slugify DOMAIN = "zwave" REQUIREMENTS = ['pydispatcher==2.0.5'] diff --git a/homeassistant/config.py b/homeassistant/config.py index b6d60f873cb..d87dd3d89ad 100644 --- a/homeassistant/config.py +++ b/homeassistant/config.py @@ -7,11 +7,11 @@ Module to help with parsing and generating configuration files. import logging import os -from homeassistant.exceptions import HomeAssistantError -from homeassistant.const import ( - CONF_LATITUDE, CONF_LONGITUDE, CONF_TEMPERATURE_UNIT, CONF_NAME, - CONF_TIME_ZONE) import homeassistant.util.location as loc_util +from homeassistant.const import ( + CONF_LATITUDE, CONF_LONGITUDE, CONF_NAME, CONF_TEMPERATURE_UNIT, + CONF_TIME_ZONE) +from homeassistant.exceptions import HomeAssistantError from homeassistant.util.yaml import load_yaml _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/core.py b/homeassistant/core.py index 839058d25dd..991de9c6189 100644 --- a/homeassistant/core.py +++ b/homeassistant/core.py @@ -5,31 +5,31 @@ Home Assistant is a Home Automation framework for observing the state of entities and react to changes. """ -import os -import time -import logging -import signal -import threading -from types import MappingProxyType import enum import functools as ft +import logging +import os +import signal +import threading +import time +from types import MappingProxyType -from homeassistant.const import ( - __version__, EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP, - SERVICE_HOMEASSISTANT_STOP, SERVICE_HOMEASSISTANT_RESTART, - EVENT_TIME_CHANGED, EVENT_STATE_CHANGED, - EVENT_CALL_SERVICE, ATTR_NOW, ATTR_DOMAIN, ATTR_SERVICE, MATCH_ALL, - EVENT_SERVICE_EXECUTED, ATTR_SERVICE_CALL_ID, EVENT_SERVICE_REGISTERED, - TEMP_CELCIUS, TEMP_FAHRENHEIT, ATTR_FRIENDLY_NAME, ATTR_SERVICE_DATA, - RESTART_EXIT_CODE) -from homeassistant.exceptions import ( - HomeAssistantError, InvalidEntityFormatError) +import homeassistant.helpers.temperature as temp_helper import homeassistant.util as util import homeassistant.util.dt as dt_util import homeassistant.util.location as location -from homeassistant.helpers.entity import valid_entity_id, split_entity_id -import homeassistant.helpers.temperature as temp_helper from homeassistant.config import get_default_config_dir +from homeassistant.const import ( + ATTR_DOMAIN, ATTR_FRIENDLY_NAME, ATTR_NOW, ATTR_SERVICE, + ATTR_SERVICE_CALL_ID, ATTR_SERVICE_DATA, EVENT_CALL_SERVICE, + EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP, + EVENT_SERVICE_EXECUTED, EVENT_SERVICE_REGISTERED, EVENT_STATE_CHANGED, + EVENT_TIME_CHANGED, MATCH_ALL, RESTART_EXIT_CODE, + SERVICE_HOMEASSISTANT_RESTART, SERVICE_HOMEASSISTANT_STOP, TEMP_CELCIUS, + TEMP_FAHRENHEIT, __version__) +from homeassistant.exceptions import ( + HomeAssistantError, InvalidEntityFormatError) +from homeassistant.helpers.entity import split_entity_id, valid_entity_id DOMAIN = "homeassistant" diff --git a/homeassistant/helpers/entity.py b/homeassistant/helpers/entity.py index 2c47d73861b..afe5bc80291 100644 --- a/homeassistant/helpers/entity.py +++ b/homeassistant/helpers/entity.py @@ -4,16 +4,15 @@ homeassistant.helpers.entity. Provides ABC for entities in HA. """ -from collections import defaultdict import re - -from homeassistant.exceptions import NoEntitySpecifiedError -from homeassistant.util import ensure_unique_string, slugify +from collections import defaultdict from homeassistant.const import ( - ATTR_FRIENDLY_NAME, ATTR_HIDDEN, ATTR_UNIT_OF_MEASUREMENT, ATTR_ICON, - DEVICE_DEFAULT_NAME, STATE_ON, STATE_OFF, STATE_UNKNOWN, STATE_UNAVAILABLE, - TEMP_CELCIUS, TEMP_FAHRENHEIT, ATTR_ASSUMED_STATE) + ATTR_ASSUMED_STATE, ATTR_FRIENDLY_NAME, ATTR_HIDDEN, ATTR_ICON, + ATTR_UNIT_OF_MEASUREMENT, DEVICE_DEFAULT_NAME, STATE_OFF, STATE_ON, + STATE_UNAVAILABLE, STATE_UNKNOWN, TEMP_CELCIUS, TEMP_FAHRENHEIT) +from homeassistant.exceptions import NoEntitySpecifiedError +from homeassistant.util import ensure_unique_string, slugify # Dict mapping entity_id to a boolean that overwrites the hidden property _OVERWRITE = defaultdict(dict) diff --git a/homeassistant/helpers/entity_component.py b/homeassistant/helpers/entity_component.py index 268e4e7b696..26dc4500e78 100644 --- a/homeassistant/helpers/entity_component.py +++ b/homeassistant/helpers/entity_component.py @@ -1,14 +1,13 @@ """Provides helpers for components that manage entities.""" from threading import Lock -from homeassistant.const import CONF_SCAN_INTERVAL from homeassistant.bootstrap import prepare_setup_platform +from homeassistant.components import discovery, group +from homeassistant.const import ATTR_ENTITY_ID, CONF_SCAN_INTERVAL from homeassistant.helpers import config_per_platform from homeassistant.helpers.entity import generate_entity_id from homeassistant.helpers.event import track_utc_time_change from homeassistant.helpers.service import extract_entity_ids -from homeassistant.components import group, discovery -from homeassistant.const import ATTR_ENTITY_ID DEFAULT_SCAN_INTERVAL = 15 diff --git a/homeassistant/helpers/event.py b/homeassistant/helpers/event.py index d602fa5641f..e19d1646959 100644 --- a/homeassistant/helpers/event.py +++ b/homeassistant/helpers/event.py @@ -1,12 +1,12 @@ """ Helpers for listening to events """ -from datetime import timedelta import functools as ft +from datetime import timedelta -from ..util import dt as dt_util from ..const import ( ATTR_NOW, EVENT_STATE_CHANGED, EVENT_TIME_CHANGED, MATCH_ALL) +from ..util import dt as dt_util def track_state_change(hass, entity_ids, action, from_state=None, diff --git a/homeassistant/helpers/state.py b/homeassistant/helpers/state.py index 23673e678ca..9d81b95b18a 100644 --- a/homeassistant/helpers/state.py +++ b/homeassistant/helpers/state.py @@ -1,19 +1,17 @@ """Helpers that help with state related things.""" -from collections import defaultdict import json import logging +from collections import defaultdict -from homeassistant.core import State import homeassistant.util.dt as dt_util +from homeassistant.components.media_player import SERVICE_PLAY_MEDIA +from homeassistant.components.sun import ( + STATE_ABOVE_HORIZON, STATE_BELOW_HORIZON) from homeassistant.const import ( - STATE_ON, STATE_OFF, SERVICE_TURN_ON, SERVICE_TURN_OFF, - SERVICE_MEDIA_PLAY, SERVICE_MEDIA_PAUSE, - STATE_PLAYING, STATE_PAUSED, ATTR_ENTITY_ID, - STATE_LOCKED, STATE_UNLOCKED, STATE_UNKNOWN, - STATE_OPEN, STATE_CLOSED) -from homeassistant.components.sun import (STATE_ABOVE_HORIZON, - STATE_BELOW_HORIZON) -from homeassistant.components.media_player import (SERVICE_PLAY_MEDIA) + ATTR_ENTITY_ID, SERVICE_MEDIA_PAUSE, SERVICE_MEDIA_PLAY, SERVICE_TURN_OFF, + SERVICE_TURN_ON, STATE_CLOSED, STATE_LOCKED, STATE_OFF, STATE_ON, + STATE_OPEN, STATE_PAUSED, STATE_PLAYING, STATE_UNKNOWN, STATE_UNLOCKED) +from homeassistant.core import State _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/helpers/temperature.py b/homeassistant/helpers/temperature.py index 4a867ab2f2e..90f3236d111 100644 --- a/homeassistant/helpers/temperature.py +++ b/homeassistant/helpers/temperature.py @@ -5,8 +5,8 @@ homeassistant.helpers.temperature Methods to help handle temperature in Home Assistant. """ -from homeassistant.const import TEMP_CELCIUS import homeassistant.util.temperature as temp_util +from homeassistant.const import TEMP_CELCIUS def convert(temperature, unit, to_unit): diff --git a/homeassistant/loader.py b/homeassistant/loader.py index 8b38f5e0966..3dd831c4fb0 100644 --- a/homeassistant/loader.py +++ b/homeassistant/loader.py @@ -13,11 +13,11 @@ call get_component('switch.your_platform'). In both cases the config directory is checked to see if it contains a user provided version. If not available it will check the built-in components and platforms. """ -import os -import sys -import pkgutil import importlib import logging +import os +import pkgutil +import sys from homeassistant.util import OrderedSet diff --git a/homeassistant/remote.py b/homeassistant/remote.py index 29ac7eeb1db..11dd6c6be89 100644 --- a/homeassistant/remote.py +++ b/homeassistant/remote.py @@ -10,22 +10,21 @@ HomeAssistantError will be raised. For more details about the Python API, please refer to the documentation at https://home-assistant.io/developers/python_api/ """ -import threading -import logging -import json import enum +import json +import logging +import threading import urllib.parse import requests -import homeassistant.core as ha -from homeassistant.exceptions import HomeAssistantError import homeassistant.bootstrap as bootstrap - +import homeassistant.core as ha from homeassistant.const import ( - SERVER_PORT, HTTP_HEADER_HA_AUTH, URL_API, URL_API_STATES, - URL_API_STATES_ENTITY, URL_API_EVENTS, URL_API_EVENTS_EVENT, - URL_API_SERVICES, URL_API_SERVICES_SERVICE, URL_API_EVENT_FORWARD) + HTTP_HEADER_HA_AUTH, SERVER_PORT, URL_API, URL_API_EVENT_FORWARD, + URL_API_EVENTS, URL_API_EVENTS_EVENT, URL_API_SERVICES, + URL_API_SERVICES_SERVICE, URL_API_STATES, URL_API_STATES_ENTITY) +from homeassistant.exceptions import HomeAssistantError METHOD_GET = "get" METHOD_POST = "post" diff --git a/homeassistant/util/location.py b/homeassistant/util/location.py index 9d1b5d1c720..bb3d84466de 100644 --- a/homeassistant/util/location.py +++ b/homeassistant/util/location.py @@ -9,6 +9,7 @@ detect_location_info and elevation are mocked by default during tests. import collections import requests + from vincenty import vincenty ELEVATION_URL = 'http://maps.googleapis.com/maps/api/elevation/json' diff --git a/homeassistant/util/template.py b/homeassistant/util/template.py index d3ff27791d3..d9b1990a252 100644 --- a/homeassistant/util/template.py +++ b/homeassistant/util/template.py @@ -6,8 +6,10 @@ Template utility methods for rendering strings with HA data. # pylint: disable=too-few-public-methods import json import logging + import jinja2 from jinja2.sandbox import ImmutableSandboxedEnvironment + from homeassistant.const import STATE_UNKNOWN from homeassistant.exceptions import TemplateError diff --git a/homeassistant/util/yaml.py b/homeassistant/util/yaml.py index 50355e43799..fa7783d7e83 100644 --- a/homeassistant/util/yaml.py +++ b/homeassistant/util/yaml.py @@ -1,15 +1,14 @@ """ YAML utility functions. """ -from collections import OrderedDict import logging import os +from collections import OrderedDict import yaml from homeassistant.exceptions import HomeAssistantError - _LOGGER = logging.getLogger(__name__)