diff --git a/homeassistant/components/light/blinksticklight.py b/homeassistant/components/light/blinksticklight.py index ad3bb2c67514afcac6304fd55bec223c2b1992ee..627097d47b94dbd80876d34598074aeac3a3580f 100644 --- a/homeassistant/components/light/blinksticklight.py +++ b/homeassistant/components/light/blinksticklight.py @@ -6,26 +6,37 @@ https://home-assistant.io/components/light.blinksticklight/ """ import logging -from homeassistant.components.light import (ATTR_RGB_COLOR, SUPPORT_RGB_COLOR, - Light) - -_LOGGER = logging.getLogger(__name__) +import voluptuous as vol +from homeassistant.components.light import (ATTR_RGB_COLOR, SUPPORT_RGB_COLOR, + Light, PLATFORM_SCHEMA) +from homeassistant.const import CONF_NAME +import homeassistant.helpers.config_validation as cv -REQUIREMENTS = ["blinkstick==1.1.7"] +CONF_SERIAL = 'serial' +DEFAULT_NAME = 'Blinkstick' +REQUIREMENTS = ["blinkstick==1.1.8"] +SUPPORT_BLINKSTICK = SUPPORT_RGB_COLOR +PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ + vol.Required(CONF_SERIAL): cv.string, + vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string, +}) -SUPPORT_BLINKSTICK = SUPPORT_RGB_COLOR +_LOGGER = logging.getLogger(__name__) # pylint: disable=unused-argument -def setup_platform(hass, config, add_devices_callback, discovery_info=None): +def setup_platform(hass, config, add_devices, discovery_info=None): """Add device specified by serial number.""" from blinkstick import blinkstick - stick = blinkstick.find_by_serial(config['serial']) + name = config.get(CONF_NAME) + serial = config.get(CONF_SERIAL) + + stick = blinkstick.find_by_serial(serial) - add_devices_callback([BlinkStickLight(stick, config['name'])]) + add_devices([BlinkStickLight(stick, name)]) class BlinkStickLight(Light): diff --git a/requirements_all.txt b/requirements_all.txt index 528254848707207654473fa69c7bcd881f941e8d..5b346816455048b63b05db385a26548e9b979ecd 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -35,7 +35,7 @@ apcaccess==0.0.4 astral==1.2 # homeassistant.components.light.blinksticklight -blinkstick==1.1.7 +blinkstick==1.1.8 # homeassistant.components.sensor.bitcoin blockchain==1.3.3