コード例 #1
0
ファイル: lifx_OpenHAB.py プロジェクト: iandday/openHAB
def setBulbColor(bulb, r, g, b, kelvin, fade):
    r = r / float(255)
    g = g / float(255)
    b = b / float(255)
    (hue, saturation, brightness) = colorsys.rgb_to_hsv(r, g, b)
    hue = hue * float(360)
    lazylights.set_state(bulbs, hue, saturation, brightness, kelvin, fade, raw=False)
コード例 #2
0
ファイル: handy.py プロジェクト: Apophenian/handylights
 def update_bulbs(self):
     """
     Updates the bulbs with the state of the collection
     """
     if self.current_state.is_on:
         lazylights.set_state(self.bulbs, self.current_state.hue,
                              self.current_state.saturation, self.current_state.brightness,
                              self.current_state.kelvin, 0)
コード例 #3
0
 def dim(self, bulbobj, value):
     lazylights.set_state([bulbobj.bulb],
                          bulbobj.hue,
                          bulbobj.saturation,
                          value * 65535 / 255,
                          bulbobj.kelvin,
                          1000,
                          raw=True)
     return True
コード例 #4
0
def resend():
    #if timer() > LAST_UPDATE + MIN_REFRESH_INTERVAL:
    #hsb = RGBtoHSB(float(rCanStrVar.get()), float(gCanStrVar.get()), float(bCanStrVar.get()))
    hsb = colorsys.rgb_to_hsv(
        float(rCanStrVar.get()) / BAR_WIDTH,
        float(gCanStrVar.get()) / BAR_WIDTH,
        float(bCanStrVar.get()) / BAR_WIDTH)

    #hsb[0] = hsb[0] * 360

    print 'HSB', hsb[0] * 360, hsb[1], hsb[2]

    if LIFX_CONNECT:
        print("Updating light(s)...")
        #lifx.set_light_state(hsb[0], hsb[1], hsb[2], 2400)
        lazylights.set_state(bulbs, hsb[0] * 360, hsb[1], hsb[2], 5000, 500)

    top.update_idletasks()
    top.update()
コード例 #5
0
def main_loop(sc):
    red_alert = False
    print(bright_magenta + "-----------------------------------------------------------------------------------------" + bright_white)
    print(bright_cyan + "📅� {}".format(get_timestamp()) + bright_white)

    if  datetime.today().replace(hour=OFFICE_HOUR_START,minute=0) <= datetime.now() <= datetime.today().replace(hour=OFFICE_HOUR_END,minute=0):
        print("Within office hours")
        
        events = getCalendarEntries()    
        if not events:
            print(bright_white + "     No events to report")
            #lazylights.set_state(bulbs, 0, 0, 1, 8000, 500, raw=False)  # white
        else:
            for event in events:
                event_end  = event['Start'] + timedelta(minutes=event['Duration'])
                alert_time = event['Start'] - timedelta(minutes=ALERT_TIME)
                if ( event_end) < datetime.now():
                    print(bright_green + "    ✅ SAFE ✅      Event \"{}\" happened in the past (Started:{}. Ended:{})".format(event['Subject'], event['Start'].strftime("%I:%M %p"), event_end.strftime("%I:%M %p")) + bright_white)
                    #lazylights.set_state(bulbs, 0, 0, 1, 8000, 500, raw=False)  # white

                if alert_time <= datetime.now() <= event['Start']:
                    print(bright_yellow + "    � WARNING �   Event \"{}\" starts within 5 minutes at {}".format(event['Subject'],event['Start'].strftime("%I:%M %p")) + bright_white)
                    playsound.playsound('UpcomingMeeting.mp3', True)
                    #lazylights.set_state(bulbs, 60, 1, 1, 8000, 500, raw=False)  # yellow

                if ( event['Start'] <= datetime.now() <= event_end):
                    print(bright_red + "    🚨 ALERT 🚨     Event \"{}\" is happening right now (Started {}. Ends {})".format(event['Subject'], event['Start'].strftime("%I:%M %p"), event_end.strftime("%I:%M %p")) + bright_white)
                    red_alert = True
                    #lazylights.set_state(bulbs, 0, 1, 1, 8000, 500, raw=False)  # red
                    
                else:
                    #lazylights.set_state(bulbs, 0, 0, 1, 8000, 500, raw=False)  # white
                    pass

    if red_alert:
        lazylights.set_state(bulbs, 0, 1, 1, 8000, 500, raw=False)  # red
    else:
        lazylights.set_state(bulbs, 0, 0, 1, 8000, 500, raw=False)  # white
        
    s.enter(INTERVAL, 1, main_loop, (sc,))
コード例 #6
0
def main_loop(sc):
    red_alert = False
    print(
        bright_magenta +
        "-----------------------------------------------------------------------------------------"
        + bright_white)
    string = str("??? ")
    print(bright_cyan + string + "{}".format(get_timestamp()) + bright_white)
    events = []
    if datetime.today().replace(
            hour=OFFICE_HOUR_START,
            minute=0) <= datetime.now() <= datetime.today().replace(
                hour=OFFICE_HOUR_END, minute=0):
        print("Within office hours")
        try:
            events = getCalendarEntries()
        except Exception as e:
            print(e)

        if not events:
            print(bright_white + "     No events to report")
            #lazylights.set_state(bulbs, 0, 0, 1, 8000, 500, raw=False)  # white
        else:
            for event in events:
                event_end = event['Start'] + timedelta(
                    minutes=event['Duration'])
                alert_time = event['Start'] - timedelta(minutes=ALERT_TIME)
                if ((event_end) < utc.localize(datetime.now())):
                    string = str(u"    ? SAFE ?      ")
                    print(
                        bright_green + string +
                        "Event \"{}\" happened in the past (Started:{}. Ended:{})"
                        .format(event['Subject'], event['Start'].strftime(
                            "%I:%M %p"), event_end.strftime("%I:%M %p")) +
                        bright_white)
                    #lazylights.set_state(bulbs, 0, 0, 1, 8000, 500, raw=False)  # white

                if alert_time <= utc.localize(
                        datetime.now()) <= event['Start']:
                    string = str("    ? WARNING ?   ".encode("utf-8"))
                    print(bright_yellow + string +
                          "Event \"{}\" starts within 5 minutes at {}".format(
                              event['Subject'], event['Start'].strftime(
                                  "%I:%M %p")) + bright_white)
                    playsound.playsound(
                        'C:\\Users\\Frak\\Downloads\\myPython\\http_env\\outlook-notifier\\UpcomingMeeting.mp3',
                        True)
                    #lazylights.set_state(bulbs, 60, 1, 1, 8000, 500, raw=False)  # yellow

                if (event['Start'] <= utc.localize(datetime.now()) <=
                        event_end):
                    string = str("    ?? ALERT ??     ".encode("utf-8"))
                    print(
                        bright_red + string +
                        "Event \"{}\" is happening right now (Started {}. Ends {})"
                        .format(event['Subject'], event['Start'].strftime(
                            "%I:%M %p"), event_end.strftime("%I:%M %p")) +
                        bright_white)
                    red_alert = True
                    #lazylights.set_state(bulbs, 0, 1, 1, 8000, 500, raw=False)  # red

                else:
                    #lazylights.set_state(bulbs, 0, 0, 1, 8000, 500, raw=False)  # white
                    print(bright_white + "Event \"{}\" (Starts:{}. Ends:{})".
                          format(event['Subject'], event['Start'].strftime(
                              "%I:%M %p"), event_end.strftime("%I:%M %p")) +
                          bright_white)
                    pass

    if red_alert:
        lazylights.set_state(bulbs, 0, 1, 1, 8000, 500, raw=False)  # red
    else:
        lazylights.set_state(bulbs, 0, 0, 1, 8000, 500, raw=False)  # white

    s.enter(INTERVAL, 1, main_loop, (sc, ))
コード例 #7
0
ファイル: ulfire.py プロジェクト: HeatfanJohn/ulfire
 def dim(self, bulbobj, value):
     lazylights.set_state([bulbobj.bulb], bulbobj.hue, bulbobj.saturation,
                          value * 65535 / 255, bulbobj.kelvin, 1000,
                          raw=True)
     return True
コード例 #8
0
ファイル: lifx_OpenHAB.py プロジェクト: iandday/openHAB

"""
    Sets the state of `bulbs`.
    If `raw` is True, hue, saturation, and brightness should be integers in the
    range of 0x0000 to 0xffff. Otherwise, hue should be a float from 0.0 to
    360.0 (where 360.0/0.0 is red), and saturation and brightness are floats
    from 0.0 to 1.0 (0 being least saturated and least bright)..
    `kelvin` is an integer from 2000 to 8000, where 2000 is the warmest and
    8000 is the coolest. If this is non-zero, the white spectrum is used
    instead of the color spectrum (hue and saturation are be ignored).
    `fade` is an integer number of milliseonds over which to transition the
    state change, carried out by the bulbs.
"""

if __name__ == "__main__":
    # Create our own Bulbs
    myBulb1 = createBulb("10.168.1.21", "D0:73:D5:02:64:11")
    # append to bulbs list
    bulbs = [myBulb1]

    # setBulbPower(bulbs,sys.argv[1] == '1')
    # RGB Colors
    # setBulbColor(bulbs, 255, 255, 255, 8500, 0)
    input = sys.argv[1].split(",")

    hue = int(input[0])
    saturation = int(input[1])
    brightness = int(input[2])
    lazylights.set_state(bulbs, hue, saturation, brightness, kelvin=0, fade=0, raw=False)
コード例 #9
0
ファイル: setlights.py プロジェクト: frakman1/rotarylights
                           dest='state',
                           required=False,
                           help='[Input] lights on or off')
requiredNamed.add_argument('-b',
                           '--brightness',
                           dest='brightness',
                           required=False,
                           help='[Input] brightness of lights: 0-100')
results = parser.parse_args()
print results

myBulb1 = createBulb('10.0.0.x', 'xx:xx:xx:xx:xx:xx')
#myBulb2 = createBulb('10.0.0.x','xx:xx:xx:xx:xx:xx')
bulbs = [myBulb1]

#bulbs = lazylights.find_bulbs(expected_bulbs=6)

if results.brightness:
    print "Setting Brightness"
    val = int(results.brightness) / float(100)
    print val
    lazylights.set_state(bulbs, 1, 0, val, 4000, 100, raw=False)
    exit(0)

if results.state == 'on':
    print 'Turning on'
    lazylights.set_power(bulbs, True)
else:
    print 'Turning off'
    lazylights.set_power(bulbs, False)
コード例 #10
0
ファイル: lifxaway.py プロジェクト: caj380/lifxaway
    return lazylights.Bulb(b'LIFXV2',
                           binascii.unhexlify(macString.replace(':', '')),
                           (ip, port))


#------------------------------------------------------------------------------------------------------------

myBulb1 = createBulb('10.0.0.X',
                     'XX:XX:XX:XX:XX:XX')  #Bulb for right side of screen
#lazylights requires a 'set' of bulbs as input so I put each one in its own set
bulbs1 = [myBulb1]
while True:
    target_name = "Pixel XL"
    target_address = None
    nearby_devices = bluetooth.discover_devices()

    for bdaddr in nearby_devices:
        if target_name == bluetooth.lookup_name(bdaddr):
            target_address = bdaddr
            break

    if target_address is not None:
        c = Color("green")
        print "***True"
        lazylights.set_state(bulbs1, c.hue * 360, (c.saturation), c.luminance,
                             3500, (500), False)
    else:
        c = Color("yellow")
        print "***False"
        lazylights.set_state(bulbs1, c.hue * 360, (c.saturation), c.luminance,
                             3500, (500), False)
コード例 #11
0
ファイル: lifxscreen2.py プロジェクト: ZackDibe/lifxscreen2
	blue = ((blue / ( (height/DECIMATE) * (width/DECIMATE) ) ) )/255.0

	# generate a composite colour from these averages
	c = Color(rgb=(red, green, blue))
	#print c

	#print "\naverage1  red:%s green:%s blue:%s" % (red,green,blue)
	#print "average1   hue:%f saturation:%f luminance:%f" % (c.hue,c.saturation,c.luminance)
	#print "average1  (hex) "+  (c.hex)

	#//////////////////////////////////////////////////////////////////////////////////////////////////////////
	# PROGRAM LIFX BULBS (LEFT)
	#//////////////////////////////////////////////////////////////////////////////////////////////////////////
	if (c.red < BLACK_THRESHOLD)  and (c.green < BLACK_THRESHOLD) and (c.blue < BLACK_THRESHOLD):
		#print "black1 detected"
		lazylights.set_state(bulbs1,0,0,BLACK_BRIGHTNESS,BLACK_KELVIN,(DURATION),False)
	else:
		lazylights.set_state(bulbs1,c.hue*360,(c.saturation),c.luminance,KELVIN,(DURATION),False)
	#//////////////////////////////////////////////////////////////////////////////////////////////////////////

	# Clear colour accumulators in preperation for going over the second half of the screen
	red   = 0
	green = 0
	blue  = 0

	#//////////////////////////////////////////////////////////////////////////////////////////////////////////
	# Right Side of Screen
	#//////////////////////////////////////////////////////////////////////////////////////////////////////////
	for y in range(0, height, DECIMATE):  #loop over the height
		for x in range(width/2, width, DECIMATE):  #loop over the width (the second half of the width)
			#print "\n coordinates   x:%d y:%d \n" % (x,y)
コード例 #12
0
        countBeat += 1
        red = random.uniform(0, 1)
        while abs(red - redReg) < 0.15:
            red = random.uniform(0, 1)
        while abs(blue - blueReg) < 0.15:
            blue = random.uniform(0, 1)
        while abs(green - greenReg) < 0.15:
            green = random.uniform(0, 1)

        c = Color(
            rgb=(red, green, blue)
        )  #display a random color but sufficently different from the previous one

        # on even numbers, first lifx is light on
        if countBeat % 2 == 0:
            lazylights.set_state(bulbs, cReg.hue * 360, cReg.saturation, 1,
                                 KELVIN, 0, False)
        # on odd numbers it is the other one
        else:
            cReg = c
            redReg = red  #save each previous color
            blueReg = blue
            greenReg = green
            lazylights.set_state(bulbs, c.hue * 360, c.saturation, 1, KELVIN,
                                 0, False)
    # lazylights.set_state(bulbs,c.hue*360,(2+c.saturation)/3,1,KELVIN,(DURATION),False)#c.luminance

#Thread.thread_stop
#except keyboardInterupt
#destroy()
#def destroy():
コード例 #13
0
ファイル: Light.py プロジェクト: eirikwor/HomeAutomation
    def setState(self, inRoom, state):
        print "Setting lights in room", inRoom,"to state",state

        if inRoom < 0 or inRoom > 1 or state < 0 or state > 2:
            print "inRoom or state out of range"
            return
    
        if inRoom == 0:
            # Stue
            self.states[0] = state
            if state == 0:
                for i in range(0,self.resends):
                    for device in self.devices:
                        label = device.label.decode('utf8').encode('ascii','ignore')
                        if "Spisebord" in label:
                            lazylights.set_power([device.bulb], False)
                        elif "Stuehjrne" in label:
                            lazylights.set_power([device.bulb], False)
                sleep(0.5)
                self._rfOff(0)
                self._rfOff(1)
                self._rfOff(2)
            elif state == 1:
                for i in range(0,self.resends):
                    for device in self.devices:
                        label = device.label.decode('utf8').encode('ascii','ignore')
                        if "Spisebord" in label:
                            lazylights.set_power([device.bulb], True)
                            lazylights.set_state([device.bulb], 49.0, 0.1, 0.4, 3000, 500)
                        elif "Stuehjrne" in label:
                            lazylights.set_power([device.bulb], True)
                            lazylights.set_state([device.bulb], 49.0, 0.1, 0.3, 3200, 500)
                sleep(0.5)
                self._rfOn(0)
                self._rfOn(1)
                self._rfOn(2)
            elif state == 2:
                for i in range(0,self.resends):
                    for device in self.devices:
                        label = device.label.decode('utf8').encode('ascii','ignore')
                        if "Spisebord" in label:
                            lazylights.set_power([device.bulb], True)
                            lazylights.set_state([device.bulb], 0.0, 0.0, 0.95, 3000, 500)
                        elif "Stuehjrne" in label:
                            lazylights.set_power([device.bulb], True)
                            lazylights.set_state([device.bulb], 0.0, 0.0, 0.67, 3200, 500)
                sleep(0.5)
                self._rfOn(0)
                self._rfOn(1)
                self._rfOn(2)
        elif inRoom == 1:
            # Kontor
            self.states[1] = state
            if state == 0:
                for i in range(0,self.resends):
                    for device in self.devices:
                        label = device.label.decode('utf8').encode('ascii','ignore')
                        if "Idagulv" in label:
                            lazylights.set_power([device.bulb], False)
                        elif "Leselys" in label:
                            lazylights.set_power([device.bulb], False)
                        elif "Lskule" in label:
                            lazylights.set_power([device.bulb], False)
                        elif "PC lys" in label:
                            lazylights.set_power([device.bulb], False)
            elif state == 1:
                for i in range(0,self.resends):
                    for device in self.devices:
                        label = device.label.decode('utf8').encode('ascii','ignore')
                        if "Idagulv" in label:
                            lazylights.set_power([device.bulb], True)
                            lazylights.set_state([device.bulb], 49.0, 0.2, 0.4, 3000, 500)
                        elif "Leselys" in label:
                            lazylights.set_power([device.bulb], True)
                            lazylights.set_state([device.bulb], 0.0, 0.2, 0.4, 3000, 500)
                        elif "Lskule" in label:
                            lazylights.set_power([device.bulb], True)
                            lazylights.set_state([device.bulb], 49.0, 0.2, 0.2, 3000, 500)
                        elif "PC lys" in label:
                            lazylights.set_power([device.bulb], True)
                            lazylights.set_state([device.bulb], 49.0, 0.2, 0.2, 3200, 500)
            elif state == 2:
                for i in range(0,self.resends):
                    for device in self.devices:
                        label = device.label.decode('utf8').encode('ascii','ignore')
                        if "Idagulv" in label:
                            lazylights.set_power([device.bulb], True)
                            lazylights.set_state([device.bulb], 0.0, 0.0, 1.0, 3200, 500)
                        elif "Leselys" in label:
                            lazylights.set_power([device.bulb], True)
                            lazylights.set_state([device.bulb], 0.0, 0.0, 1.0, 3000, 500)
                        elif "Lskule" in label:
                            lazylights.set_power([device.bulb], True)
                            lazylights.set_state([device.bulb], 0.0, 0.0, 0.4, 3200, 500)
                        elif "PC lys" in label:
                            lazylights.set_power([device.bulb], True)
                            lazylights.set_state([device.bulb], 0.0, 0.0, 0.35, 3200, 500)
コード例 #14
0
ファイル: lifxstatus.py プロジェクト: frakman1/lifxstatus
    print "********************** Periodic Check  *******************"  
    try:
        lazylights.set_power(bulbs,True)
    except: # catch *all* exceptions
        e = sys.exc_info()[0]
        print("Unexpected error:", sys.exc_info()[0])
    
      
    if (status == 'Available'):
        print "Status Detected!(%s)" % status
        c = Color("green")

    elif (status == 'Busy') or (status == 'Do Not Disturb') or (status == 'In a Meeting'):
        print "Status Detected!(%s)" % status
        c = Color("red")
        
    elif (status == 'Away') or (status == 'Be Right Back') or (status == 'Off Work'):
        print "Status Detected(%s)" % status
        c = Color("yellow")

    try:
        lazylights.set_state(bulbs,c.hue*360,(c.saturation),1,0,(1000),False);
    except: # catch *all* exceptions
        e = sys.exc_info()[0]
        print("Unexpected error:", sys.exc_info()[0])


    savedStatus = status
    firstTime = False
    
コード例 #15
0
def lightChanger():
    global sliderValue, KELVIN
    global bpm, idName
    global beginBPMSlidder
    #mac and IP MUST be associated by pair
    mac1 = ''
    mac2 = ''
    mac3 = ''
    mac4 = ''
    mac5 = ''
    i = 0
    ip1 = sys.argv[i + 1]
    ip2 = sys.argv[i + 2]
    ip3 = sys.argv[i + 3]
    ip4 = sys.argv[i + 4]
    ip5 = sys.argv[i + 5]

    myBulb1 = createBulb(ip1, mac1)
    myBulb2 = createBulb(ip2, mac2)
    myBulb3 = createBulb(ip3, mac3)
    myBulb4 = createBulb(ip4, mac4)
    myBulb5 = createBulb(ip5, mac5)

    bulbs = [myBulb1, myBulb2, myBulb3, myBulb4, myBulb5]
    # now bulbs can be called by their names
    bulbs_by_name = {
        state.label.strip(" \x00"): state.bulb
        for state in lazylights.get_state(bulbs)
    }
    if (len(bulbs) == 0):
        print(
            "No LIFX bulbs found. Make sure you're on the same WiFi network and try again"
        )
        sys.exit(1)
    # turn on
    lazylights.set_power(bulbs, True)
    # do nothing during a tenth of a second
    time.sleep(0.1)
    # init counters/accumulators
    red = 0
    green = 0
    blue = 0
    redReg = 0
    greenReg = 0
    blueReg = 0
    begin1 = time.time()
    beatLenghtReg = DURATION + 1  # to force it to a state beatLenghtReg not equal to beatLenght
    beginBPM = time.time()
    countBeat = 1
    cReg = Color(rgb=(1, 0, 0))
    global cHue
    cHue = cReg.hue
    sliderValueReg = sliderValue
    # the music changed
    while True:
        graphInterfaceUpdate()
        if bpm != 0:
            beatLenght = SLOW_DOWN * 60000.0 / bpm
        else:
            beatLenght = DURATION

        if beatLenghtReg != beatLenght:
            beginBPM = time.time()
            countBeat = 0
            beatLenghtReg = beatLenght
            print("music changed BPM is now: ", bpm,
                  " track name from spotify is ", idName)
        # no music is playing (e.g. pause or just only watching youtube music)
        elif (beatLenght == DURATION):  #i.e. bpm == 0

            cHue += 0.01
            time.sleep(
                0.2
            )  # 20 wifi commands per seconds, can be increased if no checking
            lazylights.set_state(bulbs, (cHue + 0.5) * 360, 1, 1, KELVIN, 200,
                                 False)
            # LIFX 246D45
            lazylights.set_state(bulbs, cHue * 360, 1, 1, KELVIN, 200, False)
            #print(cHue)
        # 31ea4e
        # while music is playing
        else:
            #if sliderValue != sliderValueReg
            beginBPMSlidder = beginBPM + 2 * sliderValue * beatLenght / 100000  #slider value is 0->100
            #print("beginBPMSlidder", beginBPMSlidder)

            #sliderValueReg = sliderValueReg
            # this is the same music
            a = (beatLenght / 1000) - (time.time() -
                                       beginBPMSlidder) % (beatLenght / 1000.0)
            a = max(0, a)
            time.sleep(a)  # should not sleep if 0
            countBeat += 1
            red = random.uniform(0, 1)
            #find RGB that is not looking the same as the previous RGB
            while abs(red - redReg) < 0.15:
                red = random.uniform(0, 1)
            while abs(blue - blueReg) < 0.15:
                blue = random.uniform(0, 1)
            while abs(green - greenReg) < 0.15:
                green = random.uniform(0, 1)

            c = Color(
                rgb=(red, green, blue)
            )  # display a random color but sufficently different from the previous one

            # on even numbers, first lifx is light on
            if countBeat % 2 == 0:
                lazylights.set_state(bulbs, cReg.hue * 360, cReg.saturation,
                                     INTENSITY, KELVIN, 0, False)
            # on odd numbers it is the other one
            else:
                cReg = c
                redReg = red  # save each previous color
                blueReg = blue
                greenReg = green
                lazylights.set_state(bulbs, c.hue * 360, c.saturation,
                                     INTENSITY, KELVIN, 0, False)
コード例 #16
0
#------------------------------------------------------------------------------------------------------------

#Set your bulbs' real MAC addresses and IP addresses here:
myBulb1 = createBulb('192.168.1.XX', 'XX:XX:XX:XX:XX:XX')
myBulb2 = createBulb('192.168.1.XX', 'XX:XX:XX:XX:XX:XX')

#lazylights requires a 'set' of bulbs as input
bulbs1 = [myBulb1, myBulb2]
c = Color("white")

while True:
    print "---------------------------------------------------------------------------------------------------------"
    print(time.strftime("%m/%d/%Y at %H:%M:%S"))
    try:
        lazylights.set_state(bulbs1, c.hue * 360, (c.saturation), 1, 3500,
                             (3000), False)

    except Exception as e:
        print "Ignoring error:"
        print str(e)
        continue

    time.sleep(PERIOD)
    #------------------------------------------------------------------------------------------------------------
    try:
        iconFound = pyautogui.locateOnScreen(
            'C:\\Python27\\lifxaway\\busy.png')
        if (iconFound):
            print Fore.RED + "FOUND BUSY ICON. CODE RED!"
            c = Color("red")
            continue
コード例 #17
0
ファイル: lifxstatus.py プロジェクト: frakman1/lifxstatus
    try:
        lazylights.set_power(bulbs, True)
    except:  # catch *all* exceptions
        e = sys.exc_info()[0]
        print("Unexpected error:", sys.exc_info()[0])

    if (status == 'Available'):
        print "Status Detected!(%s)" % status
        c = Color("green")

    elif (status == 'Busy') or (status
                                == 'Do Not Disturb') or (status
                                                         == 'In a Meeting'):
        print "Status Detected!(%s)" % status
        c = Color("red")

    elif (status == 'Away') or (status == 'Be Right Back') or (status
                                                               == 'Off Work'):
        print "Status Detected(%s)" % status
        c = Color("yellow")

    try:
        lazylights.set_state(bulbs, c.hue * 360, (c.saturation), 1, 0, (1000),
                             False)
    except:  # catch *all* exceptions
        e = sys.exc_info()[0]
        print("Unexpected error:", sys.exc_info()[0])

    savedStatus = status
    firstTime = False