diff --git a/homeassistant/components/velux/__init__.py b/homeassistant/components/velux/__init__.py index 51f615e68aa..bac65c969cf 100644 --- a/homeassistant/components/velux/__init__.py +++ b/homeassistant/components/velux/__init__.py @@ -1,12 +1,12 @@ """Support for VELUX KLF 200 devices.""" import logging -import voluptuous as vol -from pyvlx import PyVLX -from pyvlx import PyVLXException +from pyvlx import PyVLX, PyVLXException +import voluptuous as vol + +from homeassistant.const import CONF_HOST, CONF_PASSWORD, EVENT_HOMEASSISTANT_STOP from homeassistant.helpers import discovery import homeassistant.helpers.config_validation as cv -from homeassistant.const import CONF_HOST, CONF_PASSWORD, EVENT_HOMEASSISTANT_STOP DOMAIN = "velux" DATA_VELUX = "data_velux" diff --git a/homeassistant/components/velux/cover.py b/homeassistant/components/velux/cover.py index a471960b048..7d4adc7350c 100644 --- a/homeassistant/components/velux/cover.py +++ b/homeassistant/components/velux/cover.py @@ -1,4 +1,7 @@ """Support for Velux covers.""" +from pyvlx import OpeningDevice, Position +from pyvlx.opening_device import Awning, Blind, RollerShutter, Window + from homeassistant.components.cover import ( ATTR_POSITION, SUPPORT_CLOSE, @@ -16,7 +19,6 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= """Set up cover(s) for Velux platform.""" entities = [] for node in hass.data[DATA_VELUX].pyvlx.nodes: - from pyvlx import OpeningDevice if isinstance(node, OpeningDevice): entities.append(VeluxCover(node)) @@ -67,8 +69,6 @@ class VeluxCover(CoverDevice): @property def device_class(self): """Define this cover as either window/blind/awning/shutter.""" - from pyvlx.opening_device import Blind, RollerShutter, Window, Awning - if isinstance(self.node, Window): return "window" if isinstance(self.node, Blind): @@ -96,7 +96,6 @@ class VeluxCover(CoverDevice): """Move the cover to a specific position.""" if ATTR_POSITION in kwargs: position_percent = 100 - kwargs[ATTR_POSITION] - from pyvlx import Position await self.node.set_position( Position(position_percent=position_percent), wait_for_completion=False