Move imports in everlights component (#27983)

This commit is contained in:
Diefferson Koderer Môro 2019-10-20 18:36:43 -03:00 committed by cgtobi
parent bf6a30d1bb
commit ef8f88e25a

View File

@ -1,25 +1,26 @@
"""Support for EverLights lights.""" """Support for EverLights lights."""
import logging
from datetime import timedelta from datetime import timedelta
import logging
from typing import Tuple from typing import Tuple
import pyeverlights
import voluptuous as vol import voluptuous as vol
from homeassistant.const import CONF_HOSTS
from homeassistant.components.light import ( from homeassistant.components.light import (
ATTR_BRIGHTNESS, ATTR_BRIGHTNESS,
ATTR_HS_COLOR,
ATTR_EFFECT, ATTR_EFFECT,
SUPPORT_BRIGHTNESS, ATTR_HS_COLOR,
SUPPORT_EFFECT,
SUPPORT_COLOR,
Light,
PLATFORM_SCHEMA, PLATFORM_SCHEMA,
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
SUPPORT_EFFECT,
Light,
) )
from homeassistant.const import CONF_HOSTS
from homeassistant.exceptions import PlatformNotReady
from homeassistant.helpers.aiohttp_client import async_get_clientsession
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
import homeassistant.util.color as color_util import homeassistant.util.color as color_util
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.exceptions import PlatformNotReady
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -46,8 +47,6 @@ def color_int_to_rgb(value: int) -> Tuple[int, int, 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 EverLights lights from configuration.yaml.""" """Set up the EverLights lights from configuration.yaml."""
import pyeverlights
lights = [] lights = []
for ipaddr in config[CONF_HOSTS]: for ipaddr in config[CONF_HOSTS]:
@ -159,8 +158,6 @@ class EverLightsLight(Light):
async def async_update(self): async def async_update(self):
"""Synchronize state with control box.""" """Synchronize state with control box."""
import pyeverlights
try: try:
self._status = await self._api.get_status() self._status = await self._api.get_status()
except pyeverlights.ConnectionError: except pyeverlights.ConnectionError: