Skip to content
Permalink
Browse files

Clean up light example (#7)

* Fix lint issues.
* Follow current standard.
  • Loading branch information...
MartinHjelmare authored and balloob committed Apr 27, 2019
1 parent 6291fb7 commit 351afec33de3f88132b7522f400912b2cd81c710
Showing with 11 additions and 12 deletions.
  1. +11 −12 custom_components/example_light/light.py
@@ -3,11 +3,11 @@

import voluptuous as vol

# Import the device class from the component that you want to support
from homeassistant.components.light import ATTR_BRIGHTNESS, Light, PLATFORM_SCHEMA
from homeassistant.const import CONF_HOST, CONF_USERNAME, CONF_PASSWORD
import homeassistant.helpers.config_validation as cv

# Import the device class from the component that you want to support
from homeassistant.components.light import (
ATTR_BRIGHTNESS, PLATFORM_SCHEMA, Light)
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME

_LOGGER = logging.getLogger(__name__)

@@ -19,14 +19,14 @@
})


def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the Awesome Light platform."""
def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Awesome Light platform."""
import awesomelights

# Assign configuration variables. The configuration check takes care they are
# present.
host = config.get(CONF_HOST)
username = config.get(CONF_USERNAME)
# Assign configuration variables.
# The configuration check takes care they are present.
host = config[CONF_HOST]
username = config[CONF_USERNAME]
password = config.get(CONF_PASSWORD)

# Setup connection with devices/cloud
@@ -38,8 +38,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
return

# Add devices
add_devices(AwesomeLight(light) for light in hub.lights())

add_entities(AwesomeLight(light) for light in hub.lights())


class AwesomeLight(Light):

0 comments on commit 351afec

Please sign in to comment.
You can’t perform that action at this time.