Update demo component

This commit is contained in:
Paulus Schoutsen 2015-08-30 13:48:40 -07:00
parent a8b932223f
commit 4cadc7df96
3 changed files with 10 additions and 11 deletions

View file

@ -46,12 +46,12 @@ def setup(hass, config):
hass, component, {component: {CONF_PLATFORM: 'demo'}})
# Setup room groups
lights = hass.states.entity_ids('light')
switches = hass.states.entity_ids('switch')
lights = sorted(hass.states.entity_ids('light'))
switches = sorted(hass.states.entity_ids('switch'))
media_players = sorted(hass.states.entity_ids('media_player'))
group.setup_group(hass, 'living room', [lights[0], lights[1], switches[0],
group.setup_group(hass, 'living room', [lights[2], lights[1], switches[0],
media_players[1]])
group.setup_group(hass, 'bedroom', [lights[2], switches[1],
group.setup_group(hass, 'bedroom', [lights[0], switches[1],
media_players[0]])
# Setup IP Camera
@ -68,7 +68,7 @@ def setup(hass, config):
hass, 'script',
{'script': {
'demo': {
'alias': 'Demo {}'.format(lights[0]),
'alias': 'Toggle {}'.format(lights[0].split('.')[1]),
'sequence': [{
'execute_service': 'light.turn_off',
'service_data': {ATTR_ENTITY_ID: lights[0]}

View file

@ -12,9 +12,8 @@ from homeassistant.components.light import (
LIGHT_COLORS = [
[0.861, 0.3259],
[0.6389, 0.3028],
[0.1684, 0.0416]
[0.368, 0.180],
[0.460, 0.470],
]
@ -22,8 +21,8 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None):
""" Find and return demo lights. """
add_devices_callback([
DemoLight("Bed Light", False),
DemoLight("Ceiling", True),
DemoLight("Kitchen", True)
DemoLight("Ceiling Lights", True, LIGHT_COLORS[0]),
DemoLight("Kitchen Lights", True, LIGHT_COLORS[1])
])

View file

@ -13,7 +13,7 @@ from homeassistant.const import DEVICE_DEFAULT_NAME
def setup_platform(hass, config, add_devices_callback, discovery_info=None):
""" Find and return demo switches. """
add_devices_callback([
DemoSwitch('Ceiling', True),
DemoSwitch('Decorative Lights', True),
DemoSwitch('AC', False)
])