Echo Devices (Alexa) as Media Player - Testers Needed

The current solution only works for english/us. Is there a way to make it lang independent?

I have a very simple appdeamon python script. which allows you to type a message into the UI

You will need to create an input_text component so you can type the message

input_text:
  alexa:
    name: alexa_speech

appdaemon configuration yaml. The device parameter is the name of the echo or dot to speak

SpeakAlexa:
  module: SpeakAlexa
  class: Speakalexa
  device: "media_player.lr_dot"

appdaemon script. Alexa will speak whenever the message changes

import appdaemon.plugins.hass.hassapi as hass
class Speakalexa(hass.Hass):
    def initialize(self):
        self.alexa = self.args["device"]
        self.listen_state(self.speakalexa,"input_text.alexa")
    def speakalexa (self, entity, attribute, old, new, kwargs):
        talk = self.get_state("input_text.alexa")
        if talk != "" :
            self.log("TTS Called")
            self.call_service("media_player/alexa_tts",entity_id=self.alexa,message=talk)
3 Likes

Definitely going to work on getting it to be language independent. I think I have a solution and will push a fix in a few days!

3 Likes

I have done just that today, installed on Raspbian and after some issues getting the systemctl script to auto boot HA correctly, I can confirm the component is working!

The captcha appears on each reboot, which is already known, but other than that, it seems to work very well. Great job @keatontaylor

I am also stuck in that captcha. Tried it several times but it still shows up and nothing in media player.

Press on ‘confirm’ without entering anything, then try again. A captcha reappeared for me after doing that

1 Like

tried that i am entering captcha but its coming again and again.

with this update already works with hassbian?

How do I remove the addon? I’m always getting an error.

1 Like

Yes. I just did it yesterday. Working great on Hassbian.

I see the note about not being able to initiate media. I imagine that it will be a difficult to send arbitrary audio to the echo devices so I’m curious; are you starting with an approach that just emulates a voice command. i.e. from HA send “alexa, ask plex to play guns and roses”?

Besides that, I consider this a huge accomplishment and I’ve been able to get tts working. It removes my one regret that I went with Echos over Google Homes.

1 Like

Was able to successfully add this. Is there a way to add only a specific Alexa entity (or exclude the unwanted ones)? It added 6 entities for me, but only one is an Echo.

No filtering yet, but I do need to add basic filtering for devices that cannot be controlled this way. (This Device, EchoSim, etc)

That will be perfect. May be allow a config setting to enter only the devices to be added. I have 6 devices, but only Echo.

The devices can be hidden using the existing customization configurations provided by HA. Which is probably a better way of doing it instead of allowing a config option directly for the component.

Indeed, but I want to avoid filling in the captcha 6 times :wink:

Umm, the captcha should be once per amazon account. Assuming it gets entered correctly on the first attempt.

No…I had to fill in at least 3-4 times. May be I did not enter the right letters. Do we add spaces there when the characters are separated?

No spaces needed, but I’ll test some more and make sure there isn’t an issue with the first captcha

I tried entering the captcha 3 -4 time before trying the above. The very next time it took.

@keatontaylor Great work by the way, this has filled a very glaring hole for us Echo / Home Assistant users!