question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

volume_level attribute not set when media_player.volume_set service is run

See original GitHub issue

Describe 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:closed
  • Created 2 years ago
  • Reactions:5
  • Comments:8

github_iconTop GitHub Comments

1reaction
energywavecommented, Nov 22, 2021

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…

0reactions
github-actions[bot]commented, Jan 23, 2022

The issue has received no activity for 60 days and will be closed in a week.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Volume for media_player - Configuration
I'm trying to create a volume sensor that will convert the volume_level on a media player to the volume shown on the front...
Read more >
Android: MediaPlayer setVolume function
I have to use AudioManager when trying to mute in Text to Speech. Is there any better way to set mute in Text...
Read more >
Application Programmer Interface (API) Reference Guide
Codec configuration. To enable Telnet service, configure the following setting on the codec. Changing this setting does not require a reboot of.
Read more >
MediaPlayer
MediaPlayer is not thread-safe. Creation of and all access to player instances should be on the same thread. If registering callbacks, the thread...
Read more >
FFplay media player
This is not related to min/max bitrate. Lowering tolerance too much has an adverse effect on quality. flags flags (decoding/encoding,audio,video,subtitles) Set ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found