Home Assistant: Amazon Alexa Integration with Emulated Hue
Integrate Home Assistant and Amazon Alexa and your smart home setup can have the benefits of both. This Home Assistant: Amazon Alexa Integration article will show how you can enjoy Alexa’s simple voice control with the power of Home Assistant. It also allows you to extend Alexa to many Home Assistant Devices even if they are not Alexa supported out of the box. This of course can be done at no cost (other than your time). Yup. Free. This uses the emulated hue integration within Home Assistant which provides a virtual Philips Hue bridge, allowing Alexa to interact with Home Assistant entities. This can also work with Google Home, but our focus in this article is Amazon Alexa. The virtual bridge can turn entities on/off or change the brightness of dimmable lights. The volume level of media players can be controlled as brightness. In deciding if Home Assistant would work for me, I needed to know if there would be some integration with the Alexa environment. I have a number of Alexa compatible devices and enjoy the convenience and this process has worked very well for me.
This is actually quite simple to setup, however when I was first trying to figure it out, there were a couple small things that I got snagged on. There other options to setup the Alexa / Home Assistant but one is complicated (Alexa integrated skill) and the other requires a monthly subscription (Home Assistant Cloud). Both are options, if you’d like, however I’ve found the emulated Hue approach to work very well.
This article is part of my Home Automation series and you can check out other Home Automation articles on this site which may also be interesting or helpful.
Emulated Hue configuration.yaml Setup
Lets gets started with this Home Assistant: Amazon Alexa Integration article. The first thing we will need to do is edit our
/config/configuration.yaml file on our Home Assistant machine. The best way to do this is by navigating to your Home Assistant WebUI (by going to [ip address]:8123 in a web browser, where [ip address] is the ip address of your home assistant machine) and using the built in file editor, which looks like the image below.
If you have File Editor installed, it should show up on the left tool bar as indicated in the above image. If it’s not showing up there you can install it or access it by navigating to the following menus:
Supervisor -> File Editor
Supervisor -> Add-on Store - File Editor and follow the instructions there.
So once, you’ve gotten the File Editor open, you will need to navigate it to the
/config/configuration.yaml file by clicking the folder icon in the top left corner. In a blank space at the bottom of the file, we will paste the following:
# Amazon Echo emulated_hue: # type: alexa host_ip: 192.168.1.180 listen_port: 80 expose_by_default: false exposed_domains: - light - switch - scene - media_player - script entities:
When pasting, you will need to change the host_ip to the ip of your Home Assistant machine (the same IP used above to access the WebUI). You will also need to pay VERY close attention to BOTH the syntax and the spacing. In the top right corner there is either a green check mark or a red X. If you see the green check mark, that means your syntax and spacing are good. If you see the red X, review what you’ve pasted in.
A bit about what the above configuration does. This is telling your system a) you want to enable the emulated Hue and b) the configuration for that setup. The host_ip and listen_port tell the system what the IP address and port of the emulated Hue are.
The next line
expose_by_default: false means that by default, Home Assistant devices and entities are NOT exposed as emulated Hue devices and therefore won’t be visible by Alexa. This means that we will (below) need to manually specify which devices are exposed. This is going to be the best approach for most people for a few of reasons. First, this means that devices that HA detects which you have no intention of controlling with Alexa (such as network routers) don’t confuse Alexa (which is easy to do). Second, many of you, like me, have a number of smart home devices and adding all of these devices would also have the potential to confuse Alexa. Third, there are privacy concerns in general with Alexa (both as a part of Google and as it is cloud based service) and exposing more devices may not be the best practice. Finally, and maybe most importantly, manually defining each of the devices gives us the opportunity to name that device for Alexa, which might be better than, in my case, “switch.outletlinc_relay_13_A9_F3”. Imagine trying to remember that when asking Alexa to turn devices on or off. If you only have couple of devices and you want to expose everything, then you could change this to true if you’d like.
The final lines are telling what areas (domains) Alexa will be able to see (are exposed). In this case we have exposed lights, switches, scenes, media players and scripts. There are others and you can read the Emulated Hue documentation should there be other types you want to expose. Below this line is entities, which we will fill out next and which tells Home Assistant which specific entities the emulated Hue is allow to see and send to Alexa.
Exposing Devices to Alexa
If you’ve kept the exposed_by_default set to false, then you need to follow the steps in the section to overwrite that statement and manually expose devices. If you decided to set it to true, then you don’t need to follow the steps in this section.
I recommend that you expose on a couple of entities to start off with and test and then add more on. I’ve included some sample code below for some of my Insteon and wifi devices that I exposed:
# Amazon Echo emulated_hue: # type: alexa host_ip: 192.168.1.180 listen_port: 80 expose_by_default: false exposed_domains: - light - switch - scene - media_player - script entities: switch.outletlinc_relay_00_00_00: name: "Deck" hidden: false light.basement_lamp_east: name: "Basement Lamp East" hidden: false light.basement_lamp_west: name: "Basement Lamp West" hidden: false
Again, when adding this text to your config file be very careful of the syntax and spacing. You can see in the above example, each entity is indented by a single space with the name of that entity in Home Assistant. This name is the name that shows up in the device properties in the “Entity ID” field. To see this, go to your device and click on settings (the gear icon). That name is followed by a “:” then on the following two lines, each line indented one more space, are the name of the device (which will show up to Alexa) and then “hidden: false” meaning it will be visible to Alexa. Repeat this for all the devices you wish to expose.
Once done, make sure the configuration is valid (you see a green check mark in the top right of the file editor) and save the file. Now you will need to restart Home Assistant.
Now it’s time to get out your phone or tablet and open up the Amazon Alexa App so that we can add the devices to Alexa.
In the app, we need to add the Phillips Hue Hub as a device. We do not need to add the Phillips Hue skill. To add it as a device, click
"Devices" (bottom left of the main screen) -> plus icon (top right) -> "Add Device" -> "Hub" -> "Phillips Hue" -> "Phillips Hue V1 bridge (Circular Shape)" -> "Discover Devices"
After about 45 seconds it should discover your devices! Go ahead and add them!
Congrats! You’ve completed this Home Assistant: Amazon Alexa Integration article and added devices to Alexa – go ahead and use voice commands to turn them on and off!
Tech Tech and More Tech: https://techtechandmoretech.com/guides/home-assistant-alexa/
Tech Tech and More Tech YouTube Video: https://www.youtube.com/watch?v=-bi0p6jk_R8
Emulated HUE documentation: https://www.home-assistant.io/integrations/emulated_hue/
8 thoughts on “Home Assistant: Amazon Alexa Integration with Emulated Hue”
Yet another amazing tutorial! Thank you! I just bought my family an Echo and Echo Dot for Christmas and have read that there was a way to enable Alexa with HA but each source said it was too complicated. Thank you for finding the â€œeasyâ€ way and for sharing! Now to go read up on your home automation tutorialsâ€¦
P.S. I’d love to read how you installed and setup Home Assistant. I’m not liking the Core version that is offered as a plugin in TrueNAS.
I have it running on an raspberry pi 3. Install is pretty simple and very stable. I haven’t tried it on anything else, freenas or otherwise. I havent decided where I want it to live permanently, maybe keep on the rpi.
I cant achieve the part App setup. When selecting the Hue device (circular) the discovering device function doesnt find anything. I made sure my HA configuration was right by checking on port 80 if HA took correctly what I configured into account…
I wonder if there was a change in the skill since January the 1st
I just did it again on my phone and it works fine for me.
Check your steps and make sure you’re on connected to the same network.
thank you very much for this instructions, it really works with my configuration and all Zigbee devices I got in Alexa.
On my version of AmazonAlexa , when I select HUB -Philips Hue , it always asks to install SKILL Hue.
But, just select OTHER HUB and all devices are found.
Glad it was helpful.
Did u get it working in app? I am also having the same issue.