Echo Devices (Alexa) as Media Player - Testers Needed

Hey, just looking to get this setup and very excited about it! When I’ve added alexa.py to the custom_components/media_player folder the config validator in Hassio just hangs and hangs on the loading screen… When I remove the alexa.py file the config validator runs and says all is okay… Any one else experienced this?

Did you download the raw version? If not, you need to.

What do you mean by raw version? I used the link in the top post of this thread…

This.

When you go that link, you will see a RAW button to the right.

Are there any examples of how to use the “last_called” option? I’m assuming you’d use this to have a media_player.alexa_tts send a message to the last used alexa?

I’ve tried the last_called - it’s not perfect but does kind of work.

Each media player has the last_called attribute - the one that was last called will be set to true with the others set to false.

I’ve got a routine that responds with a TTS (via nodered), and I’ve updated this to use last location, and this attribute doesn’t appear to be updated through the routine - I’ve then tried adding some additional stuff to the routine, which seemed to help, but it’s still a bit unpredictable.

It might be to do with update timings/etc.

My best success has been to say

  1. “Alexa, hello”
  2. “Routine prompt”

but even then - the last_called isn’t always up to date.
Possibly to do with timings of when the mediaplayer is updated, so I don’t blame this component :slight_smile:

I need to somehow force the media players to update, or wait I think…

Thanks @alandtse and @PlayedIn ! Worked a treat

1 Like

One example here.

1 Like

Replying to myself somewhat - a 5 second delay before a TTS response seems enough to allow the last_called to be updated.

So my process is

  1. Alexa routine
  2. First thing in routine is a “let me check… just a second… or similar” response from Alexa
  3. Call the smart switch I’m interested in (which isn’t really a switch :slight_smile:)
  4. This does what it needs to in order to collect the info
  5. Delay for 5 seconds - then get the last_called.
  6. Initiate the TTS response back based on the last called

This seems to work repeatedly, though I’ve only done a small amount of testing.

Thanks all for putting this change in :+1:

1 Like

depends.
if the mediaplayer is updated every 5 seconds then thats enough.
but with 13 dots i dont think my network will be fast enough to scan them all every 5 seconds :wink:

Hi, I tried to use this example, but my Alexa keeps reading the name of the sensor as opposed to the value :frowning:

Any ideas? My automation:

- id: '1548858157210'
  alias: Ask Alexa House Temperature
  trigger:
  - entity_id: input_boolean.house_temp
    platform: state
    to: 'on'
  condition: []
  action:
  - data:
      entity_id: input_boolean.house_temp
    service: input_boolean.turn_off
  - data:
      entity_id: media_player.joaos_echo_dot
      message: -> 'The Current Temperature in the Living room is   {{states.sensor.netatmo_the_inside_temperature}}''
    service: media_player.alexa_tts

:smiley: Here’s me with a mere 4 !

I do need to look at alternatives as it’s definitely not scalable… was more trying to prove it worked first!

Great idea. Hope you can fix custom tts playing on Alexa.

i think the mediaplayer component is great and it makes things easy for a lot of users, but i dont use media player components in general.
you always need a lot of network traffic for it.
for me its useless to be able to see what is playing on an alexa through HA, i can see that in the app if i like (and even that i dont use)

i want to send commands to the alexa devices, start playing music, stop it, use TTS, etc.
i dont need a mediaplayer for that.

but in general i have seen in HA that a great deal of people like mediaplayers, so its certainly good that they are there.

Change ‘data:’ to ‘data_template:’ and your automation will work.

2 Likes

What’s the purpose to putting the “->” in front of the message?

Oh, that makes sense. I’ll give it a try when I’m back home. It would be handy to have a way of not having to say “Alexa, Turn On, Whats the house temperature” but guess thats for a next time?

Thanks for the help. I’ll give it a test later today.

create a routine where you say “Alexa, Whats the house temperature” and let it turn on the switch.

OMG of course! Thanks @ReneTode :slight_smile: