diff --git a/homeassistant/components/mystrom/light.py b/homeassistant/components/mystrom/light.py index d878ee60302..56fe369144b 100644 --- a/homeassistant/components/mystrom/light.py +++ b/homeassistant/components/mystrom/light.py @@ -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() diff --git a/homeassistant/components/mystrom/switch.py b/homeassistant/components/mystrom/switch.py index 0eca5598cc9..3a045e0391d 100644 --- a/homeassistant/components/mystrom/switch.py +++ b/homeassistant/components/mystrom/switch.py @@ -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"