UPDATE – Fixed some bugs with some of the code below. Thanks for all your feedback.
Home Assistant (HA) is a piece of free home automation software for controlling your Smart Home.
People use it as the central hub or command centre for their smart home tech.
With HA you can link all your devices in just one place and build cool automations based on the state of all your devices.
Alexa + Home Assistant
Whilst it has support for some Alexa functionality, it has been very difficult until recently to trigger Alexa routines directly from Home Assistant.
Now, services such as Voice Monkey make it as easy as sending an API request to trigger Routines and make dynamic TTS voice announcements through your Echo speakers.
What Is Voice Monkey?
Voice Monkey extends Alexa’s smart home capabilities.
It offers an API to trigger Alexa Routines remotely from services such as Home Assistant and IFTTT.
It also allows you to make dynamic text to speech announcements via the API. Want to announce to one or multiple Alexa devices that a camera detected motion? You can do that with Voice Monkey 🙂
How To Trigger Alexa Routines from Home Assistant
The process is easy.
Firstly, sign up to Voice Monkey and follow the instructions to create your first Monkey and Routine.
A Monkey is simply a virtual doorbell device which can be pressed (or triggered). We can use these doorbells, or Monkeys, as triggers in our Alexa Routines.
But how do we trigger these virtual doorbells from Home Assistant?
Trigger Your Monkey With The RESTful Command
In Home Assistant you can make API calls using the REST command.
Simply add the following to Home Assistant’s configuration.yaml file:

Here’s the same code so you can copy and paste:
# Voice Monkey Alexa Routine API call
rest_command:
trigger_monkey:
url: https://api.voicemonkey.io/trigger
method: POST
verify_ssl: true
content_type: 'application/json; charset=utf-8'
payload: '{"access_token":"ACCESS_TOKEN","secret_token":"SECRET_TOKEN","monkey":"{{monkey}}"}'
In the code above you should replace ACCESS_TOKEN with your own access code found in the Voice Monkey dashboard and SECRET_TOKEN with your own secret code (make sure you keep it secret!).
Even better, as pointed out by James Inge in the comments below, keep your tokens in the a secrets.yaml file to ensure they don’t accidently get leaked by way of a public Github post etc.
Testing
Go to developer tools and test it out.
First, restart the server (Configuration -> Server Controls -> RESTART) to apply the new changes:
- Go to Home Assistant’s Developer Tools -> Services screen
- Select “rest_command.trigger_monkey” from the Service menu
- Enter the following in the Service Data field to trigger your Monkey:
{"monkey":"MONKEY_ID"}
- Select the CALL SERVICE button
You must replace MONKEY_ID with the ID of your Monkey found in the Monkey manager section of the dashboard.
And that’s it!
You can now start triggering Alexa Routines from Home Assistant.
Making announcements
To make announcements using Alexa, you must first configure an Alexa Routine which is triggered by a Monkey as above.
The last action in your Routine must be to open the Voice Monkey Skill whilst also selecting which Alexa device to make the announcement from.
In your HASS set-up you simply add the ‘announcement’ parameter to your payload object. Here is the same code above but with the ‘announcement’ key + value.
# Voice Monkey Alexa Routine API call
rest_command:
trigger_monkey:
url: https://api.voicemonkey.io/trigger
method: POST
verify_ssl: true
content_type: 'application/json; charset=utf-8'
payload: '{"access_token":"ACCESS_TOKEN","secret_token":"SECRET_TOKEN","monkey":"{{monkey}}","announcement":"{{announcement}}"}'
Now when your testing, you must also send an ‘announcement’ parameter along with the monkey ID in the Service Data field e.g. {"monkey":"MONKEY_ID","announcement":"YOUR TEXT HERE"}
I hope that helps get you started creating some awesome automations with HA and Alexa.
Let us know your automation ideas in the comments below!
43 Comments