Hue Emulation exposes openHAB items as Hue lights to other Hue API compatible applications like Amazon Echos, Google Homes or any Hue compatible application.
Because Amazon Echo and Google Home control openHAB locally this way, it is a fast and reliable way to voice control your installation.
See the Troubleshoot section down below though.
This service is independent of the also available Hue binding!
Currently the following Hue functionality is supported:
* Lights: Maps to items
* Groups: Maps to group items
* Rooms: Maps to group items with a specific tag
* Scenes: Maps to rules (new rule engine) that are tagged with "scene"
* Rules: Maps to rules (new rule engine) that are tagged with "hueemulation_rule"
* Schedule: Maps to rules (new rule engine) that are tagged with "hueemulation_schedule"
You can create / modify and remove groups, rooms, scenes, rules and schedules from within Hue compatible devices and apps.
## Discovery:
As soon as the service is enabled, it will announce the presence of an (emulated) HUE bridge of the second generation (square bridge).
Hue bridges are using the Universal Plug and Play (UPnP) protocol for discovery.
![Philips Hue Bridge](doc/Philips_Hue_Bridge.jpg)
Like the real HUE bridge the service must be put into pairing mode before other applications can access it.
By default the pairing mode disables itself after 1 minute (can be configured).
## Exposed lights
It is important to note that you are exposing *Items* not *Things* or *Channels*.
Only Color, Dimmer, Rollershutter, Switch and Group type *Items* are supported.
Group type items require the "Huelight" tag to be exposed as devices instead of Groups.
This service can emulate 3 different devices:
* An OSRAM SMART+ Plug,
* a dimmable white color Philips A19 bulb and
* an a Philips Gen 3 LCT010 extended color bulb.
The exposed Hue-type depends on some criteria:
* If the item has the category "ColorLight": It will be exposed as a color bulb
* If the item has the category "Light": It will be exposed as a switch.
This initial type determination is overridden if the item is tagged.
The following default tags are setup:
* "Switchable": Item will be exposed as an OSRAM SMART+ Plug
* "Lighting": Item will be exposed as a dimmable white bulb
* "ColorLighting": Item will be exposed as a color bulb
It is the responsibility of binding developers to categories and default tag their available *Channels*, so that linked Items are automatically exposed with this service.
You can tag items manually though as well.
## Exposed names
Your items labels are used for exposing!
The default naming schema for automatically linked items unfortunately names *Items* like their Channel names,
so usually "Brightness" or "Color". You want to rename those.
## Configuration
All options are available in the graphical interface and via textual configuration.
The following configurations can be adjusted.
Pairing can be turned on and off:
```
org.openhab.hueemulation:pairingEnabled=false
```
You can define a pairing timeout in seconds.
After that timeout, the `pairingEnabled` is automatically set to `false`.
```
org.openhab.hueemulation:pairingTimeout=60
```
Enable the following option in combination with pairing to create a new API key on the fly on every API endpoint, not only via the new-user-create API.
Necessary for Amazon Echos and other devices where the API key cannot be reset.
After a new installation of openHAB or a configuration pruning the old API keys are gone but Amazon Echos will keep trying with their old, invalid keys.
* For Amazon Echo the pairing process may fail due to a 302 response from openHAB, this can be resolved by using a reverse proxy to change the request url from `/api` to `/api/`, for example nginx with the following configuration:
Please open port 80 tcp and port 1900 udp in your firewall installation.
You can test if the hue emulation does its job by enabling pairing mode including the option "Amazon Echo device discovery fix".
1. Navigate with your browser to "http://your-openhab-ip/description.xml" to check the discovery response.
Check the IP address in there.
2. Navigate with your browser to "http://your-openhab-ip/api/status" to check the self test report.
If you use the port forwarding way, the self-test page will not be able to correctly determine if your installation works on port 80.
A reverse proxy is recommended.
Depending on the firmware version of your Amazon Echo, it may not support colored bulbs or switches.
Please assign "ColorLighting" and "Switchable" to the `WhiteLights` type as explained above.
Also note that Amazon Echos are stubborn as.
You might need to remove all former recognized devices multiple times and perform the search via different Echos and also the web or mobile application.
It might help to (temporarly) lower the emulated bridge version in the configuration as described above,
## Text configuration example
The item label will be used as the Hue device name. Please be aware that textual defined items are generally a bad idea.
In this case renaming items in Hue compatible Apps will fail.