Emulated Hue Not Working

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

Oddly enough I forgot that I had tried HA Bridge while I was following that post and had the same issue of the Echo not finding anything even though it works via the HA Bridge console. I went out of town and then got sidetracked by the 0.29.X segmentation fault problems. Now that I remember, I think I was starting go down other troubleshooting routes. If my actual Hue bridge is causing issues, being on a VM and virtual network interface that is tied to a physical 802.3ad Link Aggregated port, router blocking something, etc.

1 Like

This is interesting. I have Hue emulation and HA Bridge both working in my home. I’ve been thinking of setting up Haaska so that I could do “Alexa, tell Home Assistant to…” types of commands.

Are you saying that if I set up Haaska, it automatically exposes everything in my HA configuration?

It does, however it’s pretty easy to add a line to your customize to disable them. What I was doing, just a first world problem.

Just as a follow up to this, received a few additional echo dot’s (v2) and soon as I connected them up it started to work as expected and all of my emulated hue devices showed up as expected. Makes me believe something was not working on the Echo end or network.

I got my 2 new dots as well and no luck getting anything working. This is what I keep getting in the error log for Home assistant:

16-10-20 16:57:57 homeassistant.components.light.hue: Error connecting to the Hue bridge at 192.168.86.148

I’ve had no luck with HA Bridge either, I think there is a problem if you have LetsEncrypt SSL certificate (HA-Bridge Issue#183).

I could go the skill route, but I really hate having to say “ask home assistant”.

Never mind!!! it all works now … don’t ask me how but emulated hue just started working for some reason.

Same thing, wonder if it has something to do with the software update they pushed to the Echo. Also that error you’re seeing I believe is caused by HA thinking you are running an actual Hue hub and trying to connect.

1 Like

Mine started working as well. Not sure when but all devices are seen in Alexa! - DAMN! Spoke too soon. I had it forget all devices and groups and now won’t discover any again… argh… frustrating.

I had a similar issue that went away after I pinged my Amazon Echo from the RPi that HA is running on. Echo doesn’t respond to pings, but I confirmed that ARP was working (“arp -a” at the command line), so devices were able to reach other.

After the ping, I did a discovery on the Echo and everything showed up. It might be a coincidence, but it’s worth a try.

1 Like

Hey, guys!
Is this supposed to work on Windows? I get WinError 10049 “The requested address is not valid in its context”.
Don’t know what to do with it.

Hey CCostan. Do this.

1 Clear devices
2 Reinitialize HA-Bridge
3 change your emulated_hue: section in configuration.yaml to only show emulated_hue:

So if at first it was something like

emulated_hue:
  host_ip: 192.168.0.10
  listen_port: 8300
  expose_by_default: true
  exposed_domains:
    - light

change it to

emulated_hue:

4 Do a restart of HA via Developers Tools - Services
5 Discover Devices in your Alexa App
6 Forget Devices you don’t need.
7 change your emulated_hue: section in configuration.yaml back into:

emulated_hue:
  host_ip: 192.168.0.10
  listen_port: 8300
  expose_by_default: true
  exposed_domains:
    - light

5 Do another restart of HA via Developers Tools - Services
6 Start talking sweet to your “other woman” Alexa.

You will want to do the following