volume_level attribute not set when media_player.volume_set service is run
See original GitHub issueDescribe the bug
When you set a volume on an Alexa device using the media_player.volume_set
service the volume_level
attribute is not adjusted to reflect the change. I suspect you wait for an update from Alexa that sometimes arrives sometimes not. Most of times, if you’re not listening to music or have not listened to it in the past period, the update could arrives seveeral minutes later.
To Reproduce Use this code in developer tools -> services:
service: media_player.volume_set
target:
entity_id: media_player.mansarda
data:
volume_level: 0.4
then go to developers tools -> state and look at the entity you used in the target entity_id above. This is mine (some minutes later…):
source_list:
- Local Speaker
volume_level: 0.5
is_volume_muted: false
media_content_type: standby
media_position_updated_at: '2021-11-19T20:45:54.014871+00:00'
source: Local Speaker
available: true
last_called: false
last_called_timestamp: 1637504727956
last_called_summary: stop
connected_bluetooth: null
bluetooth_list: []
friendly_name: Alexa mansarda
supported_features: 56253
Expected behavior
When you call the volume_set
service update directly the volume_level
attribute to reflect the change that otherwise will be lost.
System details
- Home-assistant (version): 2021.11.4
- Hassio (Yes/No): Yes
- alexa_media (version from
const.py
or HA startup): 3.10.12 - alexapy (version from
pip show alexapy
or HA startup): don’t know, it’s all updated. - Amazon 2FA is enabled (y/n). We will not debug login issues if unanswered: y
Logs This is not needed here.
Additional context I’m using Amazon Echo Dot devices but I don’t think it will make any difference.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:5
- Comments:8
Top GitHub Comments
I can add some details as we was discussing this issue on the italian Home Assistant group on Facebook. It seems that this happens when Alexa Media Plyer loose connection to Amazon (websocket?). It happens from time to time after several days of no reboot on Home Assistant. When in that situation Alexa entities are not updated with what is going on the devices, example I’ve checked and I had no update in the last 24h, when one of the Echos was super used to play music from my kids. Volume level is not updated too when in that condition. At least I’ve seen that it’s updated after several minutes (like there is some long time polling?) However my request remains valid. It’s as easy as set an attribute when you set volume, so we’re sure to have a correct volume_level when the websocket is working and when it’s not.
Then there is the theme to check and reestablish the websocket, but that’s another issue…
The issue has received no activity for 60 days and will be closed in a week.