Created
November 19, 2012 08:44
-
-
Save KelSolaar/4109616 to your computer and use it in GitHub Desktop.
Philips Hue - On
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
import json | |
import urllib2 | |
def hueOn(address, client, on=True): | |
for light in (1, 2, 3): | |
url = "http://%s/api/%s/lights/%s/state" % (address, client, light) | |
request = urllib2.Request(url, json.dumps({"on": on})) | |
request.get_method = lambda: "PUT" | |
response = urllib2.urlopen(request) | |
hueOn("192.168.0.5", "25bebfd9e3d966783278c476011e2321", True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's a working library if you want to explore a bit:
https://github.com/studioimaginaire/phue