Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notifications on Amazon Echos does not work #1

Closed
BembelBenji opened this issue May 17, 2021 · 8 comments
Closed

Notifications on Amazon Echos does not work #1

BembelBenji opened this issue May 17, 2021 · 8 comments

Comments

@BembelBenji
Copy link

When I select the service alexa_media_XXX and want to send a notification, following error message appears:
TypeError: 'NoneType' object is not subscriptable

@bernikr
Copy link
Owner

bernikr commented May 17, 2021

Can you please post the complete yaml config of the card as well as check in the developer tools if a notify service with that exact name exists?

@BembelBenji
Copy link
Author

BembelBenji commented May 17, 2021

This is the yaml of my card:

type: 'custom:notify-card'
target: alexa_media_bad
title: ' '
label: Alexa Bad

The service notify.alexa_media_bad is existing in my dev tools list.

@bernikr
Copy link
Owner

bernikr commented May 17, 2021

Unfortunately I don't have an Alexa, so I cannot reproduce this issue. Could you try to send a notification through the developer tools and post the yaml of the successful service call?

@BembelBenji
Copy link
Author

BembelBenji commented May 17, 2021

This is a valid service yaml of an Alexa notification:

service: notify.alexa_media_bad
data:
  message: MESSAGE TEXT
  data:
    type: announce

You can also replace the "announce" in data with "tts", then the intro sound will not play before the notification.

@bernikr
Copy link
Owner

bernikr commented May 17, 2021

I have now included support for additional data. You should be able to update the card via HACS and try this config:

type: 'custom:notify-card'
target: alexa_media_bad
label: Alexa Bad
data:
  type: announce

Please report back if it works.

@BembelBenji
Copy link
Author

Unfortunately it does not work.
I updated the card in HACS, cleared my browser cache and changed the yaml code.

type: 'custom:notify-card'
target: alexa_media_bad
title: ' '
label: Alexa Bad
data:
  type: announce

By trying to send a notification, an error message appears:
'NoneType' object is not subscriptable

This is the error message from the logs:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 167, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1481, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1516, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/components/notify/__init__.py", line 160, in _async_notify_message_service
    await self.async_send_message(**kwargs)
  File "/config/custom_components/alexa_media/notify.py", line 216, in async_send_message
    if data["type"] == "tts":
TypeError: 'NoneType' object is not subscriptable

@bernikr bernikr reopened this May 17, 2021
@bernikr
Copy link
Owner

bernikr commented May 17, 2021

That's very strange. I still don't understand completely what my card is doing differently. One last thing you could do for me to help me is to use the Developer Tools to subscribe to the call_service event. Then open a new tab and try to send a notification with the card and one with the dev tools and post the event data of both those service calls.

@BembelBenji
Copy link
Author

Now it's working!
Maybe I've should have restart HASS before I've done these tests. Many sorry for that!!!
Anyway, thanks for the great help and responds and this great new card.
Cheers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants