Пример #1
0
def __main():
    # import routines
    # print(help(routines.core))
    # print(help(routines.morse_code))
    # print(help(routines.light_eq))
    from lifxlan3.settings import global_settings
    print(global_settings.items())
    global_settings.preserve_brightness = False
    print(global_settings.items())
    return
    t = LifxLAN()
    l = t.multizone_lights[0]
    print(l.zones)
    l.set_theme(Themes.rainbow)
    return
    print(default_override.get('library'))
    print(default_override.get('library'))
    print(default_override.get('library'))
    print(default_override.get('library'))
    print(default_override.get('library'))
    return
    lifx = LifxLAN()
    lr1 = lifx.get_device_by_name('living room 1')

    return
    print(Themes.xmas.color_str('xmas'))
    print((Themes.xmas + Theme.from_colors()).color_str('snth'))
    return
    print(Themes.xmas.get_colors(6))
    lifx = LifxLAN()
    # lifx.set_color(Colors.DEFAULT)
    with lifx.reset_to_orig():
        lifx.turn_on()
        lifx.set_theme(Themes.xmas)
        time.sleep(15)
    return
    return test_powers()
    return grid_test()
    print(Colors)
    c = Colors.YALE_BLUE
    print(c.offset_hue(60))
    exhaust(map(print, Themes.snes))
    # exhaust(map(print, c.get_complements(1)))
    # exhaust(map(print, c.get_complements(1)))
    comps = c.get_complements(.2)
    # print(len(comps))
    lan = LifxLAN()
    print(lan.lights)
    ag = lan.auto_group()
    m = ag['master']
    print(m + ag['living_room'] + m)
    print(isinstance(m, Iterable))
    cs, vs = zip(*Colors)
    c = vs[0]
    print(len(c.get_complements(20)))
    print(c)
    c += vs[1]
    print(c, vs[0] + vs[1])
    print('JEB', Colors.sum(*vs))
    return

    print(m)
    print(lan.on_lights)
    print(lan.off_lights)
    return
    exhaust(map(print, m.color_power.items()))
    return
    m.set_color(Colors.DEFAULT)
    return
    for c in Themes.snes:
        m.set_color(c)
        time.sleep(5)
    return
    c = Color.mean(*(c for _, c in Colors))
    print(c)
    m.set_color(c)
    time.sleep(4)
    m.set_color(Colors.DEFAULT)

    return

    # for _ in range(20):
    #     t = get_vals(1300)
    #     t.sort()
    #     gb = groupby(t)
    #     for k, v in gb:
    #         print(k, sum(1 for _ in v))
    #     print()
    #
    # return
    for _ in range(20):
        t = Themes.xmas.get_colors(27)
        t.sort()
        gb = groupby(t)
        for k, v in gb:
            print(k, sum(1 for _ in v))
        print()
    return
    lan = LifxLAN()
    print(lan.auto_group())
    print(lan.color_lights)
    return
    l1 = lan.get_device_by_name('test')
    # l2 = lan.get_device_by_name('master 2')
    labels = [l.label for l in lan.lights]
    for lab in sorted(labels):
        print(lab)
    print(l1.color)

    duration = 4
    orig = l1.color
    l2.set_color(Color.from_hex(0xf4d92, l2.color.kelvin), duration=duration * 1000)
    time.sleep(duration)
    l2.set_color(orig, duration=duration * 1000)
    return
    print(len(lan.lights))
    print(l.color)
    print(l.power_level)
    print(lan.get_color_all_lights())
Пример #2
0
def __main():
    lan = LifxLAN()
    g = lan.auto_group()['master']
    exhaust(map(print, (light.power for light in g)))
    morse_code('s', g)