Echo Devices (Alexa) as Media Player - Testers Needed

So happy, been waiting so long for this. Thank you.
Curious if templating works with TTS? Tried a few different ways including:

alexa_tts_test3:
  alias: Alexa tts test 3
  sequence:
    - service: media_player.alexa_tts
      data_template:
        message: '
          {%- if is_state("device_tracker.em_iphone", "home") and
                 is_state("device_tracker.22", "home") -%}
            You are both home, you silly
          {%- else -%}
            Em is at {{ states("device_tracker.em_iphone") }}
            and L is at {{ states("device_tracker.22") }}
          {% endif %} '

Alexa doesn’t respond to anything inside if statements, she does however responds to states.
Thanks again

@emnaudin you need to include the entity_id of the meida_player that you want to speak.

 alexa_tts_test3:
  alias: Alexa tts test 3
  sequence:
    - service: media_player.alexa_tts
      data_template:
        entity_id: media_player.my_echo_dot
        message: '
          {%- if is_state("device_tracker.em_iphone", "home") and
                 is_state("device_tracker.22", "home") -%}
            You are both home, you silly
          {%- else -%}
            Em is at {{ states("device_tracker.em_iphone") }}
            and L is at {{ states("device_tracker.22") }}
          {% endif %} '

For those still getting errors logging in @juan11perez, @J.eremy and others. I’m going to release another version that includes selection for bluetooth devices and will also include some more logging so that we can hopefully get to the root cause of your issue.

@keatontaylor Awesome! Looking forward to it!!

Great work @keatontaylor!
I’ll be trying this out right away.
Thanks!

2 Likes

Trying to install this but receiving the following error on Raspberry Pi 3b with HassIO

[hassio.docker.interface] Can't install keatontaylor/armhf-addon-alexa-api:0.4 -> 404 Client Error: Not Found ("no such image: keatontaylor/armhf-addon-alexa-api:0.4: No such image: keatontaylor/armhf-addon-alexa-api:0.4").

Has anyone on the armhf platform been able to upgrade to 0.4? (Raspberry Pi 3)

Thank you.

@DrZzs Oh snap! Can we expect a video about this soon? DrZzs is the man lol.

1 Like

For those having issues such as “no such image” can you please let me know what HASSIO version you’re running? I just installed a fresh version of my Raspberry Pi 3 and it seems to install just fine without issue. Also, just in case after I attempted and it worked I re-uploaded the docker image, so maybe give it another go.

I’d also suggest removing the add-on completely, along with removing my add-on repository from the add-ons page and re-adding it from scratch. Just in case that helps.

UPDATE!

0.5 released (for both the custom_component and hassio add-on.)

Please be sure to update both the add-on and place the update alexa.py file in your media_player custom_components directory.

[https://github.com/keatontaylor/custom_components/blob/master/media_player/alexa.py]

Make sure you see VERSION 0.5 when downloading.

What this fixes/adds:

  1. Major refactoring of the requests component for talking to the hassio add-on.
  2. Added the ability to select paired bluetooth devices as sources
    27%20PM
  3. Changes to cross-platform build that will hopefully fix those of you that are getting an image not found error.
4 Likes

Latest version seems to be working now (had the error with the alexaURL beeing null).

Only thing left is (pretty much see this for every device):

You know what, it just occurred to me that I am duplicating the requests for bluetooth connection status for each detected echo device, when it can be fetched in a single request. Which would explain why it might be taking longer than the default update interval. Will get this pushed out as a fix in version 0.6 along with implementing play_media.

1 Like

@keatontaylor I now suspect there were some legacy calls to the speech script in my code from earlier testing that were triggering the script (quite possibly with an empty message). Sorry for the worry.

I started a couple of months ago trying to copy and paste @CCOSTAN’s speech_engine script into my codebase. I never could get it working reliably so I am going to start with a new script, with a new name and slowly add things to it after I get the previous stuff working first.

On a side-note, I discovered that my alexa_api docker container’s IP address changes every time I reload it. I am going to have to figure out a stable way to reference that container from Home Assistant. Earlier today I was going to test the TTS again, but I was unable because it wasn’t loaded. Of course right before I fall asleep I realize the problem. At least I was able to test my theory and tentatively confirm it was my code, not yours. Hooray for progress!!! :slight_smile:

P.S. Tonights test was with 0.5. TTS is working great so far.

@keatontaylor any update on a working guide for Hassbian? Very interested to be a part of the testing for this.

Cheers.

1 Like

@keatontaylor Still getting the exact same error message. No clue on what else to do.

@juan11perez, @J.eremy

First off, I’m running this in Docker…

I started getting the same errors after multiple reboots of the host OS. ( for something unrelated )

I figured I was hammering the alexa web page too much and got a temp block or mandatory captcha, etc…, I shutdown the container overnight, upgraded and restarted this morning and now it is working fine.

Just curious if you were restarting the script/docker a few times prior to receiving the errors.

@keatontaylor . Thank You very much for your hard work version 0.5 works perfectly on my Pi 3 with UK Amazon. Bluetooth option is perfect :slight_smile:

Is it possible you can display the radio stations currently being played as I would like to automate the turning on of my Sony Bluetooth and pairing whenever media is playing on my dot? Currently whenever a radio station is being streamed, media player simply says Standby

Same error persists as @J.eremy and @juan11perez after the 0.5 update.
Running in Docker. Any help with debug tips welcomed…

This is great! I’m curious once the play_media is implemented if it would be possible to play local files. Would the Echos even allow that? I know you can use the Echo as a bluetooth speaker itself. From what I gather, this component/addon is so far only using music streaming services to play music, is that right?

1 Like