Help with Emulated Hue inside of docker

So I run HASS via the official docker and am trying to get emulated hue to work. Does anyone know what protocol listen_port and advertise_port need? I think this may be what is causing it to not be found.

Alternatively if anyone knows how to set this up inside of docker I would be most grateful if you could share your configs.

Your Docker container should be using net=host, so there is no need to expose ports.

And if I don’t want to/can’t use net=host?

8300 and possibly 8080

Per docs

You can verify that the  `emulated_hue`  integration has been loaded and is responding by pointing a local browser to the following URL:

* `http://<HA IP Address>:8300/description.xml`  - This URL should return a descriptor file in the form of an XML file.
* `http://<HA IP Address>:8300/api/pi/lights`  - This will return a list of devices, lights, scenes, groups, etc.. that  `emulated_hue`  is exposing to Alexa.

For Google Home, verify that the URLs above are using port 80, rather than port 8300 (i.e.  `http://<HA IP Address>:80/description.xml` ).

The docs are wrong. If you specify the value for ports then the ports listed there is incorrect. Regardless it looks like it just cannot work in docker mode. If it can I have yet to find a way to do it…

Works fine for many people. Why can’t you use host network mode?

Works perfectly in docker - I have over 30 emulated hue devices, running Hass.io. Config as per the instructions page.

because i like to have control over what ports are being used. i am running 23 dockers and do not want things conflicting…

can you please share your config for this and what you have config wise for docker? is it running in host mode? if so this is not something that i really want to do.

1 Like

Yes, it is.

Why?

host_ip: 192.168.1.101
expose_by_default: true
exposed_domains:
  - switch
  - scene
  - vacuum
  - light
  - script

Appears that your version of having control may not be compatible with the running of emulated_hue.

1 Like

The documentation says this could be a problem at pairing time but the way it is stated makes it sound like you can run hass in a docker without host mode. I guess the docs are wrong about this aspect then…

All docker commands and docker-compose configurations in the official documentation for installing homeassistant in a docker container say to use host network mode.

If you choose to configure contrary to official instructions, then you must expect some potential side effects I’m afraid.

That is fine but the docs really need updated on the emulated hue and roku pages since they make it sound possible.

1 Like

If you don’t think they are correct, submit a change on Github. There is a link at the top of every page. See if what you think gets past the HA devs.

Thanks, will do.

It probably is possible, but you need to understand what to configure HA with based on the configuration of the rest of your system, which will probably involve looking at the source code for emulated_hue, looking at the internal network traffic of your docker stack, looking at your host machine’s networking, and a lot of trial and error.

1 Like

Syco54645 - I don’t know why others are being so stubborn. I’m also running in Docker - with a reverse proxy redirecting a duckdns address to my HA instance. Since letsencrypt is already listening on port 80, every time I try and look at http://my_ip_address:80/api/pi/lights, it redirects to the nginx web interface. So I also need to do some port trickery to get Alexa to see my emulated hue. You are not alone!!!

I’ve tried changing port mappings in my docker-compose without success. But Alexa is looking for port 80 outside of docker so as soon as it hits the IP, it redirects to nginx. I need to find a way to shift (or shut off) port 80 on nginx and let the HA container grab those incoming requests. If I can accomplish that, I think I might be able to conquer this.

All that said, if you aren’t using network_mode: host, could you do something like the following:

ports:
  - "80:8300"

For anyone that doesn’t want to use network_mode host or is using an macvlan, the solution is to add the following to your docker-compose file:

cap_add:
      - NET_BIND_SERVICE

Or from command line --cap_add NET_BIND_SERVICE

This gives HA the limited host permissions to below 1024 on the ports and causes it to work correctly.

2 Likes