Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.55 KB | None | 0 0
  1. Index: moodlamp.py
  2. ===================================================================
  3. --- moodlamp.py (revision 243)
  4. +++ moodlamp.py (working copy)
  5. @@ -72,6 +72,10 @@
  6.          self.color = color
  7.          self.interface.packet( self.address, "C%c%c%c" % (color[0], color[1], color[2]), 0, True)
  8.          
  9. +    def fadems(self, color, time):
  10. +        self.color = color
  11. +        self.interface.packet( self.address, "M%c%c%c%c" % (color[0], color[1], color[2], time), 0, True)
  12. +
  13.      def pause(self, pause):
  14.          self.interface.packet( self.address, "\x17", 0, True)
  15.          #unused pause
  16. Index: mldclient.py
  17. ===================================================================
  18. --- mldclient.py        (revision 243)
  19. +++ mldclient.py        (working copy)
  20. @@ -112,7 +112,16 @@
  21.                          m = self.ml.getLamp(s[1])
  22.                          m.pause(True)
  23.                  elif cmd == "005": # unused
  24. -                    pass
  25. +                    if s[1] == "0":
  26. +                        for n in self.ml:
  27. +                            if n.ready:
  28. +                                self.push("Send %2d (%s) -> %s %s %s in %s\r\n" % (n.address, n.name, int(s[2], 16), int(s[3], 16), int(s[4], 16), int(s[5])))
  29. +                                m = self.ml.getLamp(n.address)
  30. +                                m.fadems([int(s[2], 16), int(s[3], 16), int(s[4], 16)], int(s[5]))
  31. +                    else:
  32. +                        m = self.ml.getLamp(s[1])
  33. +                        self.push("Send %2d (%s) -> %s %s %s in %s\r\n" % (m.address, m.name, int(s[2], 16), int(s[3], 16), int(s[4], 16), int(s[5])))
  34. +                        m.fadems([int(s[2], 16), int(s[3], 16), int(s[4], 16)], int(s[5]))
  35.                  elif cmd == "006": # set interface raw
  36.                      for m in self.interfaces:
  37.                          m.set_raw(True)
  38. @@ -184,7 +193,7 @@
  39.                      self.push("002 - list of all available and ready moodlamps\r\n")
  40.                      self.push("003 [moodlamp_id] <ff> <00> <00> - change color r/g/b as hex\r\n     moodlamp id = 0 for all moodlamps\r\n")
  41.                      self.push("004 [moodlamp_id] - toggle pause\r\n")
  42. -                    self.push("005 - \r\n")
  43. +                    self.push("005 [moodlamp_id] <ff> <00> <00> <123> - fade to color r/g/b as hex in n minutes as dec \r\n     moodlamp id = 0 for all moodlamps\r\n")
  44.                      self.push("006 - set interface raw \r\n")
  45.                      self.push("007 - flash firmware\r\n")
  46.                      self.push("008 - flash firmware\r\n")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement