haaska implements a bridge between a Home Assistant instance and the Smart Home Skill API for Amazon's Alexa. It provides voice control for a connected home managed by Home Assistant, through any Alexa-enabled device. Currently, haaska supports the following entity types:
Type | On/Off Supported? | Dim Supported? |
---|---|---|
Alerts | Yes | No |
Automations | Yes | No |
Climate | Yes | Temperature |
Cover | Yes | No |
Fans | Yes | Yes (speed) |
Groups | Yes | No |
Input Booleans | Yes | No |
Input Sliders | No | Yes (value) |
Lights | Yes | Yes |
Locks | Lock/Unlock | No |
Media Players | Yes | Yes (volume) |
Scenes | Yes | No |
Scripts | Yes | No |
Switches | Yes | No |
@brusc put together a good video which demonstrates haaska in action, and provides a walkthrough of the setup process.
Note that Home Assistant includes a component (emulated_hue
) to communicate with Amazon Echo and Google Home devices. emulated_hue
exposes the entities in Home Assistant as Philips Hue lights. This allows basic voice control without the effort of setting up haaska, but its capabilities are limited compared to an Alexa skill and it does not work with every Alexa-enabled device.
In the config/
directory, copy config.json.sample
to config.json
and update it. Below is a listing of properties that config.json
will accept.
Run make
to build a deployable package of haaska. This will generate a haaska.zip
file that you'll upload to AWS Lambda (if you're used to docker you can try running make with docker build -t haaska . && docker run -v "$PWD":/usr/src/app haaska
Register with an OAuth provider, such as Login with Amazon.
Create an Alexa skill and Lambda Function by following these instructions (with the modifications noted below).
FUNCTION_NAME
variable in the Makefile
.haaska.zip
that you created in step 1.haaska.event_handler
lambda_basic_execution
if it existslambda_basic_execution
doesn't exist, select "Create a custom role" instead, and enter lambda_basic_execution
as the "Role Name"profile
Go back to Login with Amazon, select "Web Settings" under "Manage" for your security profile, and add each "Redirect URL" from the Lambda function as an "Allowed Return URL".
Send a test event by running make test
, which will validate that haaska can communicate with your Home Assistant instance. Note that you must have the AWS CLI and jq installed.
Key | Example Value | Required? | Notes |
---|---|---|---|
url |
https://home-assistant.io/demo/ |
Yes | The API endpoint of your Home Assistant instance. |
password |
securepassword |
Yes | The API password of your Home Assistant instance. |
ssl_verify |
mycert.crt |
No | This will be passed as the verify parameter for all requests; see here for options. |
expose_by_default |
true |
No | Whether or not entities should be exposed to Alexa by default. If not specified, this defaults to true. |
exposed_domains |
["alert", "automation", "climate", "cover", "fan", "garage_door", "group", "input_boolean", "input_slider", "light", "lock", "media_player", "scene", "script", "switch"] |
No | A JSON array of entity types to expose to Alexa. If not provided, the example value is used. |
entity_suffixes |
{"group": "Group", "scene": "Scene"} |
No | A JSON object of entity suffixes to expose to Alexa. If not provided, the example value is used. |
debug |
false |
No | When enabled, the haaska log level will be set to debug. If not provided, this defaults to false. |
After completing setup of haaska, associate the Skill with Alexa by browsing to 'Skills' in the Alexa App (Mobile or Web) and clicking 'Your Skills". Find your skill, click on it, and click enable. Go though the Amazon authentication flow and when finished, click on Discover Devices or tell Alexa: "Alexa, discover my devices." If there is an issue you can go to Menu / Smart Home
in the web or mobile app and have Alexa forget all devices, and then do the discovery again. To prevent duplicate devices from appearing, ensure that the emulated_hue
component of Home Assistant is not enabled.
Then you can say "Alexa, turn on the office light" or whatever name you have given your configured devices.
Here is the table of possible commands to use to tell Alexa what you want to do:
To do this... | Say this... |
---|---|
ON Commands | |
Alexa, turn on <Device Name> |
|
Alexa, start <Device Name> |
|
Alexa, unlock <Device Name> |
|
Alexa, open <Device Name> |
|
Alexa, boot up <Device Name> |
|
Alexa, run <Device Name> |
|
Alexa, arm <Device Name> |
|
OFF Commands | |
Alexa, turn off <Device Name> |
|
Alexa, stop <Device Name> (this one is tricky to get right) |
|
Alexa, stop running <Device Name> (also very tricky) |
|
Alexa, lock <Device Name> |
|
Alexa, close <Device Name> |
|
Alexa, shutdown <Device Name> |
|
Alexa, shut <Device Name> |
|
Alexa, disarm <Device Name> |
|
DIM Commands | <Position> is a percentage or a number 1-10 |
Alexa, brighten <Device Name> to <Position> |
|
Alexa, dim <Device Name> to <Position> |
|
Alexa, raise <Device Name> to <Position> |
|
Alexa, lower <Device Name> to <Position> |
|
Alexa, set <Device Name> to <Position> |
|
Alexa, turn up <Device Name> to <Position> |
|
Alexa, turn down <Device Name> to <Position> |
To see what Alexa thinks you said, you can see the command history under Menu / Settings / History
in the web or mobile app.
To view or remove devices that Alexa knows about, you can go to Menu / Smart Home
in the web or mobile app.
(Thanks to @dale3h for originally discovering these!)
To upgrade to a new version, run make deploy
Sometimes the "friendly name" of an entity in Home Assistant differs from what you'd actually like to call that entity when talking to Alexa. haaska provides a mechanism to define a custom name for an entity that will be used via Alexa. This is achieved by adding your entity to a customize block in your configuration.yaml
, and setting the haaska_name
key to the desired name.
customize:
light.some_long_light_name:
haaska_name: Overhead
If there's an entity you'd like to hide from haaska, you can do that by adding a haaska_hidden
tag and setting it to true
; e.g.:
customize:
switch.a_switch:
haaska_hidden: true