Author: Dylan Wallace Email: email@example.com
Date: Last modified on 01/03/17
Keywords: Smart Home, Hue, API, SDK, Android, Java
This tutorial is the second part of a series of tutorials on Smart Home development. If you have not yet performed the Nest Control Tutorial, please do this first, as this tutorial builds on the knowledge of the previous tutorial. This tutorial serves as a starting point for Philips Hue development using Android. Hue development can also be done with iOS, and many third-party SDKs, but we will not cover these in this tutorial. For more info on those, see the Hue SDKs website.
The Philips Hue API utilizes HTTP requests to the HUE Bridge on a local network to read/write data to the Hue lights. This API also allows users to control groups of lights, schedules, sensors, and scenes. This gives the user a lot of flexibility when developing an app for Hue.
In order to control Hue lights, we simply need to utilize the Hue Android SDK to control our Hue bridge, no other clients or authentication needed. This makes developing for the Hue much easier than a platform such as the Nest or api.ai.
First, make sure that you have installed and configured Android Studio as described in the Nest Control Tutorial. You should have done this already if you are following this tutorial series in the proper order.
The other download that we will need is the Philips Hue SDK, hosted on GitHub. Please download this before proceeding with the tutorial.
Now, we need to import the SDK project into Android Studio. Please follow the same steps as the Nest Control Tutorial, and just import the Philips Hue project instead of the Nest SDK project. Don't worry about granting authentication tokens, as the Hue SDK does not require this.
Once you have imported the project, do a clean build to ensure that no errors occur. If so, you should be ready to deploy your app.
Now, we will deploy our app with the same method used in the Nest Control Tutorial. Make sure the both Developer Mode and USB Debugging are enabled in order for this to work. Once you have successfully installed the app onto your device, you should be ready to test with the Hue lights.
Once you have deployed your app, you are ready to start testing with your Hue bridge and Hue lights. To do this, simply connect to the same WiFi network as the Hue bridge, and start the app. The app will then walk you through the process of pairing the Hue bridge to the app. After this process is done, your app will be paired with that Hue bridge as long as you are connected to the network.
Now, simply use the Random Lights button to change the color of the Hue lights at random. This is ajust a simple sample app that demonstrates the basic functionality of the Hue API. From here, we can then develop our own app to suit our needs. To do this, follow the steps outlined on the Java SDK page. Alternatively, you could use the sample code as a starting point for your own app, as it is freely open to build upon.
For questions, clarifications, etc, Email: firstname.lastname@example.org