mirror of
https://github.com/home-assistant/core
synced 2024-09-15 17:29:45 +02:00
Move imports in lw12wifi component (#28019)
This commit is contained in:
parent
c1fccee83a
commit
ff385d5e2b
@ -2,6 +2,7 @@
|
||||
|
||||
import logging
|
||||
|
||||
import lw12
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.light import (
|
||||
@ -9,18 +10,17 @@ from homeassistant.components.light import (
|
||||
ATTR_EFFECT,
|
||||
ATTR_HS_COLOR,
|
||||
ATTR_TRANSITION,
|
||||
Light,
|
||||
PLATFORM_SCHEMA,
|
||||
SUPPORT_BRIGHTNESS,
|
||||
SUPPORT_EFFECT,
|
||||
SUPPORT_COLOR,
|
||||
SUPPORT_EFFECT,
|
||||
SUPPORT_TRANSITION,
|
||||
Light,
|
||||
)
|
||||
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_PORT
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
import homeassistant.util.color as color_util
|
||||
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -38,8 +38,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
||||
|
||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
"""Set up LW-12 WiFi LED Controller platform."""
|
||||
import lw12
|
||||
|
||||
# Assign configuration variables.
|
||||
name = config.get(CONF_NAME)
|
||||
host = config.get(CONF_HOST)
|
||||
@ -107,8 +105,6 @@ class LW12WiFi(Light):
|
||||
|
||||
Use the Enum element name for display.
|
||||
"""
|
||||
import lw12
|
||||
|
||||
return [effect.name.replace("_", " ").title() for effect in lw12.LW12_EFFECT]
|
||||
|
||||
@property
|
||||
@ -123,8 +119,6 @@ class LW12WiFi(Light):
|
||||
|
||||
def turn_on(self, **kwargs):
|
||||
"""Instruct the light to turn on."""
|
||||
import lw12
|
||||
|
||||
self._light.light_on()
|
||||
if ATTR_HS_COLOR in kwargs:
|
||||
self._rgb_color = color_util.color_hs_to_RGB(*kwargs[ATTR_HS_COLOR])
|
||||
|
Loading…
Reference in New Issue
Block a user