Пример #1
0
    # Percentage
    target_brightness_percent = 80

    # Parse any command-line arguments.
    target_preset.parse_arguments()

    color_choices = {}
    color_choices['red'] = [0.703, 0.296]
    color_choices['magenta'] = [0.3681, 0.1683]
    color_choices['purple'] = [0.2977, 0.1415]
    color_choices['blue'] = [0.1393,0.0813]
    color_choices['cyan'] = [0.1605,0.311]
    color_choices['green'] = [0.214,0.709]
    color_choices['yellow'] = [0.426,0.5299]
    color_choices['orange'] = [0.6222,0.3642]

    color_names = color_choices.keys()
    number_of_choices = len(color_names) - 1

    picked_index = random.randint(0, number_of_choices)
    # print "Picked Index: %d" % picked_index
    # print "Color Name: %s" % color_names[picked_index]
    preset_color_value = color_choices[color_names[picked_index]]

    target_preset.define_preset([
        {'id': 17, 'on': True, 'bri': target_brightness_percent, 'xy': preset_color_value, 'transitiontime': 300}, # 30 seconds
    ])

    hipchat_notification.send_preset('Coffee Table', 'Living Room')
    target_preset.execute()
Пример #2
0
# If you're running this from anywhere else this will make it work
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), '..', '..')))

import pyhueapi
from pyhueapi.preset import Preset
from pyhueapi import hipchat_notification

if __name__ == '__main__':
    target_preset = Preset()

    # CT color mode
    color_temperature = 340

    # Percentage
    target_brightness_percent = 100
    overhead_brightness_precent = 30

    # Parse any command-line arguments.
    target_preset.parse_arguments()

    # Define the preset
    target_preset.define_preset([
        {'id':  2, 'on': True, 'bri': target_brightness_percent, 'ct': color_temperature},
        {'id': 10, 'on': True, 'bri': target_brightness_percent, 'ct': color_temperature},
        {'id': 12, 'on': True, 'bri': target_brightness_percent, 'ct': color_temperature}
    ])

    hipchat_notification.send_preset('Warm', 'Office')

    target_preset.execute()
Пример #3
0
sys.path.append(os.path.abspath(os.path.join(os.path.curdir, '..', '..')))

# If you're running this from anywhere else this will make it work
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), '..', '..')))

import pyhueapi
from pyhueapi.preset import Preset
from pyhueapi import hipchat_notification

if __name__ == '__main__':
    target_preset = Preset()

    # CT color mode
    color_temperature = 340

    # Percentage
    target_brightness_percent = 75

    # Parse any command-line arguments.
    target_preset.parse_arguments()

    # Define the preset
    target_preset.define_preset([
        {'id': 15, 'on': False, 'bri': target_brightness_percent, 'ct': color_temperature},
        {'id': 16, 'on': False, 'bri': target_brightness_percent, 'ct': color_temperature},
    ])

    hipchat_notification.send_preset('Dining Off', 'Living Room')

    target_preset.execute()
Пример #4
0
if __name__ == '__main__':
    target_preset = Preset()

    # CT color mode
    color_temperature = pyhueapi.utils.kelvin_to_ct(3400)
    # print color_temperature
    # import sys
    # sys.exit(0)

    # Percentage
    target_brightness_percent = 100

    # Parse any command-line arguments.
    target_preset.parse_arguments()

    # Define the preset
    final_preset = []
    # for light_id in [1, 3, 4, 5, 6, 7, 8, 9]:
    for light_id in [2, 10, 12, 19, 20, 21, 22, 23, 24]:
        final_preset.append({
            'id': light_id,
            'on': True,
            'bri': target_brightness_percent,
            'ct': color_temperature
        })
    target_preset.define_preset(final_preset)

    hipchat_notification.send_preset('Night', 'Office')
    target_preset.execute()
Пример #5
0
    target_preset = Preset()

    # CT color mode
    color_temperature = 340

    # Percentage
    target_brightness_percent = 80

    # Parse any command-line arguments.
    target_preset.parse_arguments()

    # Define the preset
    first_color = [0.408, 0.517]
    second_color = [0.168, 0.041]

    target_preset.define_preset(
        [
            # {'id':  2, 'on': True, 'bri': target_brightness_percent, 'xy': first_color},
            # {'id': 10, 'on': True, 'bri': target_brightness_percent, 'xy': first_color},
            # {'id': 12, 'on': True, 'bri': target_brightness_percent, 'xy': first_color},
            {"id": 13, "on": True, "bri": target_brightness_percent, "xy": second_color},
            {"id": 14, "on": True, "bri": target_brightness_percent, "xy": second_color},
            {"id": 15, "on": True, "bri": target_brightness_percent, "xy": second_color},
            {"id": 16, "on": True, "bri": target_brightness_percent, "xy": second_color},
        ]
    )

    hipchat_notification.send_preset("Seahawks", "Living Room")

    target_preset.execute()
Пример #6
0
    print "Right now it is %s F" % current_temperature
    print "Today Forecast: %s to %s F" % (today_forecast_low, today_forecast_high)
    print "Tomorrow Forecast: %s to %s F" % (tomorrow_forecast_low, tomorrow_forecast_high)

    print '-' * 80
    print "Right Now  color: %s"    % determine_color(current_temperature)
    print "Today Low  color: %s"    % determine_color(today_forecast_low)
    print "Today High color: %s"    % determine_color(today_forecast_high)
    print "Tomorrow Low  color: %s" % determine_color(tomorrow_forecast_low)
    print "Tomorrow High color: %s" % determine_color(tomorrow_forecast_high)

    color_current_temperature = determine_color(current_temperature)
    color_today_low = determine_color(today_forecast_low)
    color_today_high = determine_color(today_forecast_high)
    color_tomorrow_low = determine_color(tomorrow_forecast_low)
    color_tomorrow_high = determine_color(tomorrow_forecast_high)

    target_preset = Preset()
    target_preset.parse_arguments()

    top_color = color_today_high
    mid_color = color_current_temperature
    bot_color = color_today_high

    target_preset.define_preset([
        {'id': 10, 'on': True, 'bri': 100, 'xy': top_color, 'transitiontime': 10000 },
        {'id': 2,  'on': True, 'bri': 100, 'xy': mid_color, 'transitiontime': 10000 },
        {'id': 12, 'on': True, 'bri': 100, 'xy': top_color, 'transitiontime': 10000 },
        ])
    target_preset.execute()
Пример #7
0
        elif light_id in [23]:
            print "Building 23"
            # Middle
            power_setting = True
            target_brightness = 30

        elif light_id in [24]:
            # Bottom
            print "Building 24"
            power_setting = True
            target_brightness = 30

        else:
            power_setting = True
            target_brightness = 10

        preset_list.append({"id": light_id, "on": power_setting, "bri": target_brightness, "ct": color_temperature})

    pprint(preset_list)
    target_preset.define_preset(preset_list)
    hipchat_notification.send_preset("EliteDangerous", "Office")
    target_preset.execute()

    broker = IronQueue.get()
    print "Queues: %s" % broker.queues()
    queue = broker.queue("lights-circadian")

    payload = {"room_id": 6, "enabled": False}
    # queue.post(json.dumps(payload))
Пример #8
0
        {'id': 7,  'on': True, 'bri': 100, 'ct': 156, 'transitiontime': topFadeTime},
    ]

    preset = [
        preset1,
        preset2,
        preset3
    ]

    target_preset = Preset()

    # Parse any command-line arguments.
    target_preset.parse_arguments()

    #
    target_preset.define_preset(preset0)

    hipchat_notification.send_preset('Fancy Wakeup', 'all')
    target_preset.execute()

    # from pprint import pprint
    for i in preset:
        # pprint(i)
        # print "------------------------------------------"
        target_preset.define_preset(i)
        target_preset.execute()

        if i > 1:
            print "Sleeping..."
            # sleep((topFadeTime / 10) + 1)
            sleep(45)
Пример #9
0
from pyhueapi.preset import Preset
from pyhueapi import hipchat_notification

if __name__ == '__main__':
    target_preset = Preset()

    # CT color mode
    color_temperature = 340

    # Percentage
    target_brightness_percent = 100
    overhead_brightness_precent = 30

    # Parse any command-line arguments.
    target_preset.parse_arguments()

    # Define the preset
    target_preset.define_preset([
        # {'id':  2, 'on': True, 'bri': target_brightness_percent, 'ct': color_temperature},
        # {'id': 10, 'on': True, 'bri': target_brightness_percent, 'ct': color_temperature},
        # {'id': 12, 'on': True, 'bri': target_brightness_percent, 'ct': color_temperature},
        {'id': 13, 'on': True, 'bri': target_brightness_percent, 'ct': color_temperature},
        {'id': 14, 'on': True, 'bri': target_brightness_percent, 'ct': color_temperature},
        {'id': 15, 'on': True, 'bri': overhead_brightness_precent, 'ct': color_temperature},
        {'id': 16, 'on': True, 'bri': overhead_brightness_precent, 'ct': color_temperature},
    ])

    hipchat_notification.send_preset('Warm', 'Living Room')

    target_preset.execute()
Пример #10
0
from pyhueapi import hipchat_notification

if __name__ == '__main__':
    target_preset = Preset()

    # CT color mode
    color_temperature = 340

    # Percentage
    target_brightness_percent = 80

    # Parse any command-line arguments.
    target_preset.parse_arguments()

    # Define the preset
    first_color = [0.5489, 0.4137]  # ORANGE
    second_color = [0.168, 0.041]   # BLUE

    target_preset.define_preset([
        # {'id':  2, 'on': True, 'bri': target_brightness_percent, 'xy': first_color},
        # {'id': 10, 'on': True, 'bri': target_brightness_percent, 'xy': first_color},
        # {'id': 12, 'on': True, 'bri': target_brightness_percent, 'xy': first_color},
        {'id': 13, 'on': True, 'bri': target_brightness_percent, 'xy': second_color},
        {'id': 14, 'on': True, 'bri': target_brightness_percent, 'xy': first_color},
        {'id': 15, 'on': True, 'bri': target_brightness_percent, 'xy': second_color},
        {'id': 16, 'on': True, 'bri': target_brightness_percent, 'xy': second_color},
    ])

    hipchat_notification.send_preset('Broncoes', 'Living Room')
    target_preset.execute()
Пример #11
0
    target_preset = Preset()

    # CT color mode
    color_temperature = 340
    # xy_color = [0.139, 0.081]   # Blue
    xy_color = [0.3133, 0.3289] # White

    # Percentage
    target_brightness_percent = 10

    # Parse any command-line arguments.
    target_preset.parse_arguments()

    # Define the preset
    target_preset.define_preset([
        # {'id':  2, 'on': False, 'bri': target_brightness_percent, 'ct': color_temperature},    # Triple Lamp
        # {'id': 10, 'on': False, 'bri': target_brightness_percent, 'ct': color_temperature},    # Triple Lamp
        # {'id': 12, 'on': False, 'bri': target_brightness_percent, 'ct': color_temperature},    # Triple Lamp

        {'id': 13, 'on': True, 'bri': target_brightness_percent, 'ct': color_temperature},    # Living Room (North Couch)
        {'id': 14, 'on': True, 'bri': target_brightness_percent, 'ct': color_temperature},    # Living Room (South Couch)

        {'id': 15, 'on': False, 'bri': target_brightness_percent, 'ct': color_temperature},     # Dining (Niche)
        {'id': 16, 'on': False, 'bri': target_brightness_percent, 'ct': color_temperature},    # Dining (Table)
        {'id': 17, 'on': True,  'bri': 100, 'xy': xy_color},             # Living Room (Couch Backlight)
    ])

    hipchat_notification.send_preset('Movie', 'Living Room')

    target_preset.execute()