示例#1
0
    def step(self):
        try:
            now = datetime.now(tzlocal())
            hr = now.hour + now.minute / 60 + now.second / 3600
            x = int(((hr - 12) % 24) * 50)
            log.debug("x = %s", x)

            for name, ypos in lightYPos.items():
                if now > self.autosetAfter[name]:
                    c = self.img.getColor(x, ypos)
                    setColorAsync(name, c)
            self.lastUpdateTime = time.time()
        except Exception:
            self.lastError = traceback.format_exc()
            self.lastErrorTime = time.time()
示例#2
0
文件: nightlight.py 项目: drewp/pixel
    def step(self):
        try:
            now = datetime.now(tzlocal())
            hr = now.hour + now.minute / 60 + now.second / 3600
            x = int(((hr - 12) % 24) * 50)
            log.debug("x = %s", x)

            for name, ypos in lightYPos.items():
                if now > self.autosetAfter[name]:
                    c = self.img.getColor(x, ypos)
                    setColorAsync(name, c)
            self.lastUpdateTime = time.time()
        except Exception:
            self.lastError = traceback.format_exc()
            self.lastErrorTime = time.time()
示例#3
0
 def pixel_handler(self, message, address):
     light = message.address.split('/')[2]
     rgb = [a.value * 1023 for a in message.arguments]
     print "OSC: set %s to %s" % (light, rgb)
     setColorAsync(light, rgb)
     self.lightState.mute(light, 3)
示例#4
0
文件: nightlight.py 项目: drewp/pixel
 def pixel_handler(self, message, address):
     light = message.address.split('/')[2]
     rgb = [a.value * 1023 for a in message.arguments]
     print "OSC: set %s to %s" % (light, rgb)
     setColorAsync(light, rgb)
     self.lightState.mute(light, 3)