mirror of
https://github.com/home-assistant/core.git
synced 2025-08-05 13:45:12 +02:00
linting/flaking
This commit is contained in:
@@ -11,8 +11,7 @@ import voluptuous as vol
|
|||||||
|
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
from homeassistant.components.light import (
|
from homeassistant.components.light import (
|
||||||
ATTR_BRIGHTNESS, ENTITY_ID_FORMAT, Light, SUPPORT_BRIGHTNESS,
|
ATTR_BRIGHTNESS, ENTITY_ID_FORMAT, Light, SUPPORT_BRIGHTNESS)
|
||||||
PLATFORM_SCHEMA)
|
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_VALUE_TEMPLATE, ATTR_ENTITY_ID, ATTR_FRIENDLY_NAME, STATE_ON,
|
CONF_VALUE_TEMPLATE, ATTR_ENTITY_ID, ATTR_FRIENDLY_NAME, STATE_ON,
|
||||||
STATE_OFF, EVENT_HOMEASSISTANT_START
|
STATE_OFF, EVENT_HOMEASSISTANT_START
|
||||||
@@ -49,6 +48,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
vol.Required(CONF_LIGHTS): vol.Schema({cv.slug: LIGHT_SCHEMA}),
|
vol.Required(CONF_LIGHTS): vol.Schema({cv.slug: LIGHT_SCHEMA}),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
||||||
"""Set up Template Lights."""
|
"""Set up Template Lights."""
|
||||||
@@ -75,7 +75,7 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if not lights:
|
if not lights:
|
||||||
_LOGGER.error("No lights added");
|
_LOGGER.error("No lights added")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
async_add_devices(lights, True)
|
async_add_devices(lights, True)
|
||||||
@@ -180,7 +180,8 @@ class LightTemplate(Light):
|
|||||||
self._state = state in ('true', STATE_ON)
|
self._state = state in ('true', STATE_ON)
|
||||||
else:
|
else:
|
||||||
_LOGGER.error(
|
_LOGGER.error(
|
||||||
'Received invalid switch is_on state: %s. Expected: %s',
|
'Received invalid switch is_on state: %s. ' +
|
||||||
|
'Expected: %s',
|
||||||
state, ', '.join(_VALID_STATES))
|
state, ', '.join(_VALID_STATES))
|
||||||
self._state = None
|
self._state = None
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user