mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Move imports to top for recswitch (#29285)
This commit is contained in:
parent
d0ed9b32ac
commit
a0a348a200
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user