--- layout: page title: "Alexa / Amazon Echo" description: "Instructions how to connect Alexa/Amazon Echo to Home Assistant." date: 2015-12-13 13:02 sidebar: true comments: false sharing: true footer: true logo: amazon-echo.png ha_category: Voice featured: true ha_release: 0.10 --- There are a few ways that you can use Amazon Echo and Home Assistant together. - [Turning devices on and off](#i-just-want-to-turn-devices-on-and-off-using-echo) - [Build custom commands to use](#i-want-to-build-custom-commands-to-use-with-echo) - [Create a new Flash Briefing source](#flash-briefing-skills) No matter which method(s) you decide to use, please remember that Amazon Echo requires an active Internet connection to function. If your Internet is down or experiencing issues (or Amazon's infrastructure is having issues), none of these methods will work. Amazon has released [Echosim], a website that simulates the Alexa service in your browser. That way it is easy to test your skills without having access to a physical Amazon Echo. [Echosim]: https://echosim.io/ ## {% linkable_title I just want to turn devices on and off using Echo %} If you just want to be able to turn anything with a switch (like lights, switches, media players, etc) on and off, you should enable the [Emulated Hue][emulated-hue-component] component. It makes your Home Assistant appear as if it were a Phillips Hue bridge, which Echo works with natively. [emulated-hue-component]: https://home-assistant.io/components/emulated_hue/ Enabling the Emulated Hue component means you can turn things on and off by simply saying > Alexa, turn the living room lights on. or > Alexa, set the living room lights to twenty percent. instead of > Alexa, tell Home Assistant to turn the living room lights on. or > Alexa, tell Home Assistant to set the living room lights to twenty percent. In addition, you would need to build custom intents for each device and on/off combination using the below method, whereas everything just works without any extra work by using Emulated Hue. Please note that you can use Emulated Hue and the built-in Alexa component side-by-side without issue if you wish. ## {% linkable_title I want to build custom commands to use with Echo %} The built-in Alexa component allows you to integrate Home Assistant into Alexa/Amazon Echo. This component will allow you to query information and call services within Home Assistant by using your voice. Home Assistant offers no built-in sentences but offers a framework for you to define your own.
Custom slot type for scene support.
Custom slot type for script support.
As of April 2017, the random filter has been somewhat broken. You'll get a random response the first time this runs, but subsequent commands will reply with the same randomly-chosen phrase. On reboot, Home Assistant will pick a new random choice, but you're stuck with that choice till you reboot. To get around that, use the following code in alexa_confirm.yaml:
```text {% raw %} > {% set responses = [ "OK", "Sure", "If you insist", "Done", "No worries", "I can do that", "Leave it to me", "Consider it done", "As you wish", "By your command", "Affirmative", "Yes oh revered one", "I will", "As you decree, so shall it be", "No Problem" ] %} {% set rindex = (range(0, (responses | length - 1) )|random) -%} {{responses[rindex]}} {% endraw %} ``` ## {% linkable_title Flash Briefing Skills %} As of version [0.31][zero-three-one] Home Assistant supports the new [Alexa Flash Briefing Skills API][flash-briefing-api]. A Flash Briefing Skill adds a new Flash Briefing source that is generated by Home Assistant. ### {% linkable_title Configuring a Flash Briefing skill in Home Assistant %} You can use [templates] for the `title`, `audio`, `text` and `display_url` configuration parameters. Here's an example configuration of a Flash briefing skill that will tell you who is at home: ```yaml {% raw %}# Example configuration.yaml entry alexa: flash_briefings: whoishome: - title: Who's at home? text: > {%- if is_state('device_tracker.paulus', 'home') and is_state('device_tracker.anne_therese', 'home') -%} You are both home, you silly {%- else -%} Anne Therese is at {{ states("device_tracker.anne_therese") }} and Paulus is at {{ states("device_tracker.paulus") }} {% endif %}{% endraw %} ``` You can add multiple items for a feed if you want. The Amazon required uid and timestamp will be randomly generated at startup and change at every restart of Home Assistant. Please refer to the [Amazon documentation][flash-briefing-api-docs] for more information about allowed configuration parameters and formats. ### {% linkable_title Configuring your Flash Briefing skill %} - Log in to [Amazon developer console][amazon-dev-console] - Click the Alexa navigation tab at the top of the console - Click on the "Get Started >" button under "Alexa Skills Kit" - Click the yellow "Add a new skill" button in the top right - Skill Information - For Skill Type select "Flash Briefing Skill API" - You can enter whatever name you want - Hit "Next" - Interaction Model - Nothing to do here - Configuration - Add new feed - For URL, enter `https://YOUR_HOST/api/alexa/flash_briefings/BRIEFING_ID?api_password=YOUR_API_PASSWORD` where `BRIEFING_ID` is the key you entered in your configuration (such as `whoishome` in the above example). **NOTE:** Do not use a non-standard http or https port, AWS will not connect to it. - You can use this [specially sized Home Assistant logo][large-icon] as the Feed Icon - All other settings are up to you - Hit "Next" - Test - Having passed all validations to reach this screen you can now click on "< Back to All Skills" as your flash briefing is now available as in "Development" service. - To invoke your flash briefing, open the Alexa app on your phone or go to the [Alexa Settings Site][alexa-settings-site], open the "Skills" configuration section, select "Your Skills", scroll to the bottom, tap on the Flash Briefing Skill you just created, enable it, then manage Flash Briefing and adjust ordering as necessary. Finally ask your Echo for your "news","flash briefing", or "briefing". [amazon-dev-console]: https://developer.amazon.com [flash-briefing-api]: https://developer.amazon.com/alexa-skills-kit/flash-briefing [flash-briefing-api-docs]: https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/flash-briefing-skill-api-feed-reference [large-icon]: /images/components/alexa/alexa-512x512.png [small-icon]: /images/components/alexa/alexa-108x108.png [templates]: /topics/templating/ [zero-three-one]: /blog/2016/10/22/flash-briefing-updater-hacktoberfest/ [alexa-settings-site]: http://alexa.amazon.com/