Example #1
0
 def short_press(self):
   print('Short press!')
   self._pulsing = not self._pulsing
   print(self._pulsing)
   if self._pulsing:
     return LedEvent.pulse()
   else:
     return LedEvent(brightness=self._brightness)
Example #2
0
    def short_press(self):
        print('Short press!')
        self._pulsing = not self._pulsing
        print(self._pulsing)

        client = connectMPD()
        if client.status()["state"] == "play":
            client.pause()
            print('Audio pause!')
        else:
            client.play()
            print('Audio play!')
        client.close()

        if self._pulsing:
            return LedEvent.pulse()
        else:
            return LedEvent(brightness=self._brightness)
Example #3
0
    def rotate(self, rotation):
        #print('Rotate {}!'.format(rotation))
        self._brightness = max(
            0, min(MAX_BRIGHTNESS, self._brightness + rotation))
        self._pulsing = False

        client = connectMPD()
        cur_vol = int(client.status()["volume"])
        client.setvol(cur_vol + rotation)
        client.close()

        return LedEvent(brightness=self._brightness)
Example #4
0
 def off(self):
   self.send(LedEvent.off())
Example #5
0
 def on(self):
   self.send(LedEvent.max())
Example #6
0
 def pulse(self):
   self.send(LedEvent.pulse())
Example #7
0
 def on(self):
     self.send(LedEvent.max())
Example #8
0
 def pulse(self):
     self.send(LedEvent.pulse())
Example #9
0
 def off(self):
     self.send(LedEvent.off())