-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix unmute bug in vlc_telnet #48441
Fix unmute bug in vlc_telnet #48441
Conversation
If volume was muted and media_player.volume_up is fired, VLC would still show up as muted. PR extracted from home-assistant#44776.
@@ -249,6 +249,10 @@ def set_volume_level(self, volume): | |||
self._vlc.set_volume(volume * MAX_VOLUME) | |||
self._volume = volume | |||
|
|||
if self._muted and self._volume > 0: | |||
# This can happen if we were muted and then see a volume_up. | |||
self._muted = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there no feedback on mute state that we can get from vlc on update?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, good question. I've looked at the output of VLCTelnet.status()
and VLCTelnet.info()
, but didn't find anything relevant. AFAICT, the VLC telnet protocol doesn't ever tell us if VLC is actually muted so this seems to be a deeper problem.
Seems we'd want to use https://pypi.org/project/python-vlc/ for this type of control.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, that library is using the c-bindings so is out of scope for this integration.
Instead of using a separate variable for muted I suggest we check if self._volume
equals 0. The volume attribute is updated by the update method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, not sure I understand. Would that check mean that if the user sets the volume to 0 in VLC, Home Assistant would detect VLC as muted? If so, what would the behavior be if the user clicks unmute in Home Assistant?
Incidentally, here's another possible direction: We remove SUPPORT_VOLUME_MUTE
from vlc_telnet
entirely (since VLC doesn't actually support this and we're essentially simulating mute...).
(and yes, switching to the CTypes lib would be a totally separate integration -- probably not worth it if the only benefit is adding mute support :))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. We probably wouldn't have added mute support today simulated like this, but removing it now is also a breaking change. We have some simulated features in the base media player class so we're a bit more flexible it seems for the media player. I'm ok with this fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The vlc integration uses the c-bindings library.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Martin!
The vlc integration uses the c-bindings library.
Indeed! I'll have to revisit using that integration in my setup -- I forget why I settled on the telnet one of all things :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to have the vlc application installed on the same host as Home Assistant for that integration. I think that may be a major limitation for some users.
Proposed change
If volume was muted and media_player.volume_up is fired, VLC would still
show up as muted.
PR extracted from #44776.
Type of change
Example entry for
configuration.yaml
:# Example configuration.yaml
Additional information
Checklist
black --fast homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.The integration reached or maintains the following Integration Quality Scale:
To help with the load of incoming pull requests: