From ec9b7c2517b19fd80288fd5547bba448b2378ac2 Mon Sep 17 00:00:00 2001 From: Quentame Date: Wed, 9 Oct 2019 13:33:01 +0200 Subject: [PATCH] Move imports in hue component --- homeassistant/components/hue/config_flow.py | 4 ++-- homeassistant/components/hue/sensor_base.py | 17 ++++++++--------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/homeassistant/components/hue/config_flow.py b/homeassistant/components/hue/config_flow.py index ebd71ba7c1cf9a..f214b16a700b1e 100644 --- a/homeassistant/components/hue/config_flow.py +++ b/homeassistant/components/hue/config_flow.py @@ -3,11 +3,12 @@ import json import os -from aiohue.discovery import discover_nupnp import async_timeout import voluptuous as vol +from aiohue.discovery import discover_nupnp from homeassistant import config_entries +from homeassistant.components.ssdp import ATTR_MANUFACTURERURL from homeassistant.core import callback from homeassistant.helpers import aiohttp_client @@ -133,7 +134,6 @@ async def async_step_ssdp(self, discovery_info): This flow is triggered by the SSDP component. It will check if the host is already configured and delegate to the import step if not. """ - from homeassistant.components.ssdp import ATTR_MANUFACTURERURL if discovery_info[ATTR_MANUFACTURERURL] != HUE_MANUFACTURERURL: return self.async_abort(reason="not_hue_bridge") diff --git a/homeassistant/components/hue/sensor_base.py b/homeassistant/components/hue/sensor_base.py index 96b9b8bf5d6f83..99226afc92559b 100644 --- a/homeassistant/components/hue/sensor_base.py +++ b/homeassistant/components/hue/sensor_base.py @@ -11,6 +11,14 @@ from homeassistant.helpers.event import async_track_point_in_utc_time from homeassistant.util.dt import utcnow +import aiohue +from .binary_sensor import HuePresence, PRESENCE_NAME_FORMAT +from .sensor import ( + HueLightLevel, + HueTemperature, + LIGHT_LEVEL_NAME_FORMAT, + TEMPERATURE_NAME_FORMAT, +) CURRENT_SENSORS = "current_sensors" SENSOR_MANAGER_FORMAT = "{}_sensor_manager" @@ -52,14 +60,6 @@ class SensorManager: def __init__(self, hass, bridge): """Initialize the sensor manager.""" - import aiohue - from .binary_sensor import HuePresence, PRESENCE_NAME_FORMAT - from .sensor import ( - HueLightLevel, - HueTemperature, - LIGHT_LEVEL_NAME_FORMAT, - TEMPERATURE_NAME_FORMAT, - ) self.hass = hass self.bridge = bridge @@ -115,7 +115,6 @@ async def async_update_bridge(now): async def async_update_items(self): """Update sensors from the bridge.""" - import aiohue api = self.bridge.api.sensors