mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
limitlessled: Add support for multiple bridges
This adds support for a controlling multiple Limitless LED bridges.
This commit is contained in:
parent
34531895a0
commit
ab80af099c
@ -19,11 +19,14 @@ configuration.yaml file.
|
|||||||
|
|
||||||
light:
|
light:
|
||||||
platform: limitlessled
|
platform: limitlessled
|
||||||
host: 192.168.1.10
|
bridges:
|
||||||
|
- host: 192.168.1.10
|
||||||
group_1_name: Living Room
|
group_1_name: Living Room
|
||||||
group_2_name: Bedroom
|
group_2_name: Bedroom
|
||||||
group_3_name: Office
|
group_3_name: Office
|
||||||
group_4_name: Kitchen
|
group_4_name: Kitchen
|
||||||
|
- host: 192.168.1.11
|
||||||
|
group_2_name: Basement
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
@ -40,12 +43,16 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None):
|
|||||||
""" Gets the LimitlessLED lights. """
|
""" Gets the LimitlessLED lights. """
|
||||||
import ledcontroller
|
import ledcontroller
|
||||||
|
|
||||||
pool = ledcontroller.LedControllerPool([config['host']])
|
for bridge_id, bridge in enumerate(bridges):
|
||||||
|
bridge['id'] = bridge_id
|
||||||
|
|
||||||
|
pool = ledcontroller.LedControllerPool([x['host'] for x in bridges])
|
||||||
|
|
||||||
lights = []
|
lights = []
|
||||||
|
for bridge in bridges:
|
||||||
for i in range(1, 5):
|
for i in range(1, 5):
|
||||||
if 'group_%d_name' % (i) in config:
|
if 'group_%d_name' % (i) in bridge:
|
||||||
lights.append(LimitlessLED(pool, 0, i, config['group_%d_name' % (i)]))
|
lights.append(LimitlessLED(pool, bridge['id'], i, bridge['group_%d_name' % (i)]))
|
||||||
|
|
||||||
add_devices_callback(lights)
|
add_devices_callback(lights)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user