diff --git a/homeassistant/components/deluge/sensor.py b/homeassistant/components/deluge/sensor.py index 098484cf7ae..7df87490c60 100644 --- a/homeassistant/components/deluge/sensor.py +++ b/homeassistant/components/deluge/sensor.py @@ -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( diff --git a/homeassistant/components/deluge/switch.py b/homeassistant/components/deluge/switch.py index 981ef129b47..7ac98f284c8 100644 --- a/homeassistant/components/deluge/switch.py +++ b/homeassistant/components/deluge/switch.py @@ -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(