def test_legacy_group_factory(self):
     bridge = Bridge('localhost', 9999, version=5)
     white_group = group_factory(bridge, 1, 'test', WHITE)
     self.assertTrue(isinstance(white_group, WhiteGroup))
     rgbw_group = group_factory(bridge, 2, 'test', RGBW)
     self.assertTrue(isinstance(rgbw_group, RgbwGroup))
     bridge.close()
示例#2
0
def setup_platform(
    hass: HomeAssistant,
    config: ConfigType,
    add_entities: AddEntitiesCallback,
    discovery_info: DiscoveryInfoType | None = None,
) -> None:
    """Set up the LimitlessLED lights."""

    # Two legacy configuration formats are supported to maintain backwards
    # compatibility.
    config = rewrite_legacy(config)

    # Use the expanded configuration format.
    lights = []
    for bridge_conf in config[CONF_BRIDGES]:
        bridge = Bridge(
            bridge_conf.get(CONF_HOST),
            port=bridge_conf.get(CONF_PORT, DEFAULT_PORT),
            version=bridge_conf.get(CONF_VERSION, DEFAULT_VERSION),
        )
        for group_conf in bridge_conf.get(CONF_GROUPS):
            group = bridge.add_group(
                group_conf.get(CONF_NUMBER),
                group_conf.get(CONF_NAME),
                group_conf.get(CONF_TYPE, DEFAULT_LED_TYPE),
            )
            lights.append(
                LimitlessLEDGroup(group, {"fade": group_conf[CONF_FADE]}))
    add_entities(lights)
class TestLegacyBridge(unittest.TestCase):
    def setUp(self):
        self.bridge = Bridge('localhost', 9999, version=5)

    def test_add_group(self):
        group = self.bridge.add_group(1, 'test', WHITE)
        self.assertTrue(isinstance(group, WhiteGroup))

    def tearDown(self):
        self.bridge.close()
        self.assertTrue(self.bridge.is_closed)
class TestWhiteGroup(unittest.TestCase):
    def setUp(self):
        self.bridge = Bridge('localhost', 9999, version=5)

    def test_brightness(self):
        pass

    def test_temperature(self):
        pass

    def test_transition(self):
        pass

    def tearDown(self):
        self.bridge.close()
示例#5
0
def setup_platform(hass, config, add_devices_callback, discovery_info=None):
    """Setup the LimitlessLED lights."""
    from limitlessled.bridge import Bridge

    # Two legacy configuration formats are supported to
    # maintain backwards compatibility.
    config = rewrite_legacy(config)

    # Use the expanded configuration format.
    lights = []
    for bridge_conf in config.get('bridges'):
        bridge = Bridge(bridge_conf.get('host'),
                        port=bridge_conf.get('port', DEFAULT_PORT),
                        version=bridge_conf.get('version', DEFAULT_VERSION))
        for group_conf in bridge_conf.get('groups'):
            group = bridge.add_group(group_conf.get('number'),
                                     group_conf.get('name'),
                                     group_conf.get('type', DEFAULT_LED_TYPE))
            lights.append(LimitlessLEDGroup.factory(group))
    add_devices_callback(lights)
示例#6
0
def setup_platform(hass, config, add_devices, discovery_info=None):
    """Setup the LimitlessLED lights."""
    from limitlessled.bridge import Bridge

    # Two legacy configuration formats are supported to maintain backwards
    # compatibility.
    config = rewrite_legacy(config)

    # Use the expanded configuration format.
    lights = []
    for bridge_conf in config.get(CONF_BRIDGES):
        bridge = Bridge(bridge_conf.get(CONF_HOST),
                        port=bridge_conf.get(CONF_PORT, DEFAULT_PORT),
                        version=bridge_conf.get(CONF_VERSION, DEFAULT_VERSION))
        for group_conf in bridge_conf.get(CONF_GROUPS):
            group = bridge.add_group(
                group_conf.get(CONF_NUMBER), group_conf.get(CONF_NAME),
                group_conf.get(CONF_TYPE, DEFAULT_LED_TYPE))
            lights.append(LimitlessLEDGroup.factory(group))
    add_devices(lights)
示例#7
0
def setup_platform(hass, config, add_devices_callback, discovery_info=None):
    """ Gets the LimitlessLED lights. """
    from limitlessled.bridge import Bridge

    # Two legacy configuration formats are supported to
    # maintain backwards compatibility.
    config = rewrite_legacy(config)

    # Use the expanded configuration format.
    lights = []
    for bridge_conf in config.get('bridges'):
        bridge = Bridge(bridge_conf.get('host'),
                        port=bridge_conf.get('port', DEFAULT_PORT),
                        version=bridge_conf.get('version', DEFAULT_VERSION))
        for group_conf in bridge_conf.get('groups'):
            group = bridge.add_group(group_conf.get('number'),
                                     group_conf.get('name'),
                                     group_conf.get('type', DEFAULT_LED_TYPE))
            lights.append(LimitlessLEDGroup.factory(group))
    add_devices_callback(lights)
示例#8
0
def setup_platform(hass, config, add_devices, discovery_info=None):
    """Setup the LimitlessLED lights."""
    from limitlessled.bridge import Bridge

    # Two legacy configuration formats are supported to maintain backwards
    # compatibility.
    config = rewrite_legacy(config)

    # Use the expanded configuration format.
    lights = []
    for bridge_conf in config.get(CONF_BRIDGES):
        bridge = Bridge(bridge_conf.get(CONF_HOST),
                        port=bridge_conf.get(CONF_PORT, DEFAULT_PORT),
                        version=bridge_conf.get(CONF_VERSION, DEFAULT_VERSION))
        for group_conf in bridge_conf.get(CONF_GROUPS):
            group = bridge.add_group(
                group_conf.get(CONF_NUMBER),
                group_conf.get(CONF_NAME),
                group_conf.get(CONF_TYPE, DEFAULT_LED_TYPE))
            lights.append(LimitlessLEDGroup.factory(group))
    add_devices(lights)
示例#9
0
class TestLegacyLimitlessLED(unittest.TestCase):
    def setUp(self):
        self.ll = LimitlessLED()
        self.bridge = Bridge('localhost', 9999, version=5)
        self.group = self.bridge.add_group(1, 'test', WHITE)

    def test_add_bridge(self):
        self.ll.add_bridge(self.bridge)

    def test_group(self):
        self.ll.add_bridge(self.bridge)
        self.assertEqual(self.ll.group('test'), self.group)
示例#10
0
 def setUp(self):
     self.bridge = Bridge('localhost', 9999, version=5)
示例#11
0
#!/usr/bin/python3
from limitlessled.bridge import Bridge
from limitlessled.group.rgbw import RGBW
from limitlessled.group.white import WHITE
import time
import sys

bridge = Bridge('192.168.0.112',port=50000, version=1)
living_room=bridge.add_group(1, 'living_room', WHITE)
living_room.on = len(sys.argv) > 1 and sys.argv[1] == 'on'
time.sleep(2);
示例#12
0
import limitlessled
import time
import logging

terminate = False


def my_function():
    global terminate
    terminate = True
    pass


logging.basicConfig(level=logging.DEBUG)

logger = logging.getLogger()

logger.info("Setup group")
bridge = Bridge('192.168.178.232')
gartenhaus = bridge.add_group(1, 'gartenhaus', RGB)

pipeline = Pipeline().wait(10).on().wait(4).off()
pipeline.callback(my_function)

gartenhaus.enqueue(pipeline)
logger.info("Switch on group %s", gartenhaus)

while terminate == False:
    time.sleep(1)
示例#13
0
#!/usr/bin/python3
from limitlessled.bridge import Bridge
from limitlessled.group.rgbw import RGBW
from limitlessled.group.white import WHITE
import time
import sys

bridge = Bridge('192.168.0.120', version=6, port=5987)
living_room=bridge.add_group(2, 'living_room', WHITE)
living_room.on = len(sys.argv) > 1 and sys.argv[1] == 'on'
time.sleep(2);
示例#14
0
 def setUp(self):
     bridge = Bridge('localhost', 9999, version=5)
     self.commands = CommandSetLegacy(bridge, 1, 10)
def init_lights(): 
    bridge = Bridge('192.168.12.247') 
    bridge.incr_active()
    return bridge.add_group(1, 'demo', WHITE)
示例#16
0
 def setUp(self):
     self.ll = LimitlessLED()
     self.bridge = Bridge('localhost', 9999, version=5)
     self.group = self.bridge.add_group(1, 'test', WHITE)
示例#17
0
def init_lights():
    bridge = Bridge('192.168.12.247')
    bridge.incr_active()
    return bridge.add_group(1, 'demo', WHITE)