Echo Devices (Alexa) as Media Player - Testers Needed

The second data_template is wrong

Should only be data

tried it before with only data , but its not working… i can see my echo as media player , did the complete installation again , filled in the captcha , i can set the volume , ican start the tts service and make her say something , i know its connected but still… its not working… just a question , the extra files in the topic , named .gitignore , .gitmodules and license , should these be copy and paste also somewhere in the directory?

try this, execute the script and tell us what happens:

dash_button_test:
  alias: Dash Button Test
  sequence:
    - service: notify.alexa_media
      data:
        entity_id: media_player.ginosechodot
        message: "Hi Fifke,,, how is your programming going?"
        data:
          type: tts

no, you don’t need those files. only the ones in the alexa_media folder.

thats what ive got , i tried the script…
not working , log :slight_smile:Thu Mar 21 2019 22:31:03 GMT+0100 (Midden-Europese standaardtijd)
Error executing service <ServiceCall script.dash_button_test (c:7a6a71d0b7434c8fb34b36c0aad0d449)>
Traceback (most recent call last):
File “/usr/local/lib/python3.7/site-packages/homeassistant/core.py”, line 1147, in _safe_execute
await self._execute_service(handler, service_call)
File “/usr/local/lib/python3.7/site-packages/homeassistant/core.py”, line 1160, in _execute_service
await handler.func(service_call)
File “/usr/local/lib/python3.7/site-packages/homeassistant/components/script/init.py”, line 116, in service_handler
context=service.context)
File “/usr/local/lib/python3.7/site-packages/homeassistant/components/script/init.py”, line 174, in async_turn_on
kwargs.get(ATTR_VARIABLES), context)
File “/usr/local/lib/python3.7/site-packages/homeassistant/helpers/script.py”, line 131, in async_run
await self._handle_action(action, variables, context)
File “/usr/local/lib/python3.7/site-packages/homeassistant/helpers/script.py”, line 210, in _handle_action
action, variables, context)
File “/usr/local/lib/python3.7/site-packages/homeassistant/helpers/script.py”, line 299, in _async_call_service
context=context
File “/usr/local/lib/python3.7/site-packages/homeassistant/helpers/service.py”, line 88, in async_call_from_config
domain, service_name, service_data, blocking=blocking, context=context)
File “/usr/local/lib/python3.7/site-packages/homeassistant/core.py”, line 1115, in async_call
raise ServiceNotFound(domain, service) from None
homeassistant.exceptions.ServiceNotFound: (ServiceNotFound(…), ‘Service notify.alexa_media not found’)

can you take a screen shot of your directory structure of the folder where the alexa_media component is located.

also, how did you install the files into that location? did you copy the raw files, clone the repo and copy those files directly into the directory or put them there in some other way?

This is my directory , i copied the raw files and pasted them directly in the directory alexa_media i created…

This was in my log from last night…

Log Details (ERROR)
Fri Mar 22 2019 03:35:08 GMT+0100 (Midden-Europese standaardtijd)
Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py”, line 344, in _async_add_entity
raise HomeAssistantError(msg)
homeassistant.exceptions.HomeAssistantError: Entity id already exists: media_player.ginosechodot. Platform alexa_media does not generate unique IDs

@Fifke

try this:

alexa_test_tts:
  sequence:
    - service: media_player.volume_set
      data:
        entity_id: media_player.ginosechodot
        volume_level: 0.8
    - delay: '00:00:01'
    - service: notify.alexa_media
      data:
        target: media_player.ginosechodot
        message: "Test"
        data:
          type: tts

Please confirm you enabled the notify component in your configuration.yaml.

If enabled, something is not loading correctly. Are you on version 1.2.3? Check the __init__.py file.

For further debugging, we’ll need logs for custom_components.alexa_media to determine what’s happening. Please also format your logs like your code so it’s easier to read.

Will check that tonight. I will format my logs correctly next time , sorry for this , didnt knew i had to do it for my logs also , still duscovering this forum and home assistant. Thx for the help.

after sometesting , i have got it working , at least the notify part…
i needed to add the notify in my config ,i guess i need to add stuff to make the routines work also?

I am returning to programming after over 40+ years when I progammed BAL/Cobol/PL1…you know, ancient languages :slight_smile: Please bear with me, I’m essentially now an old newby!

Problem 1: I am trying to get my echo dot working with home assistant. I’ve added the code to configuration.yaml file…but home assistant just can’t seem to find the alexa.py file…

I’ve created a file “custom_components” in my config directory. I’ve then created a file in that folder “multi_media” and in that folder I’ve put the alexa.py file (more on that later).

when I restart HA, I get a log message “platform not found:media_player.alexa”
and another"unable to find platform alexa. search path was limited to path of component:homeassistant.components"

To me, that means HA isn’t even looking in that custom_components directory I created.??

Problem 2: I have no known_devices.yaml file. I created one in the config directory and restarted…but still nothing in that file.

Problem 3: I have no idea if I picked up the right alexa.py file because the link given in post 1 goes to a “nothing here” page. Could someone point me to the exact file I should be copying into alexa.py…I now on HA 0,90.1

You have to create a folder named alexa_media under custom_components and put here the files you find here.

Have you defined only Alexa in Home Assistant?
Any other devices that should be seen in known_devices.yaml and you don’t see?

See answer to problem 1

you need to create a folder under custom_components in your config directory called “alexa_media”.

so the directory structure is /custom_components/alexa_media.

What does the known_devices.yaml file have to do with alexa_media? I don’t understand the concern…

https://github.com/keatontaylor/alexa_media_player/tree/master/alexa_media

in that location you will find the four files you need to put in the above alexa_media folder. Be sure that when you select those files that you select the “raw” button and copy that format and not the one in the code box. Or you can also clone the repository then just copy the above referenced files into the correctly above referenced directory. there is no alexa.py that is necessary. If you have that file somewhere that you yourself manually copied in then get rid of it.

then you also need to put the alexa_media: code and notify: code into your configuration.yaml file. see the wiki installation instructions

I experimented with something like this because I don’t trust Bespoken to keep my Amazon credentials confidential. I wanted a way to send commands TO alexa. But instead of hacking the dot, I just set up a Raspberry Pi with a text to speech program (I don’t recall which I used) and when the Pi said over a speaker near the Pod: “Alexa, turn on the office light”, Alexa did it. Which surprised me because the “speech” was quite robotic sounding. My next step was going to be to loop the audio-out to the audio-in (a USB dongle). The Pi would be running Alexa-Pi- an Alexa device running on the Raspberry Pi. So the TTS program would tell the Alexa Pi a command. Just like Bespoken without the cloud.

Please see the configuring HA section. It’s not a media_player platform but alexa_media. The instructions from post 1 are deprecated. The wiki is up to date.

thanks all…I now have a clean config. On to the next step…actually using the Echo with HA. Somehow, I know I’ll be back with more questions :slight_smile:

where do I find the wiki?

go to the link i posted above and look at the row of items right below the page title. it’ll say “wiki”. click on it.