To integrate Amazon Alexa like "Media Player"On Home Assistant

5 minutes of reading
Guide purposes:
  • To integrate Amazon Echo / Alexa which ripromultimedia producer at Home Assistant
  • Difficulty level: medium / low
Concepts dealt with:
  • Software configuration
Software components used:
Physical devices used:
  • The computer on which it is running Home Assistant
  • Amazon Echo (any model or any model of smart speaker you mount Amazon Alexa as an integrated assistant)
GUIDE more indicated for:

All environments

Notes and disclaimer
  • qualsiasi modifica all'impianto elettrico dev'essere progettata ed effettuata da personale qualificato;
  • any changes implemented in probefore is a propersonal responsibility as well as a profirst risk and danger (the contents of the present page are purely educational);
  • any changes implemented in proprior to a device it voids the guarantee, quality approvals and certifications.
Driving review: 2.0

Amazon Echo Dot - colors


Amazon Echo is one of the most widely recognized and successful smart speakers. As we explained in other tabs, this component uses the software to work Alexa, which is available, even for smart speakers proproduced by third parties, as well as how appstand-alone communication for Android and iOS smartphones / tablets.

This guide, we say it immediately, is not dedicated to the integration of Alexa devices with Home Assistant as a home automation control tool. This theme has already been addressed in two other specific guides:

this guide, on the other hand, illustrates how to integrate Alexa with Home Assistant as if it were (what it is, actually) a repromusic producer. This allows you to:

  • view the status of ri from frontendpromusic production;
  • set up the repromusical production, from frontend as street automation;
  • set the volume;
  • intercept its operational status;
  • use the smart speaker as a voice notification system (to which we have dedicated a guide ).

The integration it's pretty simple and involves the use of an unofficial component (custom component) Of Home Assistant, called "Alexa Media Player"

It starts


Like any custom component Home Assistant, starting from the 0.88 version of the latter it is necessary to create a folder containing the component files, which will be placed, in turn, inside the "custom_components"Inside the main folder of Home Assistant (ie the one in which they lie) the configuration files).

Download therefore the installation package e prosee decompress it: it will contain a folder called “alexa_media"Which rappresets the folder dedicated to the component; protherefore see to copy it inside the folder "custom_components”(Where the latter does not exist, prosee to create it).


from version 1.3.0 the component provides a much easier alternative to install it: to use HACS.
To do this it is necessary have the HACS component installed once and then:

  • enter HACS;
  • click "SETTINGS";
  • * under "ADD CUSTOM REPOSITORY" add - selecting the type "integration”- the path:
  • finally, returning to the item "STORE", Search and find" Alexa Media Player", Click on it and then, on the page that opens, click on"INSTALL". At the end, restart Home Assistant.

* this specific point may no longer be necessary.


Once the component is installed "Alexa Media Player" is prosaw when restarting Home Assistant, we are therefore proto integrate Alexa devices (associated with our account Amazon) to our home automation.

The data needed for proseeing this integration is theusername and password of our account at the national webstore Amazon (. It for Italy, . Fr for France and so on).

Go to the menu item Home Assistant "Settings"> "Integrations" and select the item "Alexa Media Player""

Home Assistant - Alexa integration Media Player

On the next screen, enter the user in the required fieldsname, the password and the national reference store:

Home Assistant - Alexa integration Media Player - Step 1

Click on "SUBMIT”To access the final captcha:

Home Assistant - Alexa integration Media Player - Step 2

Finally click on "SUBMIT”To complete the integration.
At this point, if all went well Home Assistant will list i device Alexa connected to profirst account and then, from this moment, integrated to theHUB:

Home Assistant - Alexa integration Media Player - Step 3

Integration details

At any time it is possible to consult the profirst list of devices integrated in the menu item “Settings">"Integrations">"Alexa Media Player"(Item"Configured"):

Home Assistant - Alexa Media Player Integration


At the end of the restart, instead of the "Configurator" entity it will be appburned one (or more, depending on how many devices were included in the configuration) of type "Media Player"

Home Assistant - Alexa Media Player

The name of this entity will be the one set on proyour account Amazon. In this case of exemplary, "media_player.alexa"

Nb For integration to work is necessary that the status of the entity is different from "Unknown". In this case "standby”Indicates that the Smart Speaker has been integrated correctly and is in standby condition. In case of status "Unknown”Review the network configuration and status, because obviously something is working incorrectly.

Ripromusical production

At this point the entity can be controlled as a common device Media Player at the user interface Lovelace or by service media_player.play_media (via automations, scripts, etc.).

One script type is the following:

    alias: Ascolto musica
    - data:
        entity_id: media_player.alexa
        media_content_id: "Radiofreccia"
        media_content_type: "TUNEIN"
      service: media_player.play_media

evoking this script, the Media Player indicated ("media_player.alexa") Will begin to reproset the "Radiofreccia" radio station via the service Tune IN.

Other examples of services are:

  "entity_id": "media_player.alexa",
  "media_content_id": "7 rings",
  "media_content_type": "APPLE_MUSIC"
  "entity_id": "media_player.alexa",
  "media_content_id": "Concrete and gold",
  "media_content_type": "AMAZON_MUSIC"
  "entity_id": "media_player.alexa",
  "media_content_id": "La mia playlist",
  "media_content_type": "AMAZON_MUSIC"
  "entity_id": "media_player.alexa",
  "media_content_id": "Falco",
  "media_content_type": "DEEZER"
  "entity_id": "media_player.alexa",
  "media_content_id": "BBC one",
  "media_content_type": "TUNEIN"


Through the integration of multiple Smart Speakers it is possible to automate the riproin chorus (synchronized) music content:

  "entity_id": "media_player.alexa",
  "media_content_id": "boyz ii men in tutti i dispositivi",
  "media_content_type": "AMAZON_MUSIC"

The trick is to indicate in the media_content_id the suffix "in all devices"


The integration also supports the control of typical Alexa sequences, specifically:

  • Alexa.Weather.Play (weather information)
  • Alexa.Traffic.Play (traffic information)
  • Alexa.FlashBriefing.Play (short summaries)
  • Alexa.GoodMorning.Play (good morning)
  • Alexa.GoodNight.Play (good night)
  • Alexa.SingASong.Play (plays a cazone)
  • Alexa.TellStory.Play (tells a story)
  • Alexa.FunFact.Play (tells a funny fact)
  • Alexa.Joke.Play (tells a riddle)
  • Alexa.Music.PlaySearchPhrase
  • Alexa.Calendar.PlayTomorrow
  • Alexa.Calendar.PlayToday
  • Alexa.Calendar.PlayNext
  • Alexa.CleanUp.Play
  • Alexa.ImHome.Play ("I'm back")

The service used is always media_player.play_media; to change is the "media_content_type", for example:

  "entity_id": "media_player.alexa",
  "media_content_id": Alexa.FlashBriefing.Play
  "media_content_type": sequence

In this example we ask Alexa to reproduce quick summaries (flash briefing).


Finally it is also possible adjust the volume of the various integrated Smart Speakers.

Let's look at the example of a script that sets a default volume to 50%:

    - service: media_player.volume_set
        entity_id: media_player.alexa
        volume_level: 0.5


At this point all that remains is to wire these possible calls to ours automations.
A trivial example can be that of configuring an automation which, when opening the front door - interpreted as a return home - isproduke a quick summary (maybe default in home automation):

- alias: "Bentornato"
  - platform: state
    entity_id: sensor.sensore_apertura_porta
    to: 'on'
  condition: []
    service: media_player.play_media
    - data:
        entity_id: media_player.alexa
        media_content_id: Alexa.FlashBriefing.Play
        media_content_type: sequence
      service: media_player.play_media

At this point it is possible to use the automations both to control Alexa as explained above, and for unleashing events in the face of riproduction of some content triggered perhaps by voice command.

For example it might be nice to set a foolish color sensitive to the music of a panel lumiI do not know Nanoleaf opposite of the start of the reproduction of a piece:

  - alias: "Riproduzione musicale"
      platform: state
      entity_id: media_player.alexa
      to: 'playing'
      condition: state
      entity_id: light.nanoleaf
      state: 'off'
      service: light.turn_on
      entity_id: light.nanoleaf
        effect: 'Music schema'

The limit, as always, it's fantasy.

Home Assistant Official LogoATTENZIONE: remember that there is on our FORUM community an ad hoc section dedicated to Home Assistant, for any doubt, question, information on the specific merit of these components.


Stay up to date through ours Telegram channel!

"Make people talk" Amazon Alexa as a home automation notification system on Home Assistant