Move imports in fritzbox, fritz device tracker, fritzdect, fritzbox netmonitor (#27746)
* Moved imports to top-level in fritzbox_netmonitor component * Moved imports to top-level in fritz, fritzbox and fritzdect
This commit is contained in:
parent
b6c26cb363
commit
2a95180d3b
4 changed files with 13 additions and 13 deletions
|
@ -4,13 +4,13 @@ import logging
|
||||||
from fritzconnection import FritzHosts # pylint: disable=import-error
|
from fritzconnection import FritzHosts # pylint: disable=import-error
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
import homeassistant.helpers.config_validation as cv
|
|
||||||
from homeassistant.components.device_tracker import (
|
from homeassistant.components.device_tracker import (
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
PLATFORM_SCHEMA,
|
PLATFORM_SCHEMA,
|
||||||
DeviceScanner,
|
DeviceScanner,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME
|
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME
|
||||||
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
"""Support for AVM Fritz!Box smarthome devices."""
|
"""Support for AVM Fritz!Box smarthome devices."""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from pyfritzhome import Fritzhome, LoginError
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
import homeassistant.helpers.config_validation as cv
|
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_DEVICES,
|
CONF_DEVICES,
|
||||||
CONF_HOST,
|
CONF_HOST,
|
||||||
|
@ -12,6 +12,7 @@ from homeassistant.const import (
|
||||||
EVENT_HOMEASSISTANT_STOP,
|
EVENT_HOMEASSISTANT_STOP,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers import discovery
|
from homeassistant.helpers import discovery
|
||||||
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -52,7 +53,6 @@ CONFIG_SCHEMA = vol.Schema(
|
||||||
|
|
||||||
def setup(hass, config):
|
def setup(hass, config):
|
||||||
"""Set up the fritzbox component."""
|
"""Set up the fritzbox component."""
|
||||||
from pyfritzhome import Fritzhome, LoginError
|
|
||||||
|
|
||||||
fritz_list = []
|
fritz_list = []
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
"""Support for monitoring an AVM Fritz!Box router."""
|
"""Support for monitoring an AVM Fritz!Box router."""
|
||||||
import logging
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from requests.exceptions import RequestException
|
import logging
|
||||||
|
|
||||||
from fritzconnection import FritzStatus # pylint: disable=import-error
|
from fritzconnection import FritzStatus # pylint: disable=import-error
|
||||||
from fritzconnection.fritzconnection import ( # pylint: disable=import-error
|
from fritzconnection.fritzconnection import ( # pylint: disable=import-error
|
||||||
FritzConnectionException,
|
FritzConnectionException,
|
||||||
)
|
)
|
||||||
|
from requests.exceptions import RequestException
|
||||||
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 CONF_NAME, CONF_HOST, STATE_UNAVAILABLE
|
from homeassistant.const import CONF_HOST, CONF_NAME, STATE_UNAVAILABLE
|
||||||
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
|
||||||
from homeassistant.util import Throttle
|
from homeassistant.util import Throttle
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
|
@ -1,20 +1,21 @@
|
||||||
"""Support for FRITZ!DECT Switches."""
|
"""Support for FRITZ!DECT Switches."""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from requests.exceptions import RequestException, HTTPError
|
from fritzhome.fritz import FritzBox
|
||||||
|
from requests.exceptions import HTTPError, RequestException
|
||||||
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 (
|
||||||
|
ATTR_TEMPERATURE,
|
||||||
CONF_HOST,
|
CONF_HOST,
|
||||||
CONF_PASSWORD,
|
CONF_PASSWORD,
|
||||||
CONF_USERNAME,
|
CONF_USERNAME,
|
||||||
POWER_WATT,
|
|
||||||
ENERGY_KILO_WATT_HOUR,
|
ENERGY_KILO_WATT_HOUR,
|
||||||
|
POWER_WATT,
|
||||||
|
TEMP_CELSIUS,
|
||||||
)
|
)
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.const import TEMP_CELSIUS, ATTR_TEMPERATURE
|
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -42,7 +43,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
||||||
|
|
||||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Add all switches connected to Fritz Box."""
|
"""Add all switches connected to Fritz Box."""
|
||||||
from fritzhome.fritz import FritzBox
|
|
||||||
|
|
||||||
host = config.get(CONF_HOST)
|
host = config.get(CONF_HOST)
|
||||||
username = config.get(CONF_USERNAME)
|
username = config.get(CONF_USERNAME)
|
||||||
|
|
Loading…
Add table
Reference in a new issue