Emulated hue - what I've learned - now working fine in the UK 2018

Ok so I’m a noob when it comes to HA, but I’m experienced with networks, IT, programming and security. So take everything I say with a pinch of salt, but I hope this helps someone troubleshoot their emulated hue to get home assistant working,

Background: I’m running hassio as my HA instance, started a few days ago. For the life of me I couldn’t get emulated hue working with alexa - everything looked good, but alexa wasn’t finding anything… theirs loads of info on the net, some good, some confusing, some rubbish, none of it solved my problem. So I decided to set up Haaska instead…and in the process solved my emulated hue issue! Bottom line: don’t believe any post that says ‘emulated hue is broken’ or ‘emulated hue won’t work with Hassio because of docker etc.’ it’s just rubbish - emulated hue works fine if you have the right environment set up.

So if you want to use emulated hue there’s 3 things in my experience that need to be right in your environment for it to work with Alexa:

  1. your Home Assistant configuration (see the tutorial on this site)
  2. you have the right network environment for alexa to discover your devices (right ports open and unused etc.)
  3. you have an echo dot 2nd or 1st generation that is capable of discovering legacy hue devices, some echo hardware doesn’t work as it’s only set up for new hue installations (echo show etc.).

taking (1) first - this is easy, just follow the configuration tutorial. Although set your port to 80 (and only set expose by default to true if you have less than 49 devices otherwise set to false and explicitly expose them in your config - see the tutorial for this) . See my config below:

emulated_hue:
  type: alexa
  host_ip: 192.168.1.5
  listen_port: 80
  upnp_bind_multicast: true
  expose_by_default: true

Now for (2) - I changed just 2 things on my network and suddenly emulated hue was working. I’m not exactly sure which one did the trick, or maybe it was both. However, the most likely culprit is ports being blocked/in-use by another programme. Alexa uses port 1900 for upnp discovery (along with a lot of others, see here), I had some software on my hassio box that was also using port 1900 - I changed this software to use another port. This is probably what was causing the issue. Ports are where services (like alexa or other software) connect. If they are in use by another programme, blocked or closed, then alexa can’t connect and can’t discover devices. If you are having issues with emulated hue check first whether required alexa ports are in use on your HA box. For completeness, the second thing I changed was to implement SSL on my network using the DuckDyns add-on in preparation for implementing Haaska. I know alexa skills require SSL, but there is nothing out there saying emulated hue (which is not a skill) needs it. However, if you’ve checked for port conflicts then try the SSL fix.

Finally for (3) if you don’t have a 2nd or 1st generation echo dot on your network then forget it. It may work with a echo 1st generation, but in my experience these dots are the only devices that will successfully discover devices using echo hue. Don’t use the app, or go online, ask alexa directly through one of these dots to “discover devices” (actually as long as you have one of these dots on your network it’ll work from any echo). That’s it, your devices will be discovered and you can start messing with the config and them.

So there you have it, late 2018, fresh install of Hassio and emulated hue works fine - don’t believe any of the posts out there on t’internet.

Anyway, hope this helps someone avoid 24hrs of pain, wireshark and nmap like me! Right, I’ll be onto setting up Haaska now as frankly, I’ve already done most of the hard work…darn!

RRMR

Setting the type as Alexa is incorrect in most circumstances, and should have been removed a long while ago. But if it’s working for you then happy days.

Also, setting your port to 80 is unlikely to work for most basic users as it is a reserved port so requires extra sudo commands to use.

You also need to be aware that the device used to ‘discover devices’ is now your master device, if you take that off the network your emulated_hue vapourises and needs a big chunk of hugs and sympathy to get going again :slight_smile:

I think the main problem most people run in to (without realising) is the device limit. If expose_by_default is true that’s all your scenes, all your scripts, all your lights, switches, and basically everything that’s listed in your dev panel. Even the simplest of setups will exceed the device limit almost straight away.

2 Likes

OK that’s funny! Spat my coffee…

1 Like

Yeah, I know - emulated_hue is not perfect but works fine and there’s too many posts out there saying things like ‘it never works on hassio/docker’ or ‘it’s been totally broken by Amaxon as of (insert some date here)’. That’s why it’s a interim solution for me and I’ll be setting up Haaska.

Alexa is incorrect in most circumstances: erm…not from what I’ve read. Depreciated yes, incorrect no. Can you explain as I’m interested what makes you say that as it might be something I’ve missed - I’m a noob as I say, so I’d appreciate it.

Port 80 & the config: yeah, agree but that’s why I mention ports…You’ll notice that my config has other potential unnecessary elements in it (like expose by default:true), main reason I posted it is that it’s working with this config. It may well stay working without using Port 80, or type:alexa or expose_by_default:true, but this is a tested and working config so I’ve posted it.

Device limits: mmmm…maybe. Most of my google research shows it not working even when only individual devices are exposed, the limit problem is something that seems to mostly confront people who’ve already used it and then it suddenly stops working. Most noobs set it up with one or two devices, or quickly get recommended by this forum and others to do so.

I use emulated_hue, it works fine for me.

The Alexa type is a different api iirc, there is a fair amount of discussion on it in various threads on GitHub if you feel like a hunt, but basically you should be using the newer one.

As I said, it’s good that it works for you and it is helpful that you’ve posted your experience so others can try your ideas if they experience same problems you did. I wasn’t criticising :slight_smile: . I was just pointing out a few things for anyone else that finds this thread that they might not realise.

One or two devices can often be 10 - 12 exposures by the time you have your scripts and scenes, especially if one of those devices is Zwave :wink:

No worries - didn’t think you were criticising, just wanted to explain the thinking and gain some knowledge from you. Knowledge is good!

Glad hue is working for you - I was aware it worked for others, but there’s posts out there that say, ‘ah it works for them because they set it up before GDPR/some Amazon change/something else’ - that kind of thing confuses and TBH even I checked out the GDPR thing just in case as it is vaguely plausible if Phillips changed their config… they didn’t and it wasn’t BTW! Still it got me chasing my tail for an hour or so.

So my goal here was to try to help those like me who have the config right, but can’t get it to work. I think where most of these peeps are falling down is that while they’ll get the config right, they’ll forget about the network environment - probably because it’s not something they usually do in every day life. FWIW I don’t remember coming across a single post when searching that clearly said: If the right ports for Alexa are already in use on your HA device by another programme or blocked for some reason, it just won’t work and these ports are x,y,z. Weird eh?

I have to agree with @anon43302295 on this one. I have emulated hue working with expose_by_default with 58 items.

The biggest caveats that people don’t know about emulated hue is naming and number of devices.

Gotcha 1: Phillips hue only supports x number of devices, therefore alexa only allows x number of devices. If I recall correctly, its around 63 devices.

Gotcha 2: Name your devices uniquely. If you have 2 lights/scripts/switches/any_domain with the same name, emulated hue will break. I’m talking friendly names, not entity_id’s.

Gotcha 3: Expose by default being true without limiting domains will produce likely cause Gotcha 1 and Gotcha 2 to occur.

1 Like

I know a lot of people had problems, a lot of them just down to trying to get it to work with anything newer than a Gen2 Dot, but I’ve never had any issues before using SSL, after going SSL or now on the latest everything. This is all I use in my config…

emulated_hue:
  expose_by_default: false
  off_maps_to_on_domains:
    - script

I have Haaska running but still used emulated_hue to expose devices for Harmony but since using emulated_roku to do it directly I have no need for it anymore, so, thanks for bringing this up as I’ve now removed it from my config :slight_smile:

1 Like

in contradiction from what the topic starter says, there is no need to open ANY port in your router.

i got no ports opened at all and for sure not the port that i did set in the configuration.
i never did set that port in my router.
what can be the trouble is changing the default (8300) to another port. maybe then alexa got trouble discovering it.

2 Likes

You seem to have way too much emulation going on @Bobby_Nobble hahaha

1 Like

@ReneTode: Re-read my post mate - I’m not opening any of my router ports for emulated_hue, you should never do that. I opened ports on my router so I could use DuckDyns and access my site from outside of my LAN in preparation for implementing a more widespread solution of which Haaska will be a part.

Perhaps you maybe misunderstand what ports are and how they work? You have ports on almost every connected network device (even SCADA/OT devices). It’s how things communicate. Your firewall just blocks inbound communication to these devices unless you set up port forwarding. Port forwarding on your firewall is not the same as an open port, it just allows a connection to an open port. ‘Opening a port on your firewall’ is actually port forwarding.

Anyhoo - you don’t need port forwarding for emulated hue in your firewall. However you do need an open port on the HA device. The ones to ensure are unused/open for emulated hue are on your HA device, not the firewall. Don’t touch the router firewall.

sorry that i misunderstood you.

you talk about alexa ports and upnp and alexa ports being in use by other programs.

but i just dont get that.

upnp is off! (and for most people who are no network experts and use stuff we are using here thats better, you dont want things to autoconfigure when you dont understand whats happening)

i dont care about what port alexa uses. thats on the alexa device and doesnt have anything to do with the device that runs homeassistant. if alexa uses port 1900 and i have a program on my homeassistant device that also uses port 1900 thats no problem at all. because i dont have alexa on my home assistant device.

on my homeassistant device ports are used for homeassistant (default 8123) and emulated hue(default 8300)
when you dont install a firewall on that device then those ports are not blocked so they can be reached.
off course when you install a firewall on your device running home assistant you need to set the ports free that are used by homeassistant and emulated hue, but i dont think a lot of people install a firewall on that device.

in the firewall from the router there is no need to open any ports or use any portforwarding unless you want to be able to reach HA from the outside.

so my conclusion: you dont need to open a port on the HA device unless you did something to close them all.

I think the miss communication here is haaska vrs emulated hue. Haaska would require an open port because it’s using an AWS Alexa skill inside alexa. That skill needs to talk with your home assistant which requires an open port.

Emulated hue should be 100% internal to your network and shouldn’t require any open ports, let alone any outside communication.