def do_lightning(self):
        old_color = self.current_color
        old_brightness = self.light.brightness
        old_on = self.light.on
        x, y = colorhelp.calculateXY(1, 1, 1)
        self.light.transitiontime = 0
        self.light.brightness = 255
        self.light.on = False
        sleep(0.2)
        self.light.transitiontime = 0
        self.light.on = True
        sleep(0.2)
        self.light.transitiontime = 0
        self.light.on = False
        sleep(0.2)
        self.light.transitiontime = 0
        self.light.on = True
        sleep(0.2)
        self.light.transitiontime = 0
        self.light.on = True
        sleep(0.2)
        self.light.transitiontime = 0
        self.light.on = False
        sleep(0.2)
        self.light.transitiontime = 0
        self.light.on = True
        sleep(0.2)
        self.light.on = False

        sleep(4)
        self.light.on = old_on
        self._set_color(old_color)
        self.light.brightness = old_brightness
예제 #2
0
    def do_lightning(self):
        old_color = self.current_color
        old_brightness = self.light.brightness
        old_on = self.light.on
        x, y = colorhelp.calculateXY(1, 1, 1)
        self.light.transitiontime = 0
        self.light.brightness = 255
        self.light.on = False
        sleep(0.2)
        self.light.transitiontime = 0
        self.light.on = True
        sleep(0.2)
        self.light.transitiontime = 0
        self.light.on = False
        sleep(0.2)
        self.light.transitiontime = 0
        self.light.on = True
        sleep(0.2)
        self.light.transitiontime = 0
        self.light.on = True
        sleep(0.2)
        self.light.transitiontime = 0
        self.light.on = False
        sleep(0.2)
        self.light.transitiontime = 0
        self.light.on = True
        sleep(0.2)
        self.light.on = False

        sleep(4)
        self.light.on = old_on
        self._set_color(old_color)
        self.light.brightness = old_brightness
 def _set_color(self, rgb=None, xy=None, brightness=None):
     with self.lock:
         self.light.transitiontime = 0
         if rgb == (0, 0, 0):
             self.light.on = False
             return
         if not self.light.on:
             self.light.on = True
         x, y = colorhelp.calculateXY(rgb[0], rgb[1], rgb[2])
         self.light.xy = (x, y)
         self.light.brightness = 254
예제 #4
0
 def _set_color(self, rgb=None, xy=None, brightness=None):
     with self.lock:
         self.light.transitiontime = 0
         if rgb == (0, 0, 0):
             self.light.on = False
             return
         if not self.light.on:
             self.light.on = True
         x, y = colorhelp.calculateXY(rgb[0], rgb[1], rgb[2])
         self.light.xy = (x, y)
         self.light.brightness = 254