bernikr / lovelace-notify-card

Send notifications directly from the dashboard
MIT License
45 stars 16 forks source link

Notifications on Amazon Echos does not work #1

Closed BembelBenji closed 3 years ago

BembelBenji commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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.