In this guide, we will install and configure the Home Assistant companion app for macOS.
In this guide, you will learn how to integrate Amazon Alexa with Home Assistant Cloud. Also, how to configure what entities can be controlled from Alexa, and how to customize the response when a command is given.
Table of Contents
Sign up for Home Assistant Cloud
Open Home Assistant and on the sidebar, click on Configuration and then Home Assistant Cloud. If this is the first time using the Cloud service, you can sign up and get a 30 days free trial, so you can test it out. After you’re signed in, enable the Alexa integration. Then, you need to enable the Home Assistant skill so, on a mobile device, open the Amazon Alexa app. Tap on Menu and then Skills & Games. Search and select Home Assistant. Then tap Enable to use, and sign in to Home Assistant Cloud to link your account.
After Home Assistant is linked, on the next page, click on Discover devices to sync your entities with Alexa and assign them to groups.
How to control entities with Alexa
So Alexa is now integrated with Home Assistant, and you can start controlling your entities from any Amazon Echo device.
To trigger entities that have an on and off switch, for example, a light, you can simply say “Alexa, turn on living room light” And it would turn the light on with no problem. However, entities like scripts, for example, a script to lock your computer, you wouldn’t be able to just say, “Alexa, lock computer” You would actually have to say “Alexa, activate” and then the name for the script.
A solution to this would be to use routines and set up a phrase that would trigger a specific Home Assistant script. Let me show you an example of how to set up a routine using a script to lock my computer.
How to use Routines to trigger a script
On the Amazon Alexa app, tap on Menu, Routines, and then the “+” plus icon to create a new routine. Tap on When this happens, Voice, and then enter the phrase that would trigger the command. Save the phrase and then tap on Add action, Smart Home, Control scene, and select the script that you would like to use.
Now, if you want to customize Alexa’s response you can add another action, select Alexa says, custom, and enter the phrase that you would like Alexa to respond back. After that, tap on Next and then Add. Now, any time you say the phrase on the routine, it would execute the action that was set up.
Control what entities can be exposed to Alexa
The last thing that we’re going to look at is how to configure in Home Assistant the entities that can be controlled from Alexa, and which ones to exclude. Also, how to change the name of the entities, add a description, and assign them to specific categories.
In your Home Assistant config folder, create a new file and name it cloud.yaml. Then, in the configuration.yaml file, add the following to the
cloud: !include cloud.yaml
After that, open the cloud.yaml file and add the following:
filter, there are a few variables that you can use. So, depending on your setup, and the number of entities that you would like to expose to Alexa, you can either use
include_entities which would only expose the list of entities that you specify, or
exclude_entities, which exclude the entities in that list. Alternatively, you can either use
exclude_domains which can either include or exclude all entities inside of a specific domain.
alexa: filter: include_entities: - light.living_room_light - light.bedroom_light exclude_entities: - media_player.living_room_speaker - media_player.bedroom_speaker include_domains: - switch - light exclude_domains: - input_boolean - input_select
The domains that are currently available with Alexa are:
Configure how entities are exposed to Alexa
To configure how entities are exposed to Amazon Alexa, you can use the variable
entity_config. With this, you can change the entity’s name, add a description and also specify the category that the entity belongs to.
entity_config: light.desk_light: name: Desk Light description: The light on the desk display_categories: LIGHT
I suggest setting this option for the entities exposed to Alexa. So like that, if you unlink and then relink the Home Assistant skill, it would automatically set all the entities with a description and also set them up in the specific category.
After you finish making changes to the cloud.yaml file, restart Home Assistant and then sync the updates to Alexa by simply asking, “Alexa, discover new devices”