Skip to content

Instantly share code, notes, and snippets.

@linuxkidd
Created January 29, 2016 02:03
Show Gist options
  • Save linuxkidd/63013efd73e198d035e6 to your computer and use it in GitHub Desktop.
Save linuxkidd/63013efd73e198d035e6 to your computer and use it in GitHub Desktop.
Python code to change the color on WiFi RGB LED controller
#!/usr/bin/python
import sys
import socket
def Main(host,color):
port = 5577
s = socket.socket()
s.connect((host, port))
colorcommand='56'+color+'AA';
s.send('EF0177'.decode('hex')) # connect
data = s.recv(1024)
s.send(colorcommand.decode('hex')) # send command (turn on in this case)
s.close() # disconnect
if __name__ == '__main__':
if len(sys.argv) < 2:
print "Usage:"
print "\t"+sys.argv[0]+" <ip-address> <RRGGBB>\n"
print "Example:\n\t"+sys.argv[0]+" 192.168.1.2 ffcccc"
else:
Main(sys.argv[1],sys.argv[2])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment