From 3736120c6a6866b1eed0ecd9df35a437b0a2f894 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Thu, 14 Feb 2019 16:01:46 +0100 Subject: [PATCH] Update file header (#21061) * Update file header * Fix lint issue * Fix lint issue --- .../device_sun_light_trigger/__init__.py | 7 +--- .../components/geo_location/__init__.py | 7 +--- homeassistant/components/geo_location/demo.py | 7 +--- .../geo_location/geo_json_events.py | 11 ++---- .../nsw_rural_fire_service_feed.py | 11 ++---- .../geo_location/usgs_earthquakes_feed.py | 11 ++---- homeassistant/components/geofency/__init__.py | 35 ++++++------------- .../components/geofency/device_tracker.py | 8 ++--- homeassistant/components/goalfeed/__init__.py | 11 ++---- homeassistant/components/google/__init__.py | 27 ++++---------- homeassistant/components/google/calendar.py | 7 +--- homeassistant/components/google/tts.py | 17 ++++----- .../components/google_assistant/__init__.py | 11 ++---- .../components/google_assistant/trait.py | 2 +- .../components/google_domains/__init__.py | 11 ++---- .../components/google_pubsub/__init__.py | 13 +++---- .../components/googlehome/__init__.py | 16 +++------ .../components/googlehome/device_tracker.py | 11 ++---- homeassistant/components/googlehome/sensor.py | 16 +++------ .../components/gpslogger/__init__.py | 26 +++++--------- .../components/gpslogger/device_tracker.py | 7 +--- homeassistant/components/graphite/__init__.py | 15 +++----- .../components/greeneye_monitor/__init__.py | 7 +--- homeassistant/components/group/__init__.py | 7 +--- homeassistant/components/habitica/__init__.py | 7 +--- homeassistant/components/habitica/sensor.py | 26 ++++---------- homeassistant/components/hangouts/__init__.py | 28 ++++++--------- .../components/hangouts/config_flow.py | 3 +- homeassistant/components/hangouts/const.py | 4 +-- .../components/hangouts/hangouts_bot.py | 14 ++++---- homeassistant/components/hangouts/intents.py | 4 +-- homeassistant/components/hangouts/notify.py | 19 ++++------ homeassistant/components/harmony/__init__.py | 6 +--- homeassistant/components/harmony/remote.py | 13 +++---- homeassistant/components/hassio/__init__.py | 14 +++----- homeassistant/components/hassio/auth.py | 10 +++--- homeassistant/components/hassio/discovery.py | 10 +++--- homeassistant/components/hassio/handler.py | 7 +--- homeassistant/components/hassio/http.py | 11 ++---- homeassistant/components/hdmi_cec/__init__.py | 28 ++++++--------- .../components/hdmi_cec/media_player.py | 9 ++--- homeassistant/components/hdmi_cec/switch.py | 13 +++---- homeassistant/components/history/__init__.py | 7 +--- .../components/history_graph/__init__.py | 9 ++--- homeassistant/components/hive/__init__.py | 20 +++++------ .../components/hive/binary_sensor.py | 17 ++++----- homeassistant/components/hive/climate.py | 35 +++++++++++-------- homeassistant/components/hive/light.py | 19 ++++------ homeassistant/components/hive/sensor.py | 26 +++++++------- homeassistant/components/hive/switch.py | 13 +++---- homeassistant/components/hlk_sw16/__init__.py | 7 +--- homeassistant/components/hlk_sw16/switch.py | 11 ++---- homeassistant/components/homekit/__init__.py | 18 ++++------ .../components/homekit/accessories.py | 10 +++--- .../components/homekit/type_covers.py | 6 ++-- homeassistant/components/homekit/type_fans.py | 2 +- .../components/homekit/type_lights.py | 12 +++---- .../components/homekit/type_locks.py | 22 +++++++----- .../components/homekit/type_media_players.py | 14 ++++---- .../homekit/type_security_systems.py | 23 +++++++----- .../components/homekit/type_sensors.py | 7 ++-- .../components/homekit/type_switches.py | 6 ++-- .../components/homekit/type_thermostats.py | 28 +++++++-------- homeassistant/components/homekit/util.py | 2 +- .../components/homekit_controller/__init__.py | 9 ++--- .../homekit_controller/alarm_control_panel.py | 18 ++++------ .../homekit_controller/binary_sensor.py | 11 ++---- .../components/homekit_controller/climate.py | 17 ++++----- .../components/homekit_controller/cover.py | 17 ++++----- .../components/homekit_controller/light.py | 11 ++---- .../components/homekit_controller/lock.py | 21 ++++------- .../components/homekit_controller/switch.py | 11 ++---- .../components/homematic/__init__.py | 9 ++--- .../components/homematic/binary_sensor.py | 7 +--- homeassistant/components/homematic/climate.py | 7 +--- homeassistant/components/homematic/cover.py | 7 +--- homeassistant/components/homematic/light.py | 11 ++---- homeassistant/components/homematic/lock.py | 7 +--- homeassistant/components/homematic/notify.py | 10 +++--- homeassistant/components/homematic/sensor.py | 35 +++++-------------- homeassistant/components/homematic/switch.py | 7 +--- .../components/homematicip_cloud/__init__.py | 7 +--- .../homematicip_cloud/alarm_control_panel.py | 11 ++---- .../homematicip_cloud/binary_sensor.py | 10 ++---- .../components/homematicip_cloud/climate.py | 10 ++---- .../homematicip_cloud/config_flow.py | 6 ++-- .../components/homematicip_cloud/cover.py | 12 ++----- .../components/homematicip_cloud/hap.py | 2 +- .../components/homematicip_cloud/light.py | 7 +--- .../components/homematicip_cloud/sensor.py | 11 ++---- .../components/homematicip_cloud/switch.py | 10 ++---- .../components/homeworks/__init__.py | 16 ++++----- homeassistant/components/homeworks/light.py | 13 +++---- homeassistant/components/http/__init__.py | 14 +++----- homeassistant/components/http/auth.py | 9 +++-- homeassistant/components/http/ban.py | 7 ++-- homeassistant/components/http/cors.py | 9 ++--- .../components/http/data_validator.py | 1 - homeassistant/components/http/real_ip.py | 3 +- homeassistant/components/http/view.py | 16 +++------ .../components/huawei_lte/__init__.py | 8 +---- .../components/huawei_lte/device_tracker.py | 8 +---- homeassistant/components/huawei_lte/notify.py | 8 +---- homeassistant/components/huawei_lte/sensor.py | 12 ++----- homeassistant/components/hue/__init__.py | 7 +--- homeassistant/components/hue/bridge.py | 2 +- homeassistant/components/hue/light.py | 15 +++----- .../components/idteck_prox/__init__.py | 2 +- homeassistant/components/ifttt/__init__.py | 2 +- .../components/ifttt/alarm_control_panel.py | 6 ++-- homeassistant/components/ihc/__init__.py | 9 ++--- homeassistant/components/ihc/binary_sensor.py | 25 +++++-------- homeassistant/components/ihc/light.py | 12 ++----- homeassistant/components/ihc/sensor.py | 15 +++----- homeassistant/components/ihc/switch.py | 11 ++---- homeassistant/components/ios/__init__.py | 15 +++----- homeassistant/components/ios/notify.py | 20 ++++------- homeassistant/components/ios/sensor.py | 7 +--- homeassistant/components/ipma/__init__.py | 8 +---- homeassistant/components/ipma/const.py | 2 +- homeassistant/components/ipma/weather.py | 13 +++---- homeassistant/components/isy994/__init__.py | 14 +++----- .../components/isy994/binary_sensor.py | 19 ++++------ homeassistant/components/isy994/cover.py | 15 +++----- homeassistant/components/isy994/fan.py | 17 ++++----- homeassistant/components/isy994/light.py | 10 ++---- homeassistant/components/isy994/lock.py | 17 ++++----- homeassistant/components/isy994/sensor.py | 14 +++----- homeassistant/components/isy994/switch.py | 13 +++---- homeassistant/components/smartthings/lock.py | 13 +++---- 130 files changed, 511 insertions(+), 1058 deletions(-) diff --git a/homeassistant/components/device_sun_light_trigger/__init__.py b/homeassistant/components/device_sun_light_trigger/__init__.py index 2b047e92c1e..00adefc6b5c 100644 --- a/homeassistant/components/device_sun_light_trigger/__init__.py +++ b/homeassistant/components/device_sun_light_trigger/__init__.py @@ -1,9 +1,4 @@ -""" -Provides functionality to turn on lights based on the states. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/device_sun_light_trigger/ -""" +"""Support to turn on lights based on the states.""" import logging from datetime import timedelta diff --git a/homeassistant/components/geo_location/__init__.py b/homeassistant/components/geo_location/__init__.py index 9095ce617aa..75c99ecc74c 100644 --- a/homeassistant/components/geo_location/__init__.py +++ b/homeassistant/components/geo_location/__init__.py @@ -1,9 +1,4 @@ -""" -Geolocation component. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/geo_location/ -""" +"""Support for Geolocation.""" from datetime import timedelta import logging from typing import Optional diff --git a/homeassistant/components/geo_location/demo.py b/homeassistant/components/geo_location/demo.py index 0e7274e7a0a..523e125a737 100644 --- a/homeassistant/components/geo_location/demo.py +++ b/homeassistant/components/geo_location/demo.py @@ -1,9 +1,4 @@ -""" -Demo platform for the geolocation component. - -For more details about this platform, please refer to the documentation -https://home-assistant.io/components/demo/ -""" +"""Demo platform for the geolocation component.""" from datetime import timedelta import logging from math import cos, pi, radians, sin diff --git a/homeassistant/components/geo_location/geo_json_events.py b/homeassistant/components/geo_location/geo_json_events.py index cbfe605e722..e89616126d5 100644 --- a/homeassistant/components/geo_location/geo_json_events.py +++ b/homeassistant/components/geo_location/geo_json_events.py @@ -1,9 +1,4 @@ -""" -Generic GeoJSON events platform. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/geo_location/geo_json_events/ -""" +"""Support for generic GeoJSON events.""" from datetime import timedelta import logging from typing import Optional @@ -13,8 +8,8 @@ import voluptuous as vol from homeassistant.components.geo_location import ( PLATFORM_SCHEMA, GeolocationEvent) from homeassistant.const import ( - CONF_RADIUS, CONF_SCAN_INTERVAL, CONF_URL, EVENT_HOMEASSISTANT_START, - CONF_LATITUDE, CONF_LONGITUDE) + CONF_LATITUDE, CONF_LONGITUDE, CONF_RADIUS, CONF_SCAN_INTERVAL, CONF_URL, + EVENT_HOMEASSISTANT_START) from homeassistant.core import callback import homeassistant.helpers.config_validation as cv from homeassistant.helpers.dispatcher import ( diff --git a/homeassistant/components/geo_location/nsw_rural_fire_service_feed.py b/homeassistant/components/geo_location/nsw_rural_fire_service_feed.py index e0974ed415d..38491feb32f 100644 --- a/homeassistant/components/geo_location/nsw_rural_fire_service_feed.py +++ b/homeassistant/components/geo_location/nsw_rural_fire_service_feed.py @@ -1,9 +1,4 @@ -""" -NSW Rural Fire Service Feed platform. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/geo_location/nsw_rural_fire_service_feed/ -""" +"""Support for NSW Rural Fire Service Feeds.""" from datetime import timedelta import logging from typing import Optional @@ -13,8 +8,8 @@ import voluptuous as vol from homeassistant.components.geo_location import ( PLATFORM_SCHEMA, GeolocationEvent) from homeassistant.const import ( - ATTR_ATTRIBUTION, ATTR_LOCATION, CONF_RADIUS, CONF_SCAN_INTERVAL, - EVENT_HOMEASSISTANT_START, CONF_LATITUDE, CONF_LONGITUDE) + ATTR_ATTRIBUTION, ATTR_LOCATION, CONF_LATITUDE, CONF_LONGITUDE, + CONF_RADIUS, CONF_SCAN_INTERVAL, EVENT_HOMEASSISTANT_START) from homeassistant.core import callback import homeassistant.helpers.config_validation as cv from homeassistant.helpers.dispatcher import ( diff --git a/homeassistant/components/geo_location/usgs_earthquakes_feed.py b/homeassistant/components/geo_location/usgs_earthquakes_feed.py index 6a7bbba4464..1d11b1971cc 100644 --- a/homeassistant/components/geo_location/usgs_earthquakes_feed.py +++ b/homeassistant/components/geo_location/usgs_earthquakes_feed.py @@ -1,9 +1,4 @@ -""" -U.S. Geological Survey Earthquake Hazards Program Feed platform. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/geo_location/usgs_earthquakes_feed/ -""" +"""Support for U.S. Geological Survey Earthquake Hazards Program Feeds.""" from datetime import timedelta import logging from typing import Optional @@ -13,8 +8,8 @@ import voluptuous as vol from homeassistant.components.geo_location import ( PLATFORM_SCHEMA, GeolocationEvent) from homeassistant.const import ( - ATTR_ATTRIBUTION, CONF_RADIUS, CONF_SCAN_INTERVAL, - EVENT_HOMEASSISTANT_START, CONF_LATITUDE, CONF_LONGITUDE) + ATTR_ATTRIBUTION, CONF_LATITUDE, CONF_LONGITUDE, CONF_RADIUS, + CONF_SCAN_INTERVAL, EVENT_HOMEASSISTANT_START) from homeassistant.core import callback import homeassistant.helpers.config_validation as cv from homeassistant.helpers.dispatcher import ( diff --git a/homeassistant/components/geofency/__init__.py b/homeassistant/components/geofency/__init__.py index f265bd3492a..f27798e9e0d 100644 --- a/homeassistant/components/geofency/__init__.py +++ b/homeassistant/components/geofency/__init__.py @@ -1,19 +1,15 @@ -""" -Support for Geofency. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/geofency/ -""" +"""Support for Geofency.""" import logging -import voluptuous as vol from aiohttp import web +import voluptuous as vol -import homeassistant.helpers.config_validation as cv from homeassistant.components.device_tracker import DOMAIN as DEVICE_TRACKER -from homeassistant.const import HTTP_UNPROCESSABLE_ENTITY, STATE_NOT_HOME, \ - ATTR_LATITUDE, ATTR_LONGITUDE, CONF_WEBHOOK_ID, HTTP_OK, ATTR_NAME +from homeassistant.const import ( + ATTR_LATITUDE, ATTR_LONGITUDE, ATTR_NAME, CONF_WEBHOOK_ID, HTTP_OK, + HTTP_UNPROCESSABLE_ENTITY, STATE_NOT_HOME) from homeassistant.helpers import config_entry_flow +import homeassistant.helpers.config_validation as cv from homeassistant.helpers.dispatcher import async_dispatcher_send from homeassistant.util import slugify @@ -27,9 +23,7 @@ CONF_MOBILE_BEACONS = 'mobile_beacons' CONFIG_SCHEMA = vol.Schema({ vol.Optional(DOMAIN): vol.Schema({ vol.Optional(CONF_MOBILE_BEACONS, default=[]): vol.All( - cv.ensure_list, - [cv.string] - ), + cv.ensure_list, [cv.string]), }), }, extra=vol.ALLOW_EXTRA) @@ -62,7 +56,7 @@ WEBHOOK_SCHEMA = vol.Schema({ vol.Required(ATTR_NAME): vol.All(cv.string, slugify), vol.Optional(ATTR_CURRENT_LATITUDE): cv.latitude, vol.Optional(ATTR_CURRENT_LONGITUDE): cv.longitude, - vol.Optional(ATTR_BEACON_ID): cv.string + vol.Optional(ATTR_BEACON_ID): cv.string, }, extra=vol.ALLOW_EXTRA) @@ -114,18 +108,11 @@ def _set_location(hass, data, location_name): device = _device_name(data) async_dispatcher_send( - hass, - TRACKER_UPDATE, - device, - (data[ATTR_LATITUDE], data[ATTR_LONGITUDE]), - location_name, - data - ) + hass, TRACKER_UPDATE, device, + (data[ATTR_LATITUDE], data[ATTR_LONGITUDE]), location_name, data) return web.Response( - text="Setting location for {}".format(device), - status=HTTP_OK - ) + text="Setting location for {}".format(device), status=HTTP_OK) async def async_setup_entry(hass, entry): diff --git a/homeassistant/components/geofency/device_tracker.py b/homeassistant/components/geofency/device_tracker.py index eea0960ec11..51201240c1c 100644 --- a/homeassistant/components/geofency/device_tracker.py +++ b/homeassistant/components/geofency/device_tracker.py @@ -6,10 +6,10 @@ https://home-assistant.io/components/device_tracker.geofency/ """ import logging -from homeassistant.components.device_tracker import DOMAIN as \ - DEVICE_TRACKER_DOMAIN -from homeassistant.components.geofency import TRACKER_UPDATE, \ - DOMAIN as GEOFENCY_DOMAIN +from homeassistant.components.device_tracker import ( + DOMAIN as DEVICE_TRACKER_DOMAIN) +from homeassistant.components.geofency import ( + DOMAIN as GEOFENCY_DOMAIN, TRACKER_UPDATE) from homeassistant.helpers.dispatcher import async_dispatcher_connect _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/goalfeed/__init__.py b/homeassistant/components/goalfeed/__init__.py index c16390302d6..6f0149f657a 100644 --- a/homeassistant/components/goalfeed/__init__.py +++ b/homeassistant/components/goalfeed/__init__.py @@ -1,9 +1,4 @@ -""" -Component for the Goalfeed service. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/goalfeed/ -""" +"""Component for the Goalfeed service.""" import json import requests @@ -48,8 +43,8 @@ def setup(hass, config): 'username': username, 'password': password, 'connection_info': data} - resp = requests.post(GOALFEED_AUTH_ENDPOINT, post_data, - timeout=30).json() + resp = requests.post( + GOALFEED_AUTH_ENDPOINT, post_data, timeout=30).json() channel = pusher.subscribe('private-goals', resp['auth']) channel.bind('goal', goal_handler) diff --git a/homeassistant/components/google/__init__.py b/homeassistant/components/google/__init__.py index 49cb195d6c9..8fba016df57 100644 --- a/homeassistant/components/google/__init__.py +++ b/homeassistant/components/google/__init__.py @@ -1,14 +1,4 @@ -""" -Support for Google - Calendar Event Devices. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/google/ - -NOTE TO OTHER DEVELOPERS: IF YOU ADD MORE SCOPES TO THE OAUTH THAN JUST -CALENDAR THEN USERS WILL NEED TO DELETE THEIR TOKEN_FILE. THEY WILL LOSE THEIR -REFRESH_TOKEN PIECE WHEN RE-AUTHENTICATING TO ADD MORE API ACCESS -IT'S BEST TO JUST HAVE SEPARATE OAUTH FOR DIFFERENT PIECES OF GOOGLE -""" +"""Support for Google - Calendar Event Devices.""" import logging import os import yaml @@ -75,10 +65,10 @@ CONFIG_SCHEMA = vol.Schema({ _SINGLE_CALSEARCH_CONFIG = vol.Schema({ vol.Required(CONF_NAME): cv.string, vol.Required(CONF_DEVICE_ID): cv.string, - vol.Optional(CONF_TRACK): cv.boolean, - vol.Optional(CONF_SEARCH): cv.string, - vol.Optional(CONF_OFFSET): cv.string, vol.Optional(CONF_IGNORE_AVAILABILITY, default=True): cv.boolean, + vol.Optional(CONF_OFFSET): cv.string, + vol.Optional(CONF_SEARCH): cv.string, + vol.Optional(CONF_TRACK): cv.boolean, }) DEVICE_SCHEMA = vol.Schema({ @@ -95,10 +85,7 @@ def do_authentication(hass, hass_config, config): until we have an access token. """ from oauth2client.client import ( - OAuth2WebServerFlow, - OAuth2DeviceCodeError, - FlowExchangeError - ) + OAuth2WebServerFlow, OAuth2DeviceCodeError, FlowExchangeError) from oauth2client.file import Storage oauth = OAuth2WebServerFlow( @@ -152,8 +139,8 @@ def do_authentication(hass, hass_config, config): 'been found'.format(YAML_DEVICES), title=NOTIFICATION_TITLE, notification_id=NOTIFICATION_ID) - listener = track_time_change(hass, step2_exchange, - second=range(0, 60, dev_flow.interval)) + listener = track_time_change( + hass, step2_exchange, second=range(0, 60, dev_flow.interval)) return True diff --git a/homeassistant/components/google/calendar.py b/homeassistant/components/google/calendar.py index abb4fd28dd4..cc65c6d655d 100644 --- a/homeassistant/components/google/calendar.py +++ b/homeassistant/components/google/calendar.py @@ -1,9 +1,4 @@ -""" -Support for Google Calendar Search binary sensors. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/calendar.google/ -""" +"""Support for Google Calendar Search binary sensors.""" import logging from datetime import timedelta diff --git a/homeassistant/components/google/tts.py b/homeassistant/components/google/tts.py index 0d449083f72..49a945cbbfd 100644 --- a/homeassistant/components/google/tts.py +++ b/homeassistant/components/google/tts.py @@ -1,9 +1,4 @@ -""" -Support for the google speech service. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/tts.google/ -""" +"""Support for the Google speech service.""" import asyncio import logging import re @@ -101,16 +96,16 @@ class GoogleProvider(Provider): ) if request.status != 200: - _LOGGER.error("Error %d on load url %s", + _LOGGER.error("Error %d on load URL %s", request.status, request.url) - return (None, None) + return None, None data += await request.read() except (asyncio.TimeoutError, aiohttp.ClientError): - _LOGGER.error("Timeout for google speech.") - return (None, None) + _LOGGER.error("Timeout for google speech") + return None, None - return ("mp3", data) + return 'mp3', data @staticmethod def _split_message_to_parts(message): diff --git a/homeassistant/components/google_assistant/__init__.py b/homeassistant/components/google_assistant/__init__.py index c0dff15d888..f5ca9b8b146 100644 --- a/homeassistant/components/google_assistant/__init__.py +++ b/homeassistant/components/google_assistant/__init__.py @@ -1,9 +1,4 @@ -""" -Support for Actions on Google Assistant Smart Home Control. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/google_assistant/ -""" +"""Support for Actions on Google Assistant Smart Home Control.""" import asyncio import logging from typing import Dict, Any @@ -37,7 +32,7 @@ ENTITY_SCHEMA = vol.Schema({ vol.Optional(CONF_NAME): cv.string, vol.Optional(CONF_EXPOSE): cv.boolean, vol.Optional(CONF_ALIASES): vol.All(cv.ensure_list, [cv.string]), - vol.Optional(CONF_ROOM_HINT): cv.string + vol.Optional(CONF_ROOM_HINT): cv.string, }) GOOGLE_ASSISTANT_SCHEMA = vol.Schema({ @@ -49,7 +44,7 @@ GOOGLE_ASSISTANT_SCHEMA = vol.Schema({ vol.Optional(CONF_API_KEY): cv.string, vol.Optional(CONF_ENTITY_CONFIG): {cv.entity_id: ENTITY_SCHEMA}, vol.Optional(CONF_ALLOW_UNLOCK, - default=DEFAULT_ALLOW_UNLOCK): cv.boolean + default=DEFAULT_ALLOW_UNLOCK): cv.boolean, }, extra=vol.PREVENT_EXTRA) CONFIG_SCHEMA = vol.Schema({ diff --git a/homeassistant/components/google_assistant/trait.py b/homeassistant/components/google_assistant/trait.py index 7153115e3ef..af2d726328e 100644 --- a/homeassistant/components/google_assistant/trait.py +++ b/homeassistant/components/google_assistant/trait.py @@ -1,4 +1,4 @@ -"""Implement the Smart Home traits.""" +"""Implement the Google Smart Home traits.""" import logging from homeassistant.components import ( diff --git a/homeassistant/components/google_domains/__init__.py b/homeassistant/components/google_domains/__init__.py index 32bdb79557a..f884e46cc4c 100644 --- a/homeassistant/components/google_domains/__init__.py +++ b/homeassistant/components/google_domains/__init__.py @@ -1,9 +1,4 @@ -""" -Integrate with Google Domains. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/google_domains/ -""" +"""Support for Google Domains.""" import asyncio from datetime import timedelta import logging @@ -62,8 +57,8 @@ async def async_setup(hass, config): return True -async def _update_google_domains(hass, session, domain, user, password, - timeout): +async def _update_google_domains( + hass, session, domain, user, password, timeout): """Update Google Domains.""" url = UPDATE_URL.format(user, password) diff --git a/homeassistant/components/google_pubsub/__init__.py b/homeassistant/components/google_pubsub/__init__.py index af8bb60f8b1..18c068ea454 100644 --- a/homeassistant/components/google_pubsub/__init__.py +++ b/homeassistant/components/google_pubsub/__init__.py @@ -1,9 +1,4 @@ -""" -Support for Google Cloud Pub/Sub. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/google_pubsub/ -""" +"""Support for Google Cloud Pub/Sub.""" import datetime import json import logging @@ -34,7 +29,7 @@ CONFIG_SCHEMA = vol.Schema({ vol.Required(CONF_PROJECT_ID): cv.string, vol.Required(CONF_TOPIC_NAME): cv.string, vol.Required(CONF_SERVICE_PRINCIPAL): cv.string, - vol.Required(CONF_FILTER): FILTER_SCHEMA + vol.Required(CONF_FILTER): FILTER_SCHEMA, }), }, extra=vol.ALLOW_EXTRA) @@ -46,8 +41,8 @@ def setup(hass: HomeAssistant, yaml_config: Dict[str, Any]): config = yaml_config[DOMAIN] project_id = config[CONF_PROJECT_ID] topic_name = config[CONF_TOPIC_NAME] - service_principal_path = os.path.join(hass.config.config_dir, - config[CONF_SERVICE_PRINCIPAL]) + service_principal_path = os.path.join( + hass.config.config_dir, config[CONF_SERVICE_PRINCIPAL]) if not os.path.isfile(service_principal_path): _LOGGER.error("Path to credentials file cannot be found") diff --git a/homeassistant/components/googlehome/__init__.py b/homeassistant/components/googlehome/__init__.py index f2d5ad09350..d6a8be58967 100644 --- a/homeassistant/components/googlehome/__init__.py +++ b/homeassistant/components/googlehome/__init__.py @@ -1,9 +1,4 @@ -""" -Support Google Home units. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/googlehome/ -""" +"""Support Google Home units.""" import logging import asyncio @@ -31,11 +26,10 @@ DEFAULT_RSSI_THRESHOLD = -70 DEVICE_CONFIG = vol.Schema({ vol.Required(CONF_HOST): cv.string, - vol.Optional(CONF_DEVICE_TYPES, - default=DEVICE_TYPES): vol.All(cv.ensure_list, - [vol.In(DEVICE_TYPES)]), - vol.Optional(CONF_RSSI_THRESHOLD, - default=DEFAULT_RSSI_THRESHOLD): vol.Coerce(int), + vol.Optional(CONF_DEVICE_TYPES, default=DEVICE_TYPES): + vol.All(cv.ensure_list, [vol.In(DEVICE_TYPES)]), + vol.Optional(CONF_RSSI_THRESHOLD, default=DEFAULT_RSSI_THRESHOLD): + vol.Coerce(int), vol.Optional(CONF_TRACK_ALARMS, default=False): cv.boolean, }) diff --git a/homeassistant/components/googlehome/device_tracker.py b/homeassistant/components/googlehome/device_tracker.py index c4b490ab316..462f5db3b9b 100644 --- a/homeassistant/components/googlehome/device_tracker.py +++ b/homeassistant/components/googlehome/device_tracker.py @@ -1,9 +1,4 @@ -""" -Support for Google Home bluetooth tacker. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/device_tracker.googlehome/ -""" +"""Support for Google Home Bluetooth tacker.""" import logging from datetime import timedelta @@ -13,12 +8,12 @@ from homeassistant.components.googlehome import ( from homeassistant.helpers.event import async_track_time_interval from homeassistant.util import slugify +_LOGGER = logging.getLogger(__name__) + DEPENDENCIES = ['googlehome'] DEFAULT_SCAN_INTERVAL = timedelta(seconds=10) -_LOGGER = logging.getLogger(__name__) - async def async_setup_scanner(hass, config, async_see, discovery_info=None): """Validate the configuration and return a Google Home scanner.""" diff --git a/homeassistant/components/googlehome/sensor.py b/homeassistant/components/googlehome/sensor.py index 90b9cda80bb..7577ee0b017 100644 --- a/homeassistant/components/googlehome/sensor.py +++ b/homeassistant/components/googlehome/sensor.py @@ -1,9 +1,4 @@ -""" -Support for Google Home alarm sensor. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/sensor.googlehome/ -""" +"""Support for Google Home alarm sensor.""" import logging from datetime import timedelta @@ -13,7 +8,6 @@ from homeassistant.const import DEVICE_CLASS_TIMESTAMP from homeassistant.helpers.entity import Entity import homeassistant.util.dt as dt_util - DEPENDENCIES = ['googlehome'] SCAN_INTERVAL = timedelta(seconds=10) @@ -23,13 +17,13 @@ _LOGGER = logging.getLogger(__name__) ICON = 'mdi:alarm' SENSOR_TYPES = { - 'timer': "Timer", - 'alarm': "Alarm", + 'timer': 'Timer', + 'alarm': 'Alarm', } -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 googlehome sensor platform.""" if discovery_info is None: _LOGGER.warning( diff --git a/homeassistant/components/gpslogger/__init__.py b/homeassistant/components/gpslogger/__init__.py index 39d795dcd25..2e956bd7fc5 100644 --- a/homeassistant/components/gpslogger/__init__.py +++ b/homeassistant/components/gpslogger/__init__.py @@ -1,9 +1,4 @@ -""" -Support for GPSLogger. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/gpslogger/ -""" +"""Support for GPSLogger.""" import logging import voluptuous as vol @@ -42,16 +37,16 @@ def _id(value: str) -> str: WEBHOOK_SCHEMA = vol.Schema({ + vol.Required(ATTR_DEVICE): _id, vol.Required(ATTR_LATITUDE): cv.latitude, vol.Required(ATTR_LONGITUDE): cv.longitude, - vol.Required(ATTR_DEVICE): _id, vol.Optional(ATTR_ACCURACY, default=DEFAULT_ACCURACY): vol.Coerce(float), - vol.Optional(ATTR_BATTERY, default=DEFAULT_BATTERY): vol.Coerce(float), - vol.Optional(ATTR_SPEED): vol.Coerce(float), - vol.Optional(ATTR_DIRECTION): vol.Coerce(float), + vol.Optional(ATTR_ACTIVITY): cv.string, vol.Optional(ATTR_ALTITUDE): vol.Coerce(float), + vol.Optional(ATTR_BATTERY, default=DEFAULT_BATTERY): vol.Coerce(float), + vol.Optional(ATTR_DIRECTION): vol.Coerce(float), vol.Optional(ATTR_PROVIDER): cv.string, - vol.Optional(ATTR_ACTIVITY): cv.string + vol.Optional(ATTR_SPEED): vol.Coerce(float), }) @@ -81,14 +76,9 @@ async def handle_webhook(hass, webhook_id, request): device = data[ATTR_DEVICE] async_dispatcher_send( - hass, - TRACKER_UPDATE, - device, + hass, TRACKER_UPDATE, device, (data[ATTR_LATITUDE], data[ATTR_LONGITUDE]), - data[ATTR_BATTERY], - data[ATTR_ACCURACY], - attrs - ) + data[ATTR_BATTERY], data[ATTR_ACCURACY], attrs) return web.Response( text='Setting location for {}'.format(device), diff --git a/homeassistant/components/gpslogger/device_tracker.py b/homeassistant/components/gpslogger/device_tracker.py index 8a312afa024..90d2dc04f89 100644 --- a/homeassistant/components/gpslogger/device_tracker.py +++ b/homeassistant/components/gpslogger/device_tracker.py @@ -1,9 +1,4 @@ -""" -Support for the GPSLogger platform. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/device_tracker.gpslogger/ -""" +"""Support for the GPSLogger device tracking.""" import logging from homeassistant.components.device_tracker import DOMAIN as \ diff --git a/homeassistant/components/graphite/__init__.py b/homeassistant/components/graphite/__init__.py index 26cd80d8da2..e3f9e359f5a 100644 --- a/homeassistant/components/graphite/__init__.py +++ b/homeassistant/components/graphite/__init__.py @@ -1,9 +1,4 @@ -""" -Component that sends data to a Graphite installation. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/graphite/ -""" +"""Support for sending data to a Graphite installation.""" import logging import queue import socket @@ -69,10 +64,8 @@ class GraphiteFeeder(threading.Thread): self._quit_object = object() self._we_started = False - hass.bus.listen_once(EVENT_HOMEASSISTANT_START, - self.start_listen) - hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP, - self.shutdown) + hass.bus.listen_once(EVENT_HOMEASSISTANT_START, self.start_listen) + hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP, self.shutdown) hass.bus.listen(EVENT_STATE_CHANGED, self.event_listener) _LOGGER.debug("Graphite feeding to %s:%i initialized", self._host, self._port) @@ -95,7 +88,7 @@ class GraphiteFeeder(threading.Thread): self._queue.put(event) else: _LOGGER.error( - "Graphite feeder thread has died, not queuing event!") + "Graphite feeder thread has died, not queuing event") def _send_to_graphite(self, data): """Send data to Graphite.""" diff --git a/homeassistant/components/greeneye_monitor/__init__.py b/homeassistant/components/greeneye_monitor/__init__.py index c1e2f285772..aedc98aac31 100644 --- a/homeassistant/components/greeneye_monitor/__init__.py +++ b/homeassistant/components/greeneye_monitor/__init__.py @@ -1,9 +1,4 @@ -""" -Support for monitoring a GreenEye Monitor energy monitor. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/greeneye_monitor/ -""" +"""Support for monitoring a GreenEye Monitor energy monitor.""" import logging import voluptuous as vol diff --git a/homeassistant/components/group/__init__.py b/homeassistant/components/group/__init__.py index d1cd88a8438..e0315209ba1 100644 --- a/homeassistant/components/group/__init__.py +++ b/homeassistant/components/group/__init__.py @@ -1,9 +1,4 @@ -""" -Provide the functionality to group entities. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/group/ -""" +"""Provide the functionality to group entities.""" import asyncio import logging diff --git a/homeassistant/components/habitica/__init__.py b/homeassistant/components/habitica/__init__.py index 8e77c6bf50b..23113a1388b 100644 --- a/homeassistant/components/habitica/__init__.py +++ b/homeassistant/components/habitica/__init__.py @@ -1,9 +1,4 @@ -""" -The Habitica API component. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/habitica/ -""" +"""Support for Habitica devices.""" from collections import namedtuple import logging diff --git a/homeassistant/components/habitica/sensor.py b/homeassistant/components/habitica/sensor.py index d2f13eb30e6..fb3a5670c2b 100644 --- a/homeassistant/components/habitica/sensor.py +++ b/homeassistant/components/habitica/sensor.py @@ -1,18 +1,13 @@ -""" -The Habitica sensor. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/sensor.habitica/ -""" - -import logging +"""Support for Habitica sensors.""" from datetime import timedelta +import logging +from homeassistant.components import habitica from homeassistant.helpers.entity import Entity from homeassistant.util import Throttle -from homeassistant.components import habitica _LOGGER = logging.getLogger(__name__) + MIN_TIME_BETWEEN_UPDATES = timedelta(minutes=15) @@ -36,11 +31,7 @@ class HabitipyData: """Habitica API user data cache.""" def __init__(self, api): - """ - Habitica API user data cache. - - api - HAHabitipyAsync object - """ + """Habitica API user data cache.""" self.api = api self.data = None @@ -54,12 +45,7 @@ class HabitipySensor(Entity): """A generic Habitica sensor.""" def __init__(self, name, sensor_name, updater): - """ - Init a generic Habitica sensor. - - name - Habitica platform name - sensor_name - one of the names from ALL_SENSOR_TYPES - """ + """Initialize a generic Habitica sensor.""" self._name = name self._sensor_name = sensor_name self._sensor_type = habitica.SENSORS_TYPES[sensor_name] diff --git a/homeassistant/components/hangouts/__init__.py b/homeassistant/components/hangouts/__init__.py index 01d81cc466c..4796744c170 100644 --- a/homeassistant/components/hangouts/__init__.py +++ b/homeassistant/components/hangouts/__init__.py @@ -1,9 +1,4 @@ -""" -The hangouts bot component. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/hangouts/ -""" +"""Support for Hangouts.""" import logging import voluptuous as vol @@ -11,21 +6,18 @@ import voluptuous as vol from homeassistant import config_entries from homeassistant.components.hangouts.intents import HelpIntent from homeassistant.const import EVENT_HOMEASSISTANT_STOP -from homeassistant.helpers import intent -from homeassistant.helpers import dispatcher +from homeassistant.helpers import dispatcher, intent import homeassistant.helpers.config_validation as cv -from .const import ( - CONF_BOT, CONF_INTENTS, CONF_REFRESH_TOKEN, DOMAIN, - EVENT_HANGOUTS_CONNECTED, EVENT_HANGOUTS_CONVERSATIONS_CHANGED, - MESSAGE_SCHEMA, SERVICE_SEND_MESSAGE, - SERVICE_UPDATE, CONF_SENTENCES, CONF_MATCHERS, - CONF_ERROR_SUPPRESSED_CONVERSATIONS, INTENT_SCHEMA, TARGETS_SCHEMA, - CONF_DEFAULT_CONVERSATIONS, EVENT_HANGOUTS_CONVERSATIONS_RESOLVED, - INTENT_HELP, SERVICE_RECONNECT) - # We need an import from .config_flow, without it .config_flow is never loaded. from .config_flow import HangoutsFlowHandler # noqa: F401 +from .const import ( + CONF_BOT, CONF_DEFAULT_CONVERSATIONS, CONF_ERROR_SUPPRESSED_CONVERSATIONS, + CONF_INTENTS, CONF_MATCHERS, CONF_REFRESH_TOKEN, CONF_SENTENCES, DOMAIN, + EVENT_HANGOUTS_CONNECTED, EVENT_HANGOUTS_CONVERSATIONS_CHANGED, + EVENT_HANGOUTS_CONVERSATIONS_RESOLVED, INTENT_HELP, INTENT_SCHEMA, + MESSAGE_SCHEMA, SERVICE_RECONNECT, SERVICE_SEND_MESSAGE, SERVICE_UPDATE, + TARGETS_SCHEMA) REQUIREMENTS = ['hangups==0.4.6'] @@ -39,7 +31,7 @@ CONFIG_SCHEMA = vol.Schema({ vol.Optional(CONF_DEFAULT_CONVERSATIONS, default=[]): [TARGETS_SCHEMA], vol.Optional(CONF_ERROR_SUPPRESSED_CONVERSATIONS, default=[]): - [TARGETS_SCHEMA] + [TARGETS_SCHEMA], }) }, extra=vol.ALLOW_EXTRA) diff --git a/homeassistant/components/hangouts/config_flow.py b/homeassistant/components/hangouts/config_flow.py index 9d66338dff0..5eecc24d45e 100644 --- a/homeassistant/components/hangouts/config_flow.py +++ b/homeassistant/components/hangouts/config_flow.py @@ -5,8 +5,7 @@ from homeassistant import config_entries from homeassistant.const import CONF_EMAIL, CONF_PASSWORD from homeassistant.core import callback -from .const import CONF_2FA, CONF_REFRESH_TOKEN -from .const import DOMAIN as HANGOUTS_DOMAIN +from .const import CONF_2FA, CONF_REFRESH_TOKEN, DOMAIN as HANGOUTS_DOMAIN @callback diff --git a/homeassistant/components/hangouts/const.py b/homeassistant/components/hangouts/const.py index cf5374c317e..ca0fdf986ee 100644 --- a/homeassistant/components/hangouts/const.py +++ b/homeassistant/components/hangouts/const.py @@ -3,8 +3,8 @@ import logging import voluptuous as vol -from homeassistant.components.notify \ - import ATTR_MESSAGE, ATTR_TARGET, ATTR_DATA +from homeassistant.components.notify import ( + ATTR_DATA, ATTR_MESSAGE, ATTR_TARGET) import homeassistant.helpers.config_validation as cv _LOGGER = logging.getLogger('homeassistant.components.hangouts') diff --git a/homeassistant/components/hangouts/hangouts_bot.py b/homeassistant/components/hangouts/hangouts_bot.py index 748079452d8..fe72c50de77 100644 --- a/homeassistant/components/hangouts/hangouts_bot.py +++ b/homeassistant/components/hangouts/hangouts_bot.py @@ -1,17 +1,19 @@ """The Hangouts Bot.""" +import asyncio import io import logging -import asyncio + import aiohttp -from homeassistant.helpers.aiohttp_client import async_get_clientsession + from homeassistant.helpers import dispatcher, intent +from homeassistant.helpers.aiohttp_client import async_get_clientsession from .const import ( - ATTR_MESSAGE, ATTR_TARGET, ATTR_DATA, CONF_CONVERSATIONS, DOMAIN, + ATTR_DATA, ATTR_MESSAGE, ATTR_TARGET, CONF_CONVERSATION_ID, + CONF_CONVERSATION_NAME, CONF_CONVERSATIONS, CONF_MATCHERS, DOMAIN, EVENT_HANGOUTS_CONNECTED, EVENT_HANGOUTS_CONVERSATIONS_CHANGED, - EVENT_HANGOUTS_DISCONNECTED, EVENT_HANGOUTS_MESSAGE_RECEIVED, - CONF_MATCHERS, CONF_CONVERSATION_ID, - CONF_CONVERSATION_NAME, EVENT_HANGOUTS_CONVERSATIONS_RESOLVED, INTENT_HELP) + EVENT_HANGOUTS_CONVERSATIONS_RESOLVED, EVENT_HANGOUTS_DISCONNECTED, + EVENT_HANGOUTS_MESSAGE_RECEIVED, INTENT_HELP) _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/hangouts/intents.py b/homeassistant/components/hangouts/intents.py index be52f059139..3887a644700 100644 --- a/homeassistant/components/hangouts/intents.py +++ b/homeassistant/components/hangouts/intents.py @@ -1,8 +1,8 @@ -"""Intents for the hangouts component.""" +"""Intents for the Hangouts component.""" from homeassistant.helpers import intent import homeassistant.helpers.config_validation as cv -from .const import INTENT_HELP, DOMAIN, CONF_BOT +from .const import CONF_BOT, DOMAIN, INTENT_HELP class HelpIntent(intent.IntentHandler): diff --git a/homeassistant/components/hangouts/notify.py b/homeassistant/components/hangouts/notify.py index 7261663b99f..c3b5450be05 100644 --- a/homeassistant/components/hangouts/notify.py +++ b/homeassistant/components/hangouts/notify.py @@ -1,20 +1,13 @@ -""" -Hangouts notification service. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/notify.hangouts/ -""" +"""Support for Hangouts notifications.""" import logging import voluptuous as vol -from homeassistant.components.notify import (ATTR_TARGET, PLATFORM_SCHEMA, - BaseNotificationService, - ATTR_MESSAGE, ATTR_DATA) - -from homeassistant.components.hangouts.const \ - import (DOMAIN, SERVICE_SEND_MESSAGE, TARGETS_SCHEMA, - CONF_DEFAULT_CONVERSATIONS) +from homeassistant.components.hangouts.const import ( + CONF_DEFAULT_CONVERSATIONS, DOMAIN, SERVICE_SEND_MESSAGE, TARGETS_SCHEMA) +from homeassistant.components.notify import ( + ATTR_DATA, ATTR_MESSAGE, ATTR_TARGET, PLATFORM_SCHEMA, + BaseNotificationService) _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/harmony/__init__.py b/homeassistant/components/harmony/__init__.py index 25a33929c1a..12ccc78077e 100644 --- a/homeassistant/components/harmony/__init__.py +++ b/homeassistant/components/harmony/__init__.py @@ -1,5 +1 @@ -"""The harmony component. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/harmony/ -""" +"""Support for Harmony devices.""" diff --git a/homeassistant/components/harmony/remote.py b/homeassistant/components/harmony/remote.py index a5e4f5a8528..612ea735aaa 100644 --- a/homeassistant/components/harmony/remote.py +++ b/homeassistant/components/harmony/remote.py @@ -1,9 +1,4 @@ -""" -Support for Harmony Hub devices. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/remote.harmony/ -""" +"""Support for Harmony Hub devices.""" import asyncio import json import logging @@ -51,12 +46,12 @@ HARMONY_SYNC_SCHEMA = vol.Schema({ HARMONY_CHANGE_CHANNEL_SCHEMA = vol.Schema({ vol.Required(ATTR_ENTITY_ID): cv.entity_ids, - vol.Required(ATTR_CHANNEL): cv.positive_int + vol.Required(ATTR_CHANNEL): cv.positive_int, }) -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 Harmony platform.""" activity = None diff --git a/homeassistant/components/hassio/__init__.py b/homeassistant/components/hassio/__init__.py index 3c058281b0a..e070c889f31 100644 --- a/homeassistant/components/hassio/__init__.py +++ b/homeassistant/components/hassio/__init__.py @@ -1,9 +1,4 @@ -""" -Exposes regular REST commands as services. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/hassio/ -""" +"""Support for Hass.io.""" from datetime import timedelta import logging import os @@ -14,16 +9,15 @@ from homeassistant.auth.const import GROUP_ID_ADMIN from homeassistant.components import SERVICE_CHECK_CONFIG from homeassistant.const import ( ATTR_NAME, SERVICE_HOMEASSISTANT_RESTART, SERVICE_HOMEASSISTANT_STOP) -from homeassistant.core import DOMAIN as HASS_DOMAIN -from homeassistant.core import callback +from homeassistant.core import DOMAIN as HASS_DOMAIN, callback +from homeassistant.exceptions import HomeAssistantError import homeassistant.helpers.config_validation as cv from homeassistant.loader import bind_hass from homeassistant.util.dt import utcnow -from homeassistant.exceptions import HomeAssistantError from .auth import async_setup_auth -from .handler import HassIO, HassioAPIError from .discovery import async_setup_discovery +from .handler import HassIO, HassioAPIError from .http import HassIOView _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/hassio/auth.py b/homeassistant/components/hassio/auth.py index 4be3ba9956c..b104d53aff9 100644 --- a/homeassistant/components/hassio/auth.py +++ b/homeassistant/components/hassio/auth.py @@ -1,20 +1,20 @@ """Implement the auth feature from Hass.io for Add-ons.""" -import logging from ipaddress import ip_address +import logging import os from aiohttp import web from aiohttp.web_exceptions import HTTPForbidden, HTTPNotFound import voluptuous as vol -from homeassistant.core import callback -import homeassistant.helpers.config_validation as cv -from homeassistant.exceptions import HomeAssistantError from homeassistant.components.http import HomeAssistantView from homeassistant.components.http.const import KEY_REAL_IP from homeassistant.components.http.data_validator import RequestDataValidator +from homeassistant.core import callback +from homeassistant.exceptions import HomeAssistantError +import homeassistant.helpers.config_validation as cv -from .const import ATTR_USERNAME, ATTR_PASSWORD, ATTR_ADDON +from .const import ATTR_ADDON, ATTR_PASSWORD, ATTR_USERNAME _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/hassio/discovery.py b/homeassistant/components/hassio/discovery.py index a5f62b9e1a1..804247d2407 100644 --- a/homeassistant/components/hassio/discovery.py +++ b/homeassistant/components/hassio/discovery.py @@ -1,18 +1,18 @@ -"""Implement the serivces discovery feature from Hass.io for Add-ons.""" +"""Implement the services discovery feature from Hass.io for Add-ons.""" import asyncio import logging from aiohttp import web from aiohttp.web_exceptions import HTTPServiceUnavailable -from homeassistant.core import callback, CoreState -from homeassistant.const import EVENT_HOMEASSISTANT_START from homeassistant.components.http import HomeAssistantView +from homeassistant.const import EVENT_HOMEASSISTANT_START +from homeassistant.core import CoreState, callback -from .handler import HassioAPIError from .const import ( - ATTR_DISCOVERY, ATTR_ADDON, ATTR_NAME, ATTR_SERVICE, ATTR_CONFIG, + ATTR_ADDON, ATTR_CONFIG, ATTR_DISCOVERY, ATTR_NAME, ATTR_SERVICE, ATTR_UUID) +from .handler import HassioAPIError _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/hassio/handler.py b/homeassistant/components/hassio/handler.py index c33125d840e..640ed29e578 100644 --- a/homeassistant/components/hassio/handler.py +++ b/homeassistant/components/hassio/handler.py @@ -1,9 +1,4 @@ -""" -Exposes regular REST commands as services. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/hassio/ -""" +"""Handler for Hass.io.""" import asyncio import logging import os diff --git a/homeassistant/components/hassio/http.py b/homeassistant/components/hassio/http.py index 6b8004f7664..01ded9ca11d 100644 --- a/homeassistant/components/hassio/http.py +++ b/homeassistant/components/hassio/http.py @@ -1,23 +1,18 @@ -""" -Exposes regular REST commands as services. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/hassio/ -""" +"""HTTP Support for Hass.io.""" import asyncio import logging import os import re -import async_timeout import aiohttp from aiohttp import web from aiohttp.hdrs import CONTENT_TYPE from aiohttp.web_exceptions import HTTPBadGateway +import async_timeout from homeassistant.components.http import KEY_AUTHENTICATED, HomeAssistantView -from .const import X_HASSIO, X_HASS_USER_ID, X_HASS_IS_ADMIN +from .const import X_HASS_IS_ADMIN, X_HASS_USER_ID, X_HASSIO _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/hdmi_cec/__init__.py b/homeassistant/components/hdmi_cec/__init__.py index 5fb2e19edcf..8eb13c5ab21 100644 --- a/homeassistant/components/hdmi_cec/__init__.py +++ b/homeassistant/components/hdmi_cec/__init__.py @@ -1,26 +1,20 @@ -""" -HDMI CEC component. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/hdmi_cec/ -""" -import logging -import multiprocessing +"""Support for HDMI CEC.""" from collections import defaultdict from functools import reduce +import logging +import multiprocessing import voluptuous as vol -import homeassistant.helpers.config_validation as cv -from homeassistant.helpers import discovery from homeassistant.components.media_player import DOMAIN as MEDIA_PLAYER from homeassistant.components.switch import DOMAIN as SWITCH -from homeassistant.const import (EVENT_HOMEASSISTANT_START, - EVENT_HOMEASSISTANT_STOP, STATE_ON, - STATE_OFF, CONF_DEVICES, CONF_PLATFORM, - STATE_PLAYING, STATE_IDLE, - STATE_PAUSED, CONF_HOST) +from homeassistant.const import ( + CONF_DEVICES, CONF_HOST, CONF_PLATFORM, EVENT_HOMEASSISTANT_START, + EVENT_HOMEASSISTANT_STOP, STATE_IDLE, STATE_OFF, STATE_ON, STATE_PAUSED, + STATE_PLAYING) from homeassistant.core import HomeAssistant +from homeassistant.helpers import discovery +import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entity import Entity REQUIREMENTS = ['pyCEC==0.4.13'] @@ -43,7 +37,7 @@ ICONS_BY_TYPE = { 1: ICON_RECORDER, 3: ICON_TUNER, 4: ICON_PLAYER, - 5: ICON_AUDIO + 5: ICON_AUDIO, } CEC_DEVICES = defaultdict(list) @@ -87,7 +81,7 @@ SERVICE_SEND_COMMAND_SCHEMA = vol.Schema({ vol.Optional(ATTR_SRC): _VOL_HEX, vol.Optional(ATTR_DST): _VOL_HEX, vol.Optional(ATTR_ATT): _VOL_HEX, - vol.Optional(ATTR_RAW): vol.Coerce(str) + vol.Optional(ATTR_RAW): vol.Coerce(str), }, extra=vol.PREVENT_EXTRA) SERVICE_VOLUME = 'volume' diff --git a/homeassistant/components/hdmi_cec/media_player.py b/homeassistant/components/hdmi_cec/media_player.py index 6e691cad94f..553983a1f03 100644 --- a/homeassistant/components/hdmi_cec/media_player.py +++ b/homeassistant/components/hdmi_cec/media_player.py @@ -1,9 +1,4 @@ -""" -Support for HDMI CEC devices as media players. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/hdmi_cec/ -""" +"""Support for HDMI CEC devices as media players.""" import logging from homeassistant.components.hdmi_cec import ATTR_NEW, CecDevice @@ -25,7 +20,7 @@ ENTITY_ID_FORMAT = DOMAIN + '.{}' def setup_platform(hass, config, add_entities, discovery_info=None): """Find and return HDMI devices as +switches.""" if ATTR_NEW in discovery_info: - _LOGGER.info("Setting up HDMI devices %s", discovery_info[ATTR_NEW]) + _LOGGER.debug("Setting up HDMI devices %s", discovery_info[ATTR_NEW]) entities = [] for device in discovery_info[ATTR_NEW]: hdmi_device = hass.data.get(device) diff --git a/homeassistant/components/hdmi_cec/switch.py b/homeassistant/components/hdmi_cec/switch.py index 1016e91d8d2..ff423890ba5 100644 --- a/homeassistant/components/hdmi_cec/switch.py +++ b/homeassistant/components/hdmi_cec/switch.py @@ -1,14 +1,9 @@ -""" -Support for HDMI CEC devices as switches. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/hdmi_cec/ -""" +"""Support for HDMI CEC devices as switches.""" import logging -from homeassistant.components.hdmi_cec import CecDevice, ATTR_NEW -from homeassistant.components.switch import SwitchDevice, DOMAIN -from homeassistant.const import STATE_OFF, STATE_STANDBY, STATE_ON +from homeassistant.components.hdmi_cec import ATTR_NEW, CecDevice +from homeassistant.components.switch import DOMAIN, SwitchDevice +from homeassistant.const import STATE_OFF, STATE_ON, STATE_STANDBY DEPENDENCIES = ['hdmi_cec'] diff --git a/homeassistant/components/history/__init__.py b/homeassistant/components/history/__init__.py index 1773a55b3f1..fb037e8909d 100644 --- a/homeassistant/components/history/__init__.py +++ b/homeassistant/components/history/__init__.py @@ -1,9 +1,4 @@ -""" -Provide pre-made queries on top of the recorder component. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/history/ -""" +"""Provide pre-made queries on top of the recorder component.""" from collections import defaultdict from datetime import timedelta from itertools import groupby diff --git a/homeassistant/components/history_graph/__init__.py b/homeassistant/components/history_graph/__init__.py index 7d9db379705..893f3514d77 100644 --- a/homeassistant/components/history_graph/__init__.py +++ b/homeassistant/components/history_graph/__init__.py @@ -1,9 +1,4 @@ -""" -Support to graphs card in the UI. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/history_graph/ -""" +"""Support to graphs card in the UI.""" import logging import voluptuous as vol @@ -34,7 +29,7 @@ GRAPH_SCHEMA = vol.Schema({ CONFIG_SCHEMA = vol.Schema({ - DOMAIN: cv.schema_with_slug_keys(GRAPH_SCHEMA) + DOMAIN: cv.schema_with_slug_keys(GRAPH_SCHEMA), }, extra=vol.ALLOW_EXTRA) diff --git a/homeassistant/components/hive/__init__.py b/homeassistant/components/hive/__init__.py index 09319849933..934c44028ac 100644 --- a/homeassistant/components/hive/__init__.py +++ b/homeassistant/components/hive/__init__.py @@ -1,20 +1,17 @@ -""" -Support for the Hive devices. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/hive/ -""" +"""Support for the Hive devices.""" import logging + import voluptuous as vol -from homeassistant.const import (CONF_PASSWORD, CONF_SCAN_INTERVAL, - CONF_USERNAME) +from homeassistant.const import ( + CONF_PASSWORD, CONF_SCAN_INTERVAL, CONF_USERNAME) import homeassistant.helpers.config_validation as cv from homeassistant.helpers.discovery import load_platform REQUIREMENTS = ['pyhiveapi==0.2.17'] _LOGGER = logging.getLogger(__name__) + DOMAIN = 'hive' DATA_HIVE = 'data_hive' DEVICETYPES = { @@ -23,7 +20,7 @@ DEVICETYPES = { 'light': 'device_list_light', 'switch': 'device_list_plug', 'sensor': 'device_list_sensor', - } +} CONFIG_SCHEMA = vol.Schema({ DOMAIN: vol.Schema({ @@ -59,9 +56,8 @@ def setup(hass, config): password = config[DOMAIN][CONF_PASSWORD] update_interval = config[DOMAIN][CONF_SCAN_INTERVAL] - devicelist = session.core.initialise_api(username, - password, - update_interval) + devicelist = session.core.initialise_api( + username, password, update_interval) if devicelist is None: _LOGGER.error("Hive API initialization failed") diff --git a/homeassistant/components/hive/binary_sensor.py b/homeassistant/components/hive/binary_sensor.py index e114e67f90f..dee27c5c710 100644 --- a/homeassistant/components/hive/binary_sensor.py +++ b/homeassistant/components/hive/binary_sensor.py @@ -1,16 +1,13 @@ -""" -Support for the Hive devices. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/binary_sensor.hive/ -""" +"""Support for the Hive binary sensors.""" from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.hive import DATA_HIVE, DOMAIN DEPENDENCIES = ['hive'] -DEVICETYPE_DEVICE_CLASS = {'motionsensor': 'motion', - 'contactsensor': 'opening'} +DEVICETYPE_DEVICE_CLASS = { + 'motionsensor': 'motion', + 'contactsensor': 'opening', +} def setup_platform(hass, config, add_entities, discovery_info=None): @@ -76,8 +73,8 @@ class HiveBinarySensorEntity(BinarySensorDevice): @property def is_on(self): """Return true if the binary sensor is on.""" - return self.session.sensor.get_state(self.node_id, - self.node_device_type) + return self.session.sensor.get_state( + self.node_id, self.node_device_type) def update(self): """Update all Node data from Hive.""" diff --git a/homeassistant/components/hive/climate.py b/homeassistant/components/hive/climate.py index 87d426d6f05..2ecc195061a 100644 --- a/homeassistant/components/hive/climate.py +++ b/homeassistant/components/hive/climate.py @@ -1,20 +1,25 @@ -""" -Support for the Hive devices. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/climate.hive/ -""" +"""Support for the Hive climate devices.""" from homeassistant.components.climate import ( - ClimateDevice, STATE_AUTO, STATE_HEAT, STATE_OFF, STATE_ON, - SUPPORT_AUX_HEAT, SUPPORT_TARGET_TEMPERATURE, SUPPORT_OPERATION_MODE) -from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS + STATE_AUTO, STATE_HEAT, STATE_OFF, STATE_ON, SUPPORT_AUX_HEAT, + SUPPORT_OPERATION_MODE, SUPPORT_TARGET_TEMPERATURE, ClimateDevice) from homeassistant.components.hive import DATA_HIVE, DOMAIN +from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS DEPENDENCIES = ['hive'] -HIVE_TO_HASS_STATE = {'SCHEDULE': STATE_AUTO, 'MANUAL': STATE_HEAT, - 'ON': STATE_ON, 'OFF': STATE_OFF} -HASS_TO_HIVE_STATE = {STATE_AUTO: 'SCHEDULE', STATE_HEAT: 'MANUAL', - STATE_ON: 'ON', STATE_OFF: 'OFF'} + +HIVE_TO_HASS_STATE = { + 'SCHEDULE': STATE_AUTO, + 'MANUAL': STATE_HEAT, + 'ON': STATE_ON, + 'OFF': STATE_OFF, +} + +HASS_TO_HIVE_STATE = { + STATE_AUTO: 'SCHEDULE', + STATE_HEAT: 'MANUAL', + STATE_ON: 'ON', + STATE_OFF: 'OFF', +} SUPPORT_FLAGS = (SUPPORT_TARGET_TEMPERATURE | SUPPORT_OPERATION_MODE | @@ -42,8 +47,8 @@ class HiveClimateEntity(ClimateDevice): self.thermostat_node_id = hivedevice["Thermostat_NodeID"] self.session = hivesession self.attributes = {} - self.data_updatesource = '{}.{}'.format(self.device_type, - self.node_id) + self.data_updatesource = '{}.{}'.format( + self.device_type, self.node_id) self._unique_id = '{}-{}'.format(self.node_id, self.device_type) if self.device_type == "Heating": diff --git a/homeassistant/components/hive/light.py b/homeassistant/components/hive/light.py index c2bb95f40da..2bec60f0ee4 100644 --- a/homeassistant/components/hive/light.py +++ b/homeassistant/components/hive/light.py @@ -1,15 +1,8 @@ -""" -Support for the Hive devices. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/light.hive/ -""" +"""Support for the Hive lights.""" from homeassistant.components.hive import DATA_HIVE, DOMAIN -from homeassistant.components.light import (ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, - ATTR_HS_COLOR, - SUPPORT_BRIGHTNESS, - SUPPORT_COLOR_TEMP, - SUPPORT_COLOR, Light) +from homeassistant.components.light import ( + ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, ATTR_HS_COLOR, SUPPORT_BRIGHTNESS, + SUPPORT_COLOR, SUPPORT_COLOR_TEMP, Light) import homeassistant.util.color as color_util DEPENDENCIES = ['hive'] @@ -35,8 +28,8 @@ class HiveDeviceLight(Light): self.light_device_type = hivedevice["Hive_Light_DeviceType"] self.session = hivesession self.attributes = {} - self.data_updatesource = '{}.{}'.format(self.device_type, - self.node_id) + self.data_updatesource = '{}.{}'.format( + self.device_type, self.node_id) self._unique_id = '{}-{}'.format(self.node_id, self.device_type) self.session.entities.append(self) diff --git a/homeassistant/components/hive/sensor.py b/homeassistant/components/hive/sensor.py index e989074fb4b..142c8c7ee94 100644 --- a/homeassistant/components/hive/sensor.py +++ b/homeassistant/components/hive/sensor.py @@ -1,19 +1,19 @@ -""" -Support for the Hive devices. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/sensor.hive/ -""" -from homeassistant.const import TEMP_CELSIUS +"""Support for the Hive sensors.""" from homeassistant.components.hive import DATA_HIVE, DOMAIN +from homeassistant.const import TEMP_CELSIUS from homeassistant.helpers.entity import Entity DEPENDENCIES = ['hive'] -FRIENDLY_NAMES = {'Hub_OnlineStatus': 'Hive Hub Status', - 'Hive_OutsideTemperature': 'Outside Temperature'} -DEVICETYPE_ICONS = {'Hub_OnlineStatus': 'mdi:switch', - 'Hive_OutsideTemperature': 'mdi:thermometer'} +FRIENDLY_NAMES = { + 'Hub_OnlineStatus': 'Hive Hub Status', + 'Hive_OutsideTemperature': 'Outside Temperature', +} + +DEVICETYPE_ICONS = { + 'Hub_OnlineStatus': 'mdi:switch', + 'Hive_OutsideTemperature': 'mdi:thermometer', +} def setup_platform(hass, config, add_entities, discovery_info=None): @@ -36,8 +36,8 @@ class HiveSensorEntity(Entity): self.device_type = hivedevice["HA_DeviceType"] self.node_device_type = hivedevice["Hive_DeviceType"] self.session = hivesession - self.data_updatesource = '{}.{}'.format(self.device_type, - self.node_id) + self.data_updatesource = '{}.{}'.format( + self.device_type, self.node_id) self._unique_id = '{}-{}'.format(self.node_id, self.device_type) self.session.entities.append(self) diff --git a/homeassistant/components/hive/switch.py b/homeassistant/components/hive/switch.py index a50323f0a4e..c897e37f34b 100644 --- a/homeassistant/components/hive/switch.py +++ b/homeassistant/components/hive/switch.py @@ -1,11 +1,6 @@ -""" -Support for the Hive devices. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/switch.hive/ -""" -from homeassistant.components.switch import SwitchDevice +"""Support for the Hive switches.""" from homeassistant.components.hive import DATA_HIVE, DOMAIN +from homeassistant.components.switch import SwitchDevice DEPENDENCIES = ['hive'] @@ -29,8 +24,8 @@ class HiveDevicePlug(SwitchDevice): self.device_type = hivedevice["HA_DeviceType"] self.session = hivesession self.attributes = {} - self.data_updatesource = '{}.{}'.format(self.device_type, - self.node_id) + self.data_updatesource = '{}.{}'.format( + self.device_type, self.node_id) self._unique_id = '{}-{}'.format(self.node_id, self.device_type) self.session.entities.append(self) diff --git a/homeassistant/components/hlk_sw16/__init__.py b/homeassistant/components/hlk_sw16/__init__.py index cfbb8ac010c..aab3f79b8b2 100644 --- a/homeassistant/components/hlk_sw16/__init__.py +++ b/homeassistant/components/hlk_sw16/__init__.py @@ -1,9 +1,4 @@ -""" -Support for HLK-SW16 relay switch. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/hlk_sw16/ -""" +"""Support for HLK-SW16 relay switches.""" import logging import voluptuous as vol diff --git a/homeassistant/components/hlk_sw16/switch.py b/homeassistant/components/hlk_sw16/switch.py index d76528c56f0..b1bfc5ce23d 100644 --- a/homeassistant/components/hlk_sw16/switch.py +++ b/homeassistant/components/hlk_sw16/switch.py @@ -1,9 +1,4 @@ -""" -Support for HLK-SW16 switches. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/switch.hlk_sw16/ -""" +"""Support for HLK-SW16 switches.""" import logging from homeassistant.components.hlk_sw16 import ( @@ -31,8 +26,8 @@ def devices_from_config(hass, domain_config): return devices -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 HLK-SW16 platform.""" async_add_entities(devices_from_config(hass, discovery_info)) diff --git a/homeassistant/components/homekit/__init__.py b/homeassistant/components/homekit/__init__.py index c34b527252f..01979f03b9a 100644 --- a/homeassistant/components/homekit/__init__.py +++ b/homeassistant/components/homekit/__init__.py @@ -1,8 +1,4 @@ -"""Support for Apple HomeKit. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/homekit/ -""" +"""Support for Apple HomeKit.""" import ipaddress import logging from zlib import adler32 @@ -14,19 +10,19 @@ from homeassistant.const import ( ATTR_DEVICE_CLASS, ATTR_SUPPORTED_FEATURES, ATTR_UNIT_OF_MEASUREMENT, CONF_IP_ADDRESS, CONF_NAME, CONF_PORT, CONF_TYPE, DEVICE_CLASS_HUMIDITY, DEVICE_CLASS_ILLUMINANCE, DEVICE_CLASS_TEMPERATURE, - EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP, - TEMP_CELSIUS, TEMP_FAHRENHEIT) + EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP, TEMP_CELSIUS, + TEMP_FAHRENHEIT) import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entityfilter import FILTER_SCHEMA from homeassistant.util import get_local_ip from homeassistant.util.decorator import Registry + from .const import ( BRIDGE_NAME, CONF_AUTO_START, CONF_ENTITY_CONFIG, CONF_FEATURE_LIST, CONF_FILTER, CONF_SAFE_MODE, DEFAULT_AUTO_START, DEFAULT_PORT, - DEFAULT_SAFE_MODE, DEVICE_CLASS_CO, - DEVICE_CLASS_CO2, DEVICE_CLASS_PM25, DOMAIN, HOMEKIT_FILE, - SERVICE_HOMEKIT_START, TYPE_FAUCET, TYPE_OUTLET, TYPE_SHOWER, - TYPE_SPRINKLER, TYPE_SWITCH, TYPE_VALVE) + DEFAULT_SAFE_MODE, DEVICE_CLASS_CO, DEVICE_CLASS_CO2, DEVICE_CLASS_PM25, + DOMAIN, HOMEKIT_FILE, SERVICE_HOMEKIT_START, TYPE_FAUCET, TYPE_OUTLET, + TYPE_SHOWER, TYPE_SPRINKLER, TYPE_SWITCH, TYPE_VALVE) from .util import ( show_setup_message, validate_entity_config, validate_media_player_features) diff --git a/homeassistant/components/homekit/accessories.py b/homeassistant/components/homekit/accessories.py index 5baed0294b8..4adeda2465a 100644 --- a/homeassistant/components/homekit/accessories.py +++ b/homeassistant/components/homekit/accessories.py @@ -9,10 +9,9 @@ from pyhap.accessory_driver import AccessoryDriver from pyhap.const import CATEGORY_OTHER from homeassistant.const import ( - __version__, ATTR_BATTERY_CHARGING, ATTR_BATTERY_LEVEL, ATTR_ENTITY_ID, - ATTR_SERVICE) -from homeassistant.core import callback as ha_callback -from homeassistant.core import split_entity_id + ATTR_BATTERY_CHARGING, ATTR_BATTERY_LEVEL, ATTR_ENTITY_ID, ATTR_SERVICE, + __version__) +from homeassistant.core import callback as ha_callback, split_entity_id from homeassistant.helpers.event import ( async_track_state_change, track_point_in_utc_time) from homeassistant.util import dt as dt_util @@ -22,8 +21,7 @@ from .const import ( CHAR_BATTERY_LEVEL, CHAR_CHARGING_STATE, CHAR_STATUS_LOW_BATTERY, DEBOUNCE_TIMEOUT, EVENT_HOMEKIT_CHANGED, MANUFACTURER, SERV_BATTERY_SERVICE) -from .util import ( - convert_to_float, show_setup_message, dismiss_setup_message) +from .util import convert_to_float, dismiss_setup_message, show_setup_message _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/homekit/type_covers.py b/homeassistant/components/homekit/type_covers.py index b3beb11c8b6..5273480b6ce 100644 --- a/homeassistant/components/homekit/type_covers.py +++ b/homeassistant/components/homekit/type_covers.py @@ -11,11 +11,11 @@ from homeassistant.const import ( STATE_CLOSED, STATE_OPEN) from . import TYPES -from .accessories import debounce, HomeAccessory +from .accessories import HomeAccessory, debounce from .const import ( CHAR_CURRENT_DOOR_STATE, CHAR_CURRENT_POSITION, CHAR_POSITION_STATE, - CHAR_TARGET_DOOR_STATE, CHAR_TARGET_POSITION, - SERV_GARAGE_DOOR_OPENER, SERV_WINDOW_COVERING) + CHAR_TARGET_DOOR_STATE, CHAR_TARGET_POSITION, SERV_GARAGE_DOOR_OPENER, + SERV_WINDOW_COVERING) _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/homekit/type_fans.py b/homeassistant/components/homekit/type_fans.py index dcc93b7cf9e..d2777a296dc 100644 --- a/homeassistant/components/homekit/type_fans.py +++ b/homeassistant/components/homekit/type_fans.py @@ -13,7 +13,7 @@ from homeassistant.const import ( STATE_OFF, STATE_ON) from . import TYPES -from .accessories import debounce, HomeAccessory +from .accessories import HomeAccessory, debounce from .const import ( CHAR_ACTIVE, CHAR_ROTATION_DIRECTION, CHAR_ROTATION_SPEED, CHAR_SWING_MODE, SERV_FANV2) diff --git a/homeassistant/components/homekit/type_lights.py b/homeassistant/components/homekit/type_lights.py index a9007ace35b..f549958f755 100644 --- a/homeassistant/components/homekit/type_lights.py +++ b/homeassistant/components/homekit/type_lights.py @@ -5,17 +5,17 @@ from pyhap.const import CATEGORY_LIGHTBULB from homeassistant.components.light import ( ATTR_BRIGHTNESS, ATTR_BRIGHTNESS_PCT, ATTR_COLOR_TEMP, ATTR_HS_COLOR, - ATTR_MAX_MIREDS, ATTR_MIN_MIREDS, DOMAIN, - SUPPORT_BRIGHTNESS, SUPPORT_COLOR, SUPPORT_COLOR_TEMP) + ATTR_MAX_MIREDS, ATTR_MIN_MIREDS, DOMAIN, SUPPORT_BRIGHTNESS, + SUPPORT_COLOR, SUPPORT_COLOR_TEMP) from homeassistant.const import ( - ATTR_ENTITY_ID, ATTR_SUPPORTED_FEATURES, SERVICE_TURN_ON, - SERVICE_TURN_OFF, STATE_OFF, STATE_ON) + ATTR_ENTITY_ID, ATTR_SUPPORTED_FEATURES, SERVICE_TURN_OFF, SERVICE_TURN_ON, + STATE_OFF, STATE_ON) from . import TYPES -from .accessories import debounce, HomeAccessory +from .accessories import HomeAccessory, debounce from .const import ( CHAR_BRIGHTNESS, CHAR_COLOR_TEMPERATURE, CHAR_HUE, CHAR_ON, - CHAR_SATURATION, SERV_LIGHTBULB, PROP_MAX_VALUE, PROP_MIN_VALUE) + CHAR_SATURATION, PROP_MAX_VALUE, PROP_MIN_VALUE, SERV_LIGHTBULB) _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/homekit/type_locks.py b/homeassistant/components/homekit/type_locks.py index 22c47d59c62..4ed1cebd207 100644 --- a/homeassistant/components/homekit/type_locks.py +++ b/homeassistant/components/homekit/type_locks.py @@ -13,13 +13,19 @@ from .const import CHAR_LOCK_CURRENT_STATE, CHAR_LOCK_TARGET_STATE, SERV_LOCK _LOGGER = logging.getLogger(__name__) -HASS_TO_HOMEKIT = {STATE_UNLOCKED: 0, - STATE_LOCKED: 1, - # value 2 is Jammed which hass doesn't have a state for - STATE_UNKNOWN: 3} +HASS_TO_HOMEKIT = { + STATE_UNLOCKED: 0, + STATE_LOCKED: 1, + # Value 2 is Jammed which hass doesn't have a state for + STATE_UNKNOWN: 3, +} + HOMEKIT_TO_HASS = {c: s for s, c in HASS_TO_HOMEKIT.items()} -STATE_TO_SERVICE = {STATE_LOCKED: 'lock', - STATE_UNLOCKED: 'unlock'} + +STATE_TO_SERVICE = { + STATE_LOCKED: 'lock', + STATE_UNLOCKED: 'unlock', +} @TYPES.register('Lock') @@ -45,7 +51,7 @@ class Lock(HomeAccessory): def set_state(self, value): """Set lock state to value if call came from HomeKit.""" - _LOGGER.debug('%s: Set state to %d', self.entity_id, value) + _LOGGER.debug("%s: Set state to %d", self.entity_id, value) self._flag_state = True hass_value = HOMEKIT_TO_HASS.get(value) @@ -62,7 +68,7 @@ class Lock(HomeAccessory): if hass_state in HASS_TO_HOMEKIT: current_lock_state = HASS_TO_HOMEKIT[hass_state] self.char_current_state.set_value(current_lock_state) - _LOGGER.debug('%s: Updated current state to %s (%d)', + _LOGGER.debug("%s: Updated current state to %s (%d)", self.entity_id, hass_state, current_lock_state) # LockTargetState only supports locked and unlocked diff --git a/homeassistant/components/homekit/type_media_players.py b/homeassistant/components/homekit/type_media_players.py index 09088871fd2..f8f4ef96992 100644 --- a/homeassistant/components/homekit/type_media_players.py +++ b/homeassistant/components/homekit/type_media_players.py @@ -3,12 +3,12 @@ import logging from pyhap.const import CATEGORY_SWITCH +from homeassistant.components.media_player import ( + ATTR_MEDIA_VOLUME_MUTED, DOMAIN) from homeassistant.const import ( ATTR_ENTITY_ID, SERVICE_MEDIA_PAUSE, SERVICE_MEDIA_PLAY, SERVICE_MEDIA_STOP, SERVICE_TURN_OFF, SERVICE_TURN_ON, SERVICE_VOLUME_MUTE, STATE_OFF, STATE_PLAYING, STATE_UNKNOWN) -from homeassistant.components.media_player import ( - ATTR_MEDIA_VOLUME_MUTED, DOMAIN) from . import TYPES from .accessories import HomeAccessory @@ -18,10 +18,12 @@ from .const import ( _LOGGER = logging.getLogger(__name__) -MODE_FRIENDLY_NAME = {FEATURE_ON_OFF: 'Power', - FEATURE_PLAY_PAUSE: 'Play/Pause', - FEATURE_PLAY_STOP: 'Play/Stop', - FEATURE_TOGGLE_MUTE: 'Mute'} +MODE_FRIENDLY_NAME = { + FEATURE_ON_OFF: 'Power', + FEATURE_PLAY_PAUSE: 'Play/Pause', + FEATURE_PLAY_STOP: 'Play/Stop', + FEATURE_TOGGLE_MUTE: 'Mute', +} @TYPES.register('MediaPlayer') diff --git a/homeassistant/components/homekit/type_security_systems.py b/homeassistant/components/homekit/type_security_systems.py index e210217df2f..10befb4af61 100644 --- a/homeassistant/components/homekit/type_security_systems.py +++ b/homeassistant/components/homekit/type_security_systems.py @@ -5,10 +5,10 @@ from pyhap.const import CATEGORY_ALARM_SYSTEM from homeassistant.components.alarm_control_panel import DOMAIN from homeassistant.const import ( - ATTR_ENTITY_ID, ATTR_CODE, SERVICE_ALARM_ARM_AWAY, SERVICE_ALARM_ARM_HOME, + ATTR_CODE, ATTR_ENTITY_ID, SERVICE_ALARM_ARM_AWAY, SERVICE_ALARM_ARM_HOME, SERVICE_ALARM_ARM_NIGHT, SERVICE_ALARM_DISARM, STATE_ALARM_ARMED_AWAY, - STATE_ALARM_ARMED_HOME, STATE_ALARM_ARMED_NIGHT, STATE_ALARM_TRIGGERED, - STATE_ALARM_DISARMED) + STATE_ALARM_ARMED_HOME, STATE_ALARM_ARMED_NIGHT, STATE_ALARM_DISARMED, + STATE_ALARM_TRIGGERED) from . import TYPES from .accessories import HomeAccessory @@ -18,17 +18,22 @@ from .const import ( _LOGGER = logging.getLogger(__name__) -HASS_TO_HOMEKIT = {STATE_ALARM_ARMED_HOME: 0, - STATE_ALARM_ARMED_AWAY: 1, - STATE_ALARM_ARMED_NIGHT: 2, - STATE_ALARM_DISARMED: 3, - STATE_ALARM_TRIGGERED: 4} +HASS_TO_HOMEKIT = { + STATE_ALARM_ARMED_HOME: 0, + STATE_ALARM_ARMED_AWAY: 1, + STATE_ALARM_ARMED_NIGHT: 2, + STATE_ALARM_DISARMED: 3, + STATE_ALARM_TRIGGERED: 4, +} + HOMEKIT_TO_HASS = {c: s for s, c in HASS_TO_HOMEKIT.items()} + STATE_TO_SERVICE = { STATE_ALARM_ARMED_AWAY: SERVICE_ALARM_ARM_AWAY, STATE_ALARM_ARMED_HOME: SERVICE_ALARM_ARM_HOME, STATE_ALARM_ARMED_NIGHT: SERVICE_ALARM_ARM_NIGHT, - STATE_ALARM_DISARMED: SERVICE_ALARM_DISARM} + STATE_ALARM_DISARMED: SERVICE_ALARM_DISARM, +} @TYPES.register('SecuritySystem') diff --git a/homeassistant/components/homekit/type_sensors.py b/homeassistant/components/homekit/type_sensors.py index 09da361ddb8..0d7dd94d014 100644 --- a/homeassistant/components/homekit/type_sensors.py +++ b/homeassistant/components/homekit/type_sensors.py @@ -4,7 +4,7 @@ import logging from pyhap.const import CATEGORY_SENSOR from homeassistant.const import ( - ATTR_DEVICE_CLASS, ATTR_UNIT_OF_MEASUREMENT, STATE_ON, STATE_HOME, + ATTR_DEVICE_CLASS, ATTR_UNIT_OF_MEASUREMENT, STATE_HOME, STATE_ON, TEMP_CELSIUS) from . import TYPES @@ -26,7 +26,7 @@ from .const import ( SERV_LIGHT_SENSOR, SERV_MOTION_SENSOR, SERV_OCCUPANCY_SENSOR, SERV_SMOKE_SENSOR, SERV_TEMPERATURE_SENSOR, THRESHOLD_CO, THRESHOLD_CO2) from .util import ( - convert_to_float, temperature_to_homekit, density_to_air_quality) + convert_to_float, density_to_air_quality, temperature_to_homekit) _LOGGER = logging.getLogger(__name__) @@ -42,7 +42,8 @@ BINARY_SENSOR_SERVICE_MAP = { DEVICE_CLASS_OCCUPANCY: (SERV_OCCUPANCY_SENSOR, CHAR_OCCUPANCY_DETECTED), DEVICE_CLASS_OPENING: (SERV_CONTACT_SENSOR, CHAR_CONTACT_SENSOR_STATE), DEVICE_CLASS_SMOKE: (SERV_SMOKE_SENSOR, CHAR_SMOKE_DETECTED), - DEVICE_CLASS_WINDOW: (SERV_CONTACT_SENSOR, CHAR_CONTACT_SENSOR_STATE)} + DEVICE_CLASS_WINDOW: (SERV_CONTACT_SENSOR, CHAR_CONTACT_SENSOR_STATE), +} @TYPES.register('TemperatureSensor') diff --git a/homeassistant/components/homekit/type_switches.py b/homeassistant/components/homekit/type_switches.py index b41e1a01543..7629e33a4d7 100644 --- a/homeassistant/components/homekit/type_switches.py +++ b/homeassistant/components/homekit/type_switches.py @@ -2,13 +2,13 @@ import logging from pyhap.const import ( - CATEGORY_FAUCET, CATEGORY_OUTLET, CATEGORY_SHOWER_HEAD, - CATEGORY_SPRINKLER, CATEGORY_SWITCH) + CATEGORY_FAUCET, CATEGORY_OUTLET, CATEGORY_SHOWER_HEAD, CATEGORY_SPRINKLER, + CATEGORY_SWITCH) from homeassistant.components.script import ATTR_CAN_CANCEL from homeassistant.components.switch import DOMAIN from homeassistant.const import ( - ATTR_ENTITY_ID, CONF_TYPE, SERVICE_TURN_ON, SERVICE_TURN_OFF, STATE_ON) + ATTR_ENTITY_ID, CONF_TYPE, SERVICE_TURN_OFF, SERVICE_TURN_ON, STATE_ON) from homeassistant.core import split_entity_id from homeassistant.helpers.event import call_later diff --git a/homeassistant/components/homekit/type_thermostats.py b/homeassistant/components/homekit/type_thermostats.py index f78a05b1a45..4a9ccdee009 100644 --- a/homeassistant/components/homekit/type_thermostats.py +++ b/homeassistant/components/homekit/type_thermostats.py @@ -5,30 +5,30 @@ from pyhap.const import CATEGORY_THERMOSTAT from homeassistant.components.climate import ( ATTR_CURRENT_TEMPERATURE, ATTR_MAX_TEMP, ATTR_MIN_TEMP, - ATTR_OPERATION_LIST, ATTR_OPERATION_MODE, - ATTR_TARGET_TEMP_HIGH, ATTR_TARGET_TEMP_LOW, - DEFAULT_MAX_TEMP, DEFAULT_MIN_TEMP, DOMAIN as DOMAIN_CLIMATE, + ATTR_OPERATION_LIST, ATTR_OPERATION_MODE, ATTR_TARGET_TEMP_HIGH, + ATTR_TARGET_TEMP_LOW, DEFAULT_MAX_TEMP, DEFAULT_MIN_TEMP, + DOMAIN as DOMAIN_CLIMATE, SERVICE_SET_OPERATION_MODE as SERVICE_SET_OPERATION_MODE_THERMOSTAT, - SERVICE_SET_TEMPERATURE as SERVICE_SET_TEMPERATURE_THERMOSTAT, - STATE_AUTO, STATE_COOL, STATE_HEAT, SUPPORT_ON_OFF, - SUPPORT_TARGET_TEMPERATURE_HIGH, SUPPORT_TARGET_TEMPERATURE_LOW) + SERVICE_SET_TEMPERATURE as SERVICE_SET_TEMPERATURE_THERMOSTAT, STATE_AUTO, + STATE_COOL, STATE_HEAT, SUPPORT_ON_OFF, SUPPORT_TARGET_TEMPERATURE_HIGH, + SUPPORT_TARGET_TEMPERATURE_LOW) from homeassistant.components.water_heater import ( DOMAIN as DOMAIN_WATER_HEATER, SERVICE_SET_TEMPERATURE as SERVICE_SET_TEMPERATURE_WATER_HEATER) from homeassistant.const import ( ATTR_ENTITY_ID, ATTR_SUPPORTED_FEATURES, ATTR_TEMPERATURE, - SERVICE_TURN_OFF, SERVICE_TURN_ON, - STATE_OFF, TEMP_CELSIUS, TEMP_FAHRENHEIT) + SERVICE_TURN_OFF, SERVICE_TURN_ON, STATE_OFF, TEMP_CELSIUS, + TEMP_FAHRENHEIT) from . import TYPES -from .accessories import debounce, HomeAccessory +from .accessories import HomeAccessory, debounce from .const import ( CHAR_COOLING_THRESHOLD_TEMPERATURE, CHAR_CURRENT_HEATING_COOLING, - CHAR_CURRENT_TEMPERATURE, CHAR_TARGET_HEATING_COOLING, - CHAR_HEATING_THRESHOLD_TEMPERATURE, CHAR_TARGET_TEMPERATURE, - CHAR_TEMP_DISPLAY_UNITS, - DEFAULT_MAX_TEMP_WATER_HEATER, DEFAULT_MIN_TEMP_WATER_HEATER, - PROP_MAX_VALUE, PROP_MIN_STEP, PROP_MIN_VALUE, SERV_THERMOSTAT) + CHAR_CURRENT_TEMPERATURE, CHAR_HEATING_THRESHOLD_TEMPERATURE, + CHAR_TARGET_HEATING_COOLING, CHAR_TARGET_TEMPERATURE, + CHAR_TEMP_DISPLAY_UNITS, DEFAULT_MAX_TEMP_WATER_HEATER, + DEFAULT_MIN_TEMP_WATER_HEATER, PROP_MAX_VALUE, PROP_MIN_STEP, + PROP_MIN_VALUE, SERV_THERMOSTAT) from .util import temperature_to_homekit, temperature_to_states _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/homekit/util.py b/homeassistant/components/homekit/util.py index f1327f8b527..2ba5819a202 100644 --- a/homeassistant/components/homekit/util.py +++ b/homeassistant/components/homekit/util.py @@ -1,5 +1,5 @@ """Collection of useful functions for the HomeKit component.""" -from collections import namedtuple, OrderedDict +from collections import OrderedDict, namedtuple import logging import voluptuous as vol diff --git a/homeassistant/components/homekit_controller/__init__.py b/homeassistant/components/homekit_controller/__init__.py index 77d0825ef0b..ffeb9d625be 100644 --- a/homeassistant/components/homekit_controller/__init__.py +++ b/homeassistant/components/homekit_controller/__init__.py @@ -1,9 +1,4 @@ -""" -Support for Homekit device discovery. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/homekit_controller/ -""" +"""Support for Homekit device discovery.""" import json import logging import os @@ -35,7 +30,7 @@ HOMEKIT_ACCESSORY_DISPATCH = { HOMEKIT_IGNORE = [ 'BSB002', 'Home Assistant Bridge', - 'TRADFRI gateway' + 'TRADFRI gateway', ] KNOWN_ACCESSORIES = "{}-accessories".format(DOMAIN) diff --git a/homeassistant/components/homekit_controller/alarm_control_panel.py b/homeassistant/components/homekit_controller/alarm_control_panel.py index 3a2e5170453..5d366b6e27b 100644 --- a/homeassistant/components/homekit_controller/alarm_control_panel.py +++ b/homeassistant/components/homekit_controller/alarm_control_panel.py @@ -1,18 +1,12 @@ -""" -Support for Homekit Alarm Control Panel. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/alarm_control_panel.homekit_controller/ -""" +"""Support for Homekit Alarm Control Panel.""" import logging -from homeassistant.components.homekit_controller import (HomeKitEntity, - KNOWN_ACCESSORIES) from homeassistant.components.alarm_control_panel import AlarmControlPanel +from homeassistant.components.homekit_controller import ( + KNOWN_ACCESSORIES, HomeKitEntity) from homeassistant.const import ( - STATE_ALARM_DISARMED, STATE_ALARM_ARMED_AWAY, STATE_ALARM_ARMED_HOME, - STATE_ALARM_ARMED_NIGHT, STATE_ALARM_TRIGGERED) -from homeassistant.const import ATTR_BATTERY_LEVEL + ATTR_BATTERY_LEVEL, STATE_ALARM_ARMED_AWAY, STATE_ALARM_ARMED_HOME, + STATE_ALARM_ARMED_NIGHT, STATE_ALARM_DISARMED, STATE_ALARM_TRIGGERED) DEPENDENCIES = ['homekit_controller'] @@ -25,7 +19,7 @@ CURRENT_STATE_MAP = { 1: STATE_ALARM_ARMED_AWAY, 2: STATE_ALARM_ARMED_NIGHT, 3: STATE_ALARM_DISARMED, - 4: STATE_ALARM_TRIGGERED + 4: STATE_ALARM_TRIGGERED, } TARGET_STATE_MAP = { diff --git a/homeassistant/components/homekit_controller/binary_sensor.py b/homeassistant/components/homekit_controller/binary_sensor.py index 531297dc911..5d83ce6d984 100644 --- a/homeassistant/components/homekit_controller/binary_sensor.py +++ b/homeassistant/components/homekit_controller/binary_sensor.py @@ -1,14 +1,9 @@ -""" -Support for Homekit motion sensors. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/binary_sensor.homekit_controller/ -""" +"""Support for Homekit motion sensors.""" import logging -from homeassistant.components.homekit_controller import (HomeKitEntity, - KNOWN_ACCESSORIES) from homeassistant.components.binary_sensor import BinarySensorDevice +from homeassistant.components.homekit_controller import ( + KNOWN_ACCESSORIES, HomeKitEntity) DEPENDENCIES = ['homekit_controller'] diff --git a/homeassistant/components/homekit_controller/climate.py b/homeassistant/components/homekit_controller/climate.py index 15378e2b046..5531b266d21 100644 --- a/homeassistant/components/homekit_controller/climate.py +++ b/homeassistant/components/homekit_controller/climate.py @@ -1,17 +1,12 @@ -""" -Support for Homekit climate devices. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/climate.homekit_controller/ -""" +"""Support for Homekit climate devices.""" import logging -from homeassistant.components.homekit_controller import ( - HomeKitEntity, KNOWN_ACCESSORIES) from homeassistant.components.climate import ( - ClimateDevice, STATE_HEAT, STATE_COOL, STATE_IDLE, - SUPPORT_TARGET_TEMPERATURE, SUPPORT_OPERATION_MODE) -from homeassistant.const import TEMP_CELSIUS, STATE_OFF, ATTR_TEMPERATURE + STATE_COOL, STATE_HEAT, STATE_IDLE, SUPPORT_OPERATION_MODE, + SUPPORT_TARGET_TEMPERATURE, ClimateDevice) +from homeassistant.components.homekit_controller import ( + KNOWN_ACCESSORIES, HomeKitEntity) +from homeassistant.const import ATTR_TEMPERATURE, STATE_OFF, TEMP_CELSIUS DEPENDENCIES = ['homekit_controller'] diff --git a/homeassistant/components/homekit_controller/cover.py b/homeassistant/components/homekit_controller/cover.py index c8f087254bb..3951cf577d4 100644 --- a/homeassistant/components/homekit_controller/cover.py +++ b/homeassistant/components/homekit_controller/cover.py @@ -1,17 +1,12 @@ -""" -Support for Homekit Cover. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/cover.homekit_controller/ -""" +"""Support for Homekit covers.""" import logging -from homeassistant.components.homekit_controller import (HomeKitEntity, - KNOWN_ACCESSORIES) from homeassistant.components.cover import ( - CoverDevice, SUPPORT_OPEN, SUPPORT_CLOSE, SUPPORT_SET_POSITION, - SUPPORT_OPEN_TILT, SUPPORT_CLOSE_TILT, SUPPORT_SET_TILT_POSITION, - ATTR_POSITION, ATTR_TILT_POSITION) + ATTR_POSITION, ATTR_TILT_POSITION, SUPPORT_CLOSE, SUPPORT_CLOSE_TILT, + SUPPORT_OPEN, SUPPORT_OPEN_TILT, SUPPORT_SET_POSITION, + SUPPORT_SET_TILT_POSITION, CoverDevice) +from homeassistant.components.homekit_controller import ( + KNOWN_ACCESSORIES, HomeKitEntity) from homeassistant.const import ( STATE_CLOSED, STATE_CLOSING, STATE_OPEN, STATE_OPENING) diff --git a/homeassistant/components/homekit_controller/light.py b/homeassistant/components/homekit_controller/light.py index 74ef8948f45..f39e793c184 100644 --- a/homeassistant/components/homekit_controller/light.py +++ b/homeassistant/components/homekit_controller/light.py @@ -1,15 +1,10 @@ -""" -Support for Homekit lights. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/light.homekit_controller/ -""" +"""Support for Homekit lights.""" import logging from homeassistant.components.homekit_controller import ( - HomeKitEntity, KNOWN_ACCESSORIES) + KNOWN_ACCESSORIES, HomeKitEntity) from homeassistant.components.light import ( - ATTR_BRIGHTNESS, ATTR_HS_COLOR, ATTR_COLOR_TEMP, SUPPORT_BRIGHTNESS, + ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, ATTR_HS_COLOR, SUPPORT_BRIGHTNESS, SUPPORT_COLOR, SUPPORT_COLOR_TEMP, Light) DEPENDENCIES = ['homekit_controller'] diff --git a/homeassistant/components/homekit_controller/lock.py b/homeassistant/components/homekit_controller/lock.py index e27ed444528..635d457198a 100644 --- a/homeassistant/components/homekit_controller/lock.py +++ b/homeassistant/components/homekit_controller/lock.py @@ -1,17 +1,11 @@ -""" -Support for HomeKit Controller locks. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/lock.homekit_controller/ -""" - +"""Support for HomeKit Controller locks.""" import logging -from homeassistant.components.homekit_controller import (HomeKitEntity, - KNOWN_ACCESSORIES) +from homeassistant.components.homekit_controller import ( + KNOWN_ACCESSORIES, HomeKitEntity) from homeassistant.components.lock import LockDevice -from homeassistant.const import (STATE_LOCKED, STATE_UNLOCKED, - ATTR_BATTERY_LEVEL) +from homeassistant.const import ( + ATTR_BATTERY_LEVEL, STATE_LOCKED, STATE_UNLOCKED) DEPENDENCIES = ['homekit_controller'] @@ -28,7 +22,7 @@ CURRENT_STATE_MAP = { TARGET_STATE_MAP = { STATE_UNLOCKED: 0, - STATE_LOCKED: 1 + STATE_LOCKED: 1, } @@ -37,8 +31,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): if discovery_info is None: return accessory = hass.data[KNOWN_ACCESSORIES][discovery_info['serial']] - add_entities([HomeKitLock(accessory, discovery_info)], - True) + add_entities([HomeKitLock(accessory, discovery_info)], True) class HomeKitLock(HomeKitEntity, LockDevice): diff --git a/homeassistant/components/homekit_controller/switch.py b/homeassistant/components/homekit_controller/switch.py index ba4a04022f0..daa4ede6898 100644 --- a/homeassistant/components/homekit_controller/switch.py +++ b/homeassistant/components/homekit_controller/switch.py @@ -1,13 +1,8 @@ -""" -Support for Homekit switches. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/switch.homekit_controller/ -""" +"""Support for Homekit switches.""" import logging -from homeassistant.components.homekit_controller import (HomeKitEntity, - KNOWN_ACCESSORIES) +from homeassistant.components.homekit_controller import ( + KNOWN_ACCESSORIES, HomeKitEntity) from homeassistant.components.switch import SwitchDevice DEPENDENCIES = ['homekit_controller'] diff --git a/homeassistant/components/homematic/__init__.py b/homeassistant/components/homematic/__init__.py index 3439a23adb3..2918f8e03f9 100644 --- a/homeassistant/components/homematic/__init__.py +++ b/homeassistant/components/homematic/__init__.py @@ -1,9 +1,4 @@ -""" -Support for HomeMatic devices. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/homematic/ -""" +"""Support for HomeMatic devices.""" from datetime import timedelta from functools import partial import logging @@ -13,7 +8,7 @@ import voluptuous as vol from homeassistant.const import ( ATTR_ENTITY_ID, ATTR_NAME, CONF_HOST, CONF_HOSTS, CONF_PASSWORD, - CONF_PLATFORM, CONF_USERNAME, CONF_SSL, CONF_VERIFY_SSL, + CONF_PLATFORM, CONF_SSL, CONF_USERNAME, CONF_VERIFY_SSL, EVENT_HOMEASSISTANT_STOP, STATE_UNKNOWN) from homeassistant.helpers import discovery import homeassistant.helpers.config_validation as cv diff --git a/homeassistant/components/homematic/binary_sensor.py b/homeassistant/components/homematic/binary_sensor.py index 9cfe4bbd6a7..1704411c9cc 100644 --- a/homeassistant/components/homematic/binary_sensor.py +++ b/homeassistant/components/homematic/binary_sensor.py @@ -1,9 +1,4 @@ -""" -Support for HomeMatic binary sensors. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/binary_sensor.homematic/ -""" +"""Support for HomeMatic binary sensors.""" import logging from homeassistant.components.binary_sensor import BinarySensorDevice diff --git a/homeassistant/components/homematic/climate.py b/homeassistant/components/homematic/climate.py index 5233501ec30..4fc4b190808 100644 --- a/homeassistant/components/homematic/climate.py +++ b/homeassistant/components/homematic/climate.py @@ -1,9 +1,4 @@ -""" -Support for Homematic thermostats. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/climate.homematic/ -""" +"""Support for Homematic thermostats.""" import logging from homeassistant.components.climate import ( diff --git a/homeassistant/components/homematic/cover.py b/homeassistant/components/homematic/cover.py index 93574321203..79a1afe9a0e 100644 --- a/homeassistant/components/homematic/cover.py +++ b/homeassistant/components/homematic/cover.py @@ -1,9 +1,4 @@ -""" -The HomeMatic cover platform. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/cover.homematic/ -""" +"""Support for HomeMatic covers.""" import logging from homeassistant.components.cover import ( diff --git a/homeassistant/components/homematic/light.py b/homeassistant/components/homematic/light.py index de11c96f8b7..21b875742c4 100644 --- a/homeassistant/components/homematic/light.py +++ b/homeassistant/components/homematic/light.py @@ -1,15 +1,10 @@ -""" -Support for Homematic lights. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/light.homematic/ -""" +"""Support for Homematic lights.""" import logging from homeassistant.components.homematic import ATTR_DISCOVER_DEVICES, HMDevice from homeassistant.components.light import ( - ATTR_BRIGHTNESS, SUPPORT_BRIGHTNESS, ATTR_HS_COLOR, SUPPORT_COLOR, - ATTR_EFFECT, SUPPORT_EFFECT, Light) + ATTR_BRIGHTNESS, ATTR_EFFECT, ATTR_HS_COLOR, SUPPORT_BRIGHTNESS, + SUPPORT_COLOR, SUPPORT_EFFECT, Light) _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/homematic/lock.py b/homeassistant/components/homematic/lock.py index 9d9f2a28b4f..5d857617fde 100644 --- a/homeassistant/components/homematic/lock.py +++ b/homeassistant/components/homematic/lock.py @@ -1,9 +1,4 @@ -""" -Support for Homematic lock. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/lock.homematic/ -""" +"""Support for Homematic locks.""" import logging from homeassistant.components.homematic import ATTR_DISCOVER_DEVICES, HMDevice diff --git a/homeassistant/components/homematic/notify.py b/homeassistant/components/homematic/notify.py index 2897123c690..e6ef1a60e28 100644 --- a/homeassistant/components/homematic/notify.py +++ b/homeassistant/components/homematic/notify.py @@ -8,12 +8,12 @@ import logging import voluptuous as vol -from homeassistant.components.notify import ( - BaseNotificationService, PLATFORM_SCHEMA, ATTR_DATA) -import homeassistant.helpers.config_validation as cv from homeassistant.components.homematic import ( - DOMAIN, SERVICE_SET_DEVICE_VALUE, ATTR_ADDRESS, ATTR_CHANNEL, ATTR_PARAM, - ATTR_VALUE, ATTR_INTERFACE) + ATTR_ADDRESS, ATTR_CHANNEL, ATTR_INTERFACE, ATTR_PARAM, ATTR_VALUE, DOMAIN, + SERVICE_SET_DEVICE_VALUE) +from homeassistant.components.notify import ( + ATTR_DATA, PLATFORM_SCHEMA, BaseNotificationService) +import homeassistant.helpers.config_validation as cv import homeassistant.helpers.template as template_helper _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/homematic/sensor.py b/homeassistant/components/homematic/sensor.py index 84cf19652a1..c4d97dca3fe 100644 --- a/homeassistant/components/homematic/sensor.py +++ b/homeassistant/components/homematic/sensor.py @@ -1,9 +1,4 @@ -""" -The HomeMatic sensor platform. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/sensor.homematic/ -""" +"""Support for HomeMatic sensors.""" import logging from homeassistant.components.homematic import ATTR_DISCOVER_DEVICES, HMDevice @@ -14,26 +9,14 @@ _LOGGER = logging.getLogger(__name__) DEPENDENCIES = ['homematic'] HM_STATE_HA_CAST = { - 'RotaryHandleSensor': {0: 'closed', - 1: 'tilted', - 2: 'open'}, - 'RotaryHandleSensorIP': {0: 'closed', - 1: 'tilted', - 2: 'open'}, - 'WaterSensor': {0: 'dry', - 1: 'wet', - 2: 'water'}, - 'CO2Sensor': {0: 'normal', - 1: 'added', - 2: 'strong'}, - 'IPSmoke': {0: 'off', - 1: 'primary', - 2: 'intrusion', - 3: 'secondary'}, - 'RFSiren': {0: 'disarmed', - 1: 'extsens_armed', - 2: 'allsens_armed', - 3: 'alarm_blocked'}, + 'RotaryHandleSensor': {0: 'closed', 1: 'tilted', 2: 'open'}, + 'RotaryHandleSensorIP': {0: 'closed', 1: 'tilted', 2: 'open'}, + 'WaterSensor': {0: 'dry', 1: 'wet', 2: 'water'}, + 'CO2Sensor': {0: 'normal', 1: 'added', 2: 'strong'}, + 'IPSmoke': {0: 'off', 1: 'primary', 2: 'intrusion', 3: 'secondary'}, + 'RFSiren': { + 0: 'disarmed', 1: 'extsens_armed', 2: 'allsens_armed', + 3: 'alarm_blocked'}, } HM_UNIT_HA_CAST = { diff --git a/homeassistant/components/homematic/switch.py b/homeassistant/components/homematic/switch.py index b5921819ea4..cfcd26891e0 100644 --- a/homeassistant/components/homematic/switch.py +++ b/homeassistant/components/homematic/switch.py @@ -1,9 +1,4 @@ -""" -Support for HomeMatic switches. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/switch.homematic/ -""" +"""Support for HomeMatic switches.""" import logging from homeassistant.components.homematic import ATTR_DISCOVER_DEVICES, HMDevice diff --git a/homeassistant/components/homematicip_cloud/__init__.py b/homeassistant/components/homematicip_cloud/__init__.py index f048a50d1d0..b45ac291bfc 100644 --- a/homeassistant/components/homematicip_cloud/__init__.py +++ b/homeassistant/components/homematicip_cloud/__init__.py @@ -1,9 +1,4 @@ -""" -Support for HomematicIP Cloud components. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/homematicip_cloud/ -""" +"""Support for HomematicIP Cloud devices.""" import logging import voluptuous as vol diff --git a/homeassistant/components/homematicip_cloud/alarm_control_panel.py b/homeassistant/components/homematicip_cloud/alarm_control_panel.py index 3fdfc768c52..dc249775e3d 100644 --- a/homeassistant/components/homematicip_cloud/alarm_control_panel.py +++ b/homeassistant/components/homematicip_cloud/alarm_control_panel.py @@ -1,16 +1,9 @@ -""" -Support for HomematicIP Cloud alarm control panel. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/alarm_control_panel.homematicip_cloud/ -""" - +"""Support for HomematicIP Cloud alarm control panel.""" import logging from homeassistant.components.alarm_control_panel import AlarmControlPanel from homeassistant.components.homematicip_cloud import ( - HMIPC_HAPID, HomematicipGenericDevice) -from homeassistant.components.homematicip_cloud import DOMAIN as HMIPC_DOMAIN + DOMAIN as HMIPC_DOMAIN, HMIPC_HAPID, HomematicipGenericDevice) from homeassistant.const import ( STATE_ALARM_ARMED_AWAY, STATE_ALARM_ARMED_HOME, STATE_ALARM_DISARMED, STATE_ALARM_TRIGGERED) diff --git a/homeassistant/components/homematicip_cloud/binary_sensor.py b/homeassistant/components/homematicip_cloud/binary_sensor.py index 910666f93cb..9ed9d29ad39 100644 --- a/homeassistant/components/homematicip_cloud/binary_sensor.py +++ b/homeassistant/components/homematicip_cloud/binary_sensor.py @@ -1,15 +1,9 @@ -""" -Support for HomematicIP Cloud binary sensor. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/binary_sensor.homematicip_cloud/ -""" +"""Support for HomematicIP Cloud binary sensor.""" import logging from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.homematicip_cloud import ( - HMIPC_HAPID, HomematicipGenericDevice) -from homeassistant.components.homematicip_cloud import DOMAIN as HMIPC_DOMAIN + DOMAIN as HMIPC_DOMAIN, HMIPC_HAPID, HomematicipGenericDevice) DEPENDENCIES = ['homematicip_cloud'] diff --git a/homeassistant/components/homematicip_cloud/climate.py b/homeassistant/components/homematicip_cloud/climate.py index 966cd95ade1..2dff48774bb 100644 --- a/homeassistant/components/homematicip_cloud/climate.py +++ b/homeassistant/components/homematicip_cloud/climate.py @@ -1,17 +1,11 @@ -""" -Support for HomematicIP Cloud climate devices. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/climate.homematicip_cloud/ -""" +"""Support for HomematicIP Cloud climate devices.""" import logging from homeassistant.components.climate import ( ATTR_TEMPERATURE, STATE_AUTO, STATE_MANUAL, SUPPORT_TARGET_TEMPERATURE, ClimateDevice) from homeassistant.components.homematicip_cloud import ( - HMIPC_HAPID, HomematicipGenericDevice) -from homeassistant.components.homematicip_cloud import DOMAIN as HMIPC_DOMAIN + DOMAIN as HMIPC_DOMAIN, HMIPC_HAPID, HomematicipGenericDevice) from homeassistant.const import TEMP_CELSIUS _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/homematicip_cloud/config_flow.py b/homeassistant/components/homematicip_cloud/config_flow.py index ea251a3bf87..458186bcce1 100644 --- a/homeassistant/components/homematicip_cloud/config_flow.py +++ b/homeassistant/components/homematicip_cloud/config_flow.py @@ -4,9 +4,9 @@ import voluptuous as vol from homeassistant import config_entries from homeassistant.core import callback -from .const import DOMAIN as HMIPC_DOMAIN -from .const import HMIPC_AUTHTOKEN, HMIPC_HAPID, HMIPC_NAME, HMIPC_PIN -from .const import _LOGGER +from .const import ( + _LOGGER, DOMAIN as HMIPC_DOMAIN, HMIPC_AUTHTOKEN, HMIPC_HAPID, HMIPC_NAME, + HMIPC_PIN) from .hap import HomematicipAuth diff --git a/homeassistant/components/homematicip_cloud/cover.py b/homeassistant/components/homematicip_cloud/cover.py index 80fc8f7b430..7675929d40f 100644 --- a/homeassistant/components/homematicip_cloud/cover.py +++ b/homeassistant/components/homematicip_cloud/cover.py @@ -1,15 +1,9 @@ -""" -Support for HomematicIP Cloud cover devices. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/cover.homematicip_cloud/ -""" +"""Support for HomematicIP Cloud cover devices.""" import logging -from homeassistant.components.cover import ( - ATTR_POSITION, CoverDevice) +from homeassistant.components.cover import ATTR_POSITION, CoverDevice from homeassistant.components.homematicip_cloud import ( - HMIPC_HAPID, HomematicipGenericDevice, DOMAIN as HMIPC_DOMAIN) + DOMAIN as HMIPC_DOMAIN, HMIPC_HAPID, HomematicipGenericDevice) DEPENDENCIES = ['homematicip_cloud'] diff --git a/homeassistant/components/homematicip_cloud/hap.py b/homeassistant/components/homematicip_cloud/hap.py index 9af6669652d..4acace4a8b1 100644 --- a/homeassistant/components/homematicip_cloud/hap.py +++ b/homeassistant/components/homematicip_cloud/hap.py @@ -2,8 +2,8 @@ import asyncio import logging -from homeassistant.exceptions import ConfigEntryNotReady from homeassistant.core import callback +from homeassistant.exceptions import ConfigEntryNotReady from homeassistant.helpers.aiohttp_client import async_get_clientsession from .const import ( diff --git a/homeassistant/components/homematicip_cloud/light.py b/homeassistant/components/homematicip_cloud/light.py index 5d604d2c665..73c607683ba 100644 --- a/homeassistant/components/homematicip_cloud/light.py +++ b/homeassistant/components/homematicip_cloud/light.py @@ -1,9 +1,4 @@ -""" -Support for HomematicIP Cloud lights. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/light.homematicip_cloud/ -""" +"""Support for HomematicIP Cloud lights.""" import logging from homeassistant.components.homematicip_cloud import ( diff --git a/homeassistant/components/homematicip_cloud/sensor.py b/homeassistant/components/homematicip_cloud/sensor.py index 911c00e45bc..b753a4d1aa5 100644 --- a/homeassistant/components/homematicip_cloud/sensor.py +++ b/homeassistant/components/homematicip_cloud/sensor.py @@ -1,16 +1,11 @@ -""" -Support for HomematicIP Cloud sensors. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/sensor.homematicip_cloud/ -""" +"""Support for HomematicIP Cloud sensors.""" import logging from homeassistant.components.homematicip_cloud import ( DOMAIN as HMIPC_DOMAIN, HMIPC_HAPID, HomematicipGenericDevice) from homeassistant.const import ( - DEVICE_CLASS_HUMIDITY, DEVICE_CLASS_ILLUMINANCE, - DEVICE_CLASS_TEMPERATURE, TEMP_CELSIUS) + DEVICE_CLASS_HUMIDITY, DEVICE_CLASS_ILLUMINANCE, DEVICE_CLASS_TEMPERATURE, + TEMP_CELSIUS) _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/homematicip_cloud/switch.py b/homeassistant/components/homematicip_cloud/switch.py index a1b3e1789bf..ad378074621 100644 --- a/homeassistant/components/homematicip_cloud/switch.py +++ b/homeassistant/components/homematicip_cloud/switch.py @@ -1,14 +1,8 @@ -""" -Support for HomematicIP Cloud switch. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/switch.homematicip_cloud/ -""" +"""Support for HomematicIP Cloud switches.""" import logging from homeassistant.components.homematicip_cloud import ( - HMIPC_HAPID, HomematicipGenericDevice) -from homeassistant.components.homematicip_cloud import DOMAIN as HMIPC_DOMAIN + DOMAIN as HMIPC_DOMAIN, HMIPC_HAPID, HomematicipGenericDevice) from homeassistant.components.switch import SwitchDevice DEPENDENCIES = ['homematicip_cloud'] diff --git a/homeassistant/components/homeworks/__init__.py b/homeassistant/components/homeworks/__init__.py index b0510cfe9b5..d0769ed25e6 100644 --- a/homeassistant/components/homeworks/__init__.py +++ b/homeassistant/components/homeworks/__init__.py @@ -1,19 +1,15 @@ -"""Component for interfacing to Lutron Homeworks Series 4 and 8 systems. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/homeworks/ -""" +"""Support for Lutron Homeworks Series 4 and 8 systems.""" import logging import voluptuous as vol -from homeassistant.core import callback from homeassistant.const import ( CONF_HOST, CONF_ID, CONF_NAME, CONF_PORT, EVENT_HOMEASSISTANT_STOP) +from homeassistant.core import callback import homeassistant.helpers.config_validation as cv from homeassistant.helpers.discovery import load_platform from homeassistant.helpers.dispatcher import ( - dispatcher_send, async_dispatcher_connect) + async_dispatcher_connect, dispatcher_send) from homeassistant.util import slugify REQUIREMENTS = ['pyhomeworks==0.0.6'] @@ -39,7 +35,7 @@ CV_FADE_RATE = vol.All(vol.Coerce(float), vol.Range(min=0, max=20)) DIMMER_SCHEMA = vol.Schema({ vol.Required(CONF_ADDR): cv.string, vol.Required(CONF_NAME): cv.string, - vol.Optional(CONF_RATE, default=FADE_RATE): CV_FADE_RATE + vol.Optional(CONF_RATE, default=FADE_RATE): CV_FADE_RATE, }) KEYPAD_SCHEMA = vol.Schema({ @@ -52,8 +48,8 @@ CONFIG_SCHEMA = vol.Schema({ vol.Required(CONF_HOST): cv.string, vol.Required(CONF_PORT): cv.port, vol.Required(CONF_DIMMERS): vol.All(cv.ensure_list, [DIMMER_SCHEMA]), - vol.Optional(CONF_KEYPADS, default=[]): vol.All(cv.ensure_list, - [KEYPAD_SCHEMA]), + vol.Optional(CONF_KEYPADS, default=[]): + vol.All(cv.ensure_list, [KEYPAD_SCHEMA]), }), }, extra=vol.ALLOW_EXTRA) diff --git a/homeassistant/components/homeworks/light.py b/homeassistant/components/homeworks/light.py index 3ba5f805c52..7f5d7f6aab7 100644 --- a/homeassistant/components/homeworks/light.py +++ b/homeassistant/components/homeworks/light.py @@ -1,19 +1,14 @@ -"""Component for interfacing to Lutron Homeworks lights. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/light.homeworks/ -""" +"""Support for Lutron Homeworks lights.""" import logging from homeassistant.components.homeworks import ( - HomeworksDevice, HOMEWORKS_CONTROLLER, ENTITY_SIGNAL, - CONF_DIMMERS, CONF_ADDR, CONF_RATE) + CONF_ADDR, CONF_DIMMERS, CONF_RATE, ENTITY_SIGNAL, HOMEWORKS_CONTROLLER, + HomeworksDevice) from homeassistant.components.light import ( ATTR_BRIGHTNESS, SUPPORT_BRIGHTNESS, Light) from homeassistant.const import CONF_NAME from homeassistant.core import callback -from homeassistant.helpers.dispatcher import ( - async_dispatcher_connect) +from homeassistant.helpers.dispatcher import async_dispatcher_connect DEPENDENCIES = ['homeworks'] diff --git a/homeassistant/components/http/__init__.py b/homeassistant/components/http/__init__.py index 02b9affefd4..10d6ae5148b 100644 --- a/homeassistant/components/http/__init__.py +++ b/homeassistant/components/http/__init__.py @@ -1,9 +1,4 @@ -""" -This module provides WSGI application to serve the Home Assistant API. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/http/ -""" +"""Support to serve the Home Assistant API as WSGI application.""" from ipaddress import ip_network import logging import os @@ -18,17 +13,16 @@ from homeassistant.const import ( EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP, SERVER_PORT) import homeassistant.helpers.config_validation as cv import homeassistant.util as hass_util -from homeassistant.util.logging import HideSensitiveDataFilter from homeassistant.util import ssl as ssl_util +from homeassistant.util.logging import HideSensitiveDataFilter +# Import as alias from .auth import setup_auth from .ban import setup_bans +from .const import KEY_AUTHENTICATED, KEY_REAL_IP # noqa from .cors import setup_cors from .real_ip import setup_real_ip from .static import CachingFileResponse, CachingStaticResource - -# Import as alias -from .const import KEY_AUTHENTICATED, KEY_REAL_IP # noqa from .view import HomeAssistantView # noqa REQUIREMENTS = ['aiohttp_cors==0.7.0'] diff --git a/homeassistant/components/http/auth.py b/homeassistant/components/http/auth.py index a515fcd198e..312fc2164c3 100644 --- a/homeassistant/components/http/auth.py +++ b/homeassistant/components/http/auth.py @@ -1,5 +1,4 @@ """Authentication for HTTP component.""" - import base64 import hmac import logging @@ -8,20 +7,20 @@ from aiohttp import hdrs from aiohttp.web import middleware import jwt -from homeassistant.core import callback -from homeassistant.const import HTTP_HEADER_HA_AUTH from homeassistant.auth.providers import legacy_api_password from homeassistant.auth.util import generate_secret +from homeassistant.const import HTTP_HEADER_HA_AUTH +from homeassistant.core import callback from homeassistant.util import dt as dt_util from .const import KEY_AUTHENTICATED, KEY_REAL_IP +_LOGGER = logging.getLogger(__name__) + DATA_API_PASSWORD = 'api_password' DATA_SIGN_SECRET = 'http.auth.sign_secret' SIGN_QUERY_PARAM = 'authSig' -_LOGGER = logging.getLogger(__name__) - @callback def async_sign_path(hass, refresh_token_id, path, expiration): diff --git a/homeassistant/components/http/ban.py b/homeassistant/components/http/ban.py index 0d748c91c66..92c41157a33 100644 --- a/homeassistant/components/http/ban.py +++ b/homeassistant/components/http/ban.py @@ -9,11 +9,12 @@ from aiohttp.web import middleware from aiohttp.web_exceptions import HTTPForbidden, HTTPUnauthorized import voluptuous as vol -from homeassistant.core import callback, HomeAssistant from homeassistant.config import load_yaml_config_file +from homeassistant.core import HomeAssistant, callback from homeassistant.exceptions import HomeAssistantError import homeassistant.helpers.config_validation as cv from homeassistant.util.yaml import dump + from .const import KEY_REAL_IP _LOGGER = logging.getLogger(__name__) @@ -26,7 +27,7 @@ NOTIFICATION_ID_BAN = 'ip-ban' NOTIFICATION_ID_LOGIN = 'http-login' IP_BANS_FILE = 'ip_bans.yaml' -ATTR_BANNED_AT = "banned_at" +ATTR_BANNED_AT = 'banned_at' SCHEMA_IP_BAN_ENTRY = vol.Schema({ vol.Optional('banned_at'): vol.Any(None, cv.datetime) @@ -52,7 +53,7 @@ def setup_bans(hass, app, login_threshold): async def ban_middleware(request, handler): """IP Ban middleware.""" if KEY_BANNED_IPS not in request.app: - _LOGGER.error('IP Ban middleware loaded but banned IPs not loaded') + _LOGGER.error("IP Ban middleware loaded but banned IPs not loaded") return await handler(request) # Verify if IP is not banned diff --git a/homeassistant/components/http/cors.py b/homeassistant/components/http/cors.py index 5698c6048e3..6da3b0e51d7 100644 --- a/homeassistant/components/http/cors.py +++ b/homeassistant/components/http/cors.py @@ -1,15 +1,10 @@ """Provide CORS support for the HTTP component.""" - - -from aiohttp.hdrs import ACCEPT, ORIGIN, CONTENT_TYPE +from aiohttp.hdrs import ACCEPT, CONTENT_TYPE, ORIGIN from homeassistant.const import ( - HTTP_HEADER_X_REQUESTED_WITH, HTTP_HEADER_HA_AUTH) - - + HTTP_HEADER_HA_AUTH, HTTP_HEADER_X_REQUESTED_WITH) from homeassistant.core import callback - ALLOWED_CORS_HEADERS = [ ORIGIN, ACCEPT, HTTP_HEADER_X_REQUESTED_WITH, CONTENT_TYPE, HTTP_HEADER_HA_AUTH] diff --git a/homeassistant/components/http/data_validator.py b/homeassistant/components/http/data_validator.py index 8fc7cd8e658..98686e5cabd 100644 --- a/homeassistant/components/http/data_validator.py +++ b/homeassistant/components/http/data_validator.py @@ -1,5 +1,4 @@ """Decorator for view methods to help with data validation.""" - from functools import wraps import logging diff --git a/homeassistant/components/http/real_ip.py b/homeassistant/components/http/real_ip.py index 27a8550ab8c..9bbf30bd9d1 100644 --- a/homeassistant/components/http/real_ip.py +++ b/homeassistant/components/http/real_ip.py @@ -1,9 +1,8 @@ """Middleware to fetch real IP.""" - from ipaddress import ip_address -from aiohttp.web import middleware from aiohttp.hdrs import X_FORWARDED_FOR +from aiohttp.web import middleware from homeassistant.core import callback diff --git a/homeassistant/components/http/view.py b/homeassistant/components/http/view.py index beb5c647266..9662f3e6c23 100644 --- a/homeassistant/components/http/view.py +++ b/homeassistant/components/http/view.py @@ -1,27 +1,21 @@ -""" -This module provides WSGI application to serve the Home Assistant API. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/http/ -""" +"""Support for views.""" import asyncio import json import logging from aiohttp import web from aiohttp.web_exceptions import ( - HTTPUnauthorized, HTTPInternalServerError, HTTPBadRequest) + HTTPBadRequest, HTTPInternalServerError, HTTPUnauthorized) import voluptuous as vol -from homeassistant.components.http.ban import process_success_login -from homeassistant.core import Context, is_callback -from homeassistant.const import CONTENT_TYPE_JSON from homeassistant import exceptions +from homeassistant.components.http.ban import process_success_login +from homeassistant.const import CONTENT_TYPE_JSON +from homeassistant.core import Context, is_callback from homeassistant.helpers.json import JSONEncoder from .const import KEY_AUTHENTICATED, KEY_REAL_IP - _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/huawei_lte/__init__.py b/homeassistant/components/huawei_lte/__init__.py index 9d223df3344..2ff21c4d5a7 100644 --- a/homeassistant/components/huawei_lte/__init__.py +++ b/homeassistant/components/huawei_lte/__init__.py @@ -1,9 +1,4 @@ -""" -Support for Huawei LTE routers. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/huawei_lte/ -""" +"""Support for Huawei LTE routers.""" from datetime import timedelta from functools import reduce import logging @@ -18,7 +13,6 @@ from homeassistant.const import ( from homeassistant.helpers import config_validation as cv from homeassistant.util import Throttle - _LOGGER = logging.getLogger(__name__) # dicttoxml (used by huawei-lte-api) has uselessly verbose INFO level. diff --git a/homeassistant/components/huawei_lte/device_tracker.py b/homeassistant/components/huawei_lte/device_tracker.py index d30a413898f..69bf42fb3fe 100644 --- a/homeassistant/components/huawei_lte/device_tracker.py +++ b/homeassistant/components/huawei_lte/device_tracker.py @@ -1,9 +1,4 @@ -""" -Support for Huawei LTE routers. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/device_tracker.huawei_lte/ -""" +"""Support for device tracking of Huawei LTE routers.""" from typing import Any, Dict, List, Optional import attr @@ -16,7 +11,6 @@ from homeassistant.components.device_tracker import ( from homeassistant.const import CONF_URL from ..huawei_lte import DATA_KEY, RouterData - DEPENDENCIES = ['huawei_lte'] PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ diff --git a/homeassistant/components/huawei_lte/notify.py b/homeassistant/components/huawei_lte/notify.py index a406a7ec2d8..5e20a774c25 100644 --- a/homeassistant/components/huawei_lte/notify.py +++ b/homeassistant/components/huawei_lte/notify.py @@ -1,9 +1,4 @@ -"""Huawei LTE router platform for notify component. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/notify.huawei_lte/ -""" - +"""Support for Huawei LTE router notifications.""" import logging import voluptuous as vol @@ -16,7 +11,6 @@ import homeassistant.helpers.config_validation as cv from ..huawei_lte import DATA_KEY - DEPENDENCIES = ['huawei_lte'] _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/huawei_lte/sensor.py b/homeassistant/components/huawei_lte/sensor.py index ae376045544..42ad4b52f8d 100644 --- a/homeassistant/components/huawei_lte/sensor.py +++ b/homeassistant/components/huawei_lte/sensor.py @@ -1,9 +1,4 @@ -"""Huawei LTE sensors. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/sensor.huawei_lte/ -""" - +"""Support for Huawei LTE sensors.""" import logging import re @@ -19,7 +14,6 @@ import homeassistant.helpers.config_validation as cv from ..huawei_lte import DATA_KEY, RouterData - _LOGGER = logging.getLogger(__name__) DEPENDENCIES = ['huawei_lte'] @@ -118,8 +112,8 @@ def setup_platform( sensors = [] for path in config.get(CONF_MONITORED_CONDITIONS): data.subscribe(path) - sensors.append(HuaweiLteSensor( - data, path, SENSOR_META.get(path, {}))) + sensors.append(HuaweiLteSensor(data, path, SENSOR_META.get(path, {}))) + add_entities(sensors, True) diff --git a/homeassistant/components/hue/__init__.py b/homeassistant/components/hue/__init__.py index 7618e702d04..e5f40e3ca29 100644 --- a/homeassistant/components/hue/__init__.py +++ b/homeassistant/components/hue/__init__.py @@ -1,9 +1,4 @@ -""" -This component provides basic support for the Philips Hue system. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/hue/ -""" +"""Support for the Philips Hue system.""" import ipaddress import logging diff --git a/homeassistant/components/hue/bridge.py b/homeassistant/components/hue/bridge.py index 6e3d818db68..9df5b0a6730 100644 --- a/homeassistant/components/hue/bridge.py +++ b/homeassistant/components/hue/bridge.py @@ -46,7 +46,7 @@ class HueBridge: self.api = await get_bridge( hass, host, self.config_entry.data['username']) except AuthenticationRequired: - # usernames can become invalid if hub is reset or user removed. + # Usernames can become invalid if hub is reset or user removed. # We are going to fail the config entry setup and initiate a new # linking procedure. When linking succeeds, it will remove the # old config entry. diff --git a/homeassistant/components/hue/light.py b/homeassistant/components/hue/light.py index 51e50f629b5..7518a5a381f 100644 --- a/homeassistant/components/hue/light.py +++ b/homeassistant/components/hue/light.py @@ -1,9 +1,4 @@ -""" -This component provides light support for the Philips Hue system. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/light.hue/ -""" +"""Support for the Philips Hue lights.""" import asyncio from datetime import timedelta import logging @@ -37,8 +32,8 @@ SUPPORT_HUE = { 'Color light': SUPPORT_HUE_COLOR, 'Dimmable light': SUPPORT_HUE_DIMMABLE, 'On/Off plug-in unit': SUPPORT_HUE_ON_OFF, - 'Color temperature light': SUPPORT_HUE_COLOR_TEMP - } + 'Color temperature light': SUPPORT_HUE_COLOR_TEMP, +} ATTR_IS_HUE_GROUP = 'is_hue_group' GAMUT_TYPE_UNAVAILABLE = 'None' @@ -49,8 +44,8 @@ GAMUT_TYPE_UNAVAILABLE = 'None' GROUP_MIN_API_VERSION = (1, 13, 0) -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): """Old way of setting up Hue lights. Can only be called when a user accidentally mentions hue platform in their diff --git a/homeassistant/components/idteck_prox/__init__.py b/homeassistant/components/idteck_prox/__init__.py index 8ec6f49b95d..3de7aa7cc8c 100644 --- a/homeassistant/components/idteck_prox/__init__.py +++ b/homeassistant/components/idteck_prox/__init__.py @@ -37,7 +37,7 @@ def setup(hass, config): reader.connect() hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP, reader.stop) except OSError as error: - _LOGGER.error('Error creating "%s". %s', name, error) + _LOGGER.error("Error creating %s. %s", name, error) return False return True diff --git a/homeassistant/components/ifttt/__init__.py b/homeassistant/components/ifttt/__init__.py index 7dee93b2260..0a06947b00f 100644 --- a/homeassistant/components/ifttt/__init__.py +++ b/homeassistant/components/ifttt/__init__.py @@ -5,9 +5,9 @@ import logging import requests import voluptuous as vol -import homeassistant.helpers.config_validation as cv from homeassistant.const import CONF_WEBHOOK_ID from homeassistant.helpers import config_entry_flow +import homeassistant.helpers.config_validation as cv REQUIREMENTS = ['pyfttt==0.3'] DEPENDENCIES = ['webhook'] diff --git a/homeassistant/components/ifttt/alarm_control_panel.py b/homeassistant/components/ifttt/alarm_control_panel.py index bbb9a02c8a1..98a176b1e82 100644 --- a/homeassistant/components/ifttt/alarm_control_panel.py +++ b/homeassistant/components/ifttt/alarm_control_panel.py @@ -10,9 +10,9 @@ from homeassistant.components.alarm_control_panel import ( from homeassistant.components.ifttt import ( ATTR_EVENT, DOMAIN as IFTTT_DOMAIN, SERVICE_TRIGGER) from homeassistant.const import ( - ATTR_ENTITY_ID, ATTR_STATE, CONF_NAME, CONF_CODE, - CONF_OPTIMISTIC, STATE_ALARM_DISARMED, STATE_ALARM_ARMED_NIGHT, - STATE_ALARM_ARMED_HOME, STATE_ALARM_ARMED_AWAY) + ATTR_ENTITY_ID, ATTR_STATE, CONF_CODE, CONF_NAME, CONF_OPTIMISTIC, + STATE_ALARM_ARMED_AWAY, STATE_ALARM_ARMED_HOME, STATE_ALARM_ARMED_NIGHT, + STATE_ALARM_DISARMED) import homeassistant.helpers.config_validation as cv DEPENDENCIES = ['ifttt'] diff --git a/homeassistant/components/ihc/__init__.py b/homeassistant/components/ihc/__init__.py index 823f9d2657d..3365942df45 100644 --- a/homeassistant/components/ihc/__init__.py +++ b/homeassistant/components/ihc/__init__.py @@ -1,9 +1,4 @@ -""" -Support for IHC devices. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/ihc/ -""" +"""Support for IHC devices.""" import logging import os.path @@ -224,7 +219,7 @@ def autosetup_ihc_products(hass: HomeAssistantType, config, ihc_controller, return False project = ElementTree.fromstring(project_xml) - # if an auto setup file exist in the configuration it will override + # If an auto setup file exist in the configuration it will override yaml_path = hass.config.path(AUTO_SETUP_YAML) if not os.path.isfile(yaml_path): yaml_path = os.path.join(os.path.dirname(__file__), AUTO_SETUP_YAML) diff --git a/homeassistant/components/ihc/binary_sensor.py b/homeassistant/components/ihc/binary_sensor.py index fb5b4c0bfc2..7e3371a834c 100644 --- a/homeassistant/components/ihc/binary_sensor.py +++ b/homeassistant/components/ihc/binary_sensor.py @@ -1,17 +1,9 @@ -"""IHC binary sensor platform. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/binary_sensor.ihc/ -""" -from homeassistant.components.binary_sensor import ( - BinarySensorDevice) -from homeassistant.components.ihc import ( - IHC_DATA, IHC_CONTROLLER, IHC_INFO) -from homeassistant.components.ihc.const import ( - CONF_INVERTING) +"""Support for IHC binary sensors.""" +from homeassistant.components.binary_sensor import BinarySensorDevice +from homeassistant.components.ihc import IHC_CONTROLLER, IHC_DATA, IHC_INFO +from homeassistant.components.ihc.const import CONF_INVERTING from homeassistant.components.ihc.ihcdevice import IHCDevice -from homeassistant.const import ( - CONF_TYPE) +from homeassistant.const import CONF_TYPE DEPENDENCIES = ['ihc'] @@ -31,10 +23,9 @@ def setup_platform(hass, config, add_entities, discovery_info=None): info = hass.data[ihc_key][IHC_INFO] ihc_controller = hass.data[ihc_key][IHC_CONTROLLER] - sensor = IHCBinarySensor(ihc_controller, name, ihc_id, info, - product_cfg.get(CONF_TYPE), - product_cfg[CONF_INVERTING], - product) + sensor = IHCBinarySensor( + ihc_controller, name, ihc_id, info, product_cfg.get(CONF_TYPE), + product_cfg[CONF_INVERTING], product) devices.append(sensor) add_entities(devices) diff --git a/homeassistant/components/ihc/light.py b/homeassistant/components/ihc/light.py index f80c9b2fd6f..2590ea83222 100644 --- a/homeassistant/components/ihc/light.py +++ b/homeassistant/components/ihc/light.py @@ -1,14 +1,8 @@ -"""IHC light platform. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/light.ihc/ -""" +"""Support for IHC lights.""" import logging -from homeassistant.components.ihc import ( - IHC_DATA, IHC_CONTROLLER, IHC_INFO) -from homeassistant.components.ihc.const import ( - CONF_DIMMABLE) +from homeassistant.components.ihc import IHC_CONTROLLER, IHC_DATA, IHC_INFO +from homeassistant.components.ihc.const import CONF_DIMMABLE from homeassistant.components.ihc.ihcdevice import IHCDevice from homeassistant.components.light import ( ATTR_BRIGHTNESS, SUPPORT_BRIGHTNESS, Light) diff --git a/homeassistant/components/ihc/sensor.py b/homeassistant/components/ihc/sensor.py index f5a45599bb7..930ac221629 100644 --- a/homeassistant/components/ihc/sensor.py +++ b/homeassistant/components/ihc/sensor.py @@ -1,13 +1,7 @@ -"""IHC sensor platform. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/sensor.ihc/ -""" -from homeassistant.components.ihc import ( - IHC_DATA, IHC_CONTROLLER, IHC_INFO) +"""Support for IHC sensors.""" +from homeassistant.components.ihc import IHC_CONTROLLER, IHC_DATA, IHC_INFO from homeassistant.components.ihc.ihcdevice import IHCDevice -from homeassistant.const import ( - CONF_UNIT_OF_MEASUREMENT) +from homeassistant.const import CONF_UNIT_OF_MEASUREMENT from homeassistant.helpers.entity import Entity DEPENDENCIES = ['ihc'] @@ -28,8 +22,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): info = hass.data[ihc_key][IHC_INFO] ihc_controller = hass.data[ihc_key][IHC_CONTROLLER] unit = product_cfg[CONF_UNIT_OF_MEASUREMENT] - sensor = IHCSensor(ihc_controller, name, ihc_id, info, - unit, product) + sensor = IHCSensor(ihc_controller, name, ihc_id, info, unit, product) devices.append(sensor) add_entities(devices) diff --git a/homeassistant/components/ihc/switch.py b/homeassistant/components/ihc/switch.py index e217d109cbc..bbab9d3e68c 100644 --- a/homeassistant/components/ihc/switch.py +++ b/homeassistant/components/ihc/switch.py @@ -1,10 +1,5 @@ -"""IHC switch platform. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/switch.ihc/ -""" -from homeassistant.components.ihc import ( - IHC_DATA, IHC_CONTROLLER, IHC_INFO) +"""Support for IHC switches.""" +from homeassistant.components.ihc import IHC_CONTROLLER, IHC_DATA, IHC_INFO from homeassistant.components.ihc.ihcdevice import IHCDevice from homeassistant.components.switch import SwitchDevice @@ -31,7 +26,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): class IHCSwitch(IHCDevice, SwitchDevice): - """IHC Switch.""" + """Representation of an IHC switch.""" def __init__(self, ihc_controller, name: str, ihc_id: int, info: bool, product=None) -> None: diff --git a/homeassistant/components/ios/__init__.py b/homeassistant/components/ios/__init__.py index 0b1282b605a..737216af5c9 100644 --- a/homeassistant/components/ios/__init__.py +++ b/homeassistant/components/ios/__init__.py @@ -1,25 +1,18 @@ -""" -Native Home Assistant iOS app component. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/ecosystem/ios/ -""" -import logging +"""Native Home Assistant iOS app component.""" import datetime +import logging import voluptuous as vol from homeassistant import config_entries from homeassistant.components.http import HomeAssistantView -from homeassistant.const import (HTTP_INTERNAL_SERVER_ERROR, - HTTP_BAD_REQUEST) +from homeassistant.const import HTTP_BAD_REQUEST, HTTP_INTERNAL_SERVER_ERROR from homeassistant.core import callback from homeassistant.exceptions import HomeAssistantError from homeassistant.helpers import ( - config_validation as cv, discovery, config_entry_flow) + config_entry_flow, config_validation as cv, discovery) from homeassistant.util.json import load_json, save_json - _LOGGER = logging.getLogger(__name__) DOMAIN = 'ios' diff --git a/homeassistant/components/ios/notify.py b/homeassistant/components/ios/notify.py index e6a37d707ad..1f8aade4ec1 100644 --- a/homeassistant/components/ios/notify.py +++ b/homeassistant/components/ios/notify.py @@ -1,20 +1,14 @@ -""" -iOS push notification platform for notify component. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/ecosystem/ios/notifications/ -""" -import logging +"""Support for iOS push notifications.""" from datetime import datetime, timezone +import logging + import requests from homeassistant.components import ios - -import homeassistant.util.dt as dt_util - from homeassistant.components.notify import ( - ATTR_TARGET, ATTR_TITLE, ATTR_TITLE_DEFAULT, ATTR_MESSAGE, - ATTR_DATA, BaseNotificationService) + ATTR_DATA, ATTR_MESSAGE, ATTR_TARGET, ATTR_TITLE, ATTR_TITLE_DEFAULT, + BaseNotificationService) +import homeassistant.util.dt as dt_util _LOGGER = logging.getLogger(__name__) @@ -85,7 +79,7 @@ class iOSNotificationService(BaseNotificationService): for target in targets: if target not in ios.enabled_push_ids(self.hass): - _LOGGER.error("The target (%s) does not exist in .ios.conf.", + _LOGGER.error("The target (%s) does not exist in .ios.conf", targets) return diff --git a/homeassistant/components/ios/sensor.py b/homeassistant/components/ios/sensor.py index d206cd1df87..404b313368c 100644 --- a/homeassistant/components/ios/sensor.py +++ b/homeassistant/components/ios/sensor.py @@ -1,9 +1,4 @@ -""" -Support for Home Assistant iOS app sensors. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/ecosystem/ios/ -""" +"""Support for Home Assistant iOS app sensors.""" from homeassistant.components import ios from homeassistant.helpers.entity import Entity from homeassistant.helpers.icon import icon_for_battery_level diff --git a/homeassistant/components/ipma/__init__.py b/homeassistant/components/ipma/__init__.py index 87f62371b55..9bb54a1a019 100644 --- a/homeassistant/components/ipma/__init__.py +++ b/homeassistant/components/ipma/__init__.py @@ -1,9 +1,4 @@ -""" -Component for the Portuguese weather service - IPMA. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/ipma/ -""" +"""Component for the Portuguese weather service - IPMA.""" from homeassistant.core import Config, HomeAssistant from .config_flow import IpmaFlowHandler # noqa from .const import DOMAIN # noqa @@ -13,7 +8,6 @@ DEFAULT_NAME = 'ipma' async def async_setup(hass: HomeAssistant, config: Config) -> bool: """Set up configured IPMA.""" - # No support for component configuration return True diff --git a/homeassistant/components/ipma/const.py b/homeassistant/components/ipma/const.py index dbb19294541..bdd97c74e6a 100644 --- a/homeassistant/components/ipma/const.py +++ b/homeassistant/components/ipma/const.py @@ -1,4 +1,4 @@ -"""Constants in ipma component.""" +"""Constants for IPMA component.""" import logging from homeassistant.components.weather import DOMAIN as WEATHER_DOMAIN diff --git a/homeassistant/components/ipma/weather.py b/homeassistant/components/ipma/weather.py index ec9b6fec2e8..7122957ad12 100644 --- a/homeassistant/components/ipma/weather.py +++ b/homeassistant/components/ipma/weather.py @@ -1,9 +1,4 @@ -""" -Support for IPMA weather service. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/weather.ipma/ -""" +"""Support for IPMA weather service.""" import logging from datetime import timedelta @@ -54,13 +49,13 @@ 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 the ipma platform. Deprecated. """ - _LOGGER.warning('Loading IPMA via platform config is deprecated') + _LOGGER.warning("Loading IPMA via platform config is deprecated") latitude = config.get(CONF_LATITUDE, hass.config.latitude) longitude = config.get(CONF_LONGITUDE, hass.config.longitude) diff --git a/homeassistant/components/isy994/__init__.py b/homeassistant/components/isy994/__init__.py index 2b5f8fcb13f..4eaa71deece 100644 --- a/homeassistant/components/isy994/__init__.py +++ b/homeassistant/components/isy994/__init__.py @@ -1,19 +1,14 @@ -""" -Support the ISY-994 controllers. - -For configuration details please visit the documentation for this component at -https://home-assistant.io/components/isy994/ -""" +"""Support the ISY-994 controllers.""" from collections import namedtuple import logging from urllib.parse import urlparse import voluptuous as vol -from homeassistant.core import HomeAssistant from homeassistant.const import ( CONF_HOST, CONF_PASSWORD, CONF_USERNAME, EVENT_HOMEASSISTANT_STOP) -from homeassistant.helpers import discovery, config_validation as cv +from homeassistant.core import HomeAssistant +from homeassistant.helpers import config_validation as cv, discovery from homeassistant.helpers.entity import Entity from homeassistant.helpers.typing import ConfigType, Dict @@ -46,8 +41,7 @@ CONFIG_SCHEMA = vol.Schema({ default=DEFAULT_IGNORE_STRING): cv.string, vol.Optional(CONF_SENSOR_STRING, default=DEFAULT_SENSOR_STRING): cv.string, - vol.Optional(CONF_ENABLE_CLIMATE, - default=True): cv.boolean + vol.Optional(CONF_ENABLE_CLIMATE, default=True): cv.boolean, }) }, extra=vol.ALLOW_EXTRA) diff --git a/homeassistant/components/isy994/binary_sensor.py b/homeassistant/components/isy994/binary_sensor.py index b5d676f233f..013b99fbb15 100644 --- a/homeassistant/components/isy994/binary_sensor.py +++ b/homeassistant/components/isy994/binary_sensor.py @@ -1,20 +1,15 @@ -""" -Support for ISY994 binary sensors. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/binary_sensor.isy994/ -""" -import logging +"""Support for ISY994 binary sensors.""" from datetime import timedelta +import logging from typing import Callable +from homeassistant.components.binary_sensor import DOMAIN, BinarySensorDevice +from homeassistant.components.isy994 import ( + ISY994_NODES, ISY994_PROGRAMS, ISYDevice) +from homeassistant.const import STATE_OFF, STATE_ON from homeassistant.core import callback -from homeassistant.components.binary_sensor import BinarySensorDevice, DOMAIN -from homeassistant.components.isy994 import (ISY994_NODES, ISY994_PROGRAMS, - ISYDevice) -from homeassistant.const import STATE_ON, STATE_OFF -from homeassistant.helpers.typing import ConfigType from homeassistant.helpers.event import async_track_point_in_utc_time +from homeassistant.helpers.typing import ConfigType from homeassistant.util import dt as dt_util _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/isy994/cover.py b/homeassistant/components/isy994/cover.py index 4ead61e6b7a..22ea1629794 100644 --- a/homeassistant/components/isy994/cover.py +++ b/homeassistant/components/isy994/cover.py @@ -1,17 +1,12 @@ -""" -Support for ISY994 covers. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/cover.isy994/ -""" +"""Support for ISY994 covers.""" import logging from typing import Callable -from homeassistant.components.cover import CoverDevice, DOMAIN -from homeassistant.components.isy994 import (ISY994_NODES, ISY994_PROGRAMS, - ISYDevice) +from homeassistant.components.cover import DOMAIN, CoverDevice +from homeassistant.components.isy994 import ( + ISY994_NODES, ISY994_PROGRAMS, ISYDevice) from homeassistant.const import ( - STATE_OPEN, STATE_CLOSED, STATE_OPENING, STATE_CLOSING, STATE_UNKNOWN) + STATE_CLOSED, STATE_CLOSING, STATE_OPEN, STATE_OPENING, STATE_UNKNOWN) from homeassistant.helpers.typing import ConfigType _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/isy994/fan.py b/homeassistant/components/isy994/fan.py index 314200ba1c4..142eaedd66b 100644 --- a/homeassistant/components/isy994/fan.py +++ b/homeassistant/components/isy994/fan.py @@ -1,17 +1,12 @@ -""" -Support for ISY994 fans. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/fan.isy994/ -""" +"""Support for ISY994 fans.""" import logging from typing import Callable -from homeassistant.components.fan import (FanEntity, DOMAIN, SPEED_OFF, - SPEED_LOW, SPEED_MEDIUM, - SPEED_HIGH, SUPPORT_SET_SPEED) -from homeassistant.components.isy994 import (ISY994_NODES, ISY994_PROGRAMS, - ISYDevice) +from homeassistant.components.fan import ( + DOMAIN, SPEED_HIGH, SPEED_LOW, SPEED_MEDIUM, SPEED_OFF, SUPPORT_SET_SPEED, + FanEntity) +from homeassistant.components.isy994 import ( + ISY994_NODES, ISY994_PROGRAMS, ISYDevice) from homeassistant.helpers.typing import ConfigType _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/isy994/light.py b/homeassistant/components/isy994/light.py index d54aa3cd4ce..cc39a6d1a3b 100644 --- a/homeassistant/components/isy994/light.py +++ b/homeassistant/components/isy994/light.py @@ -1,15 +1,9 @@ -""" -Support for ISY994 lights. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/light.isy994/ -""" +"""Support for ISY994 lights.""" import logging from typing import Callable -from homeassistant.components.light import ( - Light, SUPPORT_BRIGHTNESS, DOMAIN) from homeassistant.components.isy994 import ISY994_NODES, ISYDevice +from homeassistant.components.light import DOMAIN, SUPPORT_BRIGHTNESS, Light from homeassistant.helpers.typing import ConfigType _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/isy994/lock.py b/homeassistant/components/isy994/lock.py index 9481e619a61..a2e8b1a1e56 100644 --- a/homeassistant/components/isy994/lock.py +++ b/homeassistant/components/isy994/lock.py @@ -1,23 +1,18 @@ -""" -Support for ISY994 locks. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/lock.isy994/ -""" +"""Support for ISY994 locks.""" import logging from typing import Callable -from homeassistant.components.lock import LockDevice, DOMAIN -from homeassistant.components.isy994 import (ISY994_NODES, ISY994_PROGRAMS, - ISYDevice) -from homeassistant.const import STATE_LOCKED, STATE_UNLOCKED, STATE_UNKNOWN +from homeassistant.components.isy994 import ( + ISY994_NODES, ISY994_PROGRAMS, ISYDevice) +from homeassistant.components.lock import DOMAIN, LockDevice +from homeassistant.const import STATE_LOCKED, STATE_UNKNOWN, STATE_UNLOCKED from homeassistant.helpers.typing import ConfigType _LOGGER = logging.getLogger(__name__) VALUE_TO_STATE = { 0: STATE_UNLOCKED, - 100: STATE_LOCKED + 100: STATE_LOCKED, } diff --git a/homeassistant/components/isy994/sensor.py b/homeassistant/components/isy994/sensor.py index eca7e88a17e..60212d081de 100644 --- a/homeassistant/components/isy994/sensor.py +++ b/homeassistant/components/isy994/sensor.py @@ -1,17 +1,11 @@ -""" -Support for ISY994 sensors. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/sensor.isy994/ -""" +"""Support for ISY994 sensors.""" import logging from typing import Callable +from homeassistant.components.isy994 import ( + ISY994_NODES, ISY994_WEATHER, ISYDevice) from homeassistant.components.sensor import DOMAIN -from homeassistant.components.isy994 import (ISY994_NODES, ISY994_WEATHER, - ISYDevice) -from homeassistant.const import ( - TEMP_CELSIUS, TEMP_FAHRENHEIT, UNIT_UV_INDEX) +from homeassistant.const import TEMP_CELSIUS, TEMP_FAHRENHEIT, UNIT_UV_INDEX from homeassistant.helpers.typing import ConfigType _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/isy994/switch.py b/homeassistant/components/isy994/switch.py index 6bb9c07de5b..96f17c80bef 100644 --- a/homeassistant/components/isy994/switch.py +++ b/homeassistant/components/isy994/switch.py @@ -1,15 +1,10 @@ -""" -Support for ISY994 switches. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/switch.isy994/ -""" +"""Support for ISY994 switches.""" import logging from typing import Callable -from homeassistant.components.switch import SwitchDevice, DOMAIN -from homeassistant.components.isy994 import (ISY994_NODES, ISY994_PROGRAMS, - ISYDevice) +from homeassistant.components.isy994 import ( + ISY994_NODES, ISY994_PROGRAMS, ISYDevice) +from homeassistant.components.switch import DOMAIN, SwitchDevice from homeassistant.helpers.typing import ConfigType _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/smartthings/lock.py b/homeassistant/components/smartthings/lock.py index 6dfff0bd02c..e756cbfa918 100644 --- a/homeassistant/components/smartthings/lock.py +++ b/homeassistant/components/smartthings/lock.py @@ -1,9 +1,4 @@ -""" -Support for locks through the SmartThings cloud API. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/smartthings.lock/ -""" +"""Support for locks through the SmartThings cloud API.""" from homeassistant.components.lock import LockDevice from . import SmartThingsEntity @@ -15,12 +10,12 @@ ST_STATE_LOCKED = 'locked' ST_LOCK_ATTR_MAP = { 'method': 'method', 'codeId': 'code_id', - 'timeout': 'timeout' + 'timeout': 'timeout', } -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): """Platform uses config entry setup.""" pass