From be0542b69e1967bc5c212776d037967df60b2012 Mon Sep 17 00:00:00 2001 From: springstan Date: Mon, 2 Dec 2019 23:18:58 +0100 Subject: [PATCH] Move imports to top for qwikswitch --- homeassistant/components/qwikswitch/__init__.py | 4 ++-- homeassistant/components/qwikswitch/binary_sensor.py | 3 ++- homeassistant/components/qwikswitch/sensor.py | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/qwikswitch/__init__.py b/homeassistant/components/qwikswitch/__init__.py index 1ae92b0a18ad05..33392c51be8e0c 100644 --- a/homeassistant/components/qwikswitch/__init__.py +++ b/homeassistant/components/qwikswitch/__init__.py @@ -1,6 +1,8 @@ """Support for Qwikswitch devices.""" import logging +from pyqwikswitch.async_ import QSUsb +from pyqwikswitch.qwikswitch import CMD_BUTTONS, QS_CMD, QS_ID, SENSORS, QSType import voluptuous as vol from homeassistant.components.binary_sensor import DEVICE_CLASSES_SCHEMA @@ -128,8 +130,6 @@ async def async_turn_off(self, **_): async def async_setup(hass, config): """Qwiskswitch component setup.""" - from pyqwikswitch.async_ import QSUsb - from pyqwikswitch.qwikswitch import CMD_BUTTONS, QS_CMD, QS_ID, QSType, SENSORS # Add cmd's to in /&listen packets will fire events # By default only buttons of type [TOGGLE,SCENE EXE,LEVEL] diff --git a/homeassistant/components/qwikswitch/binary_sensor.py b/homeassistant/components/qwikswitch/binary_sensor.py index a5b142e19aede4..054028b5629e82 100644 --- a/homeassistant/components/qwikswitch/binary_sensor.py +++ b/homeassistant/components/qwikswitch/binary_sensor.py @@ -1,6 +1,8 @@ """Support for Qwikswitch Binary Sensors.""" import logging +from pyqwikswitch.qwikswitch import SENSORS + from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.core import callback @@ -27,7 +29,6 @@ class QSBinarySensor(QSEntity, BinarySensorDevice): def __init__(self, sensor): """Initialize the sensor.""" - from pyqwikswitch.qwikswitch import SENSORS super().__init__(sensor["id"], sensor["name"]) self.channel = sensor["channel"] diff --git a/homeassistant/components/qwikswitch/sensor.py b/homeassistant/components/qwikswitch/sensor.py index 01964fc7831e04..4674da420b22b9 100644 --- a/homeassistant/components/qwikswitch/sensor.py +++ b/homeassistant/components/qwikswitch/sensor.py @@ -1,6 +1,8 @@ """Support for Qwikswitch Sensors.""" import logging +from pyqwikswitch.qwikswitch import SENSORS + from homeassistant.core import callback from . import DOMAIN as QWIKSWITCH, QSEntity @@ -26,7 +28,6 @@ class QSSensor(QSEntity): def __init__(self, sensor): """Initialize the sensor.""" - from pyqwikswitch.qwikswitch import SENSORS super().__init__(sensor["id"], sensor["name"]) self.channel = sensor["channel"]