Echo Devices (Alexa) as Media Player - Testers Needed

Thank you! It looks like we had a working solution! In the installation guide there was no mention about the need to install Alexapy module. I haven’t Hassio but I solved with py -m pip install alexapy like you suggested. What is strage is that the configuration device didn’t appear but I have the media player components, I tried with iphone as a source and seems to work anyway!

Thank you again for your work and support!

1.3.1 is out.

This is just bug fixes for those who got a keyerror because Guard mode is not enabled or available. If you weren’t seeing those errors, this version won’t do anything for you so you can skip it.

Fixes:

  • Fix keyerror bug when Alexa Guard is not enabled or available (resolves #226, #230)

Full changelog.

As always, please use the the Wiki and FAQ if you need instructions or have questions. Also, please help in documenting features in the wiki since this thread is basically unsearchable now. We also use GitHub for bug reports/feature requests .


I am looking at a request to add do not disturb and shuffle functionality. I also implemented a repeat command. I am planning to use switches that will automatically be created for every Alexa device you have. Since this will create a boatload of entities for each Alexa device, I wanted to see if anyone would prefer I only enabled a service instead. My initial thought is you can ignore entities you don’t use, but figured I’d get feedback.

Exposing the service means I’d probably release it earlier since I don’t have to figure out whether the items are actually on or off if there are changes outside of HA. Of course, if people don’t care if the state is accurate, I already have a developer version working to play with (feedback welcome but I won’t be providing any direct support if you play with a developer branch).

2 Likes

Quick question: I want to play this song:

When the doorbell is pressed. media_content_id:“Hello! The Book of Mormon” cannot find the song.

Is it possible to substitute the Spotify URI, in this case " spotify:track:08hlFtp8y9S6YZmjBNvQ1I" somehow into the content ID? Or is this a new feature request?

Thanks.

was wondering how can i read sensors from HA, but from services, i, able to make it work with automations but for some reason not able to make it work in services

{
    "message": "{{ states('sensor.time_of_day') }}, the current time is {{ states('sensor.time') }}",
    "data": {
        "type": "announce"
    },
    "target": [
        "media_player.echo_dot"
    ]
}

We support whatever Amazon recognizes if spoken. I don’t believe it uses Spotify URIs but you can try.

I don’t believe the dev-tool service supports data_template which you need to read sensor data. You’ll need to either do it with a script or automation.

1 Like

Can someone please tell me a really simple thing which I can not work out… How do I make a TTS call from the services function?

I don;t have media_player.alexa_tts in the services?

Thank you!

I have this entry inside an automation, but i cannot get it working with my alexa devices.
What is wrong?

- service: notify.alexa_media
  entity_id: media_player.echo_plus, media_player.echo_spot
  data:
    message: "E' davvero caldo!"

The new version changed the syntax:

https://github.com/keatontaylor/alexa_media_player/wiki/Automation-examples

Ciao!!

try it this way:

- service: notify.alexa_media
        data:
          data:
            type: announce
          target:
            - media_player.echo_plus 
            - media_player.echo_spot
         message: "E' davvero caldo!"

Thanks, solved!

Anyone have an example automation on how to turn on/off alexa guard based on coming or going, or an imput boolean/select?

1 Like

See https://github.com/arsaboo/homeassistant-config/blob/aaa60ab8d21bc1ff2fe8e07d29e5c665a9e24cd1/scripts.yaml#L17 for example

Hi all, I can’t seem to get this plugin to work. Getting the ‘cannot find alexapy module’.

I’m using Hassio w/ Raspberry Pi. Took the github files in RAW and created the folders. Restarted multiple times.

Even downloaded the SSH & Web Terminal and installed alexapy manually through pip3. When I type pip3 list it shows ‘AlexaPy’ version ‘0.7.0’.

Any ideas?

Fixed it. The instructions with the wiki weren’t updated to include all of the files in the repo, so I copied over the entire directory (including manifest.json, etc). Asked me for the captcha now.

Glad you got it working. Do you mind updating the wiki so the next person doesn’t get tripped up?

Sure. It’s updated now.

Is anyone else having issues while templating the devices you want to use for TTS? Individual target devices in the template work fine but listing them as “media_player.alexa_1, media_player.alexa_2, media_player.alexa_3” without quotes of course, for example, doesn’t error the automation, but does not play anything over the devices. Any ideas?

I do see above that someone listed a url for examples but none of them use a template for the target

possibly an example is needed? this is an example of the target and it fails to actually respond when the automation happens, however the automation itself does not fail:

          target: >-
            {% if now().strftime("%H%M")|int > 0759 and now().strftime("%H%M")|int < 2100 %}
            media_player.alexa_1, media_player.alexa_2, media_player.alexa_3
            {% else %}
            media_player.alexa_1, media_player.alexa_2
            {% endif %}

We can’t do much with just a snippet. For example, is that under a data_template?

Turn on alexapy debugging so we can see the actual call to the underlying API. The API expects an array of strings if you’re going to list individual devices and I have no idea if that’s what the automation is passing through.

here would be a full automation example:

  - alias: 'notify alexa example'
    trigger:
      - platform: state
        entity_id: sensor.presence
        to: 'home'
    action:
      - service: notify.alexa_media
        data_template:
          target:
            {% if now().strftime("%H%M")|int > 0759 and now().strftime("%H%M")|int < 2100 %}
            media_player.alexa_1, media_player.alexa_2, media_player.alexa_3
            {% else %}
            media_player.alexa_1, media_player.alexa_2
            {% endif %}
          data:
            type: tts
          message: "speech example"
1 Like