Exemple #1
0
def send_light_commands(bulbs, rgb, dark_ratio, party=False):
    screen = get_screen_object()

    bulb_states = {}
    for bulb in bulbs:
        bulb_settings = screen.bulb_settings[unicode(bulb)]
        bulb_max_bri = bulb_settings['max_bri']
        bulb_min_bri = bulb_settings['min_bri']
        bri = utility.get_brightness(screen, bulb_max_bri, bulb_min_bri,
                                     dark_ratio)

        if party:
            rgb = utility.party_rgb()
            try:
                bri = random.randrange(int(screen.min_bri), int(bri) + 1)
            except ValueError:
                continue

        try:
            bulb_settings = screen.bulb_settings[str(bulb)]
            bulb_state = hue_interface.get_bulb_state(bulb_settings, rgb, bri,
                                                      screen.update)
            bulb_states[bulb] = bulb_state
        except Exception as e:
            print e.message
            continue

    for bulb in bulb_states:
        hue_interface.update_light(screen.ip, screen.devicename, bulb,
                                   bulb_states[bulb])
Exemple #2
0
def send_light_commands(bulbs, rgb, dark_ratio, party=False):
    screen = get_screen_object()
    for bulb in bulbs:
        bulb_settings = screen.bulb_settings[unicode(bulb)]
        bulb_max_bri = bulb_settings['max_bri']
        bulb_min_bri = bulb_settings['min_bri']
        bri = utility.get_brightness(screen, bulb_max_bri, bulb_min_bri, dark_ratio)

        if party:
            rgb = utility.party_rgb()
            try:
                bri = random.randrange(int(screen.min_bri), int(bri) + 1)
            except ValueError:
                continue

        hue_interface.send_rgb_or_xy_to_bulb(bulb, rgb, bri)
Exemple #3
0
def send_light_commands(bulbs, rgb, dark_ratio, party=False):
    screen = get_screen_object()

    for bulb in bulbs:
        bulb_settings = screen.bulb_settings[unicode(bulb)]
        bulb_max_bri = bulb_settings['max_bri']
        bulb_min_bri = bulb_settings['min_bri']
        bri = utility.get_brightness(screen, bulb_max_bri, bulb_min_bri, dark_ratio)

        if party:
            rgb = utility.party_rgb()
            try:
                bri = random.randrange(int(screen.min_bri), int(bri) + 1)
            except ValueError:
                continue

        hue_interface.send_rgb_or_xy_to_bulb(bulb, rgb, bri)
Exemple #4
0
def send_light_commands(rgb, dark_ratio, party=False):
    global _screen

    active_bulbs = [bulb for bulb in _screen.bulbs if bulb]
    for bulb in active_bulbs:
        bulb_settings = _screen.bulb_settings[unicode(bulb)]
        bulb_max_bri = bulb_settings['max_bri']
        bulb_min_bri = bulb_settings['min_bri']
        bri = utility.get_brightness(_screen, bulb_max_bri, bulb_min_bri,
                                     dark_ratio)

        if party:
            rgb = utility.party_rgb()
            try:
                bri = random.randrange(int(_screen.min_bri), int(bri) + 1)
            except ValueError as e:
                print e
                continue
        hue_interface.send_rgb_to_bulb(bulb, rgb, bri)
Exemple #5
0
def update_bulb_party():
    screen = get_screen_object()
    active_bulbs = [bulb for bulb in screen.bulbs if bulb]
    party_color = utility.party_rgb()
    send_light_commands(active_bulbs, party_color, 0.0, party=True)
Exemple #6
0
def update_bulb_party():
    global _screen
    print '\nParty Mode!'
    party_color = utility.party_rgb()
    send_light_commands(party_color, 0.0, party=True)
Exemple #7
0
def update_bulb_party():
    screen = get_screen_object()
    active_bulbs = [bulb for bulb in screen.bulbs if bulb]
    party_color = utility.party_rgb()
    send_light_commands(active_bulbs, party_color, 0.0, party=True)