diff --git a/homeassistant/components/hydrawise/__init__.py b/homeassistant/components/hydrawise/__init__.py index 5a045a083b3..800d19d7efe 100644 --- a/homeassistant/components/hydrawise/__init__.py +++ b/homeassistant/components/hydrawise/__init__.py @@ -1,9 +1,4 @@ -""" -Support for Hydrawise cloud. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/hydrawise/ -""" +"""Support for Hydrawise cloud.""" from datetime import timedelta import logging diff --git a/homeassistant/components/hydrawise/binary_sensor.py b/homeassistant/components/hydrawise/binary_sensor.py index 38b660c506f..bfe7cbd5531 100644 --- a/homeassistant/components/hydrawise/binary_sensor.py +++ b/homeassistant/components/hydrawise/binary_sensor.py @@ -1,9 +1,4 @@ -""" -Support for Hydrawise sprinkler. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/binary_sensor.hydrawise/ -""" +"""Support for Hydrawise sprinkler binary sensors.""" import logging import voluptuous as vol diff --git a/homeassistant/components/hydrawise/sensor.py b/homeassistant/components/hydrawise/sensor.py index bff99ddc501..575686b92cd 100644 --- a/homeassistant/components/hydrawise/sensor.py +++ b/homeassistant/components/hydrawise/sensor.py @@ -1,9 +1,4 @@ -""" -Support for Hydrawise sprinkler. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/sensor.hydrawise/ -""" +"""Support for Hydrawise sprinkler sensors.""" import logging import voluptuous as vol diff --git a/homeassistant/components/hydrawise/switch.py b/homeassistant/components/hydrawise/switch.py index 6b73333431d..a6a8b9c54cf 100644 --- a/homeassistant/components/hydrawise/switch.py +++ b/homeassistant/components/hydrawise/switch.py @@ -1,9 +1,4 @@ -""" -Support for Hydrawise cloud. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/switch.hydrawise/ -""" +"""Support for Hydrawise cloud switches.""" import logging import voluptuous as vol @@ -36,12 +31,10 @@ def setup_platform(hass, config, add_entities, discovery_info=None): sensors = [] for sensor_type in config.get(CONF_MONITORED_CONDITIONS): - # create a switch for each zone + # Create a switch for each zone for zone in hydrawise.relays: sensors.append( - HydrawiseSwitch(default_watering_timer, - zone, - sensor_type)) + HydrawiseSwitch(default_watering_timer, zone, sensor_type)) add_entities(sensors, True) diff --git a/homeassistant/components/idteck_prox/__init__.py b/homeassistant/components/idteck_prox/__init__.py index 90c07c487b6..8ec6f49b95d 100644 --- a/homeassistant/components/idteck_prox/__init__.py +++ b/homeassistant/components/idteck_prox/__init__.py @@ -1,8 +1,4 @@ -"""Component for interfacing RFK101 proximity card readers. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/idteck_prox/ -""" +"""Component for interfacing RFK101 proximity card readers.""" import logging import voluptuous as vol diff --git a/homeassistant/components/ifttt/__init__.py b/homeassistant/components/ifttt/__init__.py index 209bbcef607..7dee93b2260 100644 --- a/homeassistant/components/ifttt/__init__.py +++ b/homeassistant/components/ifttt/__init__.py @@ -1,9 +1,4 @@ -""" -Support to trigger Maker IFTTT recipes. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/ifttt/ -""" +"""Support to trigger Maker IFTTT recipes.""" import json import logging diff --git a/homeassistant/components/ifttt/alarm_control_panel.py b/homeassistant/components/ifttt/alarm_control_panel.py index fe9c96a0083..bbb9a02c8a1 100644 --- a/homeassistant/components/ifttt/alarm_control_panel.py +++ b/homeassistant/components/ifttt/alarm_control_panel.py @@ -1,9 +1,4 @@ -""" -Interfaces with alarm control panels that have to be controlled through IFTTT. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/alarm_control_panel.ifttt/ -""" +"""Support for alarm control panels that can be controlled through IFTTT.""" import logging import re diff --git a/homeassistant/components/influxdb/__init__.py b/homeassistant/components/influxdb/__init__.py index 2b9a5d9e193..b421960b51f 100644 --- a/homeassistant/components/influxdb/__init__.py +++ b/homeassistant/components/influxdb/__init__.py @@ -1,9 +1,4 @@ -""" -A component which allows you to send data to an Influx database. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/influxdb/ -""" +"""Support for sending data to an Influx database.""" import logging import re import queue diff --git a/homeassistant/components/input_boolean/__init__.py b/homeassistant/components/input_boolean/__init__.py index 896de61130c..246af2613a7 100644 --- a/homeassistant/components/input_boolean/__init__.py +++ b/homeassistant/components/input_boolean/__init__.py @@ -1,9 +1,4 @@ -""" -Component to keep track of user controlled booleans for within automation. - -For more details about this component, please refer to the documentation -at https://home-assistant.io/components/input_boolean/ -""" +"""Support to keep track of user controlled booleans for within automation.""" import logging import voluptuous as vol diff --git a/homeassistant/components/input_datetime/__init__.py b/homeassistant/components/input_datetime/__init__.py index 63dcc364c9c..34faffd2028 100644 --- a/homeassistant/components/input_datetime/__init__.py +++ b/homeassistant/components/input_datetime/__init__.py @@ -1,9 +1,4 @@ -""" -Component to offer a way to select a date and / or a time. - -For more details about this component, please refer to the documentation -at https://home-assistant.io/components/input_datetime/ -""" +"""Support to select a date and/or a time.""" import logging import datetime diff --git a/homeassistant/components/input_number/__init__.py b/homeassistant/components/input_number/__init__.py index 8cfa7abaf20..d9d3ac8bbc0 100644 --- a/homeassistant/components/input_number/__init__.py +++ b/homeassistant/components/input_number/__init__.py @@ -1,9 +1,4 @@ -""" -Component to offer a way to set a numeric value from a slider or text box. - -For more details about this component, please refer to the documentation -at https://home-assistant.io/components/input_number/ -""" +"""Support to set a numeric value from a slider or text box.""" import logging import voluptuous as vol diff --git a/homeassistant/components/input_select/__init__.py b/homeassistant/components/input_select/__init__.py index fc858e75397..fd3e4335c33 100644 --- a/homeassistant/components/input_select/__init__.py +++ b/homeassistant/components/input_select/__init__.py @@ -1,9 +1,4 @@ -""" -Component to offer a way to select an option from a list. - -For more details about this component, please refer to the documentation -at https://home-assistant.io/components/input_select/ -""" +"""Support to select an option from a list.""" import logging import voluptuous as vol diff --git a/homeassistant/components/input_text/__init__.py b/homeassistant/components/input_text/__init__.py index 580337a3af3..48a467b54a2 100644 --- a/homeassistant/components/input_text/__init__.py +++ b/homeassistant/components/input_text/__init__.py @@ -1,9 +1,4 @@ -""" -Component to offer a way to enter a value into a text box. - -For more details about this component, please refer to the documentation -at https://home-assistant.io/components/input_text/ -""" +"""Support to enter a value into a text box.""" import logging import voluptuous as vol diff --git a/homeassistant/components/insteon_local/__init__.py b/homeassistant/components/insteon_local/__init__.py index 003714d0f94..f73c46746f0 100644 --- a/homeassistant/components/insteon_local/__init__.py +++ b/homeassistant/components/insteon_local/__init__.py @@ -1,9 +1,4 @@ -""" -Local support for Insteon. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/insteon_local/ -""" +"""Local support for Insteon.""" import logging _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/insteon_plm/__init__.py b/homeassistant/components/insteon_plm/__init__.py index b3011e9d7bd..5ff492b6f6c 100644 --- a/homeassistant/components/insteon_plm/__init__.py +++ b/homeassistant/components/insteon_plm/__init__.py @@ -1,9 +1,4 @@ -""" -Support for INSTEON PowerLinc Modem. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/insteon_plm/ -""" +"""Support for INSTEON PowerLinc Modem.""" import logging _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/introduction/__init__.py b/homeassistant/components/introduction/__init__.py index 17de7fcd6ca..8a2d72ebbdd 100644 --- a/homeassistant/components/introduction/__init__.py +++ b/homeassistant/components/introduction/__init__.py @@ -1,9 +1,4 @@ -""" -Component that will help guide the user taking its first steps. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/introduction/ -""" +"""Component that will help guide the user taking its first steps.""" import logging import voluptuous as vol diff --git a/homeassistant/components/iota/__init__.py b/homeassistant/components/iota/__init__.py index 717213da9ac..e28de61aad0 100644 --- a/homeassistant/components/iota/__init__.py +++ b/homeassistant/components/iota/__init__.py @@ -1,9 +1,4 @@ -""" -Support for IOTA wallets. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/iota/ -""" +"""Support for IOTA wallets.""" import logging from datetime import timedelta diff --git a/homeassistant/components/iota/sensor.py b/homeassistant/components/iota/sensor.py index 961cd119d78..5cd5db6169b 100644 --- a/homeassistant/components/iota/sensor.py +++ b/homeassistant/components/iota/sensor.py @@ -1,9 +1,4 @@ -""" -Support for IOTA wallets. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/iota -""" +"""Support for IOTA wallet sensors.""" import logging from datetime import timedelta @@ -26,12 +21,10 @@ SCAN_INTERVAL = timedelta(minutes=3) def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the IOTA sensor.""" - # Add sensors for wallet balance iota_config = discovery_info sensors = [IotaBalanceSensor(wallet, iota_config) for wallet in iota_config[CONF_WALLETS]] - # Add sensor for node information sensors.append(IotaNodeSensor(iota_config=iota_config)) add_entities(sensors) diff --git a/homeassistant/components/itach/__init__.py b/homeassistant/components/itach/__init__.py index 267370dbcd7..de43b41fdb7 100644 --- a/homeassistant/components/itach/__init__.py +++ b/homeassistant/components/itach/__init__.py @@ -1,5 +1 @@ -"""The itach component. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/itach/ -""" +"""Support for itach devices.""" diff --git a/homeassistant/components/itach/remote.py b/homeassistant/components/itach/remote.py index e7f23dfcd13..beb773838fb 100644 --- a/homeassistant/components/itach/remote.py +++ b/homeassistant/components/itach/remote.py @@ -1,10 +1,4 @@ -""" -Support for iTach IR Devices. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/remote.itach/ -""" - +"""Support for iTach IR devices.""" import logging import voluptuous as vol @@ -38,7 +32,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_CONNADDR): vol.Coerce(int), vol.Required(CONF_COMMANDS): vol.All(cv.ensure_list, [{ vol.Required(CONF_NAME): cv.string, - vol.Required(CONF_DATA): cv.string + vol.Required(CONF_DATA): cv.string, }]) }]) }) diff --git a/homeassistant/components/joaoapps_join/__init__.py b/homeassistant/components/joaoapps_join/__init__.py index b5bcb1e1a8a..adc856bdd3a 100644 --- a/homeassistant/components/joaoapps_join/__init__.py +++ b/homeassistant/components/joaoapps_join/__init__.py @@ -1,9 +1,4 @@ -""" -Component for Joaoapps Join services. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/join/ -""" +"""Support for Joaoapps Join services.""" import logging import voluptuous as vol @@ -16,6 +11,7 @@ REQUIREMENTS = ['python-join-api==0.0.2'] _LOGGER = logging.getLogger(__name__) DOMAIN = 'joaoapps_join' + CONF_DEVICE_ID = 'device_id' CONF_DEVICE_IDS = 'device_ids' CONF_DEVICE_NAMES = 'device_names' @@ -26,7 +22,7 @@ CONFIG_SCHEMA = vol.Schema({ vol.Optional(CONF_DEVICE_ID): cv.string, vol.Optional(CONF_DEVICE_IDS): cv.string, vol.Optional(CONF_DEVICE_NAMES): cv.string, - vol.Optional(CONF_NAME): cv.string + vol.Optional(CONF_NAME): cv.string, }]) }, extra=vol.ALLOW_EXTRA) diff --git a/homeassistant/components/joaoapps_join/notify.py b/homeassistant/components/joaoapps_join/notify.py index a75ff9cd165..c586147d632 100644 --- a/homeassistant/components/joaoapps_join/notify.py +++ b/homeassistant/components/joaoapps_join/notify.py @@ -1,9 +1,4 @@ -""" -Join platform for notify component. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/notify.join/ -""" +"""Support for Join notifications.""" import logging import voluptuous as vol from homeassistant.components.notify import ( diff --git a/homeassistant/components/juicenet/__init__.py b/homeassistant/components/juicenet/__init__.py index 55567d45879..f62331d1502 100644 --- a/homeassistant/components/juicenet/__init__.py +++ b/homeassistant/components/juicenet/__init__.py @@ -1,10 +1,4 @@ -""" -Support for Juicenet cloud. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/juicenet -""" - +"""Support for Juicenet cloud.""" import logging import voluptuous as vol @@ -22,7 +16,7 @@ DOMAIN = 'juicenet' CONFIG_SCHEMA = vol.Schema({ DOMAIN: vol.Schema({ - vol.Required(CONF_ACCESS_TOKEN): cv.string + vol.Required(CONF_ACCESS_TOKEN): cv.string, }) }, extra=vol.ALLOW_EXTRA) diff --git a/homeassistant/components/juicenet/sensor.py b/homeassistant/components/juicenet/sensor.py index 18725394a1f..e3786627075 100644 --- a/homeassistant/components/juicenet/sensor.py +++ b/homeassistant/components/juicenet/sensor.py @@ -1,19 +1,14 @@ -""" -Support for monitoring juicenet/juicepoint/juicebox based EVSE sensors. - -For more details about this platform, please refer to the documentation at -at https://home-assistant.io/components/sensor.juicenet/ -""" - +"""Support for monitoring juicenet/juicepoint/juicebox based EVSE sensors.""" import logging from homeassistant.const import TEMP_CELSIUS from homeassistant.helpers.entity import Entity from homeassistant.components.juicenet import JuicenetDevice, DOMAIN -DEPENDENCIES = ['juicenet'] _LOGGER = logging.getLogger(__name__) +DEPENDENCIES = ['juicenet'] + SENSOR_TYPES = { 'status': ['Charging Status', None], 'temperature': ['Temperature', TEMP_CELSIUS], diff --git a/homeassistant/components/keyboard/__init__.py b/homeassistant/components/keyboard/__init__.py index 16253ba271a..44accca2f56 100644 --- a/homeassistant/components/keyboard/__init__.py +++ b/homeassistant/components/keyboard/__init__.py @@ -1,9 +1,4 @@ -""" -Provides functionality to emulate keyboard presses on host machine. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/keyboard/ -""" +"""Support to emulate keyboard presses on host machine.""" import voluptuous as vol from homeassistant.const import ( diff --git a/homeassistant/components/keyboard_remote/__init__.py b/homeassistant/components/keyboard_remote/__init__.py index e02c2ee5475..e786fe458a8 100644 --- a/homeassistant/components/keyboard_remote/__init__.py +++ b/homeassistant/components/keyboard_remote/__init__.py @@ -1,9 +1,4 @@ -""" -Receive signals from a keyboard and use it as a remote control. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/keyboard_remote/ -""" +"""Receive signals from a keyboard and use it as a remote control.""" # pylint: disable=import-error import threading import logging diff --git a/homeassistant/components/kira/__init__.py b/homeassistant/components/kira/__init__.py index 3a5ee25f05e..d60d8e0cfeb 100644 --- a/homeassistant/components/kira/__init__.py +++ b/homeassistant/components/kira/__init__.py @@ -1,9 +1,4 @@ -""" -KIRA interface to receive UDP packets from an IR-IP bridge. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/kira/ -""" +"""KIRA interface to receive UDP packets from an IR-IP bridge.""" import logging import os @@ -13,7 +8,7 @@ import yaml from homeassistant.const import ( CONF_DEVICE, CONF_HOST, CONF_NAME, CONF_PORT, CONF_SENSORS, CONF_TYPE, - EVENT_HOMEASSISTANT_STOP, STATE_UNKNOWN) + EVENT_HOMEASSISTANT_STOP, STATE_UNKNOWN, CONF_CODE) from homeassistant.helpers import discovery import homeassistant.helpers.config_validation as cv @@ -26,7 +21,6 @@ _LOGGER = logging.getLogger(__name__) DEFAULT_HOST = "0.0.0.0" DEFAULT_PORT = 65432 -CONF_CODE = "code" CONF_REPEAT = "repeat" CONF_REMOTES = "remotes" CONF_SENSOR = "sensor" diff --git a/homeassistant/components/kira/remote.py b/homeassistant/components/kira/remote.py index 24fc54ee78c..8ddf0858e16 100644 --- a/homeassistant/components/kira/remote.py +++ b/homeassistant/components/kira/remote.py @@ -1,9 +1,4 @@ -""" -Support for Keene Electronics IR-IP devices. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/remote.kira/ -""" +"""Support for Keene Electronics IR-IP devices.""" import functools as ft import logging @@ -15,7 +10,7 @@ DOMAIN = 'kira' _LOGGER = logging.getLogger(__name__) -CONF_REMOTE = "remote" +CONF_REMOTE = 'remote' def setup_platform(hass, config, add_entities, discovery_info=None): diff --git a/homeassistant/components/kira/sensor.py b/homeassistant/components/kira/sensor.py index ced17281cc8..8885ebcbe24 100644 --- a/homeassistant/components/kira/sensor.py +++ b/homeassistant/components/kira/sensor.py @@ -1,9 +1,4 @@ -""" -KIRA interface to receive UDP packets from an IR-IP bridge. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/sensor.kira/ -""" +"""KIRA interface to receive UDP packets from an IR-IP bridge.""" import logging from homeassistant.const import CONF_DEVICE, CONF_NAME, STATE_UNKNOWN diff --git a/homeassistant/components/knx/__init__.py b/homeassistant/components/knx/__init__.py index fae18bf8b77..fdaba5e5709 100644 --- a/homeassistant/components/knx/__init__.py +++ b/homeassistant/components/knx/__init__.py @@ -1,10 +1,4 @@ -""" -Connects to KNX platform. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/knx/ -""" - +"""Support KNX devices.""" import logging import voluptuous as vol @@ -19,6 +13,8 @@ from homeassistant.helpers.script import Script REQUIREMENTS = ['xknx==0.9.4'] +_LOGGER = logging.getLogger(__name__) + DOMAIN = "knx" DATA_KNX = "data_knx" CONF_KNX_CONFIG = "config_file" @@ -39,8 +35,6 @@ SERVICE_KNX_ATTR_PAYLOAD = "payload" ATTR_DISCOVER_DEVICES = 'devices' -_LOGGER = logging.getLogger(__name__) - TUNNELING_SCHEMA = vol.Schema({ vol.Required(CONF_HOST): cv.string, vol.Required(CONF_KNX_LOCAL_IP): cv.string, diff --git a/homeassistant/components/knx/binary_sensor.py b/homeassistant/components/knx/binary_sensor.py index a89d5d1c945..ca7037fe81d 100644 --- a/homeassistant/components/knx/binary_sensor.py +++ b/homeassistant/components/knx/binary_sensor.py @@ -1,10 +1,4 @@ -""" -Support for KNX/IP binary sensors. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/binary_sensor.knx/ -""" - +"""Support for KNX/IP binary sensors.""" import voluptuous as vol from homeassistant.components.binary_sensor import ( @@ -35,7 +29,7 @@ DEPENDENCIES = ['knx'] AUTOMATION_SCHEMA = vol.Schema({ vol.Optional(CONF_HOOK, default=CONF_DEFAULT_HOOK): cv.string, vol.Optional(CONF_COUNTER, default=CONF_DEFAULT_COUNTER): cv.port, - vol.Required(CONF_ACTION): cv.SCRIPT_SCHEMA + vol.Required(CONF_ACTION): cv.SCRIPT_SCHEMA, }) AUTOMATIONS_SCHEMA = vol.All( diff --git a/homeassistant/components/knx/climate.py b/homeassistant/components/knx/climate.py index 77d995af2a1..82eaa52ae5a 100644 --- a/homeassistant/components/knx/climate.py +++ b/homeassistant/components/knx/climate.py @@ -1,10 +1,4 @@ -""" -Support for KNX/IP climate devices. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/climate.knx/ -""" - +"""Support for KNX/IP climate devices.""" import voluptuous as vol import homeassistant.helpers.config_validation as cv from homeassistant.components.climate import ( diff --git a/homeassistant/components/knx/cover.py b/homeassistant/components/knx/cover.py index 4173db5f450..9423983f9f7 100644 --- a/homeassistant/components/knx/cover.py +++ b/homeassistant/components/knx/cover.py @@ -1,10 +1,4 @@ -""" -Support for KNX/IP covers. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/cover.knx/ -""" - +"""Support for KNX/IP covers.""" import voluptuous as vol from homeassistant.components.cover import ( @@ -49,8 +43,8 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ }) -async def async_setup_platform(hass, config, async_add_entities, - discovery_info=None): +async def async_setup_platform( + hass, config, async_add_entities, discovery_info=None): """Set up cover(s) for KNX platform.""" if discovery_info is not None: async_add_entities_discovery(hass, discovery_info, async_add_entities) diff --git a/homeassistant/components/knx/light.py b/homeassistant/components/knx/light.py index bb92f1d0ce0..f2a6f15e08b 100644 --- a/homeassistant/components/knx/light.py +++ b/homeassistant/components/knx/light.py @@ -1,9 +1,4 @@ -""" -Support for KNX/IP lights. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/light.knx/ -""" +"""Support for KNX/IP lights.""" from enum import Enum import voluptuous as vol diff --git a/homeassistant/components/knx/notify.py b/homeassistant/components/knx/notify.py index 750e3945569..2488114aa41 100644 --- a/homeassistant/components/knx/notify.py +++ b/homeassistant/components/knx/notify.py @@ -1,10 +1,4 @@ -""" -KNX/IP notification service. - -For more details about this platform, please refer to the documentation -https://home-assistant.io/components/notify.knx/ -""" - +"""Support for KNX/IP notification services.""" import voluptuous as vol from homeassistant.components.knx import DATA_KNX, ATTR_DISCOVER_DEVICES @@ -16,6 +10,7 @@ import homeassistant.helpers.config_validation as cv CONF_ADDRESS = 'address' DEFAULT_NAME = 'KNX Notify' + DEPENDENCIES = ['knx'] PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ diff --git a/homeassistant/components/knx/scene.py b/homeassistant/components/knx/scene.py index cd333ba79b4..008e81508b9 100644 --- a/homeassistant/components/knx/scene.py +++ b/homeassistant/components/knx/scene.py @@ -1,9 +1,4 @@ -""" -Support for KNX scenes. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/scene.knx/ -""" +"""Support for KNX scenes.""" import voluptuous as vol from homeassistant.components.knx import ATTR_DISCOVER_DEVICES, DATA_KNX @@ -26,8 +21,8 @@ PLATFORM_SCHEMA = vol.Schema({ }) -async def async_setup_platform(hass, config, async_add_entities, - discovery_info=None): +async def async_setup_platform( + hass, config, async_add_entities, discovery_info=None): """Set up the scenes for KNX platform.""" if discovery_info is not None: async_add_entities_discovery(hass, discovery_info, async_add_entities) diff --git a/homeassistant/components/knx/sensor.py b/homeassistant/components/knx/sensor.py index c096e15192d..6a2d8144b1e 100644 --- a/homeassistant/components/knx/sensor.py +++ b/homeassistant/components/knx/sensor.py @@ -1,10 +1,4 @@ -""" -Support for KNX/IP sensors. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/sensor.knx/ -""" - +"""Support for KNX/IP sensors.""" import voluptuous as vol from homeassistant.components.knx import ATTR_DISCOVER_DEVICES, DATA_KNX diff --git a/homeassistant/components/knx/switch.py b/homeassistant/components/knx/switch.py index 26b9f77028d..305234e1eec 100644 --- a/homeassistant/components/knx/switch.py +++ b/homeassistant/components/knx/switch.py @@ -1,10 +1,4 @@ -""" -Support for KNX/IP switches. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/switch.knx/ -""" - +"""Support for KNX/IP switches.""" import voluptuous as vol from homeassistant.components.knx import ATTR_DISCOVER_DEVICES, DATA_KNX diff --git a/homeassistant/components/konnected/__init__.py b/homeassistant/components/konnected/__init__.py index 0cba8552346..e3f9a46743d 100644 --- a/homeassistant/components/konnected/__init__.py +++ b/homeassistant/components/konnected/__init__.py @@ -1,9 +1,4 @@ -""" -Support for Konnected devices. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/konnected/ -""" +"""Support for Konnected devices.""" import asyncio import hmac import json diff --git a/homeassistant/components/konnected/binary_sensor.py b/homeassistant/components/konnected/binary_sensor.py index e91d3f6136a..cb15e44e798 100644 --- a/homeassistant/components/konnected/binary_sensor.py +++ b/homeassistant/components/konnected/binary_sensor.py @@ -1,9 +1,4 @@ -""" -Support for wired binary sensors attached to a Konnected device. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/binary_sensor.konnected/ -""" +"""Support for wired binary sensors attached to a Konnected device.""" import logging from homeassistant.components.binary_sensor import BinarySensorDevice @@ -20,8 +15,8 @@ _LOGGER = logging.getLogger(__name__) DEPENDENCIES = ['konnected'] -async def async_setup_platform(hass, config, async_add_entities, - discovery_info=None): +async def async_setup_platform( + hass, config, async_add_entities, discovery_info=None): """Set up binary sensors attached to a Konnected device.""" if discovery_info is None: return @@ -38,7 +33,7 @@ class KonnectedBinarySensor(BinarySensorDevice): """Representation of a Konnected binary sensor.""" def __init__(self, device_id, pin_num, data): - """Initialize the binary sensor.""" + """Initialize the Konnected binary sensor.""" self._data = data self._device_id = device_id self._pin_num = pin_num @@ -46,7 +41,7 @@ class KonnectedBinarySensor(BinarySensorDevice): self._device_class = self._data.get(CONF_TYPE) self._name = self._data.get(CONF_NAME, 'Konnected {} Zone {}'.format( device_id, PIN_TO_ZONE[pin_num])) - _LOGGER.debug('Created new Konnected sensor: %s', self._name) + _LOGGER.debug("Created new Konnected sensor: %s", self._name) @property def name(self): diff --git a/homeassistant/components/konnected/switch.py b/homeassistant/components/konnected/switch.py index 84016dac28d..897933e6d80 100644 --- a/homeassistant/components/konnected/switch.py +++ b/homeassistant/components/konnected/switch.py @@ -1,10 +1,4 @@ -""" -Support for wired switches attached to a Konnected device. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/switch.konnected/ -""" - +"""Support for wired switches attached to a Konnected device.""" import logging from homeassistant.components.konnected import ( @@ -19,8 +13,8 @@ _LOGGER = logging.getLogger(__name__) DEPENDENCIES = ['konnected'] -async def async_setup_platform(hass, config, async_add_entities, - discovery_info=None): +async def async_setup_platform( + hass, config, async_add_entities, discovery_info=None): """Set switches attached to a Konnected device.""" if discovery_info is None: return @@ -37,7 +31,7 @@ class KonnectedSwitch(ToggleEntity): """Representation of a Konnected switch.""" def __init__(self, device_id, pin_num, data): - """Initialize the switch.""" + """Initialize the Konnected switch.""" self._data = data self._device_id = device_id self._pin_num = pin_num @@ -49,7 +43,7 @@ class KonnectedSwitch(ToggleEntity): self._name = self._data.get( 'name', 'Konnected {} Actuator {}'.format( device_id, PIN_TO_ZONE[pin_num])) - _LOGGER.debug('Created new switch: %s', self._name) + _LOGGER.debug("Created new switch: %s", self._name) @property def name(self): diff --git a/homeassistant/components/lametric/__init__.py b/homeassistant/components/lametric/__init__.py index 96ea3781566..0c3c8b08dd7 100644 --- a/homeassistant/components/lametric/__init__.py +++ b/homeassistant/components/lametric/__init__.py @@ -1,12 +1,4 @@ -""" -Support for LaMetric time. - -This is the base platform to support LaMetric components: -Notify, Light, Mediaplayer - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/lametric/ -""" +"""Support for LaMetric time.""" import logging import voluptuous as vol diff --git a/homeassistant/components/lametric/notify.py b/homeassistant/components/lametric/notify.py index 61bc5172af0..e5e6a5bd522 100644 --- a/homeassistant/components/lametric/notify.py +++ b/homeassistant/components/lametric/notify.py @@ -1,9 +1,4 @@ -""" -Notifier for LaMetric time. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/notify.lametric/ -""" +"""Support for LaMetric notifications.""" import logging from requests.exceptions import ConnectionError as RequestsConnectionError @@ -17,33 +12,32 @@ import homeassistant.helpers.config_validation as cv from homeassistant.components.lametric import DOMAIN as LAMETRIC_DOMAIN REQUIREMENTS = ['lmnotify==0.0.4'] -DEPENDENCIES = ['lametric'] _LOGGER = logging.getLogger(__name__) -CONF_LIFETIME = "lifetime" -CONF_CYCLES = "cycles" -CONF_PRIORITY = "priority" +AVAILABLE_PRIORITIES = ['info', 'warning', 'critical'] -AVAILABLE_PRIORITIES = ["info", "warning", "critical"] +CONF_CYCLES = 'cycles' +CONF_LIFETIME = 'lifetime' +CONF_PRIORITY = 'priority' + +DEPENDENCIES = ['lametric'] PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ - vol.Optional(CONF_ICON, default="i555"): cv.string, + vol.Optional(CONF_ICON, default='i555'): cv.string, vol.Optional(CONF_LIFETIME, default=10): cv.positive_int, vol.Optional(CONF_CYCLES, default=1): cv.positive_int, - vol.Optional(CONF_PRIORITY, default="warning"): - vol.In(AVAILABLE_PRIORITIES) + vol.Optional(CONF_PRIORITY, default='warning'): + vol.In(AVAILABLE_PRIORITIES), }) def get_service(hass, config, discovery_info=None): """Get the LaMetric notification service.""" hlmn = hass.data.get(LAMETRIC_DOMAIN) - return LaMetricNotificationService(hlmn, - config[CONF_ICON], - config[CONF_LIFETIME] * 1000, - config[CONF_CYCLES], - config[CONF_PRIORITY]) + return LaMetricNotificationService( + hlmn, config[CONF_ICON], config[CONF_LIFETIME] * 1000, + config[CONF_CYCLES], config[CONF_PRIORITY]) class LaMetricNotificationService(BaseNotificationService): diff --git a/homeassistant/components/lcn/__init__.py b/homeassistant/components/lcn/__init__.py index 8efdcc99794..941160b6397 100644 --- a/homeassistant/components/lcn/__init__.py +++ b/homeassistant/components/lcn/__init__.py @@ -1,10 +1,4 @@ -""" -Connects to LCN platform. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/lcn/ -""" - +"""Support for LCN devices.""" import logging import re diff --git a/homeassistant/components/lcn/light.py b/homeassistant/components/lcn/light.py index b9457b7b7d9..2b7f4ed4074 100644 --- a/homeassistant/components/lcn/light.py +++ b/homeassistant/components/lcn/light.py @@ -1,10 +1,4 @@ -""" -Support for LCN lights. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/light.lcn/ -""" - +"""Support for LCN lights.""" from homeassistant.components.lcn import ( CONF_CONNECTIONS, CONF_DIMMABLE, CONF_OUTPUT, CONF_TRANSITION, DATA_LCN, OUTPUT_PORTS, LcnDevice, get_connection) @@ -16,8 +10,8 @@ from homeassistant.const import CONF_ADDRESS DEPENDENCIES = ['lcn'] -async def async_setup_platform(hass, hass_config, async_add_entities, - discovery_info=None): +async def async_setup_platform( + hass, hass_config, async_add_entities, discovery_info=None): """Set up the LCN light platform.""" if discovery_info is None: return diff --git a/homeassistant/components/lcn/switch.py b/homeassistant/components/lcn/switch.py index 468afe178b5..60eda2ea779 100755 --- a/homeassistant/components/lcn/switch.py +++ b/homeassistant/components/lcn/switch.py @@ -1,10 +1,4 @@ -""" -Support for LCN switches. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/switch.lcn/ -""" - +"""Support for LCN switches.""" from homeassistant.components.lcn import ( CONF_CONNECTIONS, CONF_OUTPUT, DATA_LCN, OUTPUT_PORTS, LcnDevice, get_connection) diff --git a/homeassistant/components/lifx/__init__.py b/homeassistant/components/lifx/__init__.py index a2ae6266a8d..82802bab4af 100644 --- a/homeassistant/components/lifx/__init__.py +++ b/homeassistant/components/lifx/__init__.py @@ -1,4 +1,4 @@ -"""Component to embed LIFX.""" +"""Support for LIFX.""" import voluptuous as vol import homeassistant.helpers.config_validation as cv @@ -7,7 +7,6 @@ from homeassistant.const import CONF_PORT from homeassistant.helpers import config_entry_flow from homeassistant.components.light import DOMAIN as LIGHT_DOMAIN - DOMAIN = 'lifx' REQUIREMENTS = ['aiolifx==0.6.7'] diff --git a/homeassistant/components/lifx/light.py b/homeassistant/components/lifx/light.py index f0cd7b7a7fe..c0b6158f186 100644 --- a/homeassistant/components/lifx/light.py +++ b/homeassistant/components/lifx/light.py @@ -1,9 +1,4 @@ -""" -Support for the LIFX platform that implements lights. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/light.lifx/ -""" +"""Support for LIFX lights.""" import asyncio from datetime import timedelta from functools import partial diff --git a/homeassistant/components/lightwave/__init__.py b/homeassistant/components/lightwave/__init__.py index e1aa1664eba..a9e5dcf9823 100644 --- a/homeassistant/components/lightwave/__init__.py +++ b/homeassistant/components/lightwave/__init__.py @@ -1,9 +1,4 @@ -""" -Support for device connected via Lightwave WiFi-link hub. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/lightwave/ -""" +"""Support for device connected via Lightwave WiFi-link hub.""" import voluptuous as vol import homeassistant.helpers.config_validation as cv from homeassistant.const import (CONF_HOST, CONF_LIGHTS, CONF_NAME, @@ -11,7 +6,9 @@ from homeassistant.const import (CONF_HOST, CONF_LIGHTS, CONF_NAME, from homeassistant.helpers.discovery import async_load_platform REQUIREMENTS = ['lightwave==0.15'] + LIGHTWAVE_LINK = 'lightwave_link' + DOMAIN = 'lightwave' diff --git a/homeassistant/components/lightwave/light.py b/homeassistant/components/lightwave/light.py index 50c664d9046..1dfbac37c88 100644 --- a/homeassistant/components/lightwave/light.py +++ b/homeassistant/components/lightwave/light.py @@ -1,9 +1,4 @@ -""" -Implements LightwaveRF lights. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/light.lightwave/ -""" +"""Support for LightwaveRF lights.""" from homeassistant.components.light import ( ATTR_BRIGHTNESS, SUPPORT_BRIGHTNESS, Light) from homeassistant.components.lightwave import LIGHTWAVE_LINK @@ -14,8 +9,8 @@ DEPENDENCIES = ['lightwave'] MAX_BRIGHTNESS = 255 -async def async_setup_platform(hass, config, async_add_entities, - discovery_info=None): +async def async_setup_platform( + hass, config, async_add_entities, discovery_info=None): """Find and return LightWave lights.""" if not discovery_info: return diff --git a/homeassistant/components/lightwave/switch.py b/homeassistant/components/lightwave/switch.py index b612cd8dec7..d6c00b7fddb 100644 --- a/homeassistant/components/lightwave/switch.py +++ b/homeassistant/components/lightwave/switch.py @@ -1,9 +1,4 @@ -""" -Implements LightwaveRF switches. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/switch.lightwave/ -""" +"""Support for LightwaveRF switches.""" from homeassistant.components.lightwave import LIGHTWAVE_LINK from homeassistant.components.switch import SwitchDevice from homeassistant.const import CONF_NAME @@ -11,8 +6,8 @@ from homeassistant.const import CONF_NAME DEPENDENCIES = ['lightwave'] -async def async_setup_platform(hass, config, async_add_entities, - discovery_info=None): +async def async_setup_platform( + hass, config, async_add_entities, discovery_info=None): """Find and return LightWave switches.""" if not discovery_info: return diff --git a/homeassistant/components/linode/__init__.py b/homeassistant/components/linode/__init__.py index c98ef16c7ed..8bbd98c0acf 100644 --- a/homeassistant/components/linode/__init__.py +++ b/homeassistant/components/linode/__init__.py @@ -1,17 +1,12 @@ -""" -Support for Linode. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/linode/ -""" -import logging +"""Support for Linode.""" from datetime import timedelta +import logging import voluptuous as vol from homeassistant.const import CONF_ACCESS_TOKEN -from homeassistant.util import Throttle import homeassistant.helpers.config_validation as cv +from homeassistant.util import Throttle REQUIREMENTS = ['linode-api==4.1.9b1'] diff --git a/homeassistant/components/linode/binary_sensor.py b/homeassistant/components/linode/binary_sensor.py index 24abc3dd8be..a05681497de 100644 --- a/homeassistant/components/linode/binary_sensor.py +++ b/homeassistant/components/linode/binary_sensor.py @@ -1,20 +1,15 @@ -""" -Support for monitoring the state of Linode Nodes. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/binary_sensor.linode/ -""" +"""Support for monitoring the state of Linode Nodes.""" import logging import voluptuous as vol -import homeassistant.helpers.config_validation as cv from homeassistant.components.binary_sensor import ( - BinarySensorDevice, PLATFORM_SCHEMA) + PLATFORM_SCHEMA, BinarySensorDevice) from homeassistant.components.linode import ( - CONF_NODES, ATTR_CREATED, ATTR_NODE_ID, ATTR_NODE_NAME, - ATTR_IPV4_ADDRESS, ATTR_IPV6_ADDRESS, ATTR_MEMORY, - ATTR_REGION, ATTR_VCPUS, DATA_LINODE) + ATTR_CREATED, ATTR_IPV4_ADDRESS, ATTR_IPV6_ADDRESS, ATTR_MEMORY, + ATTR_NODE_ID, ATTR_NODE_NAME, ATTR_REGION, ATTR_VCPUS, CONF_NODES, + DATA_LINODE) +import homeassistant.helpers.config_validation as cv _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/linode/switch.py b/homeassistant/components/linode/switch.py index 47bba280e1c..0cab2f4d0f2 100644 --- a/homeassistant/components/linode/switch.py +++ b/homeassistant/components/linode/switch.py @@ -1,19 +1,14 @@ -""" -Support for interacting with Linode nodes. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/switch.linode/ -""" +"""Support for interacting with Linode nodes.""" import logging import voluptuous as vol -import homeassistant.helpers.config_validation as cv -from homeassistant.components.switch import (SwitchDevice, PLATFORM_SCHEMA) from homeassistant.components.linode import ( - CONF_NODES, ATTR_CREATED, ATTR_NODE_ID, ATTR_NODE_NAME, - ATTR_IPV4_ADDRESS, ATTR_IPV6_ADDRESS, ATTR_MEMORY, - ATTR_REGION, ATTR_VCPUS, DATA_LINODE) + ATTR_CREATED, ATTR_IPV4_ADDRESS, ATTR_IPV6_ADDRESS, ATTR_MEMORY, + ATTR_NODE_ID, ATTR_NODE_NAME, ATTR_REGION, ATTR_VCPUS, CONF_NODES, + DATA_LINODE) +from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice +import homeassistant.helpers.config_validation as cv _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/lirc/__init__.py b/homeassistant/components/lirc/__init__.py index f15020a5d72..0f00eda2007 100644 --- a/homeassistant/components/lirc/__init__.py +++ b/homeassistant/components/lirc/__init__.py @@ -1,9 +1,4 @@ -""" -LIRC interface to receive signals from an infrared remote control. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/lirc/ -""" +"""Support for LIRC devices.""" # pylint: disable=no-member, import-error import threading import time diff --git a/homeassistant/components/litejet/__init__.py b/homeassistant/components/litejet/__init__.py index e7c8452b27b..b4e8e45fa0b 100644 --- a/homeassistant/components/litejet/__init__.py +++ b/homeassistant/components/litejet/__init__.py @@ -1,8 +1,4 @@ -"""Allows the LiteJet lighting system to be controlled by Home Assistant. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/litejet/ -""" +"""Support for the LiteJet lighting system.""" import logging import voluptuous as vol @@ -24,7 +20,7 @@ CONFIG_SCHEMA = vol.Schema({ DOMAIN: vol.Schema({ vol.Required(CONF_PORT): cv.string, vol.Optional(CONF_EXCLUDE_NAMES): vol.All(cv.ensure_list, [cv.string]), - vol.Optional(CONF_INCLUDE_SWITCHES, default=False): cv.boolean + vol.Optional(CONF_INCLUDE_SWITCHES, default=False): cv.boolean, }) }, extra=vol.ALLOW_EXTRA) diff --git a/homeassistant/components/locative/__init__.py b/homeassistant/components/locative/__init__.py index 5a27fbaec63..e6a5b56ecda 100644 --- a/homeassistant/components/locative/__init__.py +++ b/homeassistant/components/locative/__init__.py @@ -1,9 +1,4 @@ -""" -Support for Locative. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/locative/ -""" +"""Support for Locative.""" import logging from typing import Dict diff --git a/homeassistant/components/logbook/__init__.py b/homeassistant/components/logbook/__init__.py index 0c6608e3572..74a90f0f5f0 100644 --- a/homeassistant/components/logbook/__init__.py +++ b/homeassistant/components/logbook/__init__.py @@ -1,9 +1,4 @@ -""" -Event parser and human readable log generator. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/logbook/ -""" +"""Event parser and human readable log generator.""" from datetime import timedelta from itertools import groupby import logging @@ -47,12 +42,12 @@ CONFIG_SCHEMA = vol.Schema({ CONF_EXCLUDE: vol.Schema({ vol.Optional(CONF_ENTITIES, default=[]): cv.entity_ids, vol.Optional(CONF_DOMAINS, default=[]): - vol.All(cv.ensure_list, [cv.string]) + vol.All(cv.ensure_list, [cv.string]), }), CONF_INCLUDE: vol.Schema({ vol.Optional(CONF_ENTITIES, default=[]): cv.entity_ids, vol.Optional(CONF_DOMAINS, default=[]): - vol.All(cv.ensure_list, [cv.string]) + vol.All(cv.ensure_list, [cv.string]), }) }), }, extra=vol.ALLOW_EXTRA) diff --git a/homeassistant/components/logentries/__init__.py b/homeassistant/components/logentries/__init__.py index 6dc76d8d932..383fa000514 100644 --- a/homeassistant/components/logentries/__init__.py +++ b/homeassistant/components/logentries/__init__.py @@ -1,9 +1,4 @@ -""" -Support for sending data to Logentries webhook endpoint. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/logentries/ -""" +"""Support for sending data to Logentries webhook endpoint.""" import json import logging import requests @@ -42,19 +37,17 @@ def setup(hass, config): _state = state_helper.state_as_number(state) except ValueError: _state = state.state - json_body = [ - { - 'domain': state.domain, - 'entity_id': state.object_id, - 'attributes': dict(state.attributes), - 'time': str(event.time_fired), - 'value': _state, - } - ] + json_body = [{ + 'domain': state.domain, + 'entity_id': state.object_id, + 'attributes': dict(state.attributes), + 'time': str(event.time_fired), + 'value': _state, + }] try: payload = { - "host": le_wh, - "event": json_body + 'host': le_wh, + 'event': json_body } requests.post(le_wh, data=json.dumps(payload), timeout=10) except requests.exceptions.RequestException as error: diff --git a/homeassistant/components/logger/__init__.py b/homeassistant/components/logger/__init__.py index 21ae7595ab8..2bfc6656945 100644 --- a/homeassistant/components/logger/__init__.py +++ b/homeassistant/components/logger/__init__.py @@ -1,9 +1,4 @@ -""" -Component that will help set the level of logging for components. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/logger/ -""" +"""Support for settting the level of logging for components.""" import logging from collections import OrderedDict diff --git a/homeassistant/components/logi_circle/__init__.py b/homeassistant/components/logi_circle/__init__.py index c0a7f4c2621..50500f47e42 100644 --- a/homeassistant/components/logi_circle/__init__.py +++ b/homeassistant/components/logi_circle/__init__.py @@ -1,9 +1,4 @@ -""" -Support for Logi Circle cameras. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/logi_circle/ -""" +"""Support for Logi Circle devices.""" import logging import asyncio diff --git a/homeassistant/components/logi_circle/camera.py b/homeassistant/components/logi_circle/camera.py index 1dae58ad0f7..51bd7c124a3 100644 --- a/homeassistant/components/logi_circle/camera.py +++ b/homeassistant/components/logi_circle/camera.py @@ -1,9 +1,4 @@ -""" -This component provides support to the Logi Circle camera. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/camera.logi_circle/ -""" +"""Support to the Logi Circle cameras.""" import logging import asyncio from datetime import timedelta diff --git a/homeassistant/components/logi_circle/sensor.py b/homeassistant/components/logi_circle/sensor.py index 104de68ce03..74c2039c120 100644 --- a/homeassistant/components/logi_circle/sensor.py +++ b/homeassistant/components/logi_circle/sensor.py @@ -1,9 +1,4 @@ -""" -This component provides HA sensor support for Logi Circle cameras. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/sensor.logi_circle/ -""" +"""Support for Logi Circle sensors.""" import logging import voluptuous as vol @@ -26,26 +21,13 @@ _LOGGER = logging.getLogger(__name__) # Sensor types: Name, unit of measure, icon per sensor key. SENSOR_TYPES = { - 'battery_level': [ - 'Battery', '%', 'battery-50'], - - 'last_activity_time': [ - 'Last Activity', None, 'history'], - - 'privacy_mode': [ - 'Privacy Mode', None, 'eye'], - - 'signal_strength_category': [ - 'WiFi Signal Category', None, 'wifi'], - - 'signal_strength_percentage': [ - 'WiFi Signal Strength', '%', 'wifi'], - - 'speaker_volume': [ - 'Volume', '%', 'volume-high'], - - 'streaming_mode': [ - 'Streaming Mode', None, 'camera'], + 'battery_level': ['Battery', '%', 'battery-50'], + 'last_activity_time': ['Last Activity', None, 'history'], + 'privacy_mode': ['Privacy Mode', None, 'eye'], + 'signal_strength_category': ['WiFi Signal Category', None, 'wifi'], + 'signal_strength_percentage': ['WiFi Signal Strength', '%', 'wifi'], + 'speaker_volume': ['Volume', '%', 'volume-high'], + 'streaming_mode': ['Streaming Mode', None, 'camera'], } PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ diff --git a/homeassistant/components/lovelace/__init__.py b/homeassistant/components/lovelace/__init__.py index b4cb2b18dca..03b1cf06d68 100644 --- a/homeassistant/components/lovelace/__init__.py +++ b/homeassistant/components/lovelace/__init__.py @@ -1,9 +1,4 @@ -""" -Support for the Lovelace UI. - -For more details about this component, please refer to the documentation -at https://www.home-assistant.io/lovelace/ -""" +"""Support for the Lovelace UI.""" from functools import wraps import logging import os diff --git a/homeassistant/components/luftdaten/__init__.py b/homeassistant/components/luftdaten/__init__.py index 45d75b90f7f..125cefb9026 100644 --- a/homeassistant/components/luftdaten/__init__.py +++ b/homeassistant/components/luftdaten/__init__.py @@ -1,9 +1,4 @@ -""" -Support for Luftdaten stations. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/luftdaten/ -""" +"""Support for Luftdaten stations.""" import logging import voluptuous as vol diff --git a/homeassistant/components/luftdaten/sensor.py b/homeassistant/components/luftdaten/sensor.py index d0792883457..398ec30a3f5 100644 --- a/homeassistant/components/luftdaten/sensor.py +++ b/homeassistant/components/luftdaten/sensor.py @@ -1,9 +1,4 @@ -""" -Support for Luftdaten sensors. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/sensor.luftdaten/ -""" +"""Support for Luftdaten sensors.""" import logging from homeassistant.components.luftdaten import ( diff --git a/homeassistant/components/lupusec/__init__.py b/homeassistant/components/lupusec/__init__.py index 94cb3abc4a2..8a5f098f741 100644 --- a/homeassistant/components/lupusec/__init__.py +++ b/homeassistant/components/lupusec/__init__.py @@ -1,10 +1,4 @@ -""" -This component provides basic support for Lupusec Home Security system. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/lupusec -""" - +"""Support for Lupusec Home Security system.""" import logging import voluptuous as vol @@ -14,6 +8,7 @@ from homeassistant.helpers import discovery from homeassistant.const import (CONF_USERNAME, CONF_PASSWORD, CONF_NAME, CONF_IP_ADDRESS) from homeassistant.helpers.entity import Entity + _LOGGER = logging.getLogger(__name__) REQUIREMENTS = ['lupupy==0.0.17'] @@ -28,7 +23,7 @@ CONFIG_SCHEMA = vol.Schema({ vol.Required(CONF_USERNAME): cv.string, vol.Required(CONF_PASSWORD): cv.string, vol.Required(CONF_IP_ADDRESS): cv.string, - vol.Optional(CONF_NAME): cv.string + vol.Optional(CONF_NAME): cv.string, }), }, extra=vol.ALLOW_EXTRA) diff --git a/homeassistant/components/lupusec/alarm_control_panel.py b/homeassistant/components/lupusec/alarm_control_panel.py index 21eefc238a0..de62e5bfac2 100644 --- a/homeassistant/components/lupusec/alarm_control_panel.py +++ b/homeassistant/components/lupusec/alarm_control_panel.py @@ -1,10 +1,4 @@ -""" -This component provides HA alarm_control_panel support for Lupusec System. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/alarm_control_panel.lupusec/ -""" - +"""Support for Lupusec System alarm control panels.""" from datetime import timedelta from homeassistant.components.alarm_control_panel import AlarmControlPanel diff --git a/homeassistant/components/lupusec/binary_sensor.py b/homeassistant/components/lupusec/binary_sensor.py index df8210df026..8a5e103db0d 100644 --- a/homeassistant/components/lupusec/binary_sensor.py +++ b/homeassistant/components/lupusec/binary_sensor.py @@ -1,9 +1,4 @@ -""" -This component provides HA binary_sensor support for Lupusec Security System. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/binary_sensor.lupusec/ -""" +"""Support for Lupusec Security System binary sensors.""" import logging from datetime import timedelta diff --git a/homeassistant/components/lupusec/switch.py b/homeassistant/components/lupusec/switch.py index 35744160f24..8a30d65fec3 100644 --- a/homeassistant/components/lupusec/switch.py +++ b/homeassistant/components/lupusec/switch.py @@ -1,9 +1,4 @@ -""" -This component provides HA switch support for Lupusec Security System. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/switch.lupusec/ -""" +"""Support for Lupusec Security System switches.""" import logging from datetime import timedelta diff --git a/homeassistant/components/lutron/__init__.py b/homeassistant/components/lutron/__init__.py index 435039ce4bd..e4ebec4cc5a 100644 --- a/homeassistant/components/lutron/__init__.py +++ b/homeassistant/components/lutron/__init__.py @@ -1,9 +1,4 @@ -""" -Component for interacting with a Lutron RadioRA 2 system. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/lutron/ -""" +"""Component for interacting with a Lutron RadioRA 2 system.""" import logging import voluptuous as vol diff --git a/homeassistant/components/lutron/cover.py b/homeassistant/components/lutron/cover.py index 7ea7abf882d..cc7a57a5522 100644 --- a/homeassistant/components/lutron/cover.py +++ b/homeassistant/components/lutron/cover.py @@ -1,9 +1,4 @@ -""" -Support for Lutron shades. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/cover.lutron/ -""" +"""Support for Lutron shades.""" import logging from homeassistant.components.cover import ( diff --git a/homeassistant/components/lutron/light.py b/homeassistant/components/lutron/light.py index 359ef0114c5..c0b3b991147 100644 --- a/homeassistant/components/lutron/light.py +++ b/homeassistant/components/lutron/light.py @@ -1,9 +1,4 @@ -""" -Support for Lutron lights. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/light.lutron/ -""" +"""Support for Lutron lights.""" import logging from homeassistant.components.light import ( diff --git a/homeassistant/components/lutron/scene.py b/homeassistant/components/lutron/scene.py index bdb8bc344fe..f9002f2a839 100644 --- a/homeassistant/components/lutron/scene.py +++ b/homeassistant/components/lutron/scene.py @@ -1,9 +1,4 @@ -""" -Support for Lutron scenes. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/scene.lutron/ -""" +"""Support for Lutron scenes.""" import logging from homeassistant.components.lutron import ( @@ -30,12 +25,9 @@ def setup_platform(hass, config, add_entities, discovery_info=None): class LutronScene(LutronDevice, Scene): """Representation of a Lutron Scene.""" - def __init__(self, - area_name, - keypad_name, - lutron_device, - lutron_led, - controller): + def __init__( + self, area_name, keypad_name, lutron_device, lutron_led, + controller): """Initialize the scene/button.""" super().__init__(area_name, lutron_device, controller) self._keypad_name = keypad_name @@ -48,6 +40,5 @@ class LutronScene(LutronDevice, Scene): @property def name(self): """Return the name of the device.""" - return "{} {}: {}".format(self._area_name, - self._keypad_name, - self._lutron_device.name) + return "{} {}: {}".format( + self._area_name, self._keypad_name, self._lutron_device.name) diff --git a/homeassistant/components/lutron/switch.py b/homeassistant/components/lutron/switch.py index 4146ba5a43b..bfdb06be33c 100644 --- a/homeassistant/components/lutron/switch.py +++ b/homeassistant/components/lutron/switch.py @@ -1,9 +1,4 @@ -""" -Support for Lutron switches. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/switch.lutron/ -""" +"""Support for Lutron switches.""" import logging from homeassistant.components.switch import SwitchDevice diff --git a/homeassistant/components/lutron_caseta/__init__.py b/homeassistant/components/lutron_caseta/__init__.py index eb4010e43a1..61c005f60b2 100644 --- a/homeassistant/components/lutron_caseta/__init__.py +++ b/homeassistant/components/lutron_caseta/__init__.py @@ -1,9 +1,4 @@ -""" -Component for interacting with a Lutron Caseta system. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/lutron_caseta/ -""" +"""Component for interacting with a Lutron Caseta system.""" import logging import voluptuous as vol @@ -30,7 +25,7 @@ CONFIG_SCHEMA = vol.Schema({ vol.Required(CONF_HOST): cv.string, vol.Required(CONF_KEYFILE): cv.string, vol.Required(CONF_CERTFILE): cv.string, - vol.Required(CONF_CA_CERTS): cv.string + vol.Required(CONF_CA_CERTS): cv.string, }) }, extra=vol.ALLOW_EXTRA) @@ -47,15 +42,14 @@ async def async_setup(hass, base_config): keyfile = hass.config.path(config[CONF_KEYFILE]) certfile = hass.config.path(config[CONF_CERTFILE]) ca_certs = hass.config.path(config[CONF_CA_CERTS]) - bridge = Smartbridge.create_tls(hostname=config[CONF_HOST], - keyfile=keyfile, - certfile=certfile, - ca_certs=ca_certs) + bridge = Smartbridge.create_tls( + hostname=config[CONF_HOST], keyfile=keyfile, certfile=certfile, + ca_certs=ca_certs) hass.data[LUTRON_CASETA_SMARTBRIDGE] = bridge await bridge.connect() if not hass.data[LUTRON_CASETA_SMARTBRIDGE].is_connected(): - _LOGGER.error("Unable to connect to Lutron smartbridge at %s", - config[CONF_HOST]) + _LOGGER.error( + "Unable to connect to Lutron smartbridge at %s", config[CONF_HOST]) return False _LOGGER.info("Connected to Lutron smartbridge at %s", config[CONF_HOST]) diff --git a/homeassistant/components/lutron_caseta/cover.py b/homeassistant/components/lutron_caseta/cover.py index 37b7c1be42c..5e09dcc3c85 100644 --- a/homeassistant/components/lutron_caseta/cover.py +++ b/homeassistant/components/lutron_caseta/cover.py @@ -1,9 +1,4 @@ -""" -Support for Lutron Caseta shades. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/cover.lutron_caseta/ -""" +"""Support for Lutron Caseta shades.""" import logging from homeassistant.components.cover import ( @@ -17,8 +12,8 @@ _LOGGER = logging.getLogger(__name__) DEPENDENCIES = ['lutron_caseta'] -async def async_setup_platform(hass, config, async_add_entities, - discovery_info=None): +async def async_setup_platform( + hass, config, async_add_entities, discovery_info=None): """Set up the Lutron Caseta shades as a cover device.""" devs = [] bridge = hass.data[LUTRON_CASETA_SMARTBRIDGE] diff --git a/homeassistant/components/lutron_caseta/light.py b/homeassistant/components/lutron_caseta/light.py index d454fe3c75e..3bab781f3b6 100644 --- a/homeassistant/components/lutron_caseta/light.py +++ b/homeassistant/components/lutron_caseta/light.py @@ -1,9 +1,4 @@ -""" -Support for Lutron Caseta lights. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/light.lutron_caseta/ -""" +"""Support for Lutron Caseta lights.""" import logging from homeassistant.components.light import ( @@ -18,8 +13,8 @@ _LOGGER = logging.getLogger(__name__) DEPENDENCIES = ['lutron_caseta'] -async def async_setup_platform(hass, config, async_add_entities, - discovery_info=None): +async def async_setup_platform( + hass, config, async_add_entities, discovery_info=None): """Set up the Lutron Caseta lights.""" devs = [] bridge = hass.data[LUTRON_CASETA_SMARTBRIDGE] diff --git a/homeassistant/components/lutron_caseta/scene.py b/homeassistant/components/lutron_caseta/scene.py index 0ef974e2778..c6ca7bad3ac 100644 --- a/homeassistant/components/lutron_caseta/scene.py +++ b/homeassistant/components/lutron_caseta/scene.py @@ -1,9 +1,4 @@ -""" -Support for Lutron Caseta scenes. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/scene.lutron_caseta/ -""" +"""Support for Lutron Caseta scenes.""" import logging from homeassistant.components.lutron_caseta import LUTRON_CASETA_SMARTBRIDGE @@ -14,8 +9,8 @@ _LOGGER = logging.getLogger(__name__) DEPENDENCIES = ['lutron_caseta'] -async def async_setup_platform(hass, config, async_add_entities, - discovery_info=None): +async def async_setup_platform( + hass, config, async_add_entities, discovery_info=None): """Set up the Lutron Caseta lights.""" devs = [] bridge = hass.data[LUTRON_CASETA_SMARTBRIDGE] @@ -32,8 +27,8 @@ class LutronCasetaScene(Scene): def __init__(self, scene, bridge): """Initialize the Lutron Caseta scene.""" - self._scene_name = scene["name"] - self._scene_id = scene["scene_id"] + self._scene_name = scene['name'] + self._scene_id = scene['scene_id'] self._bridge = bridge @property diff --git a/homeassistant/components/lutron_caseta/switch.py b/homeassistant/components/lutron_caseta/switch.py index f983050cffa..0ef0595187b 100644 --- a/homeassistant/components/lutron_caseta/switch.py +++ b/homeassistant/components/lutron_caseta/switch.py @@ -1,9 +1,4 @@ -""" -Support for Lutron Caseta switches. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/sitch.lutron_caseta/ -""" +"""Support for Lutron Caseta switches.""" import logging from homeassistant.components.lutron_caseta import ( @@ -15,8 +10,8 @@ _LOGGER = logging.getLogger(__name__) DEPENDENCIES = ['lutron_caseta'] -async def async_setup_platform(hass, config, async_add_entities, - discovery_info=None): +async def async_setup_platform( + hass, config, async_add_entities, discovery_info=None): """Set up Lutron switch.""" devs = [] bridge = hass.data[LUTRON_CASETA_SMARTBRIDGE] diff --git a/homeassistant/components/mailbox/__init__.py b/homeassistant/components/mailbox/__init__.py index 2ed12b23164..1907a1e9e97 100644 --- a/homeassistant/components/mailbox/__init__.py +++ b/homeassistant/components/mailbox/__init__.py @@ -1,9 +1,4 @@ -""" -Provides functionality for mailboxes. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/mailbox/ -""" +"""Support for Voice mailboxes.""" import asyncio from contextlib import suppress from datetime import timedelta diff --git a/homeassistant/components/mailbox/asterisk_cdr.py b/homeassistant/components/mailbox/asterisk_cdr.py index ae0939c3da5..db5d4e8d6ee 100644 --- a/homeassistant/components/mailbox/asterisk_cdr.py +++ b/homeassistant/components/mailbox/asterisk_cdr.py @@ -1,9 +1,4 @@ -""" -Asterisk CDR interface. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/mailbox.asterisk_cdr/ -""" +"""Support for the Asterisk CDR interface.""" import logging import hashlib import datetime @@ -14,9 +9,11 @@ from homeassistant.components.asterisk_mbox import DOMAIN as ASTERISK_DOMAIN from homeassistant.components.mailbox import Mailbox from homeassistant.helpers.dispatcher import async_dispatcher_connect -DEPENDENCIES = ['asterisk_mbox'] _LOGGER = logging.getLogger(__name__) -MAILBOX_NAME = "asterisk_cdr" + +DEPENDENCIES = ['asterisk_mbox'] + +MAILBOX_NAME = 'asterisk_cdr' async def async_get_handler(hass, config, discovery_info=None): diff --git a/homeassistant/components/mailbox/demo.py b/homeassistant/components/mailbox/demo.py index 2aabde42b36..885988adb6b 100644 --- a/homeassistant/components/mailbox/demo.py +++ b/homeassistant/components/mailbox/demo.py @@ -1,9 +1,4 @@ -""" -Asterisk Voicemail interface. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/mailbox.asteriskvm/ -""" +"""Support for a demo mailbox.""" from hashlib import sha1 import logging import os @@ -14,7 +9,7 @@ from homeassistant.util import dt _LOGGER = logging.getLogger(__name__) -MAILBOX_NAME = "DemoMailbox" +MAILBOX_NAME = 'DemoMailbox' async def async_get_handler(hass, config, discovery_info=None): diff --git a/homeassistant/components/mailgun/__init__.py b/homeassistant/components/mailgun/__init__.py index 7fa08bb0f22..3903bd14e25 100644 --- a/homeassistant/components/mailgun/__init__.py +++ b/homeassistant/components/mailgun/__init__.py @@ -1,9 +1,4 @@ -""" -Support for Mailgun. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/mailgun/ -""" +"""Support for Mailgun.""" import hashlib import hmac import json @@ -15,12 +10,15 @@ import homeassistant.helpers.config_validation as cv from homeassistant.const import CONF_API_KEY, CONF_DOMAIN, CONF_WEBHOOK_ID from homeassistant.helpers import config_entry_flow -DOMAIN = 'mailgun' _LOGGER = logging.getLogger(__name__) -DEPENDENCIES = ['webhook'] -MESSAGE_RECEIVED = '{}_message_received'.format(DOMAIN) + CONF_SANDBOX = 'sandbox' + DEFAULT_SANDBOX = False +DEPENDENCIES = ['webhook'] +DOMAIN = 'mailgun' + +MESSAGE_RECEIVED = '{}_message_received'.format(DOMAIN) CONFIG_SCHEMA = vol.Schema({ vol.Optional(DOMAIN): vol.Schema({ diff --git a/homeassistant/components/mailgun/notify.py b/homeassistant/components/mailgun/notify.py index d4052678d36..05137254fcc 100644 --- a/homeassistant/components/mailgun/notify.py +++ b/homeassistant/components/mailgun/notify.py @@ -1,9 +1,4 @@ -""" -Support for the Mailgun mail notification service. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/notify.mailgun/ -""" +"""Support for the Mailgun mail notifications.""" import logging import voluptuous as vol @@ -16,10 +11,11 @@ from homeassistant.components.notify import ( from homeassistant.const import ( CONF_API_KEY, CONF_DOMAIN, CONF_RECIPIENT, CONF_SENDER) +REQUIREMENTS = ['pymailgunner==1.4'] + _LOGGER = logging.getLogger(__name__) DEPENDENCIES = ['mailgun'] -REQUIREMENTS = ['pymailgunner==1.4'] # Images to attach to notification ATTR_IMAGES = 'images' @@ -30,7 +26,7 @@ DEFAULT_SANDBOX = False # pylint: disable=no-value-for-parameter PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_RECIPIENT): vol.Email(), - vol.Optional(CONF_SENDER): vol.Email() + vol.Optional(CONF_SENDER): vol.Email(), }) diff --git a/homeassistant/components/map/__init__.py b/homeassistant/components/map/__init__.py index d30a7568452..df8ac49a6d5 100644 --- a/homeassistant/components/map/__init__.py +++ b/homeassistant/components/map/__init__.py @@ -1,9 +1,4 @@ -""" -Provides a map panel for showing device locations. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/map/ -""" +"""Support for showing device locations.""" DOMAIN = 'map' diff --git a/homeassistant/components/matrix/__init__.py b/homeassistant/components/matrix/__init__.py index 5f6c30aaeba..4b3c1bf4d76 100644 --- a/homeassistant/components/matrix/__init__.py +++ b/homeassistant/components/matrix/__init__.py @@ -1,9 +1,4 @@ -""" -The matrix bot component. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/matrix/ -""" +"""The matrix bot component.""" import logging import os from functools import partial @@ -41,8 +36,8 @@ COMMAND_SCHEMA = vol.All( vol.Exclusive(CONF_WORD, 'trigger'): cv.string, vol.Exclusive(CONF_EXPRESSION, 'trigger'): cv.is_regex, vol.Required(CONF_NAME): cv.string, - vol.Optional(CONF_ROOMS, default=[]): vol.All(cv.ensure_list, - [cv.string]), + vol.Optional(CONF_ROOMS, default=[]): + vol.All(cv.ensure_list, [cv.string]), }), # Make sure it's either a word or an expression command cv.has_at_least_one_key(CONF_WORD, CONF_EXPRESSION) @@ -54,8 +49,8 @@ CONFIG_SCHEMA = vol.Schema({ vol.Optional(CONF_VERIFY_SSL, default=True): cv.boolean, vol.Required(CONF_USERNAME): cv.matches_regex("@[^:]*:.*"), vol.Required(CONF_PASSWORD): cv.string, - vol.Optional(CONF_ROOMS, default=[]): vol.All(cv.ensure_list, - [cv.string]), + vol.Optional(CONF_ROOMS, default=[]): + vol.All(cv.ensure_list, [cv.string]), vol.Optional(CONF_COMMANDS, default=[]): [COMMAND_SCHEMA] }) }, extra=vol.ALLOW_EXTRA) @@ -76,13 +71,9 @@ def setup(hass, config): try: bot = MatrixBot( - hass, - os.path.join(hass.config.path(), SESSION_FILE), - config[CONF_HOMESERVER], - config[CONF_VERIFY_SSL], - config[CONF_USERNAME], - config[CONF_PASSWORD], - config[CONF_ROOMS], + hass, os.path.join(hass.config.path(), SESSION_FILE), + config[CONF_HOMESERVER], config[CONF_VERIFY_SSL], + config[CONF_USERNAME], config[CONF_PASSWORD], config[CONF_ROOMS], config[CONF_COMMANDS]) hass.data[DOMAIN] = bot except MatrixRequestError as exception: diff --git a/homeassistant/components/matrix/notify.py b/homeassistant/components/matrix/notify.py index fc29ad91dc9..f1f53268c2b 100644 --- a/homeassistant/components/matrix/notify.py +++ b/homeassistant/components/matrix/notify.py @@ -1,9 +1,4 @@ -""" -Matrix notification service. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/notify.matrix/ -""" +"""Support for Matrix notifications.""" import logging import voluptuous as vol diff --git a/homeassistant/components/maxcube/__init__.py b/homeassistant/components/maxcube/__init__.py index 9980d554232..c398ccbde4f 100644 --- a/homeassistant/components/maxcube/__init__.py +++ b/homeassistant/components/maxcube/__init__.py @@ -1,9 +1,4 @@ -""" -Platform for the MAX! Cube LAN Gateway. - -For more details about this component, please refer to the documentation -https://home-assistant.io/components/maxcube/ -""" +"""Support for the MAX! Cube LAN Gateway.""" import logging import time from socket import timeout @@ -38,7 +33,7 @@ CONFIG_GATEWAY = vol.Schema({ CONFIG_SCHEMA = vol.Schema({ DOMAIN: vol.Schema({ vol.Required(CONF_GATEWAYS, default={}): - vol.All(cv.ensure_list, [CONFIG_GATEWAY]) + vol.All(cv.ensure_list, [CONFIG_GATEWAY]), }), }, extra=vol.ALLOW_EXTRA) diff --git a/homeassistant/components/maxcube/binary_sensor.py b/homeassistant/components/maxcube/binary_sensor.py index 850a416acc5..8d5ab84f6d3 100644 --- a/homeassistant/components/maxcube/binary_sensor.py +++ b/homeassistant/components/maxcube/binary_sensor.py @@ -1,9 +1,4 @@ -""" -Support for MAX! Window Shutter via MAX! Cube. - -For more details about this platform, please refer to the documentation -https://home-assistant.io/components/maxcube/ -""" +"""Support for MAX! binary sensors via MAX! Cube.""" import logging from homeassistant.components.binary_sensor import BinarySensorDevice diff --git a/homeassistant/components/maxcube/climate.py b/homeassistant/components/maxcube/climate.py index 328cdabde62..f5c4533123f 100644 --- a/homeassistant/components/maxcube/climate.py +++ b/homeassistant/components/maxcube/climate.py @@ -1,9 +1,4 @@ -""" -Support for MAX! Thermostats via MAX! Cube. - -For more details about this platform, please refer to the documentation -https://home-assistant.io/components/maxcube/ -""" +"""Support for MAX! Thermostats via MAX! Cube.""" import socket import logging diff --git a/homeassistant/components/media_extractor/__init__.py b/homeassistant/components/media_extractor/__init__.py index 8e00949da07..efc3e8bddc8 100644 --- a/homeassistant/components/media_extractor/__init__.py +++ b/homeassistant/components/media_extractor/__init__.py @@ -1,9 +1,4 @@ -""" -Decorator service for the media_player.play_media service. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/media_extractor/ -""" +"""Decorator service for the media_player.play_media service.""" import logging import voluptuous as vol diff --git a/homeassistant/components/melissa/__init__.py b/homeassistant/components/melissa/__init__.py index 638d8c55bd5..2037caa11c3 100644 --- a/homeassistant/components/melissa/__init__.py +++ b/homeassistant/components/melissa/__init__.py @@ -1,9 +1,4 @@ -""" -Support for Melissa climate. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/melissa/ -""" +"""Support for Melissa climate.""" import logging import voluptuous as vol @@ -16,7 +11,7 @@ REQUIREMENTS = ["py-melissa-climate==2.0.0"] _LOGGER = logging.getLogger(__name__) -DOMAIN = "melissa" +DOMAIN = 'melissa' DATA_MELISSA = 'MELISSA' diff --git a/homeassistant/components/microsoft_face/__init__.py b/homeassistant/components/microsoft_face/__init__.py index 9be2f8eadf5..9b3ee960fb2 100644 --- a/homeassistant/components/microsoft_face/__init__.py +++ b/homeassistant/components/microsoft_face/__init__.py @@ -1,9 +1,4 @@ -""" -Support for Microsoft face recognition. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/microsoft_face/ -""" +"""Support for Microsoft face recognition.""" import asyncio import json import logging @@ -45,7 +40,7 @@ SERVICE_TRAIN_GROUP = 'train_group' CONFIG_SCHEMA = vol.Schema({ DOMAIN: vol.Schema({ vol.Required(CONF_API_KEY): cv.string, - vol.Optional(CONF_AZURE_REGION, default="westus"): cv.string, + vol.Optional(CONF_AZURE_REGION, default='westus'): cv.string, vol.Optional(CONF_TIMEOUT, default=DEFAULT_TIMEOUT): cv.positive_int, }), }, extra=vol.ALLOW_EXTRA) diff --git a/homeassistant/components/mochad/__init__.py b/homeassistant/components/mochad/__init__.py index 7e6738b95f8..e10adf693fe 100644 --- a/homeassistant/components/mochad/__init__.py +++ b/homeassistant/components/mochad/__init__.py @@ -1,9 +1,4 @@ -""" -Support for CM15A/CM19A X10 Controller using mochad daemon. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/mochad/ -""" +"""Support for CM15A/CM19A X10 Controller using mochad daemon.""" import logging import threading diff --git a/homeassistant/components/mochad/light.py b/homeassistant/components/mochad/light.py index 2e68c369ba6..d2e1a567d27 100644 --- a/homeassistant/components/mochad/light.py +++ b/homeassistant/components/mochad/light.py @@ -1,10 +1,4 @@ -""" -Contains functionality to use a X10 dimmer over Mochad. - -For more details about this platform, please refer to the documentation at -https://home.assistant.io/components/light.mochad/ -""" - +"""Support for X10 dimmer over Mochad.""" import logging import voluptuous as vol @@ -16,11 +10,11 @@ from homeassistant.const import ( CONF_NAME, CONF_PLATFORM, CONF_DEVICES, CONF_ADDRESS) from homeassistant.helpers import config_validation as cv -DEPENDENCIES = ['mochad'] _LOGGER = logging.getLogger(__name__) -CONF_BRIGHTNESS_LEVELS = 'brightness_levels' +DEPENDENCIES = ['mochad'] +CONF_BRIGHTNESS_LEVELS = 'brightness_levels' PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_PLATFORM): mochad.DOMAIN, @@ -51,11 +45,11 @@ class MochadLight(Light): self._controller = ctrl self._address = dev[CONF_ADDRESS] - self._name = dev.get(CONF_NAME, - 'x10_light_dev_{}'.format(self._address)) + self._name = dev.get( + CONF_NAME, 'x10_light_dev_{}'.format(self._address)) self._comm_type = dev.get(mochad.CONF_COMM_TYPE, 'pl') - self.light = device.Device(ctrl, self._address, - comm_type=self._comm_type) + self.light = device.Device( + ctrl, self._address, comm_type=self._comm_type) self._brightness = 0 self._state = self._get_device_status() self._brightness_levels = dev.get(CONF_BRIGHTNESS_LEVELS) - 1 diff --git a/homeassistant/components/mochad/switch.py b/homeassistant/components/mochad/switch.py index b703d91be34..03fd2db07bf 100644 --- a/homeassistant/components/mochad/switch.py +++ b/homeassistant/components/mochad/switch.py @@ -1,10 +1,4 @@ -""" -Contains functionality to use a X10 switch over Mochad. - -For more details about this platform, please refer to the documentation at -https://home.assistant.io/components/switch.mochad -""" - +"""Support for X10 switch over Mochad.""" import logging import voluptuous as vol @@ -15,9 +9,10 @@ from homeassistant.const import (CONF_NAME, CONF_DEVICES, CONF_PLATFORM, CONF_ADDRESS) from homeassistant.helpers import config_validation as cv -DEPENDENCIES = ['mochad'] _LOGGER = logging.getLogger(__name__) +DEPENDENCIES = ['mochad'] + PLATFORM_SCHEMA = vol.Schema({ vol.Required(CONF_PLATFORM): mochad.DOMAIN, @@ -48,8 +43,8 @@ class MochadSwitch(SwitchDevice): self._address = dev[CONF_ADDRESS] self._name = dev.get(CONF_NAME, 'x10_switch_dev_%s' % self._address) self._comm_type = dev.get(mochad.CONF_COMM_TYPE, 'pl') - self.switch = device.Device(ctrl, self._address, - comm_type=self._comm_type) + self.switch = device.Device( + ctrl, self._address, comm_type=self._comm_type) # Init with false to avoid locking HA for long on CM19A (goes from rf # to pl via TM751, but not other way around) if self._comm_type == 'pl': diff --git a/homeassistant/components/modbus/__init__.py b/homeassistant/components/modbus/__init__.py index 77a62103f80..f42423bf9a8 100644 --- a/homeassistant/components/modbus/__init__.py +++ b/homeassistant/components/modbus/__init__.py @@ -1,9 +1,4 @@ -""" -Support for Modbus. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/modbus/ -""" +"""Support for Modbus.""" import logging import threading diff --git a/homeassistant/components/modbus/binary_sensor.py b/homeassistant/components/modbus/binary_sensor.py index 7089439a7e1..38511ffed7e 100644 --- a/homeassistant/components/modbus/binary_sensor.py +++ b/homeassistant/components/modbus/binary_sensor.py @@ -1,9 +1,4 @@ -""" -Support for Modbus Coil sensors. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/binary_sensor.modbus/ -""" +"""Support for Modbus Coil sensors.""" import logging import voluptuous as vol @@ -25,7 +20,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Optional(CONF_HUB, default=DEFAULT_HUB): cv.string, vol.Required(CONF_COIL): cv.positive_int, vol.Required(CONF_NAME): cv.string, - vol.Optional(CONF_SLAVE): cv.positive_int + vol.Optional(CONF_SLAVE): cv.positive_int, }] }) @@ -36,9 +31,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): for coil in config.get(CONF_COILS): hub = hass.data[MODBUS_DOMAIN][coil.get(CONF_HUB)] sensors.append(ModbusCoilSensor( - hub, - coil.get(CONF_NAME), - coil.get(CONF_SLAVE), + hub, coil.get(CONF_NAME), coil.get(CONF_SLAVE), coil.get(CONF_COIL))) add_entities(sensors) @@ -70,5 +63,5 @@ class ModbusCoilSensor(BinarySensorDevice): try: self._value = result.bits[0] except AttributeError: - _LOGGER.error('No response from hub %s, slave %s, coil %s', + _LOGGER.error("No response from hub %s, slave %s, coil %s", self._hub.name, self._slave, self._coil) diff --git a/homeassistant/components/modbus/climate.py b/homeassistant/components/modbus/climate.py index 23051898679..ed8cbda863f 100644 --- a/homeassistant/components/modbus/climate.py +++ b/homeassistant/components/modbus/climate.py @@ -1,13 +1,4 @@ -""" -Platform for a Generic Modbus Thermostat. - -This uses a setpoint and process -value within the controller, so both the current temperature register and the -target temperature register need to be configured. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/climate.modbus/ -""" +"""Support for Generic Modbus Thermostats.""" import logging import struct @@ -21,6 +12,8 @@ from homeassistant.components.modbus import ( CONF_HUB, DEFAULT_HUB, DOMAIN as MODBUS_DOMAIN) import homeassistant.helpers.config_validation as cv +_LOGGER = logging.getLogger(__name__) + DEPENDENCIES = ['modbus'] # Parameters not defined by homeassistant.const @@ -46,8 +39,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Optional(CONF_PRECISION, default=1): cv.positive_int }) -_LOGGER = logging.getLogger(__name__) - SUPPORT_FLAGS = SUPPORT_TARGET_TEMPERATURE @@ -63,9 +54,9 @@ def setup_platform(hass, config, add_entities, discovery_info=None): hub_name = config.get(CONF_HUB) hub = hass.data[MODBUS_DOMAIN][hub_name] - add_entities([ModbusThermostat(hub, name, modbus_slave, - target_temp_register, current_temp_register, - data_type, count, precision)], True) + add_entities([ModbusThermostat( + hub, name, modbus_slave, target_temp_register, current_temp_register, + data_type, count, precision)], True) class ModbusThermostat(ClimateDevice): diff --git a/homeassistant/components/modbus/sensor.py b/homeassistant/components/modbus/sensor.py index b263bad5318..6ba8d92d155 100644 --- a/homeassistant/components/modbus/sensor.py +++ b/homeassistant/components/modbus/sensor.py @@ -1,9 +1,4 @@ -""" -Support for Modbus Register sensors. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/sensor.modbus/ -""" +"""Support for Modbus Register sensors.""" import logging import struct @@ -56,7 +51,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.In([DATA_TYPE_INT, DATA_TYPE_UINT, DATA_TYPE_FLOAT, DATA_TYPE_CUSTOM]), vol.Optional(CONF_STRUCTURE): cv.string, - vol.Optional(CONF_UNIT_OF_MEASUREMENT): cv.string + vol.Optional(CONF_UNIT_OF_MEASUREMENT): cv.string, }] }) @@ -76,7 +71,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): CONF_DATA_TYPE)][register.get(CONF_COUNT)]) except KeyError: _LOGGER.error("Unable to detect data type for %s sensor, " - "try a custom type.", register.get(CONF_NAME)) + "try a custom type", register.get(CONF_NAME)) continue else: structure = register.get(CONF_STRUCTURE) diff --git a/homeassistant/components/modbus/switch.py b/homeassistant/components/modbus/switch.py index 04c73d7d372..47ad8e98958 100644 --- a/homeassistant/components/modbus/switch.py +++ b/homeassistant/components/modbus/switch.py @@ -1,9 +1,4 @@ -""" -Support for Modbus switches. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/switch.modbus/ -""" +"""Support for Modbus switches.""" import logging import voluptuous as vol @@ -17,6 +12,7 @@ from homeassistant.helpers import config_validation as cv from homeassistant.components.sensor import PLATFORM_SCHEMA _LOGGER = logging.getLogger(__name__) + DEPENDENCIES = ['modbus'] CONF_COIL = "coil" @@ -59,7 +55,7 @@ PLATFORM_SCHEMA = vol.All( cv.has_at_least_one_key(CONF_COILS, CONF_REGISTERS), PLATFORM_SCHEMA.extend({ vol.Optional(CONF_COILS): [COILS_SCHEMA], - vol.Optional(CONF_REGISTERS): [REGISTERS_SCHEMA] + vol.Optional(CONF_REGISTERS): [REGISTERS_SCHEMA], })) @@ -71,9 +67,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): hub_name = coil.get(CONF_HUB) hub = hass.data[MODBUS_DOMAIN][hub_name] switches.append(ModbusCoilSwitch( - hub, - coil.get(CONF_NAME), - coil.get(CONF_SLAVE), + hub, coil.get(CONF_NAME), coil.get(CONF_SLAVE), coil.get(CONF_COIL))) if CONF_REGISTERS in config: for register in config.get(CONF_REGISTERS): @@ -92,6 +86,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): register.get(CONF_REGISTER_TYPE), register.get(CONF_STATE_ON), register.get(CONF_STATE_OFF))) + add_entities(switches) @@ -139,9 +134,7 @@ class ModbusCoilSwitch(ToggleEntity, RestoreEntity): except AttributeError: _LOGGER.error( 'No response from hub %s, slave %s, coil %s', - self._hub.name, - self._slave, - self._coil) + self._hub.name, self._slave, self._coil) class ModbusRegisterSwitch(ModbusCoilSwitch): @@ -177,19 +170,14 @@ class ModbusRegisterSwitch(ModbusCoilSwitch): def turn_on(self, **kwargs): """Set switch on.""" - self._hub.write_register( - self._slave, - self._register, - self._command_on) + self._hub.write_register(self._slave, self._register, self._command_on) if not self._verify_state: self._is_on = True def turn_off(self, **kwargs): """Set switch off.""" self._hub.write_register( - self._slave, - self._register, - self._command_off) + self._slave, self._register, self._command_off) if not self._verify_state: self._is_on = False @@ -201,23 +189,17 @@ class ModbusRegisterSwitch(ModbusCoilSwitch): value = 0 if self._register_type == REGISTER_TYPE_INPUT: result = self._hub.read_input_registers( - self._slave, - self._register, - 1) + self._slave, self._register, 1) else: result = self._hub.read_holding_registers( - self._slave, - self._register, - 1) + self._slave, self._register, 1) try: value = int(result.registers[0]) except AttributeError: _LOGGER.error( - 'No response from hub %s, slave %s, register %s', - self._hub.name, - self._slave, - self._verify_register) + "No response from hub %s, slave %s, register %s", + self._hub.name, self._slave, self._verify_register) if value == self._state_on: self._is_on = True @@ -225,9 +207,6 @@ class ModbusRegisterSwitch(ModbusCoilSwitch): self._is_on = False else: _LOGGER.error( - 'Unexpected response from hub %s, slave %s ' - 'register %s, got 0x%2x', - self._hub.name, - self._slave, - self._verify_register, - value) + "Unexpected response from hub %s, slave %s " + "register %s, got 0x%2x", + self._hub.name, self._slave, self._verify_register, value) diff --git a/homeassistant/components/mqtt_eventstream/__init__.py b/homeassistant/components/mqtt_eventstream/__init__.py index 2cde7825734..6e545d19fe2 100644 --- a/homeassistant/components/mqtt_eventstream/__init__.py +++ b/homeassistant/components/mqtt_eventstream/__init__.py @@ -1,9 +1,4 @@ -""" -Connect two Home Assistant instances via MQTT. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/mqtt_eventstream/ -""" +"""Connect two Home Assistant instances via MQTT.""" import asyncio import json @@ -33,7 +28,7 @@ CONFIG_SCHEMA = vol.Schema({ vol.Optional(CONF_SUBSCRIBE_TOPIC): valid_subscribe_topic, vol.Optional(CONF_PUBLISH_EVENTSTREAM_RECEIVED, default=False): cv.boolean, - vol.Optional(CONF_IGNORE_EVENT, default=[]): cv.ensure_list + vol.Optional(CONF_IGNORE_EVENT, default=[]): cv.ensure_list, }), }, extra=vol.ALLOW_EXTRA) diff --git a/homeassistant/components/mqtt_statestream/__init__.py b/homeassistant/components/mqtt_statestream/__init__.py index 3a0e5d39ff0..18a70bf75bb 100644 --- a/homeassistant/components/mqtt_statestream/__init__.py +++ b/homeassistant/components/mqtt_statestream/__init__.py @@ -1,9 +1,4 @@ -""" -Publish simple item state changes via MQTT. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/mqtt_statestream/ -""" +"""Publish simple item state changes via MQTT.""" import json import voluptuous as vol @@ -20,6 +15,7 @@ import homeassistant.helpers.config_validation as cv CONF_BASE_TOPIC = 'base_topic' CONF_PUBLISH_ATTRIBUTES = 'publish_attributes' CONF_PUBLISH_TIMESTAMPS = 'publish_timestamps' + DEPENDENCIES = ['mqtt'] DOMAIN = 'mqtt_statestream' @@ -28,16 +24,16 @@ CONFIG_SCHEMA = vol.Schema({ vol.Optional(CONF_EXCLUDE, default={}): vol.Schema({ vol.Optional(CONF_ENTITIES, default=[]): cv.entity_ids, vol.Optional(CONF_DOMAINS, default=[]): - vol.All(cv.ensure_list, [cv.string]) + vol.All(cv.ensure_list, [cv.string]), }), vol.Optional(CONF_INCLUDE, default={}): vol.Schema({ vol.Optional(CONF_ENTITIES, default=[]): cv.entity_ids, vol.Optional(CONF_DOMAINS, default=[]): - vol.All(cv.ensure_list, [cv.string]) + vol.All(cv.ensure_list, [cv.string]), }), vol.Required(CONF_BASE_TOPIC): valid_publish_topic, vol.Optional(CONF_PUBLISH_ATTRIBUTES, default=False): cv.boolean, - vol.Optional(CONF_PUBLISH_TIMESTAMPS, default=False): cv.boolean + vol.Optional(CONF_PUBLISH_TIMESTAMPS, default=False): cv.boolean, }) }, extra=vol.ALLOW_EXTRA) diff --git a/homeassistant/components/mychevy/__init__.py b/homeassistant/components/mychevy/__init__.py index 209027ad472..e6fd7f19c2a 100644 --- a/homeassistant/components/mychevy/__init__.py +++ b/homeassistant/components/mychevy/__init__.py @@ -1,9 +1,4 @@ -""" -MyChevy Component. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/mychevy/ -""" +"""Support for MyChevy.""" from datetime import timedelta import logging import threading @@ -16,7 +11,7 @@ from homeassistant.helpers import config_validation as cv from homeassistant.helpers import discovery from homeassistant.util import Throttle -REQUIREMENTS = ["mychevy==1.2.0"] +REQUIREMENTS = ['mychevy==1.2.0'] DOMAIN = 'mychevy' UPDATE_TOPIC = DOMAIN @@ -41,7 +36,7 @@ CONFIG_SCHEMA = vol.Schema({ vol.Required(CONF_USERNAME): cv.string, vol.Required(CONF_PASSWORD): cv.string, vol.Optional(CONF_COUNTRY, default=DEFAULT_COUNTRY): - vol.All(cv.string, vol.In(['us', 'ca'])) + vol.All(cv.string, vol.In(['us', 'ca'])), }), }, extra=vol.ALLOW_EXTRA) diff --git a/homeassistant/components/mychevy/binary_sensor.py b/homeassistant/components/mychevy/binary_sensor.py index c1e3b6f0aac..67f12a14359 100644 --- a/homeassistant/components/mychevy/binary_sensor.py +++ b/homeassistant/components/mychevy/binary_sensor.py @@ -1,8 +1,4 @@ -"""Support for MyChevy sensors. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/binary_sensor.mychevy/ -""" +"""Support for MyChevy binary sensors.""" import logging from homeassistant.components.mychevy import ( @@ -20,8 +16,8 @@ SENSORS = [ ] -async def async_setup_platform(hass, config, async_add_entities, - discovery_info=None): +async def async_setup_platform( + hass, config, async_add_entities, discovery_info=None): """Set up the MyChevy sensors.""" if discovery_info is None: return @@ -41,7 +37,6 @@ class EVBinarySensor(BinarySensorDevice): The only real difference between sensors is which units and what attribute from the car object they are returning. All logic can be built with just setting subclass attributes. - """ def __init__(self, connection, config, car_vid): @@ -53,9 +48,8 @@ class EVBinarySensor(BinarySensorDevice): self._is_on = None self._car_vid = car_vid self.entity_id = ENTITY_ID_FORMAT.format( - '{}_{}_{}'.format(MYCHEVY_DOMAIN, - slugify(self._car.name), - slugify(self._name))) + '{}_{}_{}'.format( + MYCHEVY_DOMAIN, slugify(self._car.name), slugify(self._name))) @property def name(self): diff --git a/homeassistant/components/mychevy/sensor.py b/homeassistant/components/mychevy/sensor.py index b478e2ef3ca..c7d140e0c4c 100644 --- a/homeassistant/components/mychevy/sensor.py +++ b/homeassistant/components/mychevy/sensor.py @@ -1,9 +1,4 @@ -"""Support for MyChevy sensors. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/sensor.mychevy/ -""" - +"""Support for MyChevy sensors.""" import logging from homeassistant.components.mychevy import ( @@ -16,6 +11,8 @@ from homeassistant.helpers.entity import Entity from homeassistant.helpers.icon import icon_for_battery_level from homeassistant.util import slugify +_LOGGER = logging.getLogger(__name__) + BATTERY_SENSOR = "batteryLevel" SENSORS = [ @@ -28,8 +25,6 @@ SENSORS = [ ["charging"]) ] -_LOGGER = logging.getLogger(__name__) - def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the MyChevy sensors.""" @@ -49,7 +44,7 @@ class MyChevyStatus(Entity): """A string representing the charge mode.""" _name = "MyChevy Status" - _icon = "mdi:car-connected" + _icon = 'mdi:car-connected' def __init__(self): """Initialize sensor with car connection.""" @@ -107,7 +102,6 @@ class EVSensor(Entity): The only real difference between sensors is which units and what attribute from the car object they are returning. All logic can be built with just setting subclass attributes. - """ def __init__(self, connection, config, car_vid): @@ -123,9 +117,8 @@ class EVSensor(Entity): self._car_vid = car_vid self.entity_id = ENTITY_ID_FORMAT.format( - '{}_{}_{}'.format(MYCHEVY_DOMAIN, - slugify(self._car.name), - slugify(self._name))) + '{}_{}_{}'.format( + MYCHEVY_DOMAIN, slugify(self._car.name), slugify(self._name))) async def async_added_to_hass(self): """Register callbacks.""" diff --git a/homeassistant/components/mycroft/__init__.py b/homeassistant/components/mycroft/__init__.py index 834572bc551..29f6383f686 100644 --- a/homeassistant/components/mycroft/__init__.py +++ b/homeassistant/components/mycroft/__init__.py @@ -1,10 +1,4 @@ -""" -Support for Mycroft AI. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/mycroft -""" - +"""Support for Mycroft AI.""" import logging import voluptuous as vol @@ -17,10 +11,8 @@ REQUIREMENTS = ['mycroftapi==2.0'] _LOGGER = logging.getLogger(__name__) - DOMAIN = 'mycroft' - CONFIG_SCHEMA = vol.Schema({ DOMAIN: vol.Schema({ vol.Required(CONF_HOST): cv.string diff --git a/homeassistant/components/mysensors/__init__.py b/homeassistant/components/mysensors/__init__.py index 49f8560c6b3..7ca21ac582a 100644 --- a/homeassistant/components/mysensors/__init__.py +++ b/homeassistant/components/mysensors/__init__.py @@ -1,9 +1,4 @@ -""" -Connect to a MySensors gateway via pymysensors API. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/mysensors/ -""" +"""Connect to a MySensors gateway via pymysensors API.""" import logging import voluptuous as vol diff --git a/homeassistant/components/mysensors/binary_sensor.py b/homeassistant/components/mysensors/binary_sensor.py index f0b7832cf25..57e8f1c1ef8 100644 --- a/homeassistant/components/mysensors/binary_sensor.py +++ b/homeassistant/components/mysensors/binary_sensor.py @@ -1,9 +1,4 @@ -""" -Support for MySensors binary sensors. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/binary_sensor.mysensors/ -""" +"""Support for MySensors binary sensors.""" from homeassistant.components import mysensors from homeassistant.components.binary_sensor import ( DEVICE_CLASSES, DOMAIN, BinarySensorDevice) diff --git a/homeassistant/components/mysensors/climate.py b/homeassistant/components/mysensors/climate.py index 66c634d8cd9..20d608e1ca5 100644 --- a/homeassistant/components/mysensors/climate.py +++ b/homeassistant/components/mysensors/climate.py @@ -1,9 +1,4 @@ -""" -MySensors platform that offers a Climate (MySensors-HVAC) component. - -For more details about this platform, please refer to the documentation -https://home-assistant.io/components/climate.mysensors/ -""" +"""MySensors platform that offers a Climate (MySensors-HVAC) component.""" from homeassistant.components import mysensors from homeassistant.components.climate import ( ATTR_TARGET_TEMP_HIGH, ATTR_TARGET_TEMP_LOW, DOMAIN, STATE_AUTO, diff --git a/homeassistant/components/mysensors/cover.py b/homeassistant/components/mysensors/cover.py index 60ff7aeef1d..01605bb9afe 100644 --- a/homeassistant/components/mysensors/cover.py +++ b/homeassistant/components/mysensors/cover.py @@ -1,9 +1,4 @@ -""" -Support for MySensors covers. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/cover.mysensors/ -""" +"""Support for MySensors covers.""" from homeassistant.components import mysensors from homeassistant.components.cover import ATTR_POSITION, DOMAIN, CoverDevice from homeassistant.const import STATE_OFF, STATE_ON diff --git a/homeassistant/components/mysensors/device_tracker.py b/homeassistant/components/mysensors/device_tracker.py index 705dc9968c9..b50286585a4 100644 --- a/homeassistant/components/mysensors/device_tracker.py +++ b/homeassistant/components/mysensors/device_tracker.py @@ -1,9 +1,4 @@ -""" -Support for tracking MySensors devices. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/device_tracker.mysensors/ -""" +"""Support for tracking MySensors devices.""" from homeassistant.components import mysensors from homeassistant.components.device_tracker import DOMAIN from homeassistant.helpers.dispatcher import async_dispatcher_connect diff --git a/homeassistant/components/mysensors/light.py b/homeassistant/components/mysensors/light.py index 23d602c5d40..56511b73dfe 100644 --- a/homeassistant/components/mysensors/light.py +++ b/homeassistant/components/mysensors/light.py @@ -1,9 +1,4 @@ -""" -Support for MySensors lights. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/light.mysensors/ -""" +"""Support for MySensors lights.""" from homeassistant.components import mysensors from homeassistant.components.light import ( ATTR_BRIGHTNESS, ATTR_HS_COLOR, ATTR_WHITE_VALUE, DOMAIN, diff --git a/homeassistant/components/mysensors/notify.py b/homeassistant/components/mysensors/notify.py index 71ce7fb0b74..ab198bc21bc 100644 --- a/homeassistant/components/mysensors/notify.py +++ b/homeassistant/components/mysensors/notify.py @@ -1,9 +1,4 @@ -""" -MySensors notification service. - -For more details about this platform, please refer to the documentation -https://home-assistant.io/components/notify.mysensors/ -""" +"""MySensors notification service.""" from homeassistant.components import mysensors from homeassistant.components.notify import ( ATTR_TARGET, DOMAIN, BaseNotificationService) diff --git a/homeassistant/components/mysensors/sensor.py b/homeassistant/components/mysensors/sensor.py index 160d4b4784b..ce6d5da2b4c 100644 --- a/homeassistant/components/mysensors/sensor.py +++ b/homeassistant/components/mysensors/sensor.py @@ -1,9 +1,4 @@ -""" -Support for MySensors sensors. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/sensor.mysensors/ -""" +"""Support for MySensors sensors.""" from homeassistant.components import mysensors from homeassistant.components.sensor import DOMAIN from homeassistant.const import TEMP_CELSIUS, TEMP_FAHRENHEIT diff --git a/homeassistant/components/mysensors/switch.py b/homeassistant/components/mysensors/switch.py index 20e50518df8..0ad9be1d508 100644 --- a/homeassistant/components/mysensors/switch.py +++ b/homeassistant/components/mysensors/switch.py @@ -1,9 +1,4 @@ -""" -Support for MySensors switches. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/switch.mysensors/ -""" +"""Support for MySensors switches.""" import voluptuous as vol import homeassistant.helpers.config_validation as cv @@ -89,7 +84,7 @@ class MySensorsSwitch(mysensors.device.MySensorsEntity, SwitchDevice): self.gateway.set_child_value( self.node_id, self.child_id, self.value_type, 1) if self.gateway.optimistic: - # optimistically assume that switch has changed state + # Optimistically assume that switch has changed state self._values[self.value_type] = STATE_ON self.async_schedule_update_ha_state() @@ -98,7 +93,7 @@ class MySensorsSwitch(mysensors.device.MySensorsEntity, SwitchDevice): self.gateway.set_child_value( self.node_id, self.child_id, self.value_type, 0) if self.gateway.optimistic: - # optimistically assume that switch has changed state + # Optimistically assume that switch has changed state self._values[self.value_type] = STATE_OFF self.async_schedule_update_ha_state() @@ -127,11 +122,11 @@ class MySensorsIRSwitch(MySensorsSwitch): self.gateway.set_child_value( self.node_id, self.child_id, set_req.V_LIGHT, 1) if self.gateway.optimistic: - # optimistically assume that switch has changed state + # Optimistically assume that switch has changed state self._values[self.value_type] = self._ir_code self._values[set_req.V_LIGHT] = STATE_ON self.async_schedule_update_ha_state() - # turn off switch after switch was turned on + # Turn off switch after switch was turned on await self.async_turn_off() async def async_turn_off(self, **kwargs): @@ -140,7 +135,7 @@ class MySensorsIRSwitch(MySensorsSwitch): self.gateway.set_child_value( self.node_id, self.child_id, set_req.V_LIGHT, 0) if self.gateway.optimistic: - # optimistically assume that switch has changed state + # Optimistically assume that switch has changed state self._values[set_req.V_LIGHT] = STATE_OFF self.async_schedule_update_ha_state() diff --git a/homeassistant/components/mythicbeastsdns/__init__.py b/homeassistant/components/mythicbeastsdns/__init__.py index 6b5ce2e8597..f34b2736710 100644 --- a/homeassistant/components/mythicbeastsdns/__init__.py +++ b/homeassistant/components/mythicbeastsdns/__init__.py @@ -1,9 +1,4 @@ -""" -Integrate with Mythic Beasts Dynamic DNS service. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/mythicbeastsdns/ -""" +"""Support for Mythic Beasts Dynamic DNS service.""" from datetime import timedelta import logging diff --git a/homeassistant/components/namecheapdns/__init__.py b/homeassistant/components/namecheapdns/__init__.py index f817544ca77..f86e7d18556 100644 --- a/homeassistant/components/namecheapdns/__init__.py +++ b/homeassistant/components/namecheapdns/__init__.py @@ -1,9 +1,4 @@ -""" -Integrate with namecheap DNS services. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/namecheapdns/ -""" +"""Support for namecheap DNS services.""" import logging from datetime import timedelta diff --git a/homeassistant/components/neato/__init__.py b/homeassistant/components/neato/__init__.py index 31410d1c9b2..2b4af3e1e91 100644 --- a/homeassistant/components/neato/__init__.py +++ b/homeassistant/components/neato/__init__.py @@ -1,9 +1,4 @@ -""" -Support for Neato botvac connected vacuum cleaners. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/neato/ -""" +"""Support for Neato botvac connected vacuum cleaners.""" import logging from datetime import timedelta from urllib.error import HTTPError @@ -15,10 +10,10 @@ from homeassistant.const import CONF_PASSWORD, CONF_USERNAME from homeassistant.helpers import discovery from homeassistant.util import Throttle -_LOGGER = logging.getLogger(__name__) - REQUIREMENTS = ['pybotvac==0.0.13'] +_LOGGER = logging.getLogger(__name__) + DOMAIN = 'neato' NEATO_ROBOTS = 'neato_robots' NEATO_LOGIN = 'neato_login' diff --git a/homeassistant/components/neato/camera.py b/homeassistant/components/neato/camera.py index 4df423344bb..530aa8fc6f1 100644 --- a/homeassistant/components/neato/camera.py +++ b/homeassistant/components/neato/camera.py @@ -1,9 +1,4 @@ -""" -Camera that loads a picture from Neato. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/camera.neato/ -""" +"""Support for loading picture from Neato.""" import logging from datetime import timedelta diff --git a/homeassistant/components/neato/switch.py b/homeassistant/components/neato/switch.py index 0b49cb71ba2..fcc72762b8d 100644 --- a/homeassistant/components/neato/switch.py +++ b/homeassistant/components/neato/switch.py @@ -1,9 +1,4 @@ -""" -Support for Neato Connected Vacuums switches. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/switch.neato/ -""" +"""Support for Neato Connected Vacuums switches.""" import logging from datetime import timedelta import requests diff --git a/homeassistant/components/neato/vacuum.py b/homeassistant/components/neato/vacuum.py index 9ec9fe688b7..45cfd273aca 100644 --- a/homeassistant/components/neato/vacuum.py +++ b/homeassistant/components/neato/vacuum.py @@ -1,9 +1,4 @@ -""" -Support for Neato Connected Vacuums. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/vacuum.neato/ -""" +"""Support for Neato Connected Vacuums.""" import logging from datetime import timedelta import requests diff --git a/homeassistant/components/ness_alarm/__init__.py b/homeassistant/components/ness_alarm/__init__.py index e97ee903abc..dae244ece3f 100644 --- a/homeassistant/components/ness_alarm/__init__.py +++ b/homeassistant/components/ness_alarm/__init__.py @@ -1,16 +1,11 @@ -""" -Support for Ness D8X/D16X devices. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/ness_alarm/ -""" -import logging +"""Support for Ness D8X/D16X devices.""" from collections import namedtuple +import logging import voluptuous as vol from homeassistant.components.binary_sensor import DEVICE_CLASSES -from homeassistant.const import EVENT_HOMEASSISTANT_STOP +from homeassistant.const import ATTR_CODE, ATTR_STATE, EVENT_HOMEASSISTANT_STOP from homeassistant.helpers import config_validation as cv from homeassistant.helpers.discovery import async_load_platform from homeassistant.helpers.dispatcher import async_dispatcher_send @@ -28,9 +23,7 @@ CONF_ZONES = 'zones' CONF_ZONE_NAME = 'name' CONF_ZONE_TYPE = 'type' CONF_ZONE_ID = 'id' -ATTR_CODE = 'code' ATTR_OUTPUT_ID = 'output_id' -ATTR_STATE = 'state' DEFAULT_ZONES = [] SIGNAL_ZONE_CHANGED = 'ness_alarm.zone_changed' diff --git a/homeassistant/components/nest/__init__.py b/homeassistant/components/nest/__init__.py index 7f0fe27df73..fe6a34cf404 100644 --- a/homeassistant/components/nest/__init__.py +++ b/homeassistant/components/nest/__init__.py @@ -1,9 +1,4 @@ -""" -Support for Nest devices. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/nest/ -""" +"""Support for Nest devices.""" import logging import socket from datetime import datetime, timedelta @@ -53,7 +48,7 @@ AWAY_MODE_AWAY = 'away' AWAY_MODE_HOME = 'home' SENSOR_SCHEMA = vol.Schema({ - vol.Optional(CONF_MONITORED_CONDITIONS): vol.All(cv.ensure_list) + vol.Optional(CONF_MONITORED_CONDITIONS): vol.All(cv.ensure_list), }) CONFIG_SCHEMA = vol.Schema({ @@ -62,25 +57,25 @@ CONFIG_SCHEMA = vol.Schema({ vol.Required(CONF_CLIENT_SECRET): cv.string, vol.Optional(CONF_STRUCTURE): vol.All(cv.ensure_list, [cv.string]), vol.Optional(CONF_SENSORS): SENSOR_SCHEMA, - vol.Optional(CONF_BINARY_SENSORS): SENSOR_SCHEMA + vol.Optional(CONF_BINARY_SENSORS): SENSOR_SCHEMA, }) }, extra=vol.ALLOW_EXTRA) SET_AWAY_MODE_SCHEMA = vol.Schema({ vol.Required(ATTR_AWAY_MODE): vol.In([AWAY_MODE_AWAY, AWAY_MODE_HOME]), - vol.Optional(ATTR_STRUCTURE): vol.All(cv.ensure_list, [cv.string]) + vol.Optional(ATTR_STRUCTURE): vol.All(cv.ensure_list, [cv.string]), }) SET_ETA_SCHEMA = vol.Schema({ vol.Required(ATTR_ETA): cv.time_period, vol.Optional(ATTR_TRIP_ID): cv.string, vol.Optional(ATTR_ETA_WINDOW): cv.time_period, - vol.Optional(ATTR_STRUCTURE): vol.All(cv.ensure_list, [cv.string]) + vol.Optional(ATTR_STRUCTURE): vol.All(cv.ensure_list, [cv.string]), }) CANCEL_ETA_SCHEMA = vol.Schema({ vol.Required(ATTR_TRIP_ID): cv.string, - vol.Optional(ATTR_STRUCTURE): vol.All(cv.ensure_list, [cv.string]) + vol.Optional(ATTR_STRUCTURE): vol.All(cv.ensure_list, [cv.string]), }) @@ -90,7 +85,7 @@ def nest_update_event_broker(hass, nest): Runs in its own thread. """ - _LOGGER.debug("listening nest.update_event") + _LOGGER.debug("Listening for nest.update_event") while hass.is_running: nest.update_event.wait() @@ -99,10 +94,10 @@ def nest_update_event_broker(hass, nest): break nest.update_event.clear() - _LOGGER.debug("dispatching nest data update") + _LOGGER.debug("Dispatching nest data update") dispatcher_send(hass, SIGNAL_NEST_UPDATE) - _LOGGER.debug("stop listening nest.update_event") + _LOGGER.debug("Stop listening for nest.update_event") async def async_setup(hass, config): diff --git a/homeassistant/components/nest/binary_sensor.py b/homeassistant/components/nest/binary_sensor.py index 7f7278d9789..1077fdb073e 100644 --- a/homeassistant/components/nest/binary_sensor.py +++ b/homeassistant/components/nest/binary_sensor.py @@ -1,9 +1,4 @@ -""" -Support for Nest Thermostat Binary Sensors. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/binary_sensor.nest/ -""" +"""Support for Nest Thermostat binary sensors.""" from itertools import chain import logging @@ -12,6 +7,8 @@ from homeassistant.components.nest import ( DATA_NEST, DATA_NEST_CONFIG, CONF_BINARY_SENSORS, NestSensorDevice) from homeassistant.const import CONF_MONITORED_CONDITIONS +_LOGGER = logging.getLogger(__name__) + DEPENDENCIES = ['nest'] BINARY_TYPES = {'online': 'connectivity'} @@ -48,10 +45,12 @@ _BINARY_TYPES_DEPRECATED = [ 'hvac_emer_heat_state', ] -_VALID_BINARY_SENSOR_TYPES = {**BINARY_TYPES, **CLIMATE_BINARY_TYPES, - **CAMERA_BINARY_TYPES, **STRUCTURE_BINARY_TYPES} - -_LOGGER = logging.getLogger(__name__) +_VALID_BINARY_SENSOR_TYPES = { + **BINARY_TYPES, + **CLIMATE_BINARY_TYPES, + **CAMERA_BINARY_TYPES, + **STRUCTURE_BINARY_TYPES, +} def setup_platform(hass, config, add_entities, discovery_info=None): @@ -89,9 +88,8 @@ async def async_setup_entry(hass, entry, async_add_entities): sensors += [NestBinarySensor(structure, None, variable) for variable in conditions if variable in STRUCTURE_BINARY_TYPES] - device_chain = chain(nest.thermostats(), - nest.smoke_co_alarms(), - nest.cameras()) + device_chain = chain( + nest.thermostats(), nest.smoke_co_alarms(), nest.cameras()) for structure, device in device_chain: sensors += [NestBinarySensor(structure, device, variable) for variable in conditions @@ -106,9 +104,8 @@ async def async_setup_entry(hass, entry, async_add_entities): for variable in conditions if variable in CAMERA_BINARY_TYPES] for activity_zone in device.activity_zones: - sensors += [NestActivityZoneSensor(structure, - device, - activity_zone)] + sensors += [NestActivityZoneSensor( + structure, device, activity_zone)] return sensors diff --git a/homeassistant/components/nest/camera.py b/homeassistant/components/nest/camera.py index 158123989c0..8b450e02b46 100644 --- a/homeassistant/components/nest/camera.py +++ b/homeassistant/components/nest/camera.py @@ -1,9 +1,4 @@ -""" -Support for Nest Cameras. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/camera.nest/ -""" +"""Support for Nest Cameras.""" import logging from datetime import timedelta diff --git a/homeassistant/components/nest/climate.py b/homeassistant/components/nest/climate.py index bd6bb2991cc..8746a1959ae 100644 --- a/homeassistant/components/nest/climate.py +++ b/homeassistant/components/nest/climate.py @@ -1,9 +1,4 @@ -""" -Support for Nest thermostats. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/climate.nest/ -""" +"""Support for Nest thermostats.""" import logging import voluptuous as vol diff --git a/homeassistant/components/nest/sensor.py b/homeassistant/components/nest/sensor.py index 5514203c6ea..10fa83d23e0 100644 --- a/homeassistant/components/nest/sensor.py +++ b/homeassistant/components/nest/sensor.py @@ -1,9 +1,4 @@ -""" -Support for Nest Thermostat Sensors. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/sensor.nest/ -""" +"""Support for Nest Thermostat sensors.""" import logging from homeassistant.components.climate import ( diff --git a/homeassistant/components/netatmo/__init__.py b/homeassistant/components/netatmo/__init__.py index ce39ad9d55e..495e22aae24 100644 --- a/homeassistant/components/netatmo/__init__.py +++ b/homeassistant/components/netatmo/__init__.py @@ -1,9 +1,4 @@ -""" -Support for the Netatmo devices. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/netatmo/ -""" +"""Support for the Netatmo devices.""" import logging from datetime import timedelta from urllib.error import HTTPError diff --git a/homeassistant/components/netatmo/binary_sensor.py b/homeassistant/components/netatmo/binary_sensor.py index 2cafacf401c..727ed0a68c7 100644 --- a/homeassistant/components/netatmo/binary_sensor.py +++ b/homeassistant/components/netatmo/binary_sensor.py @@ -1,11 +1,4 @@ -""" -Support for the Netatmo binary sensors. - -The binary sensors based on events seen by the Netatmo cameras. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/binary_sensor.netatmo/. -""" +"""Support for the Netatmo binary sensors.""" import logging import voluptuous as vol diff --git a/homeassistant/components/netatmo/camera.py b/homeassistant/components/netatmo/camera.py index 93ad2cd055b..a3a5461631d 100644 --- a/homeassistant/components/netatmo/camera.py +++ b/homeassistant/components/netatmo/camera.py @@ -1,9 +1,4 @@ -""" -Support for the Netatmo cameras. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/camera.netatmo/. -""" +"""Support for the Netatmo cameras.""" import logging import requests diff --git a/homeassistant/components/netatmo/climate.py b/homeassistant/components/netatmo/climate.py index 8849ada5ccc..2b9bcbebaf2 100644 --- a/homeassistant/components/netatmo/climate.py +++ b/homeassistant/components/netatmo/climate.py @@ -1,9 +1,4 @@ -""" -Support for Netatmo Smart Thermostat. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/climate.netatmo/ -""" +"""Support for Netatmo Smart thermostats.""" import logging from datetime import timedelta import voluptuous as vol diff --git a/homeassistant/components/netatmo/sensor.py b/homeassistant/components/netatmo/sensor.py index f4dad6a3b6b..78a118528b9 100644 --- a/homeassistant/components/netatmo/sensor.py +++ b/homeassistant/components/netatmo/sensor.py @@ -1,9 +1,4 @@ -""" -Support for the NetAtmo Weather Service. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/sensor.netatmo/ -""" +"""Support for the NetAtmo Weather Service.""" import logging from time import time import threading @@ -55,8 +50,7 @@ SENSOR_TYPES = { } MODULE_SCHEMA = vol.Schema({ - vol.Required(cv.string): - vol.All(cv.ensure_list, [vol.In(SENSOR_TYPES)]), + vol.Required(cv.string): vol.All(cv.ensure_list, [vol.In(SENSOR_TYPES)]), }) PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ diff --git a/homeassistant/components/netgear_lte/__init__.py b/homeassistant/components/netgear_lte/__init__.py index 77b9783b239..5f8c680b7f0 100644 --- a/homeassistant/components/netgear_lte/__init__.py +++ b/homeassistant/components/netgear_lte/__init__.py @@ -1,9 +1,4 @@ -""" -Support for Netgear LTE modems. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/netgear_lte/ -""" +"""Support for Netgear LTE modems.""" import asyncio from datetime import timedelta import logging diff --git a/homeassistant/components/netgear_lte/notify.py b/homeassistant/components/netgear_lte/notify.py index 3f39ccfb43f..20a20b21291 100644 --- a/homeassistant/components/netgear_lte/notify.py +++ b/homeassistant/components/netgear_lte/notify.py @@ -1,9 +1,4 @@ -""" -The Netgear LTE platform for notify component. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/notify.netgear_lte/ -""" +"""Suport for Netgear LTE notifications.""" import logging import attr diff --git a/homeassistant/components/netgear_lte/sensor.py b/homeassistant/components/netgear_lte/sensor.py index 99907a21b57..339fa678d61 100644 --- a/homeassistant/components/netgear_lte/sensor.py +++ b/homeassistant/components/netgear_lte/sensor.py @@ -1,9 +1,4 @@ -""" -Support for Netgear LTE sensors. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/sensor.netgear_lte/ -""" +"""Support for Netgear LTE sensors.""" import attr import voluptuous as vol @@ -23,7 +18,7 @@ SENSOR_USAGE = 'usage' PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Optional(CONF_HOST): cv.string, vol.Required(CONF_SENSORS): vol.All( - cv.ensure_list, [vol.In([SENSOR_SMS, SENSOR_USAGE])]) + cv.ensure_list, [vol.In([SENSOR_SMS, SENSOR_USAGE])]), }) diff --git a/homeassistant/components/no_ip/__init__.py b/homeassistant/components/no_ip/__init__.py index beb11ed738f..6a714747484 100644 --- a/homeassistant/components/no_ip/__init__.py +++ b/homeassistant/components/no_ip/__init__.py @@ -1,9 +1,4 @@ -""" -Integrate with NO-IP Dynamic DNS service. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/no_ip/ -""" +"""Integrate with NO-IP Dynamic DNS service.""" import asyncio import base64 from datetime import timedelta diff --git a/homeassistant/components/nuheat/__init__.py b/homeassistant/components/nuheat/__init__.py index fb14f119dbd..4ea37339ef3 100644 --- a/homeassistant/components/nuheat/__init__.py +++ b/homeassistant/components/nuheat/__init__.py @@ -1,9 +1,4 @@ -""" -Support for NuHeat thermostats. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/nuheat/ -""" +"""Support for NuHeat thermostats.""" import logging import voluptuous as vol @@ -16,7 +11,7 @@ REQUIREMENTS = ["nuheat==0.3.0"] _LOGGER = logging.getLogger(__name__) -DOMAIN = "nuheat" +DOMAIN = 'nuheat' CONFIG_SCHEMA = vol.Schema({ DOMAIN: vol.Schema({ diff --git a/homeassistant/components/nuimo_controller/__init__.py b/homeassistant/components/nuimo_controller/__init__.py index 0f8fbb39073..70509469d2b 100644 --- a/homeassistant/components/nuimo_controller/__init__.py +++ b/homeassistant/components/nuimo_controller/__init__.py @@ -1,9 +1,4 @@ -""" -Component that connects to a Nuimo device over Bluetooth LE. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/nuimo_controller/ -""" +"""Support for Nuimo device over Bluetooth LE.""" import logging import threading import time diff --git a/homeassistant/components/octoprint/__init__.py b/homeassistant/components/octoprint/__init__.py index 869f3bd7d6e..35740a7be0d 100644 --- a/homeassistant/components/octoprint/__init__.py +++ b/homeassistant/components/octoprint/__init__.py @@ -1,9 +1,4 @@ -""" -Support for monitoring OctoPrint 3D printers. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/octoprint/ -""" +"""Support for monitoring OctoPrint 3D printers.""" import logging import time @@ -23,10 +18,11 @@ from homeassistant.util import slugify as util_slugify _LOGGER = logging.getLogger(__name__) -DOMAIN = 'octoprint' -CONF_NUMBER_OF_TOOLS = 'number_of_tools' CONF_BED = 'bed' +CONF_NUMBER_OF_TOOLS = 'number_of_tools' + DEFAULT_NAME = 'OctoPrint' +DOMAIN = 'octoprint' def has_all_unique_names(value): diff --git a/homeassistant/components/octoprint/binary_sensor.py b/homeassistant/components/octoprint/binary_sensor.py index 285495c03a0..cb860177796 100644 --- a/homeassistant/components/octoprint/binary_sensor.py +++ b/homeassistant/components/octoprint/binary_sensor.py @@ -1,9 +1,4 @@ -""" -Support for monitoring OctoPrint binary sensors. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/binary_sensor.octoprint/ -""" +"""Support for monitoring OctoPrint binary sensors.""" import logging import requests diff --git a/homeassistant/components/octoprint/sensor.py b/homeassistant/components/octoprint/sensor.py index 8170b97c4c8..2df307f02ef 100644 --- a/homeassistant/components/octoprint/sensor.py +++ b/homeassistant/components/octoprint/sensor.py @@ -1,9 +1,4 @@ -""" -Support for monitoring OctoPrint sensors. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/sensor.octoprint/ -""" +"""Support for monitoring OctoPrint sensors.""" import logging import requests @@ -16,6 +11,7 @@ from homeassistant.helpers.entity import Entity _LOGGER = logging.getLogger(__name__) DEPENDENCIES = ['octoprint'] + NOTIFICATION_ID = 'octoprint_notification' NOTIFICATION_TITLE = 'OctoPrint sensor setup error' diff --git a/homeassistant/components/onboarding/__init__.py b/homeassistant/components/onboarding/__init__.py index 25aca9f8afa..6bbe546dcb1 100644 --- a/homeassistant/components/onboarding/__init__.py +++ b/homeassistant/components/onboarding/__init__.py @@ -1,4 +1,4 @@ -"""Component to help onboard new users.""" +"""Support to help onboard new users.""" from homeassistant.core import callback from homeassistant.loader import bind_hass @@ -19,8 +19,8 @@ def async_is_onboarded(hass): async def async_setup(hass, config): """Set up the onboarding component.""" - store = hass.helpers.storage.Store(STORAGE_VERSION, STORAGE_KEY, - private=True) + store = hass.helpers.storage.Store( + STORAGE_VERSION, STORAGE_KEY, private=True) data = await store.async_load() if data is None: diff --git a/homeassistant/components/opentherm_gw/__init__.py b/homeassistant/components/opentherm_gw/__init__.py index cf74aae7577..7676806cfdf 100644 --- a/homeassistant/components/opentherm_gw/__init__.py +++ b/homeassistant/components/opentherm_gw/__init__.py @@ -1,9 +1,4 @@ -""" -Support for OpenTherm Gateway devices. - -For more details about this component, please refer to the documentation at -http://home-assistant.io/components/opentherm_gw/ -""" +"""Support for OpenTherm Gateway devices.""" import logging from datetime import datetime, date @@ -20,6 +15,10 @@ from homeassistant.helpers.dispatcher import async_dispatcher_send import homeassistant.helpers.config_validation as cv +REQUIREMENTS = ['pyotgw==0.4b1'] + +_LOGGER = logging.getLogger(__name__) + DOMAIN = 'opentherm_gw' ATTR_MODE = 'mode' @@ -104,10 +103,6 @@ CONFIG_SCHEMA = vol.Schema({ }), }, extra=vol.ALLOW_EXTRA) -REQUIREMENTS = ['pyotgw==0.4b1'] - -_LOGGER = logging.getLogger(__name__) - async def async_setup(hass, config): """Set up the OpenTherm Gateway component.""" diff --git a/homeassistant/components/opentherm_gw/binary_sensor.py b/homeassistant/components/opentherm_gw/binary_sensor.py index 8c5ff8c44d1..b35998c807b 100644 --- a/homeassistant/components/opentherm_gw/binary_sensor.py +++ b/homeassistant/components/opentherm_gw/binary_sensor.py @@ -1,9 +1,4 @@ -""" -Support for OpenTherm Gateway binary sensors. - -For more details about this platform, please refer to the documentation at -http://home-assistant.io/components/binary_sensor.opentherm_gw/ -""" +"""Support for OpenTherm Gateway binary sensors.""" import logging from homeassistant.components.binary_sensor import ( @@ -13,17 +8,17 @@ from homeassistant.components.opentherm_gw import ( from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity import async_generate_entity_id +_LOGGER = logging.getLogger(__name__) + DEVICE_CLASS_COLD = 'cold' DEVICE_CLASS_HEAT = 'heat' DEVICE_CLASS_PROBLEM = 'problem' DEPENDENCIES = ['opentherm_gw'] -_LOGGER = logging.getLogger(__name__) - -async def async_setup_platform(hass, config, async_add_entities, - discovery_info=None): +async def async_setup_platform( + hass, config, async_add_entities, discovery_info=None): """Set up the OpenTherm Gateway binary sensors.""" if discovery_info is None: return diff --git a/homeassistant/components/opentherm_gw/climate.py b/homeassistant/components/opentherm_gw/climate.py index 6dc52e6acc7..ff6acc1a884 100644 --- a/homeassistant/components/opentherm_gw/climate.py +++ b/homeassistant/components/opentherm_gw/climate.py @@ -1,9 +1,4 @@ -""" -Support for OpenTherm Gateway climate devices. - -For more details about this platform, please refer to the documentation at -http://home-assistant.io/components/climate.opentherm_gw/ -""" +"""Support for OpenTherm Gateway climate devices.""" import logging from homeassistant.components.climate import (ClimateDevice, STATE_IDLE, @@ -17,14 +12,15 @@ from homeassistant.const import (ATTR_TEMPERATURE, CONF_NAME, PRECISION_HALVES, TEMP_CELSIUS) from homeassistant.helpers.dispatcher import async_dispatcher_connect -DEPENDENCIES = ['opentherm_gw'] - -SUPPORT_FLAGS = (SUPPORT_TARGET_TEMPERATURE) _LOGGER = logging.getLogger(__name__) +DEPENDENCIES = ['opentherm_gw'] -async def async_setup_platform(hass, config, async_add_entities, - discovery_info=None): +SUPPORT_FLAGS = SUPPORT_TARGET_TEMPERATURE + + +async def async_setup_platform( + hass, config, async_add_entities, discovery_info=None): """Set up the opentherm_gw device.""" gateway = OpenThermGateway(hass, discovery_info) async_add_entities([gateway]) diff --git a/homeassistant/components/opentherm_gw/sensor.py b/homeassistant/components/opentherm_gw/sensor.py index 9ae557654ce..070f847e5e5 100644 --- a/homeassistant/components/opentherm_gw/sensor.py +++ b/homeassistant/components/opentherm_gw/sensor.py @@ -1,9 +1,4 @@ -""" -Support for OpenTherm Gateway sensors. - -For more details about this platform, please refer to the documentation at -http://home-assistant.io/components/sensor.opentherm_gw/ -""" +"""Support for OpenTherm Gateway sensors.""" import logging from homeassistant.components.opentherm_gw import ( @@ -13,6 +8,8 @@ from homeassistant.const import DEVICE_CLASS_TEMPERATURE, TEMP_CELSIUS from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity import Entity, async_generate_entity_id +_LOGGER = logging.getLogger(__name__) + UNIT_BAR = 'bar' UNIT_HOUR = 'h' UNIT_KW = 'kW' @@ -21,11 +18,9 @@ UNIT_PERCENT = '%' DEPENDENCIES = ['opentherm_gw'] -_LOGGER = logging.getLogger(__name__) - -async def async_setup_platform(hass, config, async_add_entities, - discovery_info=None): +async def async_setup_platform( + hass, config, async_add_entities, discovery_info=None): """Set up the OpenTherm Gateway sensors.""" if discovery_info is None: return @@ -163,7 +158,7 @@ class OpenThermSensor(Entity): """Representation of an OpenTherm Gateway sensor.""" def __init__(self, entity_id, var, device_class, unit, friendly_name): - """Initialize the sensor.""" + """Initialize the OpenTherm Gateway sensor.""" self.entity_id = entity_id self._var = var self._value = None diff --git a/homeassistant/components/openuv/__init__.py b/homeassistant/components/openuv/__init__.py index 32c3da0d3e5..52383366c4d 100644 --- a/homeassistant/components/openuv/__init__.py +++ b/homeassistant/components/openuv/__init__.py @@ -1,9 +1,4 @@ -""" -Support for UV data from openuv.io. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/openuv/ -""" +"""Support for UV data from openuv.io.""" import logging import voluptuous as vol @@ -11,8 +6,7 @@ import voluptuous as vol from homeassistant.config_entries import SOURCE_IMPORT from homeassistant.const import ( ATTR_ATTRIBUTION, CONF_API_KEY, CONF_BINARY_SENSORS, CONF_ELEVATION, - CONF_LATITUDE, CONF_LONGITUDE, CONF_MONITORED_CONDITIONS, - CONF_SENSORS) + CONF_LATITUDE, CONF_LONGITUDE, CONF_MONITORED_CONDITIONS, CONF_SENSORS) from homeassistant.exceptions import ConfigEntryNotReady from homeassistant.helpers import aiohttp_client, config_validation as cv from homeassistant.helpers.dispatcher import async_dispatcher_send @@ -22,6 +16,7 @@ from .config_flow import configured_instances from .const import DOMAIN REQUIREMENTS = ['pyopenuv==1.0.4'] + _LOGGER = logging.getLogger(__name__) DATA_OPENUV_CLIENT = 'data_client' diff --git a/homeassistant/components/openuv/binary_sensor.py b/homeassistant/components/openuv/binary_sensor.py index 3e9bb0b0bc3..b790427b228 100644 --- a/homeassistant/components/openuv/binary_sensor.py +++ b/homeassistant/components/openuv/binary_sensor.py @@ -1,26 +1,21 @@ -""" -This platform provides binary sensors for OpenUV data. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/binary_sensor.openuv/ -""" +"""Support for OpenUV binary sensors.""" import logging from homeassistant.components.binary_sensor import BinarySensorDevice -from homeassistant.core import callback -from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.components.openuv import ( BINARY_SENSORS, DATA_OPENUV_CLIENT, DATA_PROTECTION_WINDOW, DOMAIN, TOPIC_UPDATE, TYPE_PROTECTION_WINDOW, OpenUvEntity) +from homeassistant.core import callback +from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.util.dt import as_local, parse_datetime, utcnow -DEPENDENCIES = ['openuv'] _LOGGER = logging.getLogger(__name__) - -ATTR_PROTECTION_WINDOW_STARTING_TIME = 'start_time' -ATTR_PROTECTION_WINDOW_STARTING_UV = 'start_uv' ATTR_PROTECTION_WINDOW_ENDING_TIME = 'end_time' ATTR_PROTECTION_WINDOW_ENDING_UV = 'end_uv' +ATTR_PROTECTION_WINDOW_STARTING_TIME = 'start_time' +ATTR_PROTECTION_WINDOW_STARTING_UV = 'start_uv' + +DEPENDENCIES = ['openuv'] async def async_setup_platform( diff --git a/homeassistant/components/openuv/config_flow.py b/homeassistant/components/openuv/config_flow.py index 0f566e5a9ef..7150a8499d8 100644 --- a/homeassistant/components/openuv/config_flow.py +++ b/homeassistant/components/openuv/config_flow.py @@ -3,9 +3,9 @@ import voluptuous as vol from homeassistant import config_entries -from homeassistant.core import callback from homeassistant.const import ( CONF_API_KEY, CONF_ELEVATION, CONF_LATITUDE, CONF_LONGITUDE) +from homeassistant.core import callback from homeassistant.helpers import aiohttp_client, config_validation as cv from .const import DOMAIN diff --git a/homeassistant/components/openuv/sensor.py b/homeassistant/components/openuv/sensor.py index 63527db42a6..489a100a5e5 100644 --- a/homeassistant/components/openuv/sensor.py +++ b/homeassistant/components/openuv/sensor.py @@ -1,24 +1,20 @@ -""" -This platform provides sensors for OpenUV data. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/sensor.openuv/ -""" +"""Support for OpenUV sensors.""" import logging -from homeassistant.core import callback -from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.components.openuv import ( DATA_OPENUV_CLIENT, DATA_UV, DOMAIN, SENSORS, TOPIC_UPDATE, TYPE_CURRENT_OZONE_LEVEL, TYPE_CURRENT_UV_INDEX, TYPE_CURRENT_UV_LEVEL, TYPE_MAX_UV_INDEX, TYPE_SAFE_EXPOSURE_TIME_1, TYPE_SAFE_EXPOSURE_TIME_2, TYPE_SAFE_EXPOSURE_TIME_3, TYPE_SAFE_EXPOSURE_TIME_4, TYPE_SAFE_EXPOSURE_TIME_5, TYPE_SAFE_EXPOSURE_TIME_6, OpenUvEntity) +from homeassistant.core import callback +from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.util.dt import as_local, parse_datetime -DEPENDENCIES = ['openuv'] _LOGGER = logging.getLogger(__name__) +DEPENDENCIES = ['openuv'] + ATTR_MAX_UV_TIME = 'time' EXPOSURE_TYPE_MAP = { @@ -30,11 +26,11 @@ EXPOSURE_TYPE_MAP = { TYPE_SAFE_EXPOSURE_TIME_6: 'st6' } -UV_LEVEL_EXTREME = "Extreme" -UV_LEVEL_VHIGH = "Very High" -UV_LEVEL_HIGH = "High" -UV_LEVEL_MODERATE = "Moderate" -UV_LEVEL_LOW = "Low" +UV_LEVEL_EXTREME = 'Extreme' +UV_LEVEL_VHIGH = 'Very High' +UV_LEVEL_HIGH = 'High' +UV_LEVEL_MODERATE = 'Moderate' +UV_LEVEL_LOW = 'Low' async def async_setup_platform( diff --git a/homeassistant/components/owntracks/__init__.py b/homeassistant/components/owntracks/__init__.py index d0ba27aeddd..cc918dcf674 100644 --- a/homeassistant/components/owntracks/__init__.py +++ b/homeassistant/components/owntracks/__init__.py @@ -1,4 +1,4 @@ -"""Component for OwnTracks.""" +"""Support for OwnTracks.""" from collections import defaultdict import json import logging @@ -8,16 +8,19 @@ from aiohttp.web import json_response import voluptuous as vol from homeassistant import config_entries +from homeassistant.components import mqtt from homeassistant.const import CONF_WEBHOOK_ID from homeassistant.core import callback -from homeassistant.components import mqtt -from homeassistant.setup import async_when_setup import homeassistant.helpers.config_validation as cv +from homeassistant.setup import async_when_setup from .config_flow import CONF_SECRET -DOMAIN = "owntracks" REQUIREMENTS = ['libnacl==1.6.1'] + +_LOGGER = logging.getLogger(__name__) + +DOMAIN = 'owntracks' DEPENDENCIES = ['webhook'] CONF_MAX_GPS_ACCURACY = 'max_gps_accuracy' @@ -47,8 +50,6 @@ CONFIG_SCHEMA = vol.Schema({ } }, extra=vol.ALLOW_EXTRA) -_LOGGER = logging.getLogger(__name__) - async def async_setup(hass, config): """Initialize OwnTracks component.""" diff --git a/homeassistant/components/panel_custom/__init__.py b/homeassistant/components/panel_custom/__init__.py index 740a28a9dec..f6602169eb2 100644 --- a/homeassistant/components/panel_custom/__init__.py +++ b/homeassistant/components/panel_custom/__init__.py @@ -1,16 +1,13 @@ -""" -Register a custom front end panel. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/panel_custom/ -""" +"""Register a custom front end panel.""" import logging import os import voluptuous as vol -from homeassistant.loader import bind_hass import homeassistant.helpers.config_validation as cv +from homeassistant.loader import bind_hass + +_LOGGER = logging.getLogger(__name__) DOMAIN = 'panel_custom' DEPENDENCIES = ['frontend'] @@ -58,8 +55,6 @@ CONFIG_SCHEMA = vol.Schema({ })]) }, extra=vol.ALLOW_EXTRA) -_LOGGER = logging.getLogger(__name__) - @bind_hass async def async_register_panel( @@ -154,8 +149,8 @@ async def async_setup(hass, config): kwargs['module_url'] = panel[CONF_MODULE_URL] elif not await hass.async_add_job(os.path.isfile, panel_path): - _LOGGER.error('Unable to find webcomponent for %s: %s', - name, panel_path) + _LOGGER.error( + "Unable to find webcomponent for %s: %s", name, panel_path) continue else: diff --git a/homeassistant/components/panel_iframe/__init__.py b/homeassistant/components/panel_iframe/__init__.py index 030fbbf9324..b82f9fa9789 100644 --- a/homeassistant/components/panel_iframe/__init__.py +++ b/homeassistant/components/panel_iframe/__init__.py @@ -1,12 +1,7 @@ -""" -Register an iFrame front end panel. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/panel_iframe/ -""" +"""Register an iFrame front end panel.""" import voluptuous as vol -from homeassistant.const import (CONF_ICON, CONF_URL) +from homeassistant.const import CONF_ICON, CONF_URL import homeassistant.helpers.config_validation as cv DEPENDENCIES = ['frontend'] diff --git a/homeassistant/components/persistent_notification/__init__.py b/homeassistant/components/persistent_notification/__init__.py index d38501b9b07..0a648f6eff7 100644 --- a/homeassistant/components/persistent_notification/__init__.py +++ b/homeassistant/components/persistent_notification/__init__.py @@ -1,21 +1,16 @@ -""" -A component which is collecting configuration errors. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/persistent_notification/ -""" -import logging +"""Support for displaying persistent notifications.""" from collections import OrderedDict +import logging from typing import Awaitable import voluptuous as vol from homeassistant.components import websocket_api -from homeassistant.core import callback, HomeAssistant +from homeassistant.core import HomeAssistant, callback from homeassistant.exceptions import TemplateError -from homeassistant.loader import bind_hass from homeassistant.helpers import config_validation as cv from homeassistant.helpers.entity import async_generate_entity_id +from homeassistant.loader import bind_hass from homeassistant.util import slugify import homeassistant.util.dt as dt_util diff --git a/homeassistant/components/person/__init__.py b/homeassistant/components/person/__init__.py index 20014c3414b..d11d4208dc8 100644 --- a/homeassistant/components/person/__init__.py +++ b/homeassistant/components/person/__init__.py @@ -1,9 +1,4 @@ -""" -Support for tracking people. - -For more details about this component, please refer to the documentation. -https://home-assistant.io/components/person/ -""" +"""Support for tracking people.""" from collections import OrderedDict from itertools import chain import logging @@ -11,6 +6,7 @@ import uuid import voluptuous as vol +from homeassistant.components import websocket_api from homeassistant.components.device_tracker import ( DOMAIN as DEVICE_TRACKER_DOMAIN) from homeassistant.const import ( @@ -19,21 +15,24 @@ from homeassistant.const import ( from homeassistant.core import callback, Event from homeassistant.auth import EVENT_USER_REMOVED import homeassistant.helpers.config_validation as cv -from homeassistant.helpers.storage import Store from homeassistant.helpers.entity_component import EntityComponent from homeassistant.helpers.event import async_track_state_change from homeassistant.helpers.restore_state import RestoreEntity -from homeassistant.components import websocket_api -from homeassistant.helpers.typing import HomeAssistantType, ConfigType +from homeassistant.helpers.storage import Store +from homeassistant.helpers.typing import ConfigType, HomeAssistantType from homeassistant.loader import bind_hass _LOGGER = logging.getLogger(__name__) + ATTR_EDITABLE = 'editable' ATTR_SOURCE = 'source' ATTR_USER_ID = 'user_id' + CONF_DEVICE_TRACKERS = 'device_trackers' CONF_USER_ID = 'user_id' + DOMAIN = 'person' + STORAGE_KEY = DOMAIN STORAGE_VERSION = 1 SAVE_DELAY = 10 @@ -82,8 +81,8 @@ class PersonManager: person_id = conf[CONF_ID] if person_id in config_data: - _LOGGER.error("Found config user with duplicate ID: %s", - person_id) + _LOGGER.error( + "Found config user with duplicate ID: %s", person_id) continue config_data[person_id] = conf @@ -160,8 +159,8 @@ class PersonManager: self.hass.bus.async_listen(EVENT_USER_REMOVED, self._user_removed) - async def async_create_person(self, *, name, device_trackers=None, - user_id=None): + async def async_create_person( + self, *, name, device_trackers=None, user_id=None): """Create a new person.""" if not name: raise ValueError("Name is required") @@ -338,8 +337,8 @@ class Person(RestoreEntity): def person_start_hass(now): self.person_updated() - self.hass.bus.async_listen_once(EVENT_HOMEASSISTANT_START, - person_start_hass) + self.hass.bus.async_listen_once( + EVENT_HOMEASSISTANT_START, person_start_hass) @callback def person_updated(self): diff --git a/homeassistant/components/plant/__init__.py b/homeassistant/components/plant/__init__.py index ed43562d221..27324ad57a3 100644 --- a/homeassistant/components/plant/__init__.py +++ b/homeassistant/components/plant/__init__.py @@ -1,24 +1,21 @@ -"""Component to monitor plants. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/plant/ -""" -import logging -from datetime import datetime, timedelta +"""Support for monitoring plants.""" from collections import deque +from datetime import datetime, timedelta +import logging + import voluptuous as vol -from homeassistant.exceptions import HomeAssistantError -from homeassistant.const import ( - STATE_OK, STATE_PROBLEM, STATE_UNKNOWN, TEMP_CELSIUS, ATTR_TEMPERATURE, - CONF_SENSORS, ATTR_UNIT_OF_MEASUREMENT) from homeassistant.components import group +from homeassistant.components.recorder.util import execute, session_scope +from homeassistant.const import ( + ATTR_TEMPERATURE, ATTR_UNIT_OF_MEASUREMENT, CONF_SENSORS, STATE_OK, + STATE_PROBLEM, STATE_UNKNOWN, TEMP_CELSIUS) +from homeassistant.core import callback +from homeassistant.exceptions import HomeAssistantError import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entity import Entity from homeassistant.helpers.entity_component import EntityComponent -from homeassistant.core import callback from homeassistant.helpers.event import async_track_state_change -from homeassistant.components.recorder.util import session_scope, execute _LOGGER = logging.getLogger(__name__) @@ -111,8 +108,8 @@ ENABLE_LOAD_HISTORY = False async def async_setup(hass, config): """Set up the Plant component.""" - component = EntityComponent(_LOGGER, DOMAIN, hass, - group_name=GROUP_NAME_ALL_PLANTS) + component = EntityComponent( + _LOGGER, DOMAIN, hass, group_name=GROUP_NAME_ALL_PLANTS) entities = [] for plant_name, plant_config in config[DOMAIN].items(): @@ -204,8 +201,8 @@ class Plant(Entity): self._conductivity = int(float(value)) elif reading == READING_BRIGHTNESS: self._brightness = int(float(value)) - self._brightness_history.add_measurement(self._brightness, - new_state.last_updated) + self._brightness_history.add_measurement( + self._brightness, new_state.last_updated) else: raise HomeAssistantError( "Unknown reading from sensor {}: {}".format(entity_id, value)) @@ -260,8 +257,8 @@ class Plant(Entity): # only use the database if it's configured self.hass.async_add_job(self._load_history_from_db) - async_track_state_change(self.hass, list(self._sensormap), - self.state_changed) + async_track_state_change( + self.hass, list(self._sensormap), self.state_changed) for entity_id in self._sensormap: state = self.hass.states.get(entity_id) @@ -277,11 +274,11 @@ class Plant(Entity): start_date = datetime.now() - timedelta(days=self._conf_check_days) entity_id = self._readingmap.get(READING_BRIGHTNESS) if entity_id is None: - _LOGGER.debug("not reading the history from the database as " - "there is no brightness sensor configured.") + _LOGGER.debug("Not reading the history from the database as " + "there is no brightness sensor configured") return - _LOGGER.debug("initializing values for %s from the database", + _LOGGER.debug("Initializing values for %s from the database", self._name) with session_scope(hass=self.hass) as session: query = session.query(States).filter( @@ -298,7 +295,7 @@ class Plant(Entity): int(state.state), state.last_updated) except ValueError: pass - _LOGGER.debug("initializing from database completed") + _LOGGER.debug("Initializing from database completed") self.async_schedule_update_ha_state() @property @@ -366,7 +363,7 @@ class DailyHistory: elif day > current_day: self._add_day(day, value) else: - _LOGGER.warning('received old measurement, not storing it!') + _LOGGER.warning("Received old measurement, not storing it") self.max = max(self._max_dict.values()) diff --git a/homeassistant/components/plum_lightpad/__init__.py b/homeassistant/components/plum_lightpad/__init__.py index 979f257f25f..5b99223d25a 100644 --- a/homeassistant/components/plum_lightpad/__init__.py +++ b/homeassistant/components/plum_lightpad/__init__.py @@ -1,9 +1,4 @@ -""" -Support for Plum Lightpad switches. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/plum_lightpad -""" +"""Support for Plum Lightpad devices.""" import asyncio import logging diff --git a/homeassistant/components/plum_lightpad/light.py b/homeassistant/components/plum_lightpad/light.py index fa15c842deb..43cceaa671f 100644 --- a/homeassistant/components/plum_lightpad/light.py +++ b/homeassistant/components/plum_lightpad/light.py @@ -1,9 +1,4 @@ -""" -Support for Plum Lightpad switches. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/light.plum_lightpad/ -""" +"""Support for Plum Lightpad lights.""" from homeassistant.components.light import ( ATTR_BRIGHTNESS, ATTR_HS_COLOR, SUPPORT_BRIGHTNESS, SUPPORT_COLOR, Light) from homeassistant.components.plum_lightpad import PLUM_DATA @@ -12,8 +7,8 @@ import homeassistant.util.color as color_util DEPENDENCIES = ['plum_lightpad'] -async def async_setup_platform(hass, config, async_add_entities, - discovery_info=None): +async def async_setup_platform( + hass, config, async_add_entities, discovery_info=None): """Initialize the Plum Lightpad Light and GlowRing.""" if discovery_info is None: return @@ -35,7 +30,7 @@ async def async_setup_platform(hass, config, async_add_entities, class PlumLight(Light): - """Represenation of a Plum Lightpad dimmer.""" + """Representation of a Plum Lightpad dimmer.""" def __init__(self, load): """Initialize the light.""" @@ -91,7 +86,7 @@ class PlumLight(Light): class GlowRing(Light): - """Represenation of a Plum Lightpad dimmer glow ring.""" + """Representation of a Plum Lightpad dimmer glow ring.""" def __init__(self, lightpad): """Initialize the light.""" @@ -107,8 +102,8 @@ class GlowRing(Light): async def async_added_to_hass(self): """Subscribe to configchange events.""" - self._lightpad.add_event_listener('configchange', - self.configchange_event) + self._lightpad.add_event_listener( + 'configchange', self.configchange_event) def configchange_event(self, event): """Handle Configuration change event.""" @@ -155,7 +150,7 @@ class GlowRing(Light): @property def icon(self): - """Return the crop-portait icon representing the glow ring.""" + """Return the crop-portrait icon representing the glow ring.""" return 'mdi:crop-portrait' @property @@ -181,5 +176,4 @@ class GlowRing(Light): await self._lightpad.set_config( {"glowIntensity": kwargs[ATTR_BRIGHTNESS]}) else: - await self._lightpad.set_config( - {"glowEnabled": False}) + await self._lightpad.set_config({"glowEnabled": False}) diff --git a/homeassistant/components/point/__init__.py b/homeassistant/components/point/__init__.py index fa0217c023b..f223ded998f 100644 --- a/homeassistant/components/point/__init__.py +++ b/homeassistant/components/point/__init__.py @@ -1,9 +1,4 @@ -""" -Support for Minut Point. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/point/ -""" +"""Support for Minut Point.""" import asyncio import logging @@ -26,10 +21,11 @@ from .const import ( SCAN_INTERVAL, SIGNAL_UPDATE_ENTITY, SIGNAL_WEBHOOK) REQUIREMENTS = ['pypoint==1.0.8'] -DEPENDENCIES = ['webhook'] _LOGGER = logging.getLogger(__name__) +DEPENDENCIES = ['webhook'] + CONF_CLIENT_ID = 'client_id' CONF_CLIENT_SECRET = 'client_secret' diff --git a/homeassistant/components/point/binary_sensor.py b/homeassistant/components/point/binary_sensor.py index 2c79bf21c61..c29ce421682 100644 --- a/homeassistant/components/point/binary_sensor.py +++ b/homeassistant/components/point/binary_sensor.py @@ -1,10 +1,4 @@ -""" -Support for Minut Point. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/binary_sensor.point/ -""" - +"""Support for Minut Point binary sensors.""" import logging from homeassistant.components.binary_sensor import DOMAIN, BinarySensorDevice @@ -56,7 +50,7 @@ class MinutPointBinarySensor(MinutPointEntity, BinarySensorDevice): """The platform class required by Home Assistant.""" def __init__(self, point_client, device_id, device_class): - """Initialize the entity.""" + """Initialize the binary sensor.""" super().__init__(point_client, device_id, device_class) self._async_unsub_hook_dispatcher_connect = None @@ -64,7 +58,7 @@ class MinutPointBinarySensor(MinutPointEntity, BinarySensorDevice): self._is_on = None async def async_added_to_hass(self): - """Call when entity is added to hass.""" + """Call when entity is added to HOme Assistant.""" await super().async_added_to_hass() self._async_unsub_hook_dispatcher_connect = async_dispatcher_connect( self.hass, SIGNAL_WEBHOOK, self._webhook_event) diff --git a/homeassistant/components/point/sensor.py b/homeassistant/components/point/sensor.py index 902c1a6c981..90b83ba42e3 100644 --- a/homeassistant/components/point/sensor.py +++ b/homeassistant/components/point/sensor.py @@ -1,9 +1,4 @@ -""" -Support for Minut Point. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/sensor.point/ -""" +"""Support for Minut Point sensors.""" import logging from homeassistant.components.point import MinutPointEntity @@ -45,14 +40,14 @@ class MinutPointSensor(MinutPointEntity): """The platform class required by Home Assistant.""" def __init__(self, point_client, device_id, device_class): - """Initialize the entity.""" + """Initialize the sensor.""" super().__init__(point_client, device_id, device_class) self._device_prop = SENSOR_TYPES[device_class] async def _update_callback(self): """Update the value of the sensor.""" if self.is_updated: - _LOGGER.debug('Update sensor value for %s', self) + _LOGGER.debug("Update sensor value for %s", self) self._value = await self.hass.async_add_executor_job( self.device.sensor, self.device_class) self._updated = parse_datetime(self.device.last_update) diff --git a/homeassistant/components/prometheus/__init__.py b/homeassistant/components/prometheus/__init__.py index dc868530f88..4508611e51b 100644 --- a/homeassistant/components/prometheus/__init__.py +++ b/homeassistant/components/prometheus/__init__.py @@ -1,22 +1,17 @@ -""" -Support for Prometheus metrics export. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/prometheus/ -""" +"""Support for Prometheus metrics export.""" import logging -import voluptuous as vol from aiohttp import web +import voluptuous as vol +from homeassistant import core as hacore from homeassistant.components.climate import ATTR_CURRENT_TEMPERATURE from homeassistant.components.http import HomeAssistantView from homeassistant.const import ( - EVENT_STATE_CHANGED, TEMP_FAHRENHEIT, CONTENT_TYPE_TEXT_PLAIN, - ATTR_TEMPERATURE, ATTR_UNIT_OF_MEASUREMENT) -from homeassistant import core as hacore -import homeassistant.helpers.config_validation as cv + ATTR_TEMPERATURE, ATTR_UNIT_OF_MEASUREMENT, CONTENT_TYPE_TEXT_PLAIN, + EVENT_STATE_CHANGED, TEMP_FAHRENHEIT) from homeassistant.helpers import entityfilter, state as state_helper +import homeassistant.helpers.config_validation as cv from homeassistant.util.temperature import fahrenheit_to_celsius REQUIREMENTS = ['prometheus_client==0.2.0'] diff --git a/homeassistant/components/proximity/__init__.py b/homeassistant/components/proximity/__init__.py index e8d86d480e5..0a617bcec90 100644 --- a/homeassistant/components/proximity/__init__.py +++ b/homeassistant/components/proximity/__init__.py @@ -1,19 +1,11 @@ -""" -Support for tracking the proximity of a device. - -Component to monitor the proximity of devices to a particular zone and the -direction of travel. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/proximity/ -""" +"""Support for tracking the proximity of a device.""" import logging import voluptuous as vol -import homeassistant.helpers.config_validation as cv from homeassistant.const import ( - CONF_ZONE, CONF_DEVICES, CONF_UNIT_OF_MEASUREMENT) + CONF_DEVICES, CONF_UNIT_OF_MEASUREMENT, CONF_ZONE) +import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entity import Entity from homeassistant.helpers.event import track_state_change from homeassistant.util.distance import convert