Move imports to top for mfi (#29479)
parent
7df4c1e676
commit
12e1c695ca
|
@ -1,23 +1,24 @@
|
||||||
"""Support for Ubiquiti mFi sensors."""
|
"""Support for Ubiquiti mFi sensors."""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from mficlient.client import FailedToLogin, MFiClient
|
||||||
import requests
|
import requests
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_PASSWORD,
|
|
||||||
CONF_USERNAME,
|
|
||||||
TEMP_CELSIUS,
|
|
||||||
STATE_ON,
|
|
||||||
STATE_OFF,
|
|
||||||
CONF_HOST,
|
CONF_HOST,
|
||||||
CONF_SSL,
|
CONF_PASSWORD,
|
||||||
CONF_VERIFY_SSL,
|
|
||||||
CONF_PORT,
|
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
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
from homeassistant.helpers.entity import Entity
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_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
|
default_port = 6443 if use_tls else 6080
|
||||||
port = int(config.get(CONF_PORT, default_port))
|
port = int(config.get(CONF_PORT, default_port))
|
||||||
|
|
||||||
from mficlient.client import FailedToLogin, MFiClient
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
client = MFiClient(
|
client = MFiClient(
|
||||||
host, username, password, port=port, use_tls=use_tls, verify=verify_tls
|
host, username, password, port=port, use_tls=use_tls, verify=verify_tls
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
"""Support for Ubiquiti mFi switches."""
|
"""Support for Ubiquiti mFi switches."""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from mficlient.client import FailedToLogin, MFiClient
|
||||||
import requests
|
import requests
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.switch import SwitchDevice, PLATFORM_SCHEMA
|
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_HOST,
|
CONF_HOST,
|
||||||
CONF_PORT,
|
|
||||||
CONF_PASSWORD,
|
CONF_PASSWORD,
|
||||||
CONF_USERNAME,
|
CONF_PORT,
|
||||||
CONF_SSL,
|
CONF_SSL,
|
||||||
|
CONF_USERNAME,
|
||||||
CONF_VERIFY_SSL,
|
CONF_VERIFY_SSL,
|
||||||
)
|
)
|
||||||
import homeassistant.helpers.config_validation as cv
|
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
|
default_port = 6443 if use_tls else 6080
|
||||||
port = int(config.get(CONF_PORT, default_port))
|
port = int(config.get(CONF_PORT, default_port))
|
||||||
|
|
||||||
from mficlient.client import FailedToLogin, MFiClient
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
client = MFiClient(
|
client = MFiClient(
|
||||||
host, username, password, port=port, use_tls=use_tls, verify=verify_tls
|
host, username, password, port=port, use_tls=use_tls, verify=verify_tls
|
||||||
|
|
Loading…
Reference in New Issue