Echo Devices (Alexa) as Media Player - Testers Needed

hi, i got tts and media working on multiple accounts using the last custom build, but i have a questone, is it possible to send a audio file to two of the accounts, for exempel, il like to send at music file to play after a message on my kidds alexa devices. or maybe that easier to do using the alexa app?
//Regards

Thanks…I managed to get it working again

So i was just trying to change my file naming to match the github. from alexa/media_player.py to the newer…
alexa_media/ and then the 3 files. When i check using IDE i get this error and cant restart,"

Error: INFO:homeassistant.util.package:Attempting install of colorlog==4.0.2
Testing configuration at /config
Failed config
General Errors:

  • Platform not found: media_player.alexa

Successful config (partial)

You have to change your config.

See:

Hi

I just installed the version 1.0.0 as per the wiki page and TTS and sequence are working fine.

I don’t understand what type of routine can I run using "media_content_type": "routine" and how to play music via media_player on Alexa.

Can I choose if playing from Amazon Music, Spotify, TuneIn… ?

Thanks

My last_alexa sensor doesn’t work reliable now, but I think it will soon.

You can find two examples of automations I came up with (using the new service) here
Hopefully the last_alexa sensor will work soon to make those automations useful.
Suggestions to make it more compactor smarter are welcome.

Also not sure if the delay’s are necessary @alandtse?

I know that there are other solution like this, but as for now I just want to keep it simple and keep it in home assistant.

This has been working well, and has totally replaced my alarm clock. Only, it went nuts this morning though I’ve made no changes to it in a few days.

My setting:
service: media_player.play_media
{
“entity_id”: “media_player.bedroom”,
“media_content_id”: “ESPN Radio”,
“media_content_type”: “TUNEIN”
}

I think it tried to use the ESPN skill, but I disabled that. Now it says something like “I can’t play by artist on TUNEIN”.

Any ideas?

i have same problem…

I am using 0.10.2 to implement the last_alexa using the example on the wiki. While there are multiple accounts in the household, I’ve only configured one. I’m adding the last_alexa sensor so that if I ask Alexa to run a routine that HA will speak back the info, it speaks back on the Alexa that was used to invoke the routine. (I hope this makes sense.) So the configuration.yaml entry looks like the one in the wiki:
sensor:
- platform: template
sensors:
last_alexa:
value_template: >
{%- for entity in states.media_player -%}
{%- if state_attr(entity.entity_id, ‘last_called’) == True -%}
{{ entity.entity_id }}
{%- endif -%}
{%- endfor -%}
yet the current value shows up as blank in the dev-states page. When I put the sensor into my UI it shows up as blank, then when I click on it for details, it will take a few seconds then show “unknown”.

When I look at the states of each media_player device, I see the last_called attribute in what appears to be the correct state, but mixed in with all media_players are other devices like a Google Home mini and a Vizio TV which do not have the last_called attribute.

I’ve seen that others are having this same issue but I haven’t seen if there is a fix or if I’m doing something incorrectly. One thing I noticed, it that the attribute last_call shows “true” or “false” but not “True” or “False” (no first cap). So I tried

== true -%

then

== ‘true’ -%

in configuration.yaml with no luck. The ‘== ‘true’ -%’ version does not even show “unknown”.

Any hints or guidance is appreciated.

Thanks.
Edit: Sorry, I still haven’t figured out how to get the indentations properly put in here when pasting yaml code. I used the </> symbol but it didn’t work.

See Last Alexa Sensor using Keaton Taylor Alexa Media Player custom component

Yes!! @h4nc - Thanks. The yaml code that petro posted worked like a charm.
Thanks for pointing me to it.

Er… problem?
I’m trying to use the value of sensor.last_alexa for an entity_id in a script like this:
name: scripname
Alias: aliasname
sequence:

  • service: media_player.alexa_tts
    entity_id: sensor.last_alexa
    data_template:
    message: ‘The temperature is {{states(“sensor.house_temp”)|replace(".", " point") }} degrees.’

The house_temp value is fine, but the script does not have any output even though the value of sensor.last_alexa is the echo dot I spoke to.
I have a few more things to learn about yaml I suppose. What am I doing wrong?
Thanks.

your entity has to look like this

entity_id: '{{ states.sensor.last_alexa.state }}'

Doesn’t work for me @h4nc. I get a config error:

Invalid config for [script]: not a valid value for dictionary value @ data[‘script’][‘house_temp’][‘sequence’][0][‘entity_id’]. Got ‘{{ states.sensor.last_alexa.state }}’
My script looks like :

  house_temp:
  alias: House temp
  sequence:
  - service: media_player.alexa_tts
    entity_id: '{{ states.sensor.last_alexa.state }}'
    data_template:
      message: 'The temperature is {{states("sensor.house_temp")|replace(".", " point") }} degrees.'

Not sure how to fix it yet but will try a few things.

Ok this works:

  house_temp:
  alias: House temp
  sequence:
  - service: media_player.alexa_tts
    data_template:
      entity_id: '{{states.sensor.last_alexa.state}}'
      message: 'The temperature is {{states("sensor.house_temp")|replace(".", " point") }} degrees.'

However, the last_alexa is updated either too late or it has the “previous” alexa value. For instance. If I’m in my office and I ask for house temp, I get the reply in the office. If I then go to the kitchen and ask, the office dot speaks the result. If I ask again in the kitchen, the kitchen will respond. I’m thinking of combining it with another dummy script, that essentially allows the last_alexa to be updated…
So, more digging is necessary but this is moving forward.

Thanks @petro. Was flooded with MS SQL errors for alexa_media. The PR fixed it.

1 Like

Anyone know what happened to the custom_components.json for the master branch for use by custom updater? According to the wiki, its supposed to be here:

https://raw.githubusercontent.com/keatontaylor/custom_components/master/custom_components.json

1 Like

still cant get my alexa media player fixed after changing file structure to alexa_media/ and then the 3 files.

Error: INFO:homeassistant.util.package:Attempting install of colorlog==4.0.2
Testing configuration at /config
Failed config
General Errors:
- Component not found: alexa_media

Successful config (partial
i changed the config also as instructed

What are your config files and what is your HA installation type (Hassio on rpi strech, or VMware installed)

im on hassio on and ubuntu vm. and my file structure now looks like this

custom_components
  alexa_media
    __init__.py
    const.py
    media_player.py

i just changed it to alexa_media from just alexa and also changed the config from the old way to the newer.

alexa_media:
accounts:
- email: your amazon email
password: your amazon password
url: amazon.com