How do I send json to Philips-Hue from Mac Terminal

1.9k views Asked by At

Although the iOS SDK for Philips Hue is perfectly simple to use, the world of json is new to me. Can I (and how do I) send json to the Hue bridge directly from a mac Terminal?

1

There are 1 answers

1
Christiaan On

You need to know the IP address of your bridge. Usually you can see it on this page: https://www.meethue.com/api/nupnp

Once you have that you can create a new user for yourself on your bridge (note the escaping of quotes):

curl -X POST -d "{\"devicetype\":\"Console\",\"username\":\"yourusername\"}" http://<yourbridgeip>/api

From then on you can turn on your lights with something like this:

curl -X PUT -d "{\"on\":true}" http://<yourbridgeip>/api/yourusername/groups/0/action

See http://developers.meethue.com/ for other examples.