-
-
Notifications
You must be signed in to change notification settings - Fork 28.8k
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
Sound mode support media_player general and denonavr #13706
Conversation
add sound mode support using new denonavr library functions
@@ -6,29 +6,32 @@ | |||
""" | |||
|
|||
import logging | |||
from collections import namedtuple | |||
from collections import (namedtuple, OrderedDict) |
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.
'collections.OrderedDict' imported but unused
Can someone please merge this PR? |
@rytilahti could you review this new code which uses the denonavr library v.0.7.0? |
@scarface-4711 could you maybe review this PR, I would really like to wrap this up. |
@balloob Could you please take a look at this PR (since you merged the last denonavr PR)? |
self._sound_mode_list = list(sound_mode_dict) | ||
else: | ||
self._sound_mode = None | ||
self._sound_mode_raw = None |
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.
self._sound_mode_raw attribute does not seem to be used at all and could be removed
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.
Just made a commit where I implemented it as a state property.
Thanks for the feedback, I ment to implement this but forgot about it.
It is usefull to have this in the state because the raw sound mode provides more detailed information. (can be used in automations or to troubleshoot if the raw sound mode is not in the mapping in the denonavr 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.
Did not test this change yet, will test it tonight.
return self._sound_mode | ||
|
||
@property | ||
def sound_mode_raw(self): |
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.
Same as for self._sound_mode_raw. There is no equivalent property in constructor of parent media_player class, thus I assume it is not used.
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.
same as above
@@ -106,6 +109,7 @@ | |||
SUPPORT_CLEAR_PLAYLIST = 8192 | |||
SUPPORT_PLAY = 16384 | |||
SUPPORT_SHUFFLE_SET = 32768 | |||
SUPPORT_SELECT_SOUND_MODE = 65536 |
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.
We should not add this as a new supported feature for media players. We should only add things that exist among many media players.
Revert all changes to this file and add a new service to the denonavr platform called media_player.denonavr_set_sound_mode
to allow changing thet mode.
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.
I was planning to add support for sound modes in a form or another to songpal, so that'd be two platforms for using such a feature. I haven't checked out yet how to do that, but will try to find some time during the upcoming weekend for it, if that's fine?
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.
@balloob I asked about this on the form when I first started with this code, and at that time there was also someone who was intrested in implementing sound mode support for the sonos platform based on my code (but he wanted to wait until I finished and it has been quite a long time).
But that would already make 3 platforms that would uses this.
Besides almost all sound systems have some kind of sound mode feature, therefore it could be implemented in most of the platforms if someone is willing to make the code (and has that device).
Therfore I made this a general support feature in the media_player/init.py file, and I think this is a good thing. Do you agree @balloob?
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.
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.
So let me close this PR and the frontend PR, and you can open an issue on the architecture repo to propose the new feature.
This is usefull because the sound_mode_raw shows more information than only the sound_mode.
"""Return device specific state attributes.""" | ||
attributes = {} | ||
if self._sound_mode_raw is not None and self._sound_mode_support\ | ||
and self._power == 'ON': |
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.
continuation line over-indented for visual indent
"""Return device specific state attributes.""" | ||
attributes = {} | ||
if self._sound_mode_raw is not None and self._sound_mode_support\ | ||
and self._power == 'ON': |
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.
continuation line missing indentation or outdented
Tested the new commit (sound mode raw as state attribute), and it all works. |
@balloob How long is it going to take to get this merged if I go and open an issue on the architecture repo? I have been working on this sound mode support since january, and it was already working in january. I just experiance so much resistance to get this implemented. I am verry willing to implement changes, no problem, I just need some more detailed directions of what is expected. So if this is going to take again so long to get it through the architecturee repo, I am not going to do that. Maybe I could then converted it to a denonavr specific service, and otherwise I will just continue as I have it now and use it as a custom component. I would really like to help the home assistant community implement some new features (such as this), but if you get so much resistance the fun fades away fast. |
Is this PR now active again, that is, should I base songpal modifications on top of this PR? |
I will probably make some small adjustments to this PR based on the help of @balloob. |
Ok, could you please separate the PR for support in general and support for denonavr? And also rebase on the current head. Then I could base my WIP on that generic support PR to avoid having denonavr commits in that linked PR. |
@rytilahti Yes I will do this tonight, I will make 2 seprate PR's, I just want to wait until @balloob gives the okay to go ahead with these PR's. |
Yes go for it. |
Description:
Added backend support for selecting the sound mode and updating the sound mode status.
This is general support for all media_player components.
This box is not shown in media_players that did not (yet) implement sound mode support in the backend.
I implemented the sound mode support (backend) for the denonavr platform and that one works perfictly.
I already have a pull request for the frontend to have a dropdown select box in the user interface if the media_player supports sound mode.
home-assistant/frontend#815
I tested this code and it works on Hassbian on my pi.
On the home assistant chat I heard that other platforms like onkyo and sonos could also implement sound mode support and probably most receivers could support this, this also provides a base for other platforms to simply implement sound mode support.
Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#4470
Example entry for
configuration.yaml
(if applicable):Checklist:
tox
. Your PR cannot be merged unless tests passIf user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
REQUIREMENTS
variable (example).requirements_all.txt
by runningscript/gen_requirements_all.py
..coveragerc
.If the code does not interact with devices: