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