Emulated Hue Not Working

So I’ve been trying to get the Emulated Hue component setup, but can’t seem to get it to actually work.

I have it set to not expose all devices by default as I don’t want every device showing up, just a handful of input_boolean (most are already native).

configuration.yaml

emulated_hue:
  host_ip: _HA-IP_
  listen_port: 8300
  off_maps_to_on_domains:
    - script
    - scene
  expose_by_default: false

Devices I want to expose I setup under customize

  input_boolean.office_rainbow:
    emulated_hue: true
    emulated_hue_name: "Office Party"
  input_boolean.livingroom_rainbow:
    emulated_hue: true
    emulated_hue_name: "Living Room Party"
  input_boolean.front_porch_rainbow:
    emulated_hue: true
    emulated_hue_name: "Front Porch Party"
  input_boolean.vacation_mode:
    emulated_hue: true
    emulated_hue_name: "Vacation Mode"
  input_boolean.garage_door:
    emulated_hue: true
    emulated_hue_name: "Garage Door"
  input_boolean.unlock_doors:
    emulated_hue: true
    emulated_hue_name: "Unlock Doors"
  input_boolean.lock_doors:
    emulated_hue: true
    emulated_hue_name: "Lock Doors"
  input_boolean.bedtime:
    emulated_hue: true
    emulated_hue_name: "Bedtime"

The Amazon Echo won’t discover these devices no matter what I try, I even tested setting expose_by_default: true and setting exposed_domains to input_boolean with no luck. Slightly stumped at the moment.

Additional Info:

HA Version: 0.27.1
Not noticeable errors in the logs
Already have a Philips Hue Bridge - within HA and connected to the Amazon Echo
All devices are on the same LAN
SSL enabled on HA

1 Like

So you don’t see anything at all in your logs? I’m having trouble with the Hue Emulation too but slightly different…I can get switches and lights discovered, but nothing else (no scenes, no scripts). And the Alexa app on my phone shows the lights as “(Offline)”, but when I ask Alexa to turn them on or off…it works.

I do see errors in my logs about an error connecting to the Hue bridge and a missing file:

16-09-02 14:15:35 homeassistant.components.light.hue: Error connecting to the Hue bridge at 192.168.1.117
Traceback (most recent call last):
  File "/home/hass/deps/phue.py", line 543, in connect
    with open(self.config_file_path) as f:
FileNotFoundError: [Errno 2] No such file or directory: '/home/hass/phue.conf'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/components/light/hue.py", line 95, in setup_bridge
    config_file_path=hass.config.path(filename))
  File "/home/hass/deps/phue.py", line 435, in __init__
    self.connect()
  File "/home/hass/deps/phue.py", line 559, in connect
    self.register_app()
  File "/home/hass/deps/phue.py", line 513, in register_app
    response = self.request('POST', '/api', data)
  File "/home/hass/deps/phue.py", line 459, in request
    connection.request(mode, address, data)
  File "/usr/lib/python3.4/http/client.py", line 1090, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib/python3.4/http/client.py", line 1128, in _send_request
    self.endheaders(body)
  File "/usr/lib/python3.4/http/client.py", line 1086, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python3.4/http/client.py", line 924, in _send_output
    self.send(msg)
  File "/usr/lib/python3.4/http/client.py", line 859, in send
    self.connect()
  File "/usr/lib/python3.4/http/client.py", line 836, in connect
    self.timeout, self.source_address)
  File "/usr/lib/python3.4/socket.py", line 509, in create_connection
    raise err
  File "/usr/lib/python3.4/socket.py", line 500, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
1 Like

The only entry I get in the logs is that it started emulated hue:

homeassistant.core: WorkerPool:Current job from 2016-09-01T17:27:46.009206-05:00: (<function setup.<locals>.start_emulated_hue_bridge at 0x7f6dac7032f0>, <Event homeassistant_start[L]>)

I’ve seen that error you have before, believe it is a bug that will be patched. It’s looking for the actual Hue config file as if you had a Hue bridge, so I’m guess you do not. I do so it doesn’t happen to me. Someone else opened an issue on the same thing

I wonder if anyone has gotten something other than lights and switches to work, haven’t really read many people posting on it.

1 Like

I just did a quick test by setting one of my light bulbs to emulated_hue: true and had no luck, so I might have a problem with the configuration somewhere but I can’t for the life of me figure out where.

I really don’t want to set all entities to be exposes since I have a lot and most are already attached to the Echo.

I can make a simple telnet connection to port 8300 from another host on my network to the HA server, that makes me believe that network communication is there and the emulated hue responding.

1 Like

A quick sanity check is open http://YOUR_IP:8300/description.xml (or http://localhost:8300/description.xml , note requires setting config IP to 0.0.0.0) in a web browser, ideally from another machine.

You can check if it is working (and what is exposed) by opening http://YOUR_IP:8300/api/username/lights in a web browsers.

Discovery does NOT work on Windows but for my simple setup the emulated bridge is great! :slight_smile:

Both of those give me the output I would expect, odd that the Echo doesn’t actually see the devices then.

I tested from a different machine on the same network.

Does the Echo only support one Hue bridge since I already have a real Philips Hue?

Output:

{"input_boolean.bedtime": {"modelid": "HASS123", "name": "Bedtime", "state": {"bri": 0, "on": false, "reachable": true},    "swversion": "123", "type": "Dimmable light", "uniqueid": "input_boolean.bedtime"}, "input_boolean.front_porch_rainbow": {"modelid": "HASS123", "name": "Front Porch Party", "state": {"bri": 0, "on": false, "reachable": true}, "swversion": "123", "type": "Dimmable light", "uniqueid": "input_boolean.front_porch_rainbow"}, "input_boolean.garage_door": {"modelid": "HASS123", "name": "Garage Door", "state": {"bri": 0, "on": false, "reachable": true}, "swversion": "123", "type": "Dimmable light", "uniqueid": "input_boolean.garage_door"}, "input_boolean.livingroom_rainbow": {"modelid": "HASS123", "name": "Living Room Party", "state": {"bri": 0, "on": false, "reachable": true}, "swversion": "123", "type": "Dimmable light", "uniqueid": "input_boolean.livingroom_rainbow"}, "input_boolean.lock_doors": {"modelid": "HASS123", "name": "Lock Doors", "state": {"bri": 0, "on": false, "reachable": true}, "swversion": "123", "type": "Dimmable light", "uniqueid": "input_boolean.lock_doors"}, "input_boolean.office_rainbow": {"modelid": "HASS123", "name": "Office Party", "state": {"bri": 0, "on": false, "reachable": true}, "swversion": "123", "type": "Dimmable light", "uniqueid": "input_boolean.office_rainbow"}, "input_boolean.unlock_doors": {"modelid": "HASS123", "name": "Unlock Doors", "state": {"bri": 0, "on": false, "reachable": true}, "swversion": "123", "type": "Dimmable light", "uniqueid": "input_boolean.unlock_doors"}, "input_boolean.vacation_mode": {"modelid": "HASS123", "name": "Vacation Mode", "state": {"bri": 0, "on": false, "reachable": true}, "swversion": "123", "type": "Dimmable light", "uniqueid": "input_boolean.vacation_mode"}}

It sounds like the discovery piece is the problem (which I think you’d already hit on). :frowning:

Is the Echo on the same subnet as HA? https://www.amazon.com/gp/help/customer/display.html?nodeId=201751350 has some hints.

I spent ages trying to get an Amazon FireStick until I found out only the Echo supports discovery, FireTV’s don’t say “not supported” they just fail to find anything :frowning:

Yep same subnet. Checked that post out earlier no real luck thus far.

Well now that’s interesting, thanks for posting. My lights/switches are all being picked up by Alexa, but my scenes are not. When I look at the JSON output at that link, my scenes ARE in there. But they are never discovered by Alexa.

So as an example, this device (from the API) and a bunch of others work fine via Alexa:

switch.basement_crown_led_lights_switch_19: {
modelid: "HASS123",
name: "Crown LED",
state: {
bri: 0,
on: false,
reachable: true
},
swversion: "123",
type: "Dimmable light",
uniqueid: "switch.basement_crown_led_lights_switch_19"
}

However, she has no idea what this is:

scene.low_ambient: {
modelid: "HASS123",
name: "Low ambient",
state: {
bri: 0,
on: false,
reachable: true
},
swversion: "123",
type: "Dimmable light",
uniqueid: "scene.low_ambient"
}

So in the course of my troubleshooting, I was changing some settings (like adding “emulated_hue_name” to some of my switches). Alexa would never pick up the new names – even though the name was showing in the API.

I then had Alexa forget all my devices and tried starting discovery over again. Now it won’t find ANYTHING from the Emulated Hue Bridge. It picked up stuff from my SmartThings hub no problem. Is there some “blacklist” somewhere when you tell Alexa to forget a Hue device? Has anyone else who was having trouble with device discovery made any progress?

1 Like

I haven’t had anymore luck yet, but haven’t messed with it in a few days. Might just go back to HASKA for the moment.

I’ve done some more research and testing on this. I setup HA Bridge, which was pretty straight forward, and created a test device that works via the HA Bridge console.

Still having the same results, Echo doesn’t find any new devices. So this is leading me to believe that either my router has something to do with it (Asus RT-AC88U), or the fact that I run it on an Ubuntu and the OS is doing something to block the discovery traffic (UFW Firewall Off), or that the Ubuntu is a VM running on a QNAP with 802.3ad port trunking and that is interfering with the multicast traffic.

I might throw HA Bridge on a Pi and see if I get better results.

I have it setup on a Pi and followed all the config’s… the web shows all working fine, but still not found by Alexa… wondering if Amazon has blocked the HA emu from working?

Error logs below -

16-09-19 21:30:08 homeassistant.components.light.hue: Error connecting to the Hue bridge at 192.168.0.10
Traceback (most recent call last):
File “/home/pi/.homeassistant/deps/phue.py”, line 543, in connect
with open(self.config_file_path) as f:
FileNotFoundError: [Errno 2] No such file or directory: ‘/home/pi/.homeassistant/phue.conf’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/lib/python3.4/dist-packages/homeassistant/components/light/hue.py”, line 95, in setup_bridge
config_file_path=hass.config.path(filename))
File “/home/pi/.homeassistant/deps/phue.py”, line 435, in init
self.connect()
File “/home/pi/.homeassistant/deps/phue.py”, line 559, in connect
self.register_app()
File “/home/pi/.homeassistant/deps/phue.py”, line 513, in register_app
response = self.request(‘POST’, ‘/api’, data)
File “/home/pi/.homeassistant/deps/phue.py”, line 459, in request
connection.request(mode, address, data)
File “/usr/lib/python3.4/http/client.py”, line 1090, in request
self._send_request(method, url, body, headers)
File “/usr/lib/python3.4/http/client.py”, line 1128, in _send_request
self.endheaders(body)
File “/usr/lib/python3.4/http/client.py”, line 1086, in endheaders
self._send_output(message_body)
File “/usr/lib/python3.4/http/client.py”, line 924, in _send_output
self.send(msg)
File “/usr/lib/python3.4/http/client.py”, line 859, in send
self.connect()
File “/usr/lib/python3.4/http/client.py”, line 836, in connect
self.timeout, self.source_address)
File “/usr/lib/python3.4/socket.py”, line 509, in create_connection
raise err
File “/usr/lib/python3.4/socket.py”, line 500, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

Have you got it working yet? I have excatly the same problem, emulated hue is working and able to see it form other devices from the network but Alexa keep saying can’t find any smart home devices, same result in alexa app, however, i am using a AlexaPi instead of a real echo, don’t know if that is the problem.

Any updates? I got mine working however it was due to a silly error. I have HASS installed in a docker instance and set the IP address to localhost (127.0.0.1) in the configuration file. Once I changed it to the appropriate IP address (the host machine IP address), it worked great. Just thought I would share in case anyone else is having similar issues.

I haven’t had any luck, but honestly haven’t messed with it much in the past few days.

This is really starting to drive me nuts. Especially since it worked at first (and was so simple!) and now it doesn’t.

I can’t figure out what changed. At first I thought it might have been that Docker had created a network interface on my Pi, and that was getting picked up as the UPnP listener instead of eth0…but even after I shut down docker and killed the interface, Alexa can’t find my Emulated Hue Bridge.

My home is all on one internal network, but I have one router acting as the gateway and DHCP server and three Apple Airports (one Extreme, two Expresses) as wireless access points. The Pi is plugged in directly to the router. The Echos, of course, are on Wifi.

It’s a wild theory at this point, but I’m wondering if the right discovery packets aren’t making it through the Apple wifi access points up to the main router where the Pi is plugged in. I can’t figure out why that would be – the wifi access points aren’t setup to do any NAT or routing, and I haven’t experienced any other such problems – but I don’t know what else to try at this point. I’m going to create a special Wifi networking using the main router and connect the Echo to that.

EDIT: No dice. I put the Echo Dot on a wifi network generated by the same router the Pi is connected to, and made sure it was fully bridged, no weird security settings were enabled on my router, etc. Left my main Echo on the wifi network managed by the Apple AEs. Still can’t detect devices. I don’t know enough about networking to troubleshoot much further. Any suggestions?

So…some progress.

I downloaded and ran ha-local-echo (relevant discussion thread), on which I believe emulated_hue is based. At first I couldn’t get it working because of a logic error in the code, where it was sending the request to the HA API before any headers were set. Once I fixed that, I was able to run it…and ALEXA FOUND MY DEVICES!

So I believe this seals the deal that there is something wrong with the official emulated hue code. Going to dive in and take a look.

I’ve been debating going ha-local route. I had Haaska up in running without issue, but disabled it thinking I could move over to emulated hue. Really don’t want to go back to Haaska since it’s exclusive instead of inclusive. Basically have to hide all my devices from Haaska by default instead of just including the devices I want, and I have a lot of devices. Almost all are natively supported so it’s just a few input_boolean switches I want to include.

You should try using HA Bridge, its easy, fully managed through a web interface, you only add what you need and its been tried and tested. I wouldn’t even bother with the internal Hue Emulation and Haaska. Seriously, just try HA Bridge, you won’t know how you every survived without it.

Here is the post where I listed the steps to install it on a Raspberry Pi. If anyone is using something else, should just be a matter of changing the paths:

1 Like