Docker Emulated Hue UPNP not working

Anyone have success with Docker and Emulated Hue+HA?

I have HA running in docker container. Seems that UPNP is not working for me so it is not being discovered.
I can see the http://ha/description.xml but I noticed that UPNP is not discovered when checking using a UPNP discovery tool.

I’m sure it my docker and not HA but looking for ideas.
I expose 8124/TCP for Hue and 8123/TCP for HA Frontend

emulated_hue:
  type: alexa
  listen_port: 8124
  advertise_ip: 192.168.27.12
  advertise_port: 8124
  upnp_bind_multicast: true
  expose_by_default: true
  exposed_domains:
    - light
    - switch
    - cover

have you had any luck with this? i’m also unable to get this working inside a docker container without setting net=host, which i’d rather not do…

Nope!!

Thank you for confirming net=host fixes it.
I stopped for now since I don’t need it at the moment but will come back to this in a week or two.

I would guess that it is just a matter of opening up or forwarding correct ports…

for the record i should clarify, it worked with net=host set on my rpi2.

since moving (or attempting to move anyway) my hass install to a server with the official image, i haven’t tried net=host yet but i’m assuming it’ll fix it there as well. all i know is that when i moved it (and attempted to keep things separate in docker) i haven’t for the life of me been able to get it working…i’ll try net=host in the morning and let you know if that works, but i would imagine it will.

Looks like UPNP may bind to random address at system start. At least that is what happens in other software. This maybe why net=host is req’d.

I thought “upnp_bind_multicast” or “listen_port” would take care of this.
Will keep looking into this.

well, net=host breaks my docker stack because it prevents it from connecting to mysql. ugh. i’d rather not go messing around with that.

seems from the documentation that this is supposed to work, somehow…would be nice if someone who knew how to configure it would chime in here rather than leaving those of us who are having issues hanging like they seem to want to do (i’ve seen several posts from people who are having issues in addition to this one and nobody ever gets a valid fix)…

can now confirm that net=host does in fact fix this…but like i said it broke other parts of my config that i then had to mess around with to get working again (had to change my mysql container to map 3306:3306, and then change my hass config to point to mysql at 127.0.0.1 instead of the much easier way of pointing to “mysql” inside the docker stack).

again, it would be really nice if someone…ANYONE…would help those of us who can’t get this working the way it was obviously intended (and how some people seem to have gotten it working, but without ever letting anyone know how).

Have you tried mapping the ssdp port 1900 to your hass container for discovery? I can only get it to discover my emulated hue in the first minute after creating a fresh hass container. Rebooting an existing hass container doesn’t work for me. And I always unplug my HUE hub. So my Alexa doesn’t stop discovering after finding the real hue hub.

Hope one of this tips will helps you. Took me a few weeks to figure this out and get it to discover my emulated hue again.

Yes. 1900 udp bridged to HA and several different configs for hue tried with this.

@crackers8199
You can use “link” command during docker build to network containers together. Intend.not to do this but it is the docker way to do this
--link <name or id>:alias

yeah saw this earlier…plan to give port 80 and the provided config a try

other details dont apply

Hi,

If you have Echo v2 devices only that seems to cause the issue.

So you need to add:

listen_port: 80

to your configuration.yaml

Emulated Hue within DOCKER

If running in a docker container you will also need to add:

upnp_bind_multicast: true

to your configuration.yaml

and make sure you use the --net=host directive when creating the Home Assistant container. This means that you will have to create the container via the Terminal window as Synologies GUI does not support the --net=host option yet.

Example

Pull the image:

sudo docker pull homeassistant/home-assistant

Create the container from the image:

sudo docker run -d --name=“home-assistant_v0.66” -v /volume1/docker/hass/:/config -v /etc/localtime:/etc/localtime:ro --net=host homeassistant/home-assistant

DOCKER ON SYNOLOGY

If like PSP91 you are running docker on a Synology device then you have the issue that Synology reserves port 80 for a nginx web redirect from Port 80 to Port 5000 (Synology HTTP Port).

For that you will need to make the changes the PSP91 listed in his post to ‘free-up’ port 80 for use by the emulated_hue component in Home Assistant.

I realize this post might be a little old, but I wanted to share my solution. I was quite annoyed that I couldn’t find any combination of options to make Alexa see the devices from emulated_hue.

Then I remembered I was running a firewall on the Home Assistant VM and forgot to open the UPnP port… facepalm.

For anyone having problems with this, I can confirm the following settings work, and devices are discoverable via the Alexa app using second-gen Echo Dots:

  1. Use net=host for your Home Assistant Docker container.
  2. Don’t run Home Assistant or an NGINX redirect over port 80; the emulated_hue component will need it.
  3. Configure the component similar to below (I prefer to explicitly reveal devices, you can opt not to).
  4. Add a couple rules to your iptables INPUT chain.
emulated_hue:
    host_ip: (your Home Assistant IP address)
    listen_port: 80
    expose_by_default: false
    entities:
      light.bedroom:
        name: "Bedroom Lights"
        hidden: false

sudo iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
sudo iptables -A INPUT -p udp -m udp --dport 1900 -j ACCEPT