-
-
Notifications
You must be signed in to change notification settings - Fork 37.4k
Fix unmute bug in vlc_telnet #48441
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
Merged
Merged
Fix unmute bug in vlc_telnet #48441
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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()andVLCTelnet.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._volumeequals 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_MUTEfromvlc_telnetentirely (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.
https://www.home-assistant.io/integrations/vlc/
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!
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.