mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 09:47:13 +00:00
Move velux imports at top-level (#29085)
This commit is contained in:
parent
12c396fb19
commit
29e2201446
@ -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"
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user