alandtse / alexa_media_player

This is a custom component to allow control of Amazon Alexa devices in Home Assistant using the unofficial Alexa API.
Apache License 2.0
1.54k stars 291 forks source link

Error handling message: Unknown error #1487

Closed nickylo1978 closed 2 years ago

nickylo1978 commented 2 years ago

HA 2022.12.8 / HACS 1.19.1 / ALEXA MEDIA PLAYER INTEGRATION v3.10.15

When you try to use a "notify.alexa_media" service and invoke the service, this error appears in the logs:

Logger: homeassistant.components.websocket_api.http.connection Source: custom_components/alexa_media/notify.py:195 Integration: Home Assistant WebSocket API (documentation, issues) First occurred: 23:49:15 (1 occurrences) Last logged: 23:49:15

[1890776832] Error handling message: Unknown error Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 27, in _handle_async_response await func(hass, connection, msg) File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 527, in handle_execute_script await script_obj.async_run(msg.get("variables"), context=context) File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1260, in async_run await asyncio.shield(run.async_run()) File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 363, in async_run await self._async_step(log_exceptions=False) File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 381, in _async_step await getattr(self, handler)() File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 584, in _async_call_service_step await service_task File "/usr/src/homeassistant/homeassistant/core.py", line 1495, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1530, in _execute_service await handler.job.target(service_call) File "/usr/src/homeassistant/homeassistant/components/notify/legacy.py", line 221, in _async_notify_message_service await self.async_send_message(**kwargs) File "/config/custom_components/alexa_media/notify.py", line 195, in async_send_message for target in targets: TypeError: 'NoneType' object is not iterable

Is a problem with new version of HA ? Any suggestion ?

Tks

alandtse commented 2 years ago

Please use the template and also provide the service call.

nickylo1978 commented 2 years ago

Describe the bug

When you try to use a "notify.alexa_media" service and invoke the service, this error appears in the logs:

To Reproduce Steps to reproduce the behavior:

Expected behavior The ALEXA device should play the TEST message

Screenshots

System details

Logs

Logger: homeassistant.components.websocket_api.http.connection Source: custom_components/alexa_media/notify.py:195 Integration: Home Assistant WebSocket API (documentation, issues) First occurred: 23:49:15 (1 occurrences) Last logged: 23:49:15

[1890776832] Error handling message: Unknown error Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 27, in _handle_async_response await func(hass, connection, msg) File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 527, in handle_execute_script await script_obj.async_run(msg.get("variables"), context=context) File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1260, in async_run await asyncio.shield(run.async_run()) File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 363, in async_run await self._async_step(log_exceptions=False) File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 381, in _async_step await getattr(self, handler)() File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 584, in _async_call_service_step await service_task File "/usr/src/homeassistant/homeassistant/core.py", line 1495, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1530, in _execute_service await handler.job.target(service_call) File "/usr/src/homeassistant/homeassistant/components/notify/legacy.py", line 221, in _async_notify_message_service await self.async_send_message(**kwargs) File "/config/custom_components/alexa_media/notify.py", line 195, in async_send_message for target in targets: TypeError: 'NoneType' object is not iterable

Additional context Add any other context about the problem here.

alandtse commented 2 years ago

You need to define a target if you use the generic notify service. Check the wiki for examples. https://github.com/custom-components/alexa_media_player/wiki/Configuration%3A-Notification-Component