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()
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)