alexa_media_player: Setting Volume error
IMPORTANT: Please search the issues, including closed issues, and the FAQ before opening a new issue. The template is mandatory; failure to use it will result in issue closure.
Describe the bug
When setting Volume Home assistant stops the Script with error ‘volume’ although IT Changes the volume
To Reproduce
Call Action media_player.volume_set within a Script.
Expected behavior
The Script Changes Volume and Carries on without errors
Screenshots
System details
- Home Assistant version: 2025.3.3
- alexa_media version (from
const.pyor HA startup log): 5.6.0 - alexapy version (from
pip show alexapyin homeasssistant container or HA startup log): 1.29.5 - Is Amazon 2FA/2SV enabled <!—We will not debug login issues if unanswered—> (y/n): n
- Amazon Domain: amazon.de
Debug Logs (alexa_media & alexapy) Please provide logs.
Logger: homeassistant.components.script.alexa_wecker_langsam_lauter
Quelle: helpers/script.py:524
Integration: Skript (Dokumentation, Probleme)
Erstmals aufgetreten: 07:06:17 (5 Vorkommnisse)
Zuletzt protokolliert: 07:26:34
Alexa Wecker Langsam Lauter: Sequence action at step 1: Repeat at step 4: Error executing script. Unexpected error for call_service at pos 1: 'volume'
Alexa Wecker Langsam Lauter: Sequence action at step 1: Error executing script. Unexpected error for repeat at pos 4: 'volume'
Alexa Wecker Langsam Lauter: Error executing script. Unexpected error for sequence at pos 1: 'volume'
Alexa Wecker Langsam Lauter: Sequence action at step 1: Error executing script. Unexpected error for call_service at pos 1: 'volume'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 524, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1009, in _async_step_call_service
response_data = await self._async_run_long_action(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<9 lines>...
)
^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 624, in _async_run_long_action
return await long_task
^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2794, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2837, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1007, in entity_service_call
single_response = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
hass, entity, func, data, call.context
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1079, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/config/custom_components/alexa_media/helpers.py", line 158, in _catch_login_errors
result = await func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/alexa_media/media_player.py", line 1254, in async_set_volume_level
await self.async_update()
File "/config/custom_components/alexa_media/helpers.py", line 158, in _catch_login_errors
result = await func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/alexa_media/media_player.py", line 1059, in async_update
await self.refresh(device, no_throttle=True)
File "/config/custom_components/alexa_media/helpers.py", line 158, in _catch_login_errors
result = await func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/alexa_media/media_player.py", line 726, in refresh
else session["volume"]
~~~~~~~^^^^^^^^^^
KeyError: 'volume'
Additional context
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 20 (3 by maintainers)
Commits related to this issue
- fix: fix volume and media features (#2891) closes #2868 closes #2889 — committed to alandtse/alexa_media_player by nao-pon 2 years ago
I have updated to the new branch and will test over the next few days. Sometimes the issue was inconsistent for me but should be able to tell after a day or two if its working.
I believe playing_parents is where you have an echo_dot which is comprised of multiple echo dots, i.e. speaker pairs, etc.
echo_dot_living_roomis the “parent” forecho_dot_living_room_leftandecho_dot_living_room_rightI think it also applies when you haveecho_dot_main_floorwhose children areecho_dot_kitchen+echo_dot_dining_room+echo_dot_living_room, etc. In this case,echo_dot_main_floorwould be like a grandparent forecho_dot_living_room_leftandecho_dot_living_room_rightwhose parent isecho_dot_living_roomwhose parent isecho_dot_main_floor.@nao-pon Thanks for your response. "I am not exactly sure what you mean by “environment.” If you are referring to the type of Alexa device I am using, I have two Echo (4th Gen) devices. In the automation, I use the player ‘media_player.bathroom_stereo’ group, which consists of the units ‘media_player.echo_bathroom_l’ and 'media_player.echo_bathroom_r, all units (together with the other 29) are part of the “Alexa media_player” integration. Now that I use media_player.turn_off at the end, the issue has been avoided. The intermediate volume change to 0.01 is used to diminish the volume of the “Welcome to TuneIn” announcement, but it is not always successful. Reload_config_entry at the end is needed, because media player state sometimes stucks in “playing state”, although it’s previously turned off (probably an already reported bug). I am enclosing an action part of my automation below just in case:
@RobusX I agree that this needs a fix, but for now I worked around the issue by downgrading to v5.5.1 of Alexa Media Player.