From a0a348a200b88210cd3b20fa19f7e1def916cd38 Mon Sep 17 00:00:00 2001 From: springstan <46536646+springstan@users.noreply.github.com> Date: Sun, 1 Dec 2019 15:24:48 +0100 Subject: [PATCH] Move imports to top for recswitch (#29285) --- homeassistant/components/recswitch/switch.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/homeassistant/components/recswitch/switch.py b/homeassistant/components/recswitch/switch.py index aa93693a36d..c242f23dfdd 100644 --- a/homeassistant/components/recswitch/switch.py +++ b/homeassistant/components/recswitch/switch.py @@ -2,13 +2,13 @@ import logging +from pyrecswitch import RSNetwork, RSNetworkError import voluptuous as vol from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice from homeassistant.const import CONF_HOST, CONF_MAC, CONF_NAME import homeassistant.helpers.config_validation as cv - _LOGGER = logging.getLogger(__name__) DEFAULT_NAME = "RecSwitch {0}" @@ -26,7 +26,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Set up the device.""" - from pyrecswitch import RSNetwork host = config[CONF_HOST] mac_address = config[CONF_MAC] @@ -78,7 +77,6 @@ class RecSwitchSwitch(SwitchDevice): async def async_set_gpio_status(self, status): """Set the switch status.""" - from pyrecswitch import RSNetworkError try: ret = await self.device.set_gpio_status(status) @@ -88,7 +86,6 @@ class RecSwitchSwitch(SwitchDevice): async def async_update(self): """Update the current switch status.""" - from pyrecswitch import RSNetworkError try: ret = await self.device.get_gpio_status()