move imports in smarthab component (#27942)

This commit is contained in:
Michał Mrozek 2019-10-20 12:14:07 +02:00 committed by Pascal Vizeli
parent ed46834a30
commit c42ca94a86
3 changed files with 16 additions and 12 deletions

View file

@ -6,11 +6,12 @@ https://home-assistant.io/integrations/smarthab/
""" """
import logging import logging
import pysmarthab
import voluptuous as vol import voluptuous as vol
from homeassistant.helpers.discovery import load_platform
from homeassistant.const import CONF_EMAIL, CONF_PASSWORD from homeassistant.const import CONF_EMAIL, CONF_PASSWORD
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.discovery import load_platform
DOMAIN = "smarthab" DOMAIN = "smarthab"
DATA_HUB = "hub" DATA_HUB = "hub"
@ -32,7 +33,6 @@ CONFIG_SCHEMA = vol.Schema(
def setup(hass, config) -> bool: def setup(hass, config) -> bool:
"""Set up the SmartHab platform.""" """Set up the SmartHab platform."""
import pysmarthab
sh_conf = config.get(DOMAIN) sh_conf = config.get(DOMAIN)

View file

@ -4,18 +4,21 @@ Support for SmartHab device integration.
For more details about this component, please refer to the documentation at For more details about this component, please refer to the documentation at
https://home-assistant.io/integrations/smarthab/ https://home-assistant.io/integrations/smarthab/
""" """
import logging
from datetime import timedelta from datetime import timedelta
import logging
import pysmarthab
from requests.exceptions import Timeout from requests.exceptions import Timeout
from homeassistant.components.cover import ( from homeassistant.components.cover import (
CoverDevice,
SUPPORT_OPEN,
SUPPORT_CLOSE,
SUPPORT_SET_POSITION,
ATTR_POSITION, ATTR_POSITION,
SUPPORT_CLOSE,
SUPPORT_OPEN,
SUPPORT_SET_POSITION,
CoverDevice,
) )
from . import DOMAIN, DATA_HUB
from . import DATA_HUB, DOMAIN
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -24,7 +27,6 @@ SCAN_INTERVAL = timedelta(seconds=60)
def setup_platform(hass, config, add_entities, discovery_info=None): def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the SmartHab roller shutters platform.""" """Set up the SmartHab roller shutters platform."""
import pysmarthab
hub = hass.data[DOMAIN][DATA_HUB] hub = hass.data[DOMAIN][DATA_HUB]
devices = hub.get_device_list() devices = hub.get_device_list()

View file

@ -4,12 +4,15 @@ Support for SmartHab device integration.
For more details about this component, please refer to the documentation at For more details about this component, please refer to the documentation at
https://home-assistant.io/integrations/smarthab/ https://home-assistant.io/integrations/smarthab/
""" """
import logging
from datetime import timedelta from datetime import timedelta
import logging
import pysmarthab
from requests.exceptions import Timeout from requests.exceptions import Timeout
from homeassistant.components.light import Light from homeassistant.components.light import Light
from . import DOMAIN, DATA_HUB
from . import DATA_HUB, DOMAIN
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -18,7 +21,6 @@ SCAN_INTERVAL = timedelta(seconds=60)
def setup_platform(hass, config, add_entities, discovery_info=None): def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the SmartHab lights platform.""" """Set up the SmartHab lights platform."""
import pysmarthab
hub = hass.data[DOMAIN][DATA_HUB] hub = hass.data[DOMAIN][DATA_HUB]
devices = hub.get_device_list() devices = hub.get_device_list()