Hardware Setup
Philip Hue is a system of 4 components:
- Apps – These are ways to control the lights to make them do smart things.
- Bridge – This is used to enable your smart bulbs to communicate with each other and the Portal via the internet. The main set of APIs are those offered by the bridge. These allow you to control all settings of the lights in your system. These APIs require direct access to your bridge so you’ll only be able to access them when your app and bridge are on the same local network.
- Portal – This is a web based control panel which connects your home to the internet. It delivers control commands from outside and keeps your software in the bridge up-to-date. The portal presents a utility API to help you discover the address of your bridge.
- Lights – This is the output of the system. These smart bulbs contain 3 types of LED specifically chosen to produce a range of colors and intensities. Lights create a mesh network with each other which enables each light to pass on messages to the next extending the range and making everything more robust. They are connected to the bridge via an open standards protocol called ZigBee Light Link.
We will be controlling the lights using Philip Bridge HTTP APIs.
Philip Bridge HTTP Requests
http://10.0.2.16/api/newdeveloper/lights
Request Name: Get the list of lights
Get Lights JSON
{ "1": { "state": { "on": true, "bri": 144, "hue": 13088, "sat": 212, "effect": "none", "xy": [ 0.5128, 0.4147 ], "ct": 467, "alert": "none", "colormode": "hs", "reachable": true }, "type": "Extended color light", "name": "Hue Lamp 1", "modelid": "LCT001", "uniqueid": "00:17:88:01:00:b6:c6:f0-0b", "swversion": "66009663", "pointsymbol": { "1": "none", "2": "none", "3": "none", "4": "none", "5": "none", "6": "none", "7": "none", "8": "none" } }, "2": { "state": { "on": true, "bri": 144, "hue": 13088, "sat": 212, "effect": "none", "xy": [ 0.5128, 0.4147 ], "ct": 467, "alert": "none", "colormode": "ct", "reachable": true }, "type": "Extended color light", "name": "Hue Lamp 2", "modelid": "LCT001", "uniqueid": "00:17:88:01:00:b9:38:7c-0b", "swversion": "66009663", "pointsymbol": { "1": "none", "2": "none", "3": "none", "4": "none", "5": "none", "6": "none", "7": "none", "8": "none" } }, "3": { "state": { "on": true, "bri": 144, "hue": 13088, "sat": 212, "effect": "none", "xy": [ 0.5128, 0.4147 ], "ct": 467, "alert": "none", "colormode": "hs", "reachable": true }, "type": "Extended color light", "name": "Hue Lamp 3", "modelid": "LCT001", "uniqueid": "00:17:88:01:00:b9:38:5c-0b", "swversion": "66009663", "pointsymbol": { "1": "none", "2": "none", "3": "none", "4": "none", "5": "none", "6": "none", "7": "none", "8": "none" } } }
Request Name: Change the state of Light
http://10.0.2.16/api/newdeveloper/lights/1/state
Get Lights JSON
{"on":true}
Queries
Find Lights
<Query> <Find format="all"> <PhilipLightModel> <LightNumber eq="1"/> </PhilipLightModel> </Find> </Query>
GetLightManager
<Query> <Find format="All"> <PhilipLightManagerModel> <ManagerId ne=""/> </PhilipLightManagerModel> </Find> </Query>
InitManager
<Query> <DeleteAll> <PhilipLightManagerModel> <ManagerId ne=""/> </PhilipLightManagerModel> </DeleteAll> <Create> <PhilipLightManagerModel> <LoadLights> True </LoadLights> </PhilipLightManagerModel> </Create> </Query>
ToggleLight
<Query> <Find format="All"> <PhilipLightModel> <LightNumber eq="1"/> </PhilipLightModel> </Find> <SetResponseData> <Key> Message.Value.Find.Result.PhilipLightModel.state.On </Key> <Value> false </Value> </SetResponseData> <Update> <From> Result </From> <Include> $Response.Message.Value.Find </Include> </Update> </Query>