Jump to content






Photo

Home-Assistant Alexa Media Player options

Posted by pete_c , 02 February 2019 · 2118 views

Used this wiki to install this; very much plug n play
 
Will attempt to turn this post in to a blog.
 
What it does:
 
1 - Allows for control of Amazon Echo products as home assistant media devices with the following features:
  • Play/Pause/Stop
  • Next/Previous (Track)
  • Volume
  • Retrieval for displaying in home assistant of:
  • Song Title
  • Artists Name
  • Album Name
  • Album Image
2 - Text-to-Speech

Can be invoked from the HA UI services menu. media_player.alexa_tts and requires a payload like this:
{"entity_id": "media_player.bedroom_echo_dot", "message": "Test message"}
 
Installation

1 - download alexa.py and install it it /config/custom_components/media_player/alexa.py
wget hxxps://github.com/keatontaylor/custom_components.git
2 - edit your configuration yaml to include:

media_player:
- platform: alexa
email: your amazon email
password: your amazon password
url: amazon.com

or

media_player:
- platform: alexa
email: your amazon email
password: your amazon password
url: amazon.com
exclude_devices:
- "This Device"
- "Alan's Alexa Apps"
- Stairs
- Garage

or

media_player:
- platform: alexa
email: your amazon email
password: your amazon password
url: amazon.com
include_devices:
- "Master Bedroom"
- Stairs
exclude_devices:
- Stairs
- Garage
 
3 - restart HAOn reboot your Amazon Alexa Devices will come up as media devices in HA.
 
Here created Amazon Echo TTS for zone triggers using MQTT which work well using the built in automation editor after trying this by hand editing the automation.yaml.  Much easier to do this with the automation editor.

Here have an Amazon Dot connected to the Russound zoned audio system (that also is connected to HomeSeer MS SAPI) and utilize bluetooth microphone for this one.
 
alexa1


 
Here is one for back door.
 
Name:
backdooropenecho1
 
Trigger type: mqtt
Topic: omnilink/zone2/basic_state
payload: OPEN
 
Actions:
 
Action type: call service
Service: media_player.alexa_tts
Service data:
{
  "entity_id": "media_player.ics_echo1",
  "message": "Back door is open"
}