Esempio n. 1
0
def main():
    lifx = LifxLAN(1)
    devices = lifx.get_lights()
    count = 0
    while len(devices) == 0 and count < 10:
        sleep(2)
        devices = lifx.get_lights()
        count += 1

    bulb = devices[0]
    bulb.set_power("on")
    bulb.set_color(RED, 10, True)
    sunrise(bulb, 30, 100)
Esempio n. 2
0
 def __init__(self, mac = None, ip = None):
     self.bulb = None
     if mac != None and ip != None:
         self.bulb = Light(mac, ip) # put a try block in here later
     elif self.bulb == None: #put this in the catch block later
         lights = LifxLAN(1)
         self.bulb = lights.get_lights()[0]  # just get whatever light you find
     else:
         lights = LifxLAN(1)
         self.bulb = lights.get_lights()[0]
     self.color = 0
     #self.colors = [BLUE, CYAN, GREEN, ORANGE, PINK, PURPLE, RED, YELLOW, WHITE]
     self.colors = [BLUE, GREEN, RED, WHITE]
def find_lights():
    num_lights = None
    if len(sys.argv) != 2:
        print("\nDiscovery will go much faster if you provide the number\
            of lights on your LAN:")
        print("  python {} <number of lights on LAN>\n".format(sys.argv[0]))
    else:
        num_lights = int(sys.argv[1])

    # instantiate LifxLAN client, num_lights may be None (unknown).
    # In fact, you don't need to provide LifxLAN with the number of bulbs
    # at all.
    # lifx = LifxLAN() works just as well. Knowing the number of bulbs in
    # advance simply makes initial bulb discovery faster.
    print("Discovering lights...")
    lifx = LifxLAN(num_lights)

    # get devices
    devices = lifx.get_lights()
    print("\nFound {} light(s):\n".format(len(devices)))
    for d in devices:
        try:
            print(d)
        except():
            pass
Esempio n. 4
0
def main():
    # Get the data from standard in
    # lines = read_in()

    num_lights = None
    if len(sys.argv) != 2:
        print(
            "\nDiscovery will go much faster if you provide the number of lights on your LAN:"
        )
        print("  python {} <number of lights on LAN>\n".format(sys.argv[0]))
    else:
        num_lights = int(sys.argv[1])

    # instantiate LifxLAN client, num_lights may be None (unknown).
    # In fact, you don't need to provide LifxLAN with the number of bulbs at all.
    # lifx = LifxLAN() works just as well. Knowing the number of bulbs in advance
    # simply makes initial bulb discovery faster.
    print("Discovering lights...")
    lifx = LifxLAN(num_lights)

    # get devices
    devices = lifx.get_lights()
    bulb = devices[0]
    print("Selected {}".format(bulb.get_label()))

    # get original state
    # original_power = bulb.get_power()
    # original_color = bulb.get_color()

    # TURN BULB ON over time
    bulb.set_power("on", 20000)
Esempio n. 5
0
def main():
    num_lights = None
    if len(sys.argv) != 2:
        print(
            "\nDiscovery will go much faster if you provide the number of lights on your LAN:"
        )
        print("  python {} <number of lights on LAN>\n".format(sys.argv[0]))
    else:
        num_lights = int(sys.argv[1])

    # instantiate LifxLAN client, num_lights may be None (unknown).
    # In fact, you don't need to provide LifxLAN with the number of bulbs at all.
    # lifx = LifxLAN() works just as well. Knowing the number of bulbs in advance
    # simply makes initial bulb discovery faster.
    lifx = LifxLAN(num_lights)

    # get devices
    print("Discovering lights...")
    devices = lifx.get_lights()

    print("Found {} lights:".format(len(devices)))

    for d in devices:
        print("{} ({}) P: {} (HSBK): {}".format(d.get_label(), d.mac_addr,
                                                d.get_power() / 65535,
                                                d.get_color()))
Esempio n. 6
0
def main():
    num_lights = None
    if len(sys.argv) != 2:
        print(
            "\nDiscovery will go much faster if you provide the number of lights on your LAN:"
        )
        print("  python {} <number of lights on LAN>\n".format(sys.argv[0]))
    else:
        num_lights = int(sys.argv[1])

    print("Discovering lights...")
    lifx = LifxLAN(num_lights)

    devices = lifx.get_lights()

    bulb = devices[0]

    print("Making colors happen...")
    while True:
        bulb.set_color(WHITE, 15000, False)
        time.sleep(60)
        bulb.set_color(BLUE1, 15000, False)
        time.sleep(60)
        bulb.set_color(PINK1, 15000, False)
        time.sleep(60)
Esempio n. 7
0
def main():
    # Knowing the number of bulbs in advance would make initial bulb discovery faster.
    print("Discovering lights...")
    lifx = LifxLAN()

    #if len(sys.argv) != 2:
    #    print("NO BUILD STATUS SPECIFIED")
    #    print("  python {} <build status>\n".format(sys.argv[0]))
    #    exit(1)

    status = sys.argv[1]

    # find device
    devices = lifx.get_lights()
    bulb = [x for x in devices if x.get_label() == "Bedroom Roof"]

    print("Found device: {}".format(bulb))
    if not bulb:
        print("No bulb found")
        return

    bulb = bulb[0]
    power = bulb.get_power()
    print(power)
    if power:
        print("Power is ON")
        print(bulb.get_color())
        target_color = build_color(status)
        bulb.set_color(target_color, 0.4)
Esempio n. 8
0
def main():
    num_lights = None
    if len(sys.argv) != 2:
        print(
            "\nDiscovery will go much faster if you provide the number of lights on your LAN:"
        )
        print("  python {} <number of lights on LAN>\n".format(sys.argv[0]))
    else:
        num_lights = int(sys.argv[1])

    # instantiate LifxLAN client, num_lights may be None (unknown).
    # In fact, you don't need to provide LifxLAN with the number of bulbs at all.
    # lifx = LifxLAN() works just as well. Knowing the number of bulbs in advance
    # simply makes initial bulb discovery faster.
    print("Discovering lights...")
    lifx = LifxLAN(num_lights, verbose=True)

    # get devices
    devices = lifx.get_lights()
    labels = []
    for device in devices:
        labels.append(device.get_label())
    print("Found Bulbs:")
    for label in labels:
        print("  " + str(label))
Esempio n. 9
0
def get_light(label: str) -> Optional[Light]:
    lan = LifxLAN()
    lights = lan.get_lights()
    # need to call get_label as otherwise it's not initialized
    lights = [l for l in lights if l.get_label() and l.label == label]
    if len(lights) == 1:
        return lights[0]
    return None
Esempio n. 10
0
def getBulbInfo():
    lifx = LifxLAN(1)
    try:
        bulb = lifx.get_lights()[0]
    except:
        print("No bulbs found.  Exiting.")
        exit(1)
    return bulb
Esempio n. 11
0
def get_lights():
    num_lights = 2
    lifx = LifxLAN(num_lights)
    lights = lifx.get_lights()
    light_dict = {}
    for light in lights:
        light_dict[light.get_label()] = light
    return light_dict
Esempio n. 12
0
def main():
	lifx = LifxLAN(3)
	devices = lifx.get_lights()
	
	for d in devices:
		print("{} ({}) HSBK: {}".format(d.get_label(), d.mac_addr, d.get_color()))

	if __name__=="__main__":
		main()
Esempio n. 13
0
def main(version):
    app = Application()
    lan = LifxLAN(1)
    lights = lan.get_lights()

    for a in lights:
        a.set_power(0)

    return app.run(sys.argv)
Esempio n. 14
0
 def __update_local_lights(self):
     refresh = self.last_refresh_time - time.time() > self.refresh_threshold
     self.last_refresh_time = time.time()
     if (self.mac is None) or (self.ip is None) or refresh:
         lifx = LifxLAN()
         self.lights = lifx.get_lights()
         for _light in self.lights:
             self.mac = _light.get_mac_addr()
             self.ip = _light.get_ip_addr()
Esempio n. 15
0
class Lifx():
    def __init__(self, num_lights):
        self.lifx = LifxLAN(1)

        self.bulb = self.lifx.get_lights()[0]

    def toggle_power(self):
        original_power_state = self.bulb.get_power()
        self.bulb.set_power("on" if original_power_state == 0 else "off")
Esempio n. 16
0
def init_bulb(num_lights=1):
    """
    Initializes the light bulb for use
    """
    lifx = LifxLAN(num_lights)
    devices = lifx.get_lights()

    # I have only one Lifx light currently, may change this code in the future
    bulb = devices[0]
    return bulb
Esempio n. 17
0
    def get_function(self, message=None):

        lifx = LifxLAN(1)
        devices = lifx.get_lights()
        mac = message.get("mac", "none")
        for each_buld in devices:
            print (each_buld.mac_addr)
            if each_buld.mac_addr == mac:
                self.bulb = each_buld
        return self.toggle
Esempio n. 18
0
def main():
    num_lights = None
    if len(sys.argv) != 2:
        print(
            "\nDiscovery will go much faster if you provide the number of lights on your LAN:"
        )
        print("  python {} <number of lights on LAN>\n".format(sys.argv[0]))
    else:
        num_lights = int(sys.argv[1])

    # instantiate LifxLAN client, num_lights may be None (unknown).
    # In fact, you don't need to provide LifxLAN with the number of bulbs at all.
    # lifx = LifxLAN() works just as well. Knowing the number of bulbs in advance
    # simply makes initial bulb discovery faster.
    lifx = LifxLAN(num_lights)
    bulbs = lifx.get_lights()

    # test power control
    print("Discovering lights...")
    original_powers = lifx.get_power_all_lights()
    original_colors = lifx.get_color_all_lights()
    print(original_colors)

    half_period_ms = 2500
    duration_mins = 20
    duration_secs = duration_mins * 60
    print("Breathing...")
    try:
        start_time = time()
        while True:
            for bulb in original_colors:
                color = original_colors[bulb]
                dim = list(copy(color))
                half_bright = int(dim[2] / 2)
                dim[2] = half_bright if half_bright >= 1900 else 1900
                bulb.set_color(dim, half_period_ms, rapid=True)
                sleep(half_period_ms / 1000.0)
            for bulb in original_colors:
                color = original_colors[bulb]
                bulb.set_color(color, half_period_ms, rapid=True)
                sleep(half_period_ms / 1000.0)
            if time() - start_time > duration_secs:
                raise KeyboardInterrupt
    except KeyboardInterrupt:
        print("Restoring original color to all lights...")
        for light in original_colors:
            color = original_colors[light]
            light.set_color(color)

        print("Restoring original power to all lights...")
        for light in original_powers:
            power = original_powers[light]
            light.set_power(power)
Esempio n. 19
0
def main():
    print("Discovering lights...")
    lifx = LifxLAN()

    # get devices
    devices = lifx.get_lights()
    print("\nFound {} light(s):\n".format(len(devices)))
    for d in devices:
        try:
            print(d)
        except:
            pass
Esempio n. 20
0
    def attempt_setup ():
        lan    = LifxLAN()
        # lights = lan.get_devices_by_name(our_lights).get_device_list()
        lights = lan.get_lights()
        lights = sorted(lights, key=lambda x: int(x.get_label().replace("A", "")))
        names  = [ l.get_label() for l in lights ]

        print("Found the following lights:")
        for name in names:
            print(f"  - {name}")

        # assert len(lights) == 10, "We need 10 lights"

        return lights
Esempio n. 21
0
def main():
    num_lights = None
    if len(sys.argv) != 2:
        print(
            "\nDiscovery will go much faster if you provide the number of lights on your LAN:"
        )
        print("  python {} <number of lights on LAN>\n".format(sys.argv[0]))
    else:
        num_lights = int(sys.argv[1])

    # instantiate LifxLAN client, num_lights may be None (unknown).
    # In fact, you don't need to provide LifxLAN with the number of bulbs at all.
    # lifx = LifxLAN() works just as well. Knowing the number of bulbs in advance
    # simply makes initial bulb discovery faster.
    print("Discovering lights...")
    lifx = LifxLAN(num_lights)

    # get devices
    devices = lifx.get_lights()
    bulb = devices[0]
    print(bulb)
    # print("Selected {}".format(bulb.get_label()))

    # get original state
    original_power = bulb.get_power()
    original_color = bulb.get_color()
    bulb.set_power("on")

    sleep(0.2)  # to look pretty

    print("Toggling power...")
    toggle_device_power(bulb, 0.2)

    print("Toggling color...")
    toggle_light_color(bulb, 0.2)

    # restore original color
    # color can be restored after the power is turned off as well
    print("Restoring original color and power...")
    bulb.set_color(original_color)

    sleep(1)  # to look pretty.

    # restore original power
    print(original_power)
    bulb.set_power(original_power)
Esempio n. 22
0
def main():
    num_lights = None
    if len(sys.argv) != 2:
        print("\nDiscovery will go much faster if you provide the number of lights on your LAN:")
        print("  python {} <number of lights on LAN>\n".format(sys.argv[0]))
    else:
        num_lights = int(sys.argv[1])

    print("Discovering lights...")
    lifx = LifxLAN(num_lights)

    devices = lifx.get_lights()

    bulb = devices[0]

    print("Setting Brightness...")
    bulb.set_brightness(41000, 0, False)
Esempio n. 23
0
File: Test.py Progetto: natn/lifxlan
def main():
    num_lights = None
    if len(sys.argv) != 2:
        print(
            "\nDiscovery will go much faster if you provide the number of lights on your LAN:"
        )
        print("  python {} <number of lights on LAN>\n".format(sys.argv[0]))
    else:
        num_lights = int(sys.argv[1])

    # instantiate LifxLAN client, num_lights may be None (unknown).
    # In fact, you don't need to provide LifxLAN with the number of bulbs at all.
    # lifx = LifxLAN() works just as well. Knowing the number of bulbs in advance
    # simply makes initial bulb discovery faster.
    print("Discovering lights...")
    lifx = LifxLAN(num_lights)

    # get devices
    devices = lifx.get_devices()
    lights = lifx.get_lights()
    print("Found {} devices(s).".format(len(devices)))
    print("Found {} light(s):\n".format(len(lights)))

    cpulight = lifx.get_device_by_name("CPU")
    print(cpulight)
    workbenchlight = lifx.get_device_by_name("Workbench")
    print(workbenchlight)

    cpulight.set_color(RED, rapid=True)
    workbenchlight.set_color(RED, rapid=True)
    sleep(5)
    cpulight.set_waveform(is_transient=0,
                          color=BLUE,
                          period=55000,
                          cycles=10000,
                          duty_cycle=0.5,
                          waveform=1,
                          rapid=False)
    workbenchlight.set_waveform(is_transient=0,
                                color=BLUE,
                                period=60000,
                                cycles=10000,
                                duty_cycle=0.5,
                                waveform=1,
                                rapid=False)
Esempio n. 24
0
    def __init__(self, no_blink=False, use_light_list=True):
        light_macs = json.load(open('light_macs.json', 'r')).get('lights')
        lan = LifxLAN()

        if light_macs is None or not use_light_list:
            self.lights = lan.get_lights()
        else:
            self.lights = [Light(mac['mac'], mac['ip']) for mac in light_macs]
            #self.lights = filter(lambda x: x.mac_addr in [mac['mac'] for mac in light_macs], lan.get_lights())

        self.prev_light_power_color = self.store_power_color()
        if not no_blink:
            print "Blink lights"

            for light in self.lights:
                power = light.get_power()
                light.set_power(0)
                light.set_power(power)
Esempio n. 25
0
def _retrieve_lifx_lights() -> Dict[str, Light]:
    num_lights = 12
    # int(sys.argv[1])...(the first arg is the script path)
    print("Discovering lights...")
    lifx_client = LifxLAN(num_lights)  # Create LifxLAN client, num_lights may be None, it's just slower that way.
    # TODO: use get_devices_by_group instead (and of course put all the drum lights in a single group)
    device_list: List[Light] = lifx_client.get_lights()
    print("\nFound {} light(s):\n".format(len(device_list)))
    lights: Dict[str, Light] = {}
    for device in device_list:
        try:
            device.set_power(True)  # Initialize every light in the group to on
            lights[device.get_label()] = device
            print(device)
        except Exception:
            pass

    return lights
Esempio n. 26
0
def light():

    lifx = LifxLAN()

    # get devices
    devices = lifx.get_lights()

    bulb1 = devices[0]
    bulb2 = devices[1]

    # get original state
    original_power = bulb1.get_power()

    if original_power == 0:
        bulb1.set_power("on")
        bulb2.set_power("on")
    else:
        bulb1.set_power("off")
        bulb2.set_power("off")
Esempio n. 27
0
def main():
    num_lights = None
    if len(sys.argv) != 2:
        print(
            "\nDiscovery will go much faster if you provide the number of lights on your LAN:"
        )
        print("  python {} <number of lights on LAN>\n".format(sys.argv[0]))
    else:
        num_lights = int(sys.argv[1])

    # instantiate LifxLAN client, num_lights may be None (unknown).
    # In fact, you don't need to provide LifxLAN with the number of bulbs at all.
    # lifx = LifxLAN() works just as well. Knowing the number of bulbs in advance
    # simply makes initial bulb discovery faster.
    print("Discovering lights...")
    lifx = LifxLAN(num_lights)

    # get devices
    devices = lifx.get_lights()
    bulb = devices[0]
    print("Selected {}".format(bulb.get_label()))

    # get original state
    print("Turning on all lights...")
    original_power = bulb.get_power()
    original_color = bulb.get_color()
    bulb.set_power("on")

    sleep(1)  # for looks

    print("Flashy fast rainbow")
    rainbow(bulb, 0.1)

    print("Smooth slow rainbow")
    rainbow(bulb, 1, smooth=True)

    print("Restoring original power and color...")
    # restore original power
    bulb.set_power(original_power)
    # restore original color
    sleep(0.5)  # for looks
    bulb.set_color(original_color)
Esempio n. 28
0
def main():
    num_lights = None
    if len(sys.argv) != 2:
        print("\nDiscovery will go much faster if you provide the number of lights on your LAN:")
        print("  python {} <number of lights on LAN>\n".format(sys.argv[0]))
    else:
        num_lights = int(sys.argv[1])

    # instantiate LifxLAN client, num_lights may be None (unknown).
    # In fact, you don't need to provide LifxLAN with the number of bulbs at all.
    # lifx = LifxLAN() works just as well. Knowing the number of bulbs in advance 
    # simply makes initial bulb discovery faster.
    print("Discovering lights...")
    lifx = LifxLAN(num_lights)

    # get devices
    devices = lifx.get_lights()
    bulb = devices[0]
    print("Selected {}".format(bulb.get_label()))

    # get original state
    original_power = bulb.get_power()
    original_color = bulb.get_color()
    bulb.set_power("on")

    sleep(0.2) # to look pretty

    print("Toggling power...")
    toggle_device_power(bulb, 0.2)

    print("Toggling color...")
    toggle_light_color(bulb, 0.2)

    # restore original color
    # color can be restored after the power is turned off as well
    print("Restoring original color and power...")
    bulb.set_color(original_color)

    sleep(1) # to look pretty.

    # restore original power
    bulb.set_power(original_power)
Esempio n. 29
0
def main():
    num_lights = None
    if len(sys.argv) != 2:
        print("\nDiscovery will go much faster if you provide the number of lights on your LAN:")
        print("  python {} <number of lights on LAN>\n".format(sys.argv[0]))
    else:
        num_lights = int(sys.argv[1])

    # instantiate LifxLAN client, num_lights may be None (unknown).
    # In fact, you don't need to provide LifxLAN with the number of bulbs at all.
    # lifx = LifxLAN() works just as well. Knowing the number of bulbs in advance 
    # simply makes initial bulb discovery faster.
    lifx = LifxLAN(num_lights)

    # get devices
    print("Discovering lights...")
    devices = lifx.get_lights()

    for d in devices:
        print("{} ({}) HSBK: {}".format(d.get_label(), d.mac_addr, d.get_color()))
Esempio n. 30
0
def main():
	
    # instantiate LifxLAN client, num_lights may be None (unknown).
    # In fact, you don't need to provide LifxLAN with the number of bulbs at all.
    # lifx = LifxLAN() works just as well. Knowing the number of bulbs in advance 
    # simply makes initial bulb discovery faster.
	
	lifx = LifxLAN()
	
    # get devices
	devices = lifx.get_lights()
	bulb = devices[0]
    
    # get original state
	original_power = bulb.get_power()
            
	if original_power == 0:
		bulb.set_power("on")
		
	else:
		bulb.set_power("off")
Esempio n. 31
0
def main():
    num_lights = None
    if len(sys.argv) != 2:
        print("\nDiscovery will go much faster if you provide the number of lights on your LAN:")
        print("  python {} <number of lights on LAN>\n".format(sys.argv[0]))
    else:
        num_lights = int(sys.argv[1])

    # instantiate LifxLAN client, num_lights may be None (unknown).
    # In fact, you don't need to provide LifxLAN with the number of bulbs at all.
    # lifx = LifxLAN() works just as well. Knowing the number of bulbs in advance 
    # simply makes initial bulb discovery faster.
    print("Discovering lights...")
    lifx = LifxLAN(num_lights)

    # get devices
    devices = lifx.get_lights()
    bulb = devices[0]
    print("Selected {}".format(bulb.get_label()))

    # get original state
    print("Turning on all lights...")
    original_power = bulb.get_power()
    original_color = bulb.get_color()
    bulb.set_power("on")

    sleep(1) # for looks

    print("Flashy fast rainbow")
    rainbow(bulb, 0.1)

    print("Smooth slow rainbow")
    rainbow(bulb, 1, smooth=True)

    print("Restoring original power and color...")
    # restore original power
    bulb.set_power(original_power)
    # restore original color
    sleep(0.5) # for looks
    bulb.set_color(original_color)
Esempio n. 32
0
class LaserCatTheme():
    def __init__(self):
        self.client = LifxLAN()
        self.lights = self.client.get_lights()
        self.colors = [aqua, orag, pink]
        self.speed = 0.025

    def convert_hsb_to_65k_range(self, h, s, b):
        return ((h * max_range / hue_range), (s * max_range / sat_bri_r),
                (b * max_range / sat_bri_r), 3500)

    def set_theme(self, offset=0):
        for i, light in enumerate(self.lights):
            try:
                light.set_color(
                    self.convert_hsb_to_65k_range(
                        *self.colors[(i + offset) % len(self.colors)]))
            except:
                print('some shit went wrong yo, try and learn what. maybe...')

    def game_logic(self, dt):
        self.set_theme(int(self.speed * dt))
Esempio n. 33
0
def main():
    num_lights = None
    if len(sys.argv) != 2:
        print("\nDiscovery will go much faster if you provide the number of lights on your LAN:")
        print("  python {} <number of lights on LAN>\n".format(sys.argv[0]))
    else:
        num_lights = int(sys.argv[1])

    # instantiate LifxLAN client, num_lights may be None (unknown).
    # In fact, you don't need to provide LifxLAN with the number of bulbs at all.
    # lifx = LifxLAN() works just as well. Knowing the number of bulbs in advance 
    # simply makes initial bulb discovery faster.
    print("Discovering lights...")
    lifx = LifxLAN(num_lights, verbose=True)

    # get devices
    devices = lifx.get_lights()
    labels = []
    for device in devices:
        labels.append(device.get_label())
    print("Found Bulbs:")
    for label in labels:
        print("  " + str(label))
Esempio n. 34
0
def main():
    num_lights = None
    if len(sys.argv) != 2:
        print("\nDiscovery will go much faster if you provide the number of lights on your LAN:")
        print("  python {} <number of lights on LAN>\n".format(sys.argv[0]))
    else:
        num_lights = int(sys.argv[1])

    # instantiate LifxLAN client, num_lights may be None (unknown).
    # In fact, you don't need to provide LifxLAN with the number of bulbs at all.
    # lifx = LifxLAN() works just as well. Knowing the number of bulbs in advance
    # simply makes initial bulb discovery faster.
    print("Discovering lights...")
    lifx = LifxLAN(num_lights)

    # get devices
    devices = lifx.get_lights()
    print("\nFound {} light(s):\n".format(len(devices)))
    for d in devices:
        try:
        	print(d)
        except:
            pass
Esempio n. 35
0
def badLights():

    lifx = LifxLAN(int(1), False)
    devices = lifx.get_lights()
    bulb = devices[0]
    bulb.set_color(RED)

    def toggle_device_power(device, interval=0.5, num_cycles=3):
        rapid = True if interval < 1 else False
        for i in range(num_cycles):
            device.set_power("on", rapid)
            sleep(interval)
            device.set_power("off", rapid)
            sleep(interval)
            device.set_power("on", rapid)

    def toggle_light_color(light, interval=1, num_cycles=1):
        rapid = True if interval < 1 else False
        for i in range(num_cycles):
            light.set_color(RED, rapid=rapid)

        toggle_device_power(bulb, 0.2)
        toggle_light_color(bulb, 0.2)
Esempio n. 36
0
from phue import Bridge
from ouimeaux.environment import Environment
from myo import Myo
import requests
from device_listener import DeviceListener
from pose_type import PoseType
import time
import datetime

print('Getting light info')

#LIFX LIGHTS SECTIOM
print("Finding LIFX lights")
num_lights = 2
lifx = LifxLAN(num_lights)
devices = lifx.get_lights()

#USE THE INFO RETURNED FROM THE DEVICES TO PROPERLY NAME THE LIGHTS (EX. 'Bedroom light')
if 'Bedroom' in str(devices[1]):
    bedside_table_light = devices[0]
    bedroom_light = devices[1]

else:
    bedside_table_light = devices[1]
    bedroom_light = devices[0]


#PHILLIPS HUE LIGHTS SECTION
#FIRST GET THE IP OF THE BRIDGE (use $ nmap -sL 192.168.1.1/24)
print('Finding Hue lights')
b = Bridge('BRIDGE_IP')