Created
January 29, 2016 02:03
-
-
Save linuxkidd/63013efd73e198d035e6 to your computer and use it in GitHub Desktop.
Python code to change the color on WiFi RGB LED controller
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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