Echo Devices (Alexa) as Media Player - Testers Needed

How to see if the installed alexapy is the correct one? Is there a command to know this?

I can’t seem to figure out the syntax for using the notify announce feature in an automation.

Here is the automation that i attempted to modify from a formerly working one to the new syntax:

- alias: Notification Test Weekly TTS
  initial_state: 'on'
  trigger:
    platform: time
    at: '12:15:00'
  condition:
    condition: time
    weekday:
      - wed
  action:
    - service: notify.alexa_media
      target: 
        - media_player.computer_room_dot
      type: announce 
      message: "This is a weekly test of the announcing system."

Here is the error I get:

“Invalid config for [automation]: [target] is an invalid option for [automation]. Check: automation->action->0->target. (See /config/configuration.yaml, line 457). Please check the docs at https://home-assistant.io/components/automation/

I tried to change the action to this and it passes the config check but it then gets errors when I trigger it manually:

  action:
    - service: notify.alexa_media
      data:
        target: 
          - media_player.computer_room_dot
        type: announce 
        message: "This is a weekly test of the announcing system."

and here is the error:

2019-03-13 14:29:16 ERROR (MainThread) [homeassistant.components.automation] Error while executing automation automation.notification_test_weekly_tts. Invalid data for call_service at pos 1: extra keys not allowed @ data['type']

If I call the notify manually from the dev service page using the json syntax from the example page on the github it works fine.

Does anyone have an example of a good working notification announcement used in an automation?

I run hassio on a raspberry pi 3b+ and everything’s fine.

alexa_test_announce:
  sequence:
    - service: notify.alexa_media
      data:
        target: media_player.yourecho
        #title: My title for Echo show
        message: "Test"
        data:
          type: announce
          method: all # or speak or show
1 Like

Ah, thanks. I see I missed the second “data:”. It passed and worked! :grinning:

pip list | grep alexapy

pip3 list | grep alexapy

I get this:

DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.

I just verified Hassio replaces the homeassistant docker container on upgrade, removing alexapy.

I just went from 0.89.1 to 0.89.2 and need to reinstall alexapy.

In this case, how come that I don’t have it installed and all is working fine in the alexa_media and notify_alexa?

2 Likes

When I first installed it , I had log error. Possibly only used for the captcha?

I am working on testing the functionality now after I reinstalled alexapy. I never tested this before.

I don’t use hassio but I use docker and when I update HA it destroys the container and rebuilds it and I’ve never had to manually load alexapy.

Raspi back up and the component is working, notify seems to be working well too

1 Like

I’m on Hassio 0.89.1 and version 1.2.1
Routine doesn’t trigger if there’s more then 1 emulated_hue lights in them. I can have an endless amount of actions set in the routine, but it only triggers if there is not more then 1 emulated_hue switch.
Log:

Wed Mar 13 2019 23:22:04 GMT+0100 (Midden-Europese standaardtijd)
'operationPayload'
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/websocket_api/commands.py", line 148, in handle_call_service
    connection.context(msg))
  File "/usr/local/lib/python3.7/site-packages/homeassistant/core.py", line 1133, in async_call
    self._execute_service(handler, service_call))
  File "/usr/local/lib/python3.7/site-packages/homeassistant/core.py", line 1155, in _execute_service
    await handler.func(service_call)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity_component.py", line 188, in handle_service
    self._platforms.values(), func, call, service_name
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/service.py", line 278, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/service.py", line 294, in _handle_service_platform_call
    await func(entity, data)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/alexa_media/media_player.py", line 586, in play_media
    self.alexa_api.run_routine(media_id)
  File "/config/deps/lib/python3.7/site-packages/alexapy/alexaapi.py", line 149, in run_routine
    ['deviceType']) = self._device._device_type
KeyError: 'operationPayload'

Did someone else encounter this?

Just an fyi:

I’m using hassio on a pi. Upgraded to 0.89.1. Then upgraded this component to 1.2.0. Everything works. I’m really confused on why people using hassio are having to manually install or update alexapy.

Going to watch this thread for a while before going to HA 0.89.2 and 1.2.1 of this component.

On Hassio 0.89.1 I had the log error that alexapy was missing and indeed it was not in the hassio container on my Raspian installation. After I updated to 0.89.2 I noticed the plugin was missing so I reinstalled.
I did not get a chance to test on 0.89.1 but it works on 0.89.2.

The wiki lists a media_player.alexa service but I just have media_player.alexa_tts
I was hoping to use this to trigger alexa routines controlling my Amazon plug.

Assuming the email is correct, that’s normal behavior if you’ve logged in successfully before. I may be missing context on the question though.

That’s a bug. Please file an issue and I can look into it. I may need more logs though. It only happens with emulated hues and not other items? Does it work if you run the Routine with the Alexa App?

Assuming you don’t use announce, you’ll be fine at 1.2.0. We fixed a pretty silly bug to get to 1.2.1.

I actually don’t know how hass.io’s behavior so I’m also curious to understand why sometimes it’s installing alexapy or not. If people are using custom_updater to update alexa_media, I know that forces an install of the dependency. Maybe that’s the difference.

In a venv, my experience is HA will load components_component dependencies automatically. Maybe it’s trying in hass.io and has a bug?

That’s a typo. It should be media_player.alexa_tts. However, that will be deprecated in 1.3.x in favor of the notification component so you should switch to that formulation moving forward.

1 Like

Oh ok. I did use custom_updater to update alexa_media. Maybe that IS why I had no issues.

The question was about if it’s normal that even if it seems I don’t have installed alexapy in the homeassistant container, Alexa Media and the new notification is working.

I’m using Hassio in Docker within an Ubuntu Server 18.10
Hassio is 0.89.2 and Alexa Media Player is 1.2.1 and I never upgrade via custom_updater, but manually.

TTS and Announce works both fine, but Mobile Push doesn’t, while was working on 1.2.0

I’ve tried via Services and via NodeRED.

That is weird because I made no changes to the mobile push section of code.

Can you please file an issue with debugging logs on for the custom_components.alexa_media.notify component while you try to do a push through the dev-service? It may be useful to compare it against tts or announce.

You’ll get something like this:

2019-03-14 07:48:13 INFO (Thread-5) [custom_components.alexa_media.notify] Message: test, kwargs: {'title': 'test', 'target': ['Great Room'], 'data': {'type': 'push'}}
2019-03-14 07:48:13 DEBUG (Thread-5) [custom_components.alexa_media.notify] Testing item: Great Room against (<Entity Everywhere: standby>, Everywhere, 7****************************2ce, media_player.everywhere)
2019-03-14 07:48:13 DEBUG (Thread-5) [custom_components.alexa_media.notify] Testing item: Great Room against (<Entity Great Room: standby>, Great Room, G************9FJ, media_player.great_room)
2019-03-14 07:48:13 DEBUG (Thread-5) [custom_components.alexa_media.notify] Converting: Great Room to (entities): <Entity Great Room: standby>
2019-03-14 07:48:13 DEBUG (Thread-5) [custom_components.alexa_media.notify] Testing item: Great Room against (<Entity Master Bedroom: standby>, Master Bedroom, G************98S, media_player.master_bedroom)
2019-03-14 07:48:13 DEBUG (Thread-5) [custom_components.alexa_media.notify] Testing item: Great Room against (<Entity Kitchen: standby>, Kitchen, B************2WR, media_player.kitchen)
2019-03-14 07:48:13 DEBUG (Thread-5) [custom_components.alexa_media.notify] Testing item: Great Room against (<Entity Guest Room: standby>, Guest Room, G************9WE, media_player.guest_room)
2019-03-14 07:48:13 DEBUG (Thread-5) [custom_components.alexa_media.notify] Testing item: Great Room against (<Entity Stairs: standby>, Stairs, G************RNP, media_player.stairs)
2019-03-14 07:48:13 DEBUG (Thread-5) [custom_components.alexa_media.notify] Testing item: <Entity Great Room: standby> against (<Entity Everywhere: standby>, Everywhere, 7****************************2ce, media_player.everywhere)
2019-03-14 07:48:13 DEBUG (Thread-5) [custom_components.alexa_media.notify] Testing item: <Entity Great Room: standby> against (<Entity Great Room: standby>, Great Room, G************9FJ, media_player.great_room)
2019-03-14 07:48:13 DEBUG (Thread-5) [custom_components.alexa_media.notify] Converting: <Entity Great Room: standby> to (entities): <Entity Great Room: standby>
2019-03-14 07:48:13 DEBUG (Thread-5) [custom_components.alexa_media.notify] Testing item: <Entity Great Room: standby> against (<Entity Master Bedroom: standby>, Master Bedroom, G************98S, media_player.master_bedroom)
2019-03-14 07:48:13 DEBUG (Thread-5) [custom_components.alexa_media.notify] Testing item: <Entity Great Room: standby> against (<Entity Kitchen: standby>, Kitchen, B************2WR, media_player.kitchen)
2019-03-14 07:48:13 DEBUG (Thread-5) [custom_components.alexa_media.notify] Testing item: <Entity Great Room: standby> against (<Entity Guest Room: standby>, Guest Room, G************9WE, media_player.guest_room)
2019-03-14 07:48:13 DEBUG (Thread-5) [custom_components.alexa_media.notify] Testing item: <Entity Great Room: standby> against (<Entity Stairs: standby>, Stairs, G************RNP, media_player.stairs)
2019-03-14 07:48:13 INFO (Thread-5) [custom_components.alexa_media.notify] Push by <Entity Great Room: standby> : test test