mirror of
https://github.com/home-assistant/core.git
synced 2025-07-07 13:27:09 +00:00
Move imports to top for mystrom (#29356)
This commit is contained in:
parent
9d213e70f0
commit
be316af303
@ -1,21 +1,23 @@
|
||||
"""Support for myStrom Wifi bulbs."""
|
||||
import logging
|
||||
|
||||
from pymystrom.bulb import MyStromBulb
|
||||
from pymystrom.exceptions import MyStromConnectionError
|
||||
import voluptuous as vol
|
||||
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.components.light import (
|
||||
Light,
|
||||
PLATFORM_SCHEMA,
|
||||
ATTR_BRIGHTNESS,
|
||||
SUPPORT_BRIGHTNESS,
|
||||
SUPPORT_EFFECT,
|
||||
ATTR_EFFECT,
|
||||
SUPPORT_FLASH,
|
||||
SUPPORT_COLOR,
|
||||
ATTR_HS_COLOR,
|
||||
PLATFORM_SCHEMA,
|
||||
SUPPORT_BRIGHTNESS,
|
||||
SUPPORT_COLOR,
|
||||
SUPPORT_EFFECT,
|
||||
SUPPORT_FLASH,
|
||||
Light,
|
||||
)
|
||||
from homeassistant.const import CONF_HOST, CONF_MAC, CONF_NAME
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@ -39,8 +41,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
||||
|
||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
"""Set up the myStrom Light platform."""
|
||||
from pymystrom.bulb import MyStromBulb
|
||||
from pymystrom.exceptions import MyStromConnectionError
|
||||
|
||||
host = config.get(CONF_HOST)
|
||||
mac = config.get(CONF_MAC)
|
||||
@ -107,7 +107,6 @@ class MyStromLight(Light):
|
||||
|
||||
def turn_on(self, **kwargs):
|
||||
"""Turn on the light."""
|
||||
from pymystrom.exceptions import MyStromConnectionError
|
||||
|
||||
brightness = kwargs.get(ATTR_BRIGHTNESS, 255)
|
||||
effect = kwargs.get(ATTR_EFFECT)
|
||||
@ -136,7 +135,6 @@ class MyStromLight(Light):
|
||||
|
||||
def turn_off(self, **kwargs):
|
||||
"""Turn off the bulb."""
|
||||
from pymystrom.exceptions import MyStromConnectionError
|
||||
|
||||
try:
|
||||
self._bulb.set_off()
|
||||
@ -145,7 +143,6 @@ class MyStromLight(Light):
|
||||
|
||||
def update(self):
|
||||
"""Fetch new state data for this light."""
|
||||
from pymystrom.exceptions import MyStromConnectionError
|
||||
|
||||
try:
|
||||
self._state = self._bulb.get_status()
|
||||
|
@ -3,8 +3,8 @@ import logging
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.switch import SwitchDevice, PLATFORM_SCHEMA
|
||||
from homeassistant.const import CONF_NAME, CONF_HOST
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
|
||||
from homeassistant.const import CONF_HOST, CONF_NAME
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
DEFAULT_NAME = "myStrom Switch"
|
||||
|
Loading…
x
Reference in New Issue
Block a user