mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Move imports to top for deluge (#29438)
This commit is contained in:
parent
4c0f73a2b9
commit
69ae469148
@ -1,21 +1,22 @@
|
||||
"""Support for monitoring the Deluge BitTorrent client API."""
|
||||
import logging
|
||||
|
||||
from deluge_client import DelugeRPCClient, FailedToReconnectException
|
||||
import voluptuous as vol
|
||||
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.const import (
|
||||
CONF_HOST,
|
||||
CONF_PASSWORD,
|
||||
CONF_USERNAME,
|
||||
CONF_NAME,
|
||||
CONF_PORT,
|
||||
CONF_MONITORED_VARIABLES,
|
||||
CONF_NAME,
|
||||
CONF_PASSWORD,
|
||||
CONF_PORT,
|
||||
CONF_USERNAME,
|
||||
STATE_IDLE,
|
||||
)
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.exceptions import PlatformNotReady
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
_THROTTLED_REFRESH = None
|
||||
@ -46,7 +47,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
||||
|
||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
"""Set up the Deluge sensors."""
|
||||
from deluge_client import DelugeRPCClient
|
||||
|
||||
name = config.get(CONF_NAME)
|
||||
host = config.get(CONF_HOST)
|
||||
@ -103,7 +103,6 @@ class DelugeSensor(Entity):
|
||||
|
||||
def update(self):
|
||||
"""Get the latest data from Deluge and updates the state."""
|
||||
from deluge_client import FailedToReconnectException
|
||||
|
||||
try:
|
||||
self.data = self.client.call(
|
||||
|
@ -1,21 +1,22 @@
|
||||
"""Support for setting the Deluge BitTorrent client in Pause."""
|
||||
import logging
|
||||
|
||||
from deluge_client import DelugeRPCClient, FailedToReconnectException
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA
|
||||
from homeassistant.exceptions import PlatformNotReady
|
||||
from homeassistant.const import (
|
||||
CONF_HOST,
|
||||
CONF_NAME,
|
||||
CONF_PORT,
|
||||
CONF_PASSWORD,
|
||||
CONF_PORT,
|
||||
CONF_USERNAME,
|
||||
STATE_OFF,
|
||||
STATE_ON,
|
||||
)
|
||||
from homeassistant.helpers.entity import ToggleEntity
|
||||
from homeassistant.exceptions import PlatformNotReady
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import ToggleEntity
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@ -35,7 +36,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
||||
|
||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
"""Set up the Deluge switch."""
|
||||
from deluge_client import DelugeRPCClient
|
||||
|
||||
name = config.get(CONF_NAME)
|
||||
host = config.get(CONF_HOST)
|
||||
@ -95,7 +95,6 @@ class DelugeSwitch(ToggleEntity):
|
||||
|
||||
def update(self):
|
||||
"""Get the latest data from deluge and updates the state."""
|
||||
from deluge_client import FailedToReconnectException
|
||||
|
||||
try:
|
||||
torrent_list = self.deluge_client.call(
|
||||
|
Loading…
x
Reference in New Issue
Block a user