mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +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."""
|
"""Support for monitoring the Deluge BitTorrent client API."""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from deluge_client import DelugeRPCClient, FailedToReconnectException
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
import homeassistant.helpers.config_validation as cv
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_HOST,
|
CONF_HOST,
|
||||||
CONF_PASSWORD,
|
|
||||||
CONF_USERNAME,
|
|
||||||
CONF_NAME,
|
|
||||||
CONF_PORT,
|
|
||||||
CONF_MONITORED_VARIABLES,
|
CONF_MONITORED_VARIABLES,
|
||||||
|
CONF_NAME,
|
||||||
|
CONF_PASSWORD,
|
||||||
|
CONF_PORT,
|
||||||
|
CONF_USERNAME,
|
||||||
STATE_IDLE,
|
STATE_IDLE,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.entity import Entity
|
|
||||||
from homeassistant.exceptions import PlatformNotReady
|
from homeassistant.exceptions import PlatformNotReady
|
||||||
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
from homeassistant.helpers.entity import Entity
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
_THROTTLED_REFRESH = None
|
_THROTTLED_REFRESH = None
|
||||||
@ -46,7 +47,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):
|
||||||
"""Set up the Deluge sensors."""
|
"""Set up the Deluge sensors."""
|
||||||
from deluge_client import DelugeRPCClient
|
|
||||||
|
|
||||||
name = config.get(CONF_NAME)
|
name = config.get(CONF_NAME)
|
||||||
host = config.get(CONF_HOST)
|
host = config.get(CONF_HOST)
|
||||||
@ -103,7 +103,6 @@ class DelugeSensor(Entity):
|
|||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
"""Get the latest data from Deluge and updates the state."""
|
"""Get the latest data from Deluge and updates the state."""
|
||||||
from deluge_client import FailedToReconnectException
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.data = self.client.call(
|
self.data = self.client.call(
|
||||||
|
@ -1,21 +1,22 @@
|
|||||||
"""Support for setting the Deluge BitTorrent client in Pause."""
|
"""Support for setting the Deluge BitTorrent client in Pause."""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from deluge_client import DelugeRPCClient, FailedToReconnectException
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.switch import PLATFORM_SCHEMA
|
from homeassistant.components.switch import PLATFORM_SCHEMA
|
||||||
from homeassistant.exceptions import PlatformNotReady
|
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_HOST,
|
CONF_HOST,
|
||||||
CONF_NAME,
|
CONF_NAME,
|
||||||
CONF_PORT,
|
|
||||||
CONF_PASSWORD,
|
CONF_PASSWORD,
|
||||||
|
CONF_PORT,
|
||||||
CONF_USERNAME,
|
CONF_USERNAME,
|
||||||
STATE_OFF,
|
STATE_OFF,
|
||||||
STATE_ON,
|
STATE_ON,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.entity import ToggleEntity
|
from homeassistant.exceptions import PlatformNotReady
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
from homeassistant.helpers.entity import ToggleEntity
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -35,7 +36,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):
|
||||||
"""Set up the Deluge switch."""
|
"""Set up the Deluge switch."""
|
||||||
from deluge_client import DelugeRPCClient
|
|
||||||
|
|
||||||
name = config.get(CONF_NAME)
|
name = config.get(CONF_NAME)
|
||||||
host = config.get(CONF_HOST)
|
host = config.get(CONF_HOST)
|
||||||
@ -95,7 +95,6 @@ class DelugeSwitch(ToggleEntity):
|
|||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
"""Get the latest data from deluge and updates the state."""
|
"""Get the latest data from deluge and updates the state."""
|
||||||
from deluge_client import FailedToReconnectException
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
torrent_list = self.deluge_client.call(
|
torrent_list = self.deluge_client.call(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user