"""
Support for Insteon Hub.

For more details about this component, please refer to the documentation at
https://home-assistant.io/components/insteon_hub/
"""
import logging

from homeassistant.const import CONF_API_KEY, CONF_PASSWORD, CONF_USERNAME
from homeassistant.helpers import validate_config, discovery

DOMAIN = "insteon_hub"
REQUIREMENTS = ['insteon_hub==0.4.5']
INSTEON = None
_LOGGER = logging.getLogger(__name__)


def setup(hass, config):
    """Setup Insteon Hub component.

    This will automatically import associated lights.
    """
    if not validate_config(
            config,
            {DOMAIN: [CONF_USERNAME, CONF_PASSWORD, CONF_API_KEY]},
            _LOGGER):
        return False

    import insteon

    username = config[DOMAIN][CONF_USERNAME]
    password = config[DOMAIN][CONF_PASSWORD]
    api_key = config[DOMAIN][CONF_API_KEY]

    global INSTEON
    INSTEON = insteon.Insteon(username, password, api_key)

    if INSTEON is None:
        _LOGGER.error("Could not connect to Insteon service.")
        return

    discovery.load_platform(hass, 'light', DOMAIN, {}, config)

    return True

@@ -169,16 +169,42 @@
 ogging%0A%0A
+import voluptuous as vol%0A%0A
 from hom
@@ -227,16 +227,17 @@
  import 
+(
 CONF_API
@@ -270,16 +270,17 @@
 USERNAME
+)
 %0Afrom ho
@@ -310,46 +310,89 @@
 ort 
-validate_config, discovery%0A%0ADOMAIN = %22
+discovery%0Aimport homeassistant.helpers.config_validation as cv%0A%0AREQUIREMENTS = %5B'
 inst
@@ -402,26 +402,67 @@
 _hub
-%22%0AREQUIREMENTS
+==0.4.5'%5D%0A%0A_LOGGER = logging.getLogger(__name__)%0A%0ADOMAIN
  = 
-%5B
 'ins
@@ -469,25 +469,17 @@
 teon_hub
-==0.4.5'%5D
+'
 %0AINSTEON
@@ -490,331 +490,364 @@
 one%0A
-_LOGGER = logging.getLogger(__name__)%0A%0A%0Adef setup(hass, config):%0A    %22%22%22Setup Insteon Hub component.%0A%0A    This will automatically import associated lights.%0A    %22%22%22%0A    if not validate_config(%0A            config,%0A            %7BDOMAIN: %5BCONF_USERNAME, CONF_PASSWORD, CONF_API_KEY%5D%7D,%0A            _LOGGER):%0A        return False%0A
+%0ACONFIG_SCHEMA = vol.Schema(%7B%0A    DOMAIN: vol.Schema(%7B%0A        vol.Required(CONF_API_KEY): cv.string,%0A        vol.Required(CONF_PASSWORD): cv.string,%0A        vol.Required(CONF_USERNAME): cv.string,%0A    %7D)%0A%7D, extra=vol.ALLOW_EXTRA)%0A%0A%0Adef setup(hass, config):%0A    %22%22%22Setup Insteon Hub component.%0A%0A    This will automatically import associated lights.%0A    %22%22%22
 %0A   
@@ -1159,17 +1159,16 @@
  service
-.
 %22)%0A     
@@ -1176,16 +1176,22 @@
   return
+ False
 %0A%0A    di

Migrate to voluptuous (#3372)