mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 18:27:09 +00:00
Update demo component
This commit is contained in:
parent
a8b932223f
commit
4cadc7df96
@ -46,12 +46,12 @@ def setup(hass, config):
|
|||||||
hass, component, {component: {CONF_PLATFORM: 'demo'}})
|
hass, component, {component: {CONF_PLATFORM: 'demo'}})
|
||||||
|
|
||||||
# Setup room groups
|
# Setup room groups
|
||||||
lights = hass.states.entity_ids('light')
|
lights = sorted(hass.states.entity_ids('light'))
|
||||||
switches = hass.states.entity_ids('switch')
|
switches = sorted(hass.states.entity_ids('switch'))
|
||||||
media_players = sorted(hass.states.entity_ids('media_player'))
|
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]])
|
media_players[1]])
|
||||||
group.setup_group(hass, 'bedroom', [lights[2], switches[1],
|
group.setup_group(hass, 'bedroom', [lights[0], switches[1],
|
||||||
media_players[0]])
|
media_players[0]])
|
||||||
|
|
||||||
# Setup IP Camera
|
# Setup IP Camera
|
||||||
@ -68,7 +68,7 @@ def setup(hass, config):
|
|||||||
hass, 'script',
|
hass, 'script',
|
||||||
{'script': {
|
{'script': {
|
||||||
'demo': {
|
'demo': {
|
||||||
'alias': 'Demo {}'.format(lights[0]),
|
'alias': 'Toggle {}'.format(lights[0].split('.')[1]),
|
||||||
'sequence': [{
|
'sequence': [{
|
||||||
'execute_service': 'light.turn_off',
|
'execute_service': 'light.turn_off',
|
||||||
'service_data': {ATTR_ENTITY_ID: lights[0]}
|
'service_data': {ATTR_ENTITY_ID: lights[0]}
|
||||||
|
@ -12,9 +12,8 @@ from homeassistant.components.light import (
|
|||||||
|
|
||||||
|
|
||||||
LIGHT_COLORS = [
|
LIGHT_COLORS = [
|
||||||
[0.861, 0.3259],
|
[0.368, 0.180],
|
||||||
[0.6389, 0.3028],
|
[0.460, 0.470],
|
||||||
[0.1684, 0.0416]
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@ -22,8 +21,8 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None):
|
|||||||
""" Find and return demo lights. """
|
""" Find and return demo lights. """
|
||||||
add_devices_callback([
|
add_devices_callback([
|
||||||
DemoLight("Bed Light", False),
|
DemoLight("Bed Light", False),
|
||||||
DemoLight("Ceiling", True),
|
DemoLight("Ceiling Lights", True, LIGHT_COLORS[0]),
|
||||||
DemoLight("Kitchen", True)
|
DemoLight("Kitchen Lights", True, LIGHT_COLORS[1])
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ from homeassistant.const import DEVICE_DEFAULT_NAME
|
|||||||
def setup_platform(hass, config, add_devices_callback, discovery_info=None):
|
def setup_platform(hass, config, add_devices_callback, discovery_info=None):
|
||||||
""" Find and return demo switches. """
|
""" Find and return demo switches. """
|
||||||
add_devices_callback([
|
add_devices_callback([
|
||||||
DemoSwitch('Ceiling', True),
|
DemoSwitch('Decorative Lights', True),
|
||||||
DemoSwitch('AC', False)
|
DemoSwitch('AC', False)
|
||||||
])
|
])
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user