Echo Devices (Alexa) as Media Player - Testers Needed

@alandtse This is the debug

(how can I format like yours?)

2019-03-14 08:59:53 DEBUG (SyncWorker_6) [custom_components.alexa_media.notify] Testing item: Echo against (<Entity Alexa: standby>, Alexa, G************2TU, media_player.alexa_2) 
2019-03-14 08:59:53 DEBUG (SyncWorker_6) [custom_components.alexa_media.notify] Testing item: Echo against (<Entity Echo: standby>, Echo, G************62A, media_player.echo_2) 
2019-03-14 08:59:53 DEBUG (SyncWorker_6) [custom_components.alexa_media.notify] Converting: Echo to (entities): <Entity Echo: standby> 
2019-03-14 08:59:53 DEBUG (SyncWorker_6) [custom_components.alexa_media.notify] Testing item: Echo against (<Entity Echo Input: paused>, Echo Input, G************0TX, media_player.echo_input) 
2019-03-14 08:59:53 DEBUG (SyncWorker_6) [custom_components.alexa_media.notify] Testing item: <Entity Echo: standby> against (<Entity Alexa: standby>, Alexa, G************2TU, media_player.alexa_2) 
2019-03-14 08:59:53 DEBUG (SyncWorker_6) [custom_components.alexa_media.notify] Testing item: <Entity Echo: standby> against (<Entity Echo: standby>, Echo, G************62A, media_player.echo_2) 
2019-03-14 08:59:53 DEBUG (SyncWorker_6) [custom_components.alexa_media.notify] Converting: <Entity Echo: standby> to (entities): <Entity Echo: standby> 
2019-03-14 08:59:53 DEBUG (SyncWorker_6) [custom_components.alexa_media.notify] Testing item: <Entity Echo: standby> against (<Entity Echo Input: paused>, Echo Input, G************0TX, media_player.echo_input) 
2019-03-14 08:59:53 INFO (SyncWorker_6) [custom_components.alexa_media.notify] Push by <Entity Echo: standby> : My title test```

Next you’ll find what I wrote when it was working, probably the difference is not the 1.2.1, but that when I tried I was on 1.2.0 and 0.89.1 and I had installed via pip3 alexapy.

So probably, since now I’m on 0.89.2 and it seems it’s not installed, it doesn’t work.

I don’t want to install and do more test and then try to install it. What do you think?

Use ``` (three backticks) on it’s own line to start or end a quoted section.

The component wouldn’t work at all if alexapy wasn’t installed. I don’t think that’s the problem. Your logs actually look fine as it’s finding the device.

I assume the problem persists if you use the other devices? Does it work if you create a routine in the actual Alexa app? I noticed in your prior example when it worked you had my Echo. I assume you just changed it for purposes of the thread…

I understand you’re reluctant to do more testing, so it’s ok if you decide not to do the next step.

The next step would be to enable logging on alexapy but that will be much longer and probably shouldn’t happen in this public thread. Either DM me or create an issue in GitHub. Alexapy debug does not mask serial numbers/emails so you’ll have to manually do it.

I want to do more test, that’s why I don’t want to install it, so I can test more without (?) alexapy installed.

I already had
alexapy: debug
in logger, and the result is

2019-03-13 18:43:07 DEBUG (SyncWorker_9) [alexapy.alexalogin] Trying cookie from file /config/[email protected] 
2019-03-13 18:43:07 DEBUG (SyncWorker_9) [alexapy.alexalogin] cookie loaded: <RequestsCookieJar[<Cookie at-xxxxxx 
2019-03-13 18:43:07 DEBUG (SyncWorker_9) [alexapy.alexalogin] Logged in as [email protected]
2019-03-13 18:43:07 DEBUG (SyncWorker_9) [alexapy.alexalogin] Using cookies to log in 
2019-03-13 18:43:07 DEBUG (SyncWorker_9) [alexapy.alexalogin] Log in successful with cookies```

This is the debug you are looking for, I think.

2019-03-14 09:45:08 DEBUG (SyncWorker_1) [alexapy.alexaapi] Running sequence: Alexa.Notifications.SendMobilePush data: {"behaviorId": "PREVIEW", "sequenceJson": "{\"@type\": \"com.amazon.alexa.behaviors.model.Sequence\", \"startNode\": {\"@type\": \"com.amazon.alexa.behaviors.model.OpaquePayloadOperationNode\", \"type\": \"Alexa.Notifications.SendMobilePush\", \"operationPayload\": {\"deviceType\": \"xxxxxxx\", \"deviceSerialNumber\": \"xxxxxxxx\", \"locale\": \"en-US\", \"customerId\": \"xxxxxxxx\", \"notificationMessage\": \"test\", \"alexaUrl\": \"#v2/behaviors\", \"title\": \"My title\"}}}", "status": "ENABLED"}

Strangely I see en-US, while I’m in Italy and it should be it-IT

@alandtse Hassio has home assistant in a docket container containing the app and environment. When upgrading it replaces that container with a new one. That means if you install alexapy that it is gone after a home assistant upgrade.

How do I use the notification component to trigger an Alexa routine? That is my goal.

The thing is at least three people (@PlayedIn, @lonebaggie, me) can confirm that it works on hassio without installing alexapy manually. And because, as @alandtse said, this component doesn’t work without alexapy it must be somewhere, even if you don’t find it.

So it doesn’t matter if ha replaces the container.
Also I think this will confuse new users, as they will think they’ll have to install alexapy manually. And as hassio users probably want to avoid command line interfaces, this could prevent new users to try this great component.

So I think the best thing would be to have someone with better knowledge about hassio clear that up for all of us.

Maybe @alandtse know’s someone that could help with this.
Also @petro has always been a great help. Maybe @frenck can clear that up.

Anyone know how I would port this template message below to alexa notify instead off tts?

 action:
 - service: media_player.alexa_tts
entity_id: media_player.hallway_dot
data_template:
  message: >
     {% if is_state('group.people','not_home') %}
        Welcome, House Guest. The owners are not home, they are approximately {{ (states ('proximity.people_distance_to_home') |float / 1000) | round (1) }} kilometers away. The nearest person is {{ states.proximity.people_distance_to_home.attributes.nearest }}. Guests are reminded to remove outside shoes.
     {% elif is_state('group.people','home') %}
        Welcome, House Guest. The owners are most likely at home. Probably in the {{ states ('sensor.last_motion') }}. Guests are reminded to remove outside shoes.
     {% else %}
        Welcome, House Guest. The location of the owners is unknown. Last motion was detected in the {{ states ('sensor.last_motion') }}. Guests are reminded to remove outside shoes.
     {% endif %}
action:
  - service: notify.alexa_media
    data_template:
      target: media_player.hallway_dot
      message: >
        {% if is_state('group.people','not_home') %}
            Welcome, House Guest. The owners are not home, they are approximately {{ (states ('proximity.people_distance_to_home') |float / 1000) | round (1) }} kilometers away. The nearest person is {{ states.proximity.people_distance_to_home.attributes.nearest }}. Guests are reminded to remove outside shoes.
        {% elif is_state('group.people','home') %}
            Welcome, House Guest. The owners are most likely at home. Probably in the {{ states ('sensor.last_motion') }}. Guests are reminded to remove outside shoes.
        {% else %}
            Welcome, House Guest. The location of the owners is unknown. Last motion was detected in the {{ states ('sensor.last_motion') }}. Guests are reminded to remove outside shoes.
        {% endif %}
      data:
        type: tts
2 Likes

I also need help. I’d like to be able to tell Alexa “Dinners ready” and than it should announce that to all alexa devices but the last_called device.

Is it possible to use last_called in that inverted way?

Running Tests

The issue for hass.io users is calling the routines

I can replicate the errors generated by @Remco_Timmer. @h4nc Can you confirm the errors as well ?

Notify works without issues . I suspect the call routines relies on alexaapi.py

So you’ve checked that you don’t have alexapy? Same as me.

Did you, as well @PlayedIn and @lonebaggie , get the Push Mobile notification to work?

What a good idea. You would need to use the announce option to ensure all the echo’s were synced. Why not create the groups in in the Alexa App, with all the combinations of echos you need to call . Then you could call the group that last_called echo is not in .

Long winded ,but you need the announce to keep them in sync

1 Like

You mean using two emulated_hue devices? Did not try that yet.

But I can confirm that announce, tts and push works for me.
0.89.2 and 1.2.1 (= latest versions)

@woody4165 I didn’t check that, but I can tell you that I did not install it manually, and because the component works it must be installed.

Correct I have not installed alexapy. I don’t use push mobile will test :slight_smile:

No, test call routines

Automation routines (versions >= 1.0.0)

Running Alexa automation routines is now supported. Routines are tasks you can trigger through the Alexa App. Please create them using the Alexa app and ensure they are enabled . This is now exposed through the media_player.play_media service when the media_content_type is set to routine Example json:

{ “entity_id”: “media_player.alexa”, “media_content_id”: “Goodnight”, “media_content_type”: “routine” }

If you are going to implement this, please post your examples here. I will also give it a try.

Every component with this line with automatically grab the resource linked inside it (all versions of HA including hassio). It will always be installed.

REQUIREMENTS = ['alexapy==0.3.0']
1 Like

So here you have the answer from a pro, please read @petro last post.

@alandtse said that is a typo & should be media_player.alexa_tts. That is deprecated and you should move to notify though, according to him.

Ok, so I tried my test routine script (this worked before) and I can confirm that it currently doesn’t work

in script.yaml

alexa_test_routine:
  sequence:
    - service: media_player.play_media
      data:
        entity_id: media_player.myecho
        media_content_id: "MyRoutine"
        media_content_type: "routine"