diff --git a/homeassistant/components/binary_sensor/zha.py b/homeassistant/components/binary_sensor/zha.py index 087e7963c00..62c57f0288b 100644 --- a/homeassistant/components/binary_sensor/zha.py +++ b/homeassistant/components/binary_sensor/zha.py @@ -7,12 +7,11 @@ at https://home-assistant.io/components/binary_sensor.zha/ import logging from homeassistant.components.binary_sensor import DOMAIN, BinarySensorDevice -from homeassistant.components.zha.entities import ZhaEntity from homeassistant.components.zha import helpers -from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.components.zha.const import ( - ZHA_DISCOVERY_NEW, DATA_ZHA, DATA_ZHA_DISPATCHERS -) + DATA_ZHA, DATA_ZHA_DISPATCHERS, ZHA_DISCOVERY_NEW) +from homeassistant.components.zha.entities import ZhaEntity +from homeassistant.helpers.dispatcher import async_dispatcher_connect _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/fan/zha.py b/homeassistant/components/fan/zha.py index 4f8254672a8..d1731e89894 100644 --- a/homeassistant/components/fan/zha.py +++ b/homeassistant/components/fan/zha.py @@ -5,15 +5,15 @@ For more details on this platform, please refer to the documentation at https://home-assistant.io/components/fan.zha/ """ import logging -from homeassistant.components.zha.entities import ZhaEntity -from homeassistant.components.zha import helpers -from homeassistant.helpers.dispatcher import async_dispatcher_connect -from homeassistant.components.zha.const import ( - ZHA_DISCOVERY_NEW, DATA_ZHA, DATA_ZHA_DISPATCHERS -) + from homeassistant.components.fan import ( - DOMAIN, FanEntity, SPEED_OFF, SPEED_LOW, SPEED_MEDIUM, SPEED_HIGH, - SUPPORT_SET_SPEED) + DOMAIN, SPEED_HIGH, SPEED_LOW, SPEED_MEDIUM, SPEED_OFF, SUPPORT_SET_SPEED, + FanEntity) +from homeassistant.components.zha import helpers +from homeassistant.components.zha.const import ( + DATA_ZHA, DATA_ZHA_DISPATCHERS, ZHA_DISCOVERY_NEW) +from homeassistant.components.zha.entities import ZhaEntity +from homeassistant.helpers.dispatcher import async_dispatcher_connect DEPENDENCIES = ['zha'] diff --git a/homeassistant/components/light/zha.py b/homeassistant/components/light/zha.py index 67b65edb0a6..83448b39d9e 100644 --- a/homeassistant/components/light/zha.py +++ b/homeassistant/components/light/zha.py @@ -5,13 +5,13 @@ For more details on this platform, please refer to the documentation at https://home-assistant.io/components/light.zha/ """ import logging + from homeassistant.components import light -from homeassistant.components.zha.entities import ZhaEntity from homeassistant.components.zha import helpers -from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.components.zha.const import ( - ZHA_DISCOVERY_NEW, DATA_ZHA, DATA_ZHA_DISPATCHERS -) + DATA_ZHA, DATA_ZHA_DISPATCHERS, ZHA_DISCOVERY_NEW) +from homeassistant.components.zha.entities import ZhaEntity +from homeassistant.helpers.dispatcher import async_dispatcher_connect import homeassistant.util.color as color_util _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/sensor/zha.py b/homeassistant/components/sensor/zha.py index 97432b2512f..80aad9ac937 100644 --- a/homeassistant/components/sensor/zha.py +++ b/homeassistant/components/sensor/zha.py @@ -7,13 +7,12 @@ at https://home-assistant.io/components/sensor.zha/ import logging from homeassistant.components.sensor import DOMAIN -from homeassistant.components.zha.entities import ZhaEntity from homeassistant.components.zha import helpers -from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.components.zha.const import ( - ZHA_DISCOVERY_NEW, DATA_ZHA, DATA_ZHA_DISPATCHERS -) + DATA_ZHA, DATA_ZHA_DISPATCHERS, ZHA_DISCOVERY_NEW) +from homeassistant.components.zha.entities import ZhaEntity from homeassistant.const import TEMP_CELSIUS +from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.util.temperature import convert as convert_temperature _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/switch/zha.py b/homeassistant/components/switch/zha.py index d34ca5e71ba..4dac3bfbb22 100644 --- a/homeassistant/components/switch/zha.py +++ b/homeassistant/components/switch/zha.py @@ -6,13 +6,12 @@ at https://home-assistant.io/components/switch.zha/ """ import logging -from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.components.switch import DOMAIN, SwitchDevice -from homeassistant.components.zha.entities import ZhaEntity from homeassistant.components.zha import helpers from homeassistant.components.zha.const import ( - ZHA_DISCOVERY_NEW, DATA_ZHA, DATA_ZHA_DISPATCHERS -) + DATA_ZHA, DATA_ZHA_DISPATCHERS, ZHA_DISCOVERY_NEW) +from homeassistant.components.zha.entities import ZhaEntity +from homeassistant.helpers.dispatcher import async_dispatcher_connect _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/zha/__init__.py b/homeassistant/components/zha/__init__.py index d67fbd02b8f..fb909b6fedf 100644 --- a/homeassistant/components/zha/__init__.py +++ b/homeassistant/components/zha/__init__.py @@ -10,23 +10,22 @@ import os import voluptuous as vol -import homeassistant.helpers.config_validation as cv -from homeassistant.helpers.entity_component import EntityComponent -from homeassistant.components.zha.entities import ZhaDeviceEntity from homeassistant import config_entries, const as ha_const -from homeassistant.helpers.dispatcher import async_dispatcher_send +from homeassistant.components.zha.entities import ZhaDeviceEntity +import homeassistant.helpers.config_validation as cv from homeassistant.helpers.device_registry import CONNECTION_ZIGBEE -from . import const as zha_const +from homeassistant.helpers.dispatcher import async_dispatcher_send +from homeassistant.helpers.entity_component import EntityComponent # Loading the config flow file will register the flow from . import config_flow # noqa # pylint: disable=unused-import +from . import const as zha_const from .const import ( - DOMAIN, COMPONENTS, CONF_BAUDRATE, CONF_DATABASE, CONF_RADIO_TYPE, - CONF_USB_PATH, CONF_DEVICE_CONFIG, ZHA_DISCOVERY_NEW, DATA_ZHA, - DATA_ZHA_CONFIG, DATA_ZHA_BRIDGE_ID, DATA_ZHA_RADIO, DATA_ZHA_DISPATCHERS, - DATA_ZHA_CORE_COMPONENT, DEFAULT_RADIO_TYPE, DEFAULT_DATABASE_NAME, - DEFAULT_BAUDRATE, RadioType -) + COMPONENTS, CONF_BAUDRATE, CONF_DATABASE, CONF_DEVICE_CONFIG, + CONF_RADIO_TYPE, CONF_USB_PATH, DATA_ZHA, DATA_ZHA_BRIDGE_ID, + DATA_ZHA_CONFIG, DATA_ZHA_CORE_COMPONENT, DATA_ZHA_DISPATCHERS, + DATA_ZHA_RADIO, DEFAULT_BAUDRATE, DEFAULT_DATABASE_NAME, + DEFAULT_RADIO_TYPE, DOMAIN, ZHA_DISCOVERY_NEW, RadioType) REQUIREMENTS = [ 'bellows==0.7.0', diff --git a/homeassistant/components/zha/config_flow.py b/homeassistant/components/zha/config_flow.py index fa45194ea3f..1c903ec3056 100644 --- a/homeassistant/components/zha/config_flow.py +++ b/homeassistant/components/zha/config_flow.py @@ -1,14 +1,14 @@ """Config flow for ZHA.""" -import os from collections import OrderedDict +import os import voluptuous as vol from homeassistant import config_entries -from .helpers import check_zigpy_connection + from .const import ( - DOMAIN, CONF_RADIO_TYPE, CONF_USB_PATH, DEFAULT_DATABASE_NAME, RadioType -) + CONF_RADIO_TYPE, CONF_USB_PATH, DEFAULT_DATABASE_NAME, DOMAIN, RadioType) +from .helpers import check_zigpy_connection @config_entries.HANDLERS.register(DOMAIN) diff --git a/homeassistant/components/zha/entities/__init__.py b/homeassistant/components/zha/entities/__init__.py index d5e52e9277f..c3c3ea163ed 100644 --- a/homeassistant/components/zha/entities/__init__.py +++ b/homeassistant/components/zha/entities/__init__.py @@ -6,5 +6,5 @@ https://home-assistant.io/components/zha/ """ # flake8: noqa -from .entity import ZhaEntity from .device_entity import ZhaDeviceEntity +from .entity import ZhaEntity diff --git a/homeassistant/components/zha/entities/device_entity.py b/homeassistant/components/zha/entities/device_entity.py index 1a10f249489..2d2a5d76b81 100644 --- a/homeassistant/components/zha/entities/device_entity.py +++ b/homeassistant/components/zha/entities/device_entity.py @@ -6,6 +6,7 @@ https://home-assistant.io/components/zha/ """ import time + from homeassistant.helpers import entity from homeassistant.util import slugify diff --git a/homeassistant/components/zha/entities/entity.py b/homeassistant/components/zha/entities/entity.py index a4454244364..da8f615a665 100644 --- a/homeassistant/components/zha/entities/entity.py +++ b/homeassistant/components/zha/entities/entity.py @@ -4,13 +4,12 @@ Entity for Zigbee Home Automation. For more details about this component, please refer to the documentation at https://home-assistant.io/components/zha/ """ -from homeassistant.helpers import entity -from homeassistant.util import slugify -from homeassistant.core import callback -from homeassistant.helpers.device_registry import CONNECTION_ZIGBEE from homeassistant.components.zha.const import ( - DOMAIN, DATA_ZHA, DATA_ZHA_BRIDGE_ID -) + DATA_ZHA, DATA_ZHA_BRIDGE_ID, DOMAIN) +from homeassistant.core import callback +from homeassistant.helpers import entity +from homeassistant.helpers.device_registry import CONNECTION_ZIGBEE +from homeassistant.util import slugify class ZhaEntity(entity.Entity): diff --git a/homeassistant/components/zha/helpers.py b/homeassistant/components/zha/helpers.py index f3e1a27dca2..7ae6fbf2d22 100644 --- a/homeassistant/components/zha/helpers.py +++ b/homeassistant/components/zha/helpers.py @@ -4,9 +4,10 @@ Helpers for Zigbee Home Automation. For more details about this component, please refer to the documentation at https://home-assistant.io/components/zha/ """ -import logging import asyncio -from .const import RadioType, DEFAULT_BAUDRATE +import logging + +from .const import DEFAULT_BAUDRATE, RadioType _LOGGER = logging.getLogger(__name__)