The Hue Emulator is a hue Bridge API Emulator for the Philips Hue - Personal Wireless System.
It allows developers who don't have access to a Philips Hue system (i.e. A Bridge + Hue Light Bulbs) to write hue apps.
Note It should be noted that this is a Bridge API Emulator, ** it is not a hardware Emulator** so response times (for example the number of light/group commands that can be sent per second) will differ to an actual bridge. For a true test a Hue Bridge should be used.
Note x2 This Emulator is not complete. For example, there are no Sensors, Rules, MultiSource Luminaires and generally has all fields up to a Hue Bridge API 1.3, so some later fields may be missing. If your app focuses on Lights, Groups, Scenes and Schedules (limited) this it should be fine.
How to use
The emulator is written in Java so a Java Runtime environment is required.
The emulator is an executable .jar file, so can either double click or from the command line:-
java -jar HueEmulator-v0.6.jar
Note that if you are running on OS X on Port 80 you may need admin privileges so try:
sudo java -jar HueEmulator-v0.6.jar
Enter the port you want your emulator to run on and click the Start button (this starts the Emulator/HTTP and UPnP Server). It is recommended to use port 80, as using port 80 allows the Emulator to be found by hue apps which use Java SDK. However, if port 80 is blocked or inaccessible pick another port. Note, that the UPNP code is still in Beta and not 100% working (doesn't work with the iOS SDK for example). This will be improved at some point. To check the Emulator is running use the below URL. The full bridge config should be returned, in JSON format:
Or, if you are running on Port 80 then:
The root of the github project contains the HueEmulator-v0.6.jar executable, so building the source is not required.
Note By default the Emulator loads in the username "newdeveloper" for quick use. In the future (Feb 2016) custom whitelist entries will not be allowed in a Hue Bridge, so it will no longer be possible to create the username "newdeveloper". However, I will always keep this in the Emulator for ease of use (as easier to remember than a 32 char random username).
You can use the emulator a variety of ways:
The emulator accepts RESTful web service calls (in JSON format) just as the Hue bridge obviously.
For more details on the valid Hue API calls consult the documentation at: http://www.developers.meethue.com/
If you are running the emulator using port 80, the Java SDK should find the emulator using a bridge search. If port 80 is blocked or inaccessible then, using the Java SDK you can connect to the emulator using the following lines of code:
PHAccessPoint lastAccessPoint = new PHAccessPoint(); lastAccessPoint.setIpAddress("192.168.1.1:8000"); // Enter the IP Address and Port your Emulator is running on here. lastAccessPoint.setUsername("newdeveloper"); // newdeveloper is loaded by the emulator and set on the WhiteList. phHueSDK.connect(lastAccessPoint);
If you are testing on Android make sure your Android Wifi and your PC are on the same Network/Wifi. Additionally if connection failures occur your firewall settings may need adjusting.
See the code examples on the Philips GitHub page for more info.
Currently Implemented Features
The Emulator currently supports the following:
- Lights API Get Lights/Update State, (1.1, 1.4, 1.5 and 1.6 from http://www.developers.meethue.com/documentation/lights-api)
- Schedules API Can create/update/delete Non-Recurring Schedules (Everything from http://www.developers.meethue.com/documentation/schedules-api-0)
- Groups API Can create Groups, run commands for default 0 group.
- Scenes API Can get/create scenes + recall scenes. Not persisted though, so scenes are lost when emulator is restarted.
- Adding new Bulbs Adding new bulbs is done via the File Menu Option.
- Loading/saving bridge configs As from v0.4 you can load or save full bridge config 'JSON' files.
- 2 Graphical Views Hue bulbs are displayed in small view, or in a separate window frame showing their current colours/state.
The Emulator is currently in development and will be updated as of when new features are implemented.
The following features may be added soon (roughly in the below order).
- GUI Improvements Mouse over helpers for the Light Bulbs + scroll bars for when several lights are added.
- Recurring Schedules Currently cannot create recurring schedules.
Support or Contact
The HueEmulator is currently in alpha. Please report any bugs on GitHub and if you are using the Emulator and require a feature request drop me a line.