-
-
Notifications
You must be signed in to change notification settings - Fork 36.2k
Implement soundtouch select source #31669
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
Implement soundtouch select source #31669
Conversation
|
@springstan After reading CharlesBlonde/libsoundtouch#38 , I feel like it might be better to first solve the library issue. WDYT? |
IMHO the library issue should be solved first, here is a list of requirements to accept a new library: #31647 (comment) |
|
@springstan that comment is relevant when the topic is about forking the library to continue development. Switching to an async version of a library is a different thing. Maybe we should add a chapter to the development handbook about forking a library or replacing it with a different implementation? |
Oh I am sorry, did not know that. Falsly assumed that the process would be similar but thinking about it now it makes sense to have a different kind of discussion/process for switching to an async library.
Yes, definitely. This would make future discussions and questions easier first of all and we would have a documented consensus towards such topics. |
|
@Kane610 how would we go about deciding if we want to switch this library to an async version? |
Well HASS generally prefer async implementations (see the integration quality scale), also if the developer of the changes are willing to take on a maintainer responsibility that should also weigh in. |
|
There are currently three open PRs for the soundtouch integration: Members please coordinate these PRs when reviewing and/or considering merging. We have already requested a library change here: |
|
I don't feel comfortable changing the whole library. |
|
If the select source feature addition doesn't mean a breaking change later when we switch library it's ok, I think. Otherwise we should switch library first. |
|
There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days. |
0d56c8b to
d2c621c
Compare
|
Not related to code changes, but could help until this is merged: https://www.reddit.com/r/homeassistant/comments/fsliot/bose_soundtouch_how_to_change_the_source/fm8eyv0?utm_source=share&utm_medium=web2x |
|
@boxcee thanks, your code was added (select, select_source and the importing and usage of Source.AUX and Source.BLUETOOTH) I'm currently checking why I have functions like get_zone_info in my code but I didn't implement them and they're not on the dev branch (anymore) |
I was looking at my forked dev branch which wasn't up-to-date |
d2c621c to
e4762ed
Compare
|
Functionality was tested with Soundtouch devices. |
|
My additions were covered by tests. for me this is ready to be merged. |
MartinHjelmare
left a comment
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.
Please add a test where we mock device source status and assert that the entity sets the source state attribute correctly.
| """List of available input sources.""" | ||
| return [ | ||
| Source.AUX.value, | ||
| Source.BLUETOOTH.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.
I presume Source is an enum? I'd recommend using something like:
return [x.value for x in list(Source)]
to avoid the need to keep this in sync when/if upstream changes and adds new potential sources.
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.
It is indeed, but it looks like most of them don't have a method for selecting it (which kind of links to your second comment)
| """Select input source.""" | ||
| if source == Source.AUX.value: | ||
| _LOGGER.debug("Selecting source AUX") | ||
| self._device.select_source_aux() |
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.
Here I think it would make sense to have a select_source(Source) method in the upstream lib and use that instead of having separate methods per source type.
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.
Indeed, but the upstream lib isn't maintained anymore, so we're stuck for now.
There are efforts to replace the library, but some features are missing.
CharlesBlonde/libsoundtouch#38
This comment has been minimized.
This comment has been minimized.
|
If the tests are added we can merge here. |
…f a feature implementation
Added source and source_list
Rebased on dev
9b12740 to
1dddebb
Compare
Co-authored-by: Martin Hjelmare <[email protected]>
MartinHjelmare
left a comment
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.
Looks good!
|
Is there a chance to get the HDMI (PRODUCT) source for the SoundTouch 300 also? |
Proposed change
I use Bose Soundtouch speakers and were missing the ability to select the input source.
I saw that the external package libsoundtouch 0.8 already support this, but Home-assistant not yet.
So I updated the requirements from libsoundtouch 0.7.2 to libsoundtouch 0.8 and implemented the feature in the component.
Type of change
Example entry for
configuration.yaml:I doubt that will help since you need the device, but here it is anyway
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: