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
Add properties for surround speakers in TV, music and ambient modes #780
Conversation
Just a side note, after doing some testing (and XML checking), it looks like that changes to the audio input format is not sending events -> requires polling to get this information :-( |
@pwt do you mind giving this one a quick review? What do you think should be done to get this closer to get merged? Something besides fixing the docstrings & separating the |
This is a great. I've made a couple of comments: if you can push a new commit with the f-string replaced, that should initiate a check job run to spot any hygiene issues. One problem I have is that I'm not able to test this code, since none of my Sonos equipment is set up in HT configs, so I'd love to get a some other folks to try it out. |
3d74eca
to
5ced306
Compare
Thanks @pwt! I added some responses in the comments, and also created a separate PR (#832) for the audio input format so that's why I force-pushed this branch. I was working to add tests to the functionality when I realized that the helper methods I introduced makes testing the API interface more complicated thanks to indirection. I'll have to look for a suitable solution for that, I'm open for suggestions! |
I may not have understood this fully, but I'd be minded to keep the unit tests simple and just pattern them after the existing tests for simple getters/setters. |
1b34036
to
eb703f9
Compare
Adds following (setable) properties (see https://support.sonos.com/s/article/4804?language=en_US): * surround_mode: surround enabled/disabled * surround_mode_music_playback: ambient/full volume in the music mode * surround_volume_tv: surround volume adjustment [-15,15] for the tv mode * surround_volume_music: surround volume adjustment [15,15] for the music mode Missing settings for reseting to defaults, and adjusting the surround speaker balance (which can only be done when trueplay is disabled)
eb703f9
to
f141533
Compare
f3d1677
to
c8f565f
Compare
c8f565f
to
c2bfea1
Compare
Oops, looks like I forgot to push this earlier, but I think this should be good to go now. Mind taking a look @pwt & @jjlawren? I added tests to all surround properties (including the already existing edit: pre-commit config pins down to a version that's different from what's used by the CI, that's why all the hassle with force pushes, sorry for that. |
Thanks for following up on this. I'll take a look in the next day or two. |
Hi @rytilahti . I've reviewed the code and it looks good. I've also pushed a couple of suggested commits that:
Please review and check that the changes look OK to you. Unfortunately, I'm not able to test this PR properly as I don't have any Sonos HT setups, so I'll have to depend on the testing that you and others are able to do. |
Hi @pwt and thanks for the review and the changes you made, looks good to me! I re-tested all the new settings on my Beam setup with the most current software and they work as expected. |
@rytilahti Great! Thanks for the contribution. |
@surround_ambient_enabled.setter | ||
@only_on_soundbars | ||
def surround_ambient_enabled(self, value): | ||
"""Toggle surround music playback mode. True = ambient 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 just realized that having the ambient mode as True makes using the eventing API awkward (ambient mode is report as 0
), so this may need to be changed to be other way around. IIRC I didn't do it previously as I couldn't think of a good name for the "full mode". Maybe surround_full_volume_enabled
?
if variable == "SurroundMode": # negate desired value for surround mode | ||
desired_value = not value |
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.
This could be removed if the surround mode would be reversed.
Adds following (setable) properties (see https://support.sonos.com/s/article/4804?language=en_US):
(already done in Add sub & surround properties and controls #870)surround_mode
: surround enabled/disabledsurround_ambient_enabled
: ambient/full volume in the music mode (bool)surround_volume_tv
: surround volume adjustment [-15,15] for the tv mode (int)surround_volume_music
: surround volume adjustment [15,15] for the music mode (int)Currently missing reseting to defaults, and adjusting the surround speaker balance (which can only be done when trueplay is disabled, see #646 (review)).
Obsoletes #646. Fixes #461.