Move imports to top for mfi (#29479)

pull/29495/head
springstan 2019-12-05 06:14:26 +01:00 committed by Paulus Schoutsen
parent 7df4c1e676
commit 12e1c695ca
2 changed files with 13 additions and 15 deletions

View File

@ -1,23 +1,24 @@
"""Support for Ubiquiti mFi sensors."""
import logging
from mficlient.client import FailedToLogin, MFiClient
import requests
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (
CONF_PASSWORD,
CONF_USERNAME,
TEMP_CELSIUS,
STATE_ON,
STATE_OFF,
CONF_HOST,
CONF_SSL,
CONF_VERIFY_SSL,
CONF_PASSWORD,
CONF_PORT,
CONF_SSL,
CONF_USERNAME,
CONF_VERIFY_SSL,
STATE_OFF,
STATE_ON,
TEMP_CELSIUS,
)
from homeassistant.helpers.entity import Entity
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
_LOGGER = logging.getLogger(__name__)
@ -57,8 +58,6 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
default_port = 6443 if use_tls else 6080
port = int(config.get(CONF_PORT, default_port))
from mficlient.client import FailedToLogin, MFiClient
try:
client = MFiClient(
host, username, password, port=port, use_tls=use_tls, verify=verify_tls

View File

@ -1,16 +1,17 @@
"""Support for Ubiquiti mFi switches."""
import logging
from mficlient.client import FailedToLogin, MFiClient
import requests
import voluptuous as vol
from homeassistant.components.switch import SwitchDevice, PLATFORM_SCHEMA
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
from homeassistant.const import (
CONF_HOST,
CONF_PORT,
CONF_PASSWORD,
CONF_USERNAME,
CONF_PORT,
CONF_SSL,
CONF_USERNAME,
CONF_VERIFY_SSL,
)
import homeassistant.helpers.config_validation as cv
@ -44,8 +45,6 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
default_port = 6443 if use_tls else 6080
port = int(config.get(CONF_PORT, default_port))
from mficlient.client import FailedToLogin, MFiClient
try:
client = MFiClient(
host, username, password, port=port, use_tls=use_tls, verify=verify_tls