How to select other sources in the Soundtouch configuration?

My Soundtouch integration allows me to select only from two sources of my Bose system: AUX and Bluetooth. I just want to be able to switch between TV source and Spotify but don’t know how to do that with a service call.

Also has anyone successfully connected their Sountouch system to Alexa? For me it just throws an error. Thank you.

What are the attributes of the media_player integration?

Sorry, what do you mean by attributes? There is media_player.select_source or something like that but when I tried it only works if I call for AUX or Bluetooth.

Find them here

Open your Home Assistant instance and show your state developer tools.

Thanks.

Those are the attributes

Is that what you meant?

Yes it is. Aux and bluetooth are indeed the only ones available.

That seems to be all that is offered by the library libsoundtouch==0.8. See GitHub - CharlesBlonde/libsoundtouch: Bose Soundtouch Python library

No new release since they added aux/bluetooth in 2018. https://github.com/CharlesBlonde/libsoundtouch/blob/25163a7ae39de2724e2946e8b1b61484d2a590d6/RELEASES.rst

Although this file suggests other sources https://github.com/CharlesBlonde/libsoundtouch/blob/25163a7ae39de2724e2946e8b1b61484d2a590d6/libsoundtouch/utils.py

I am currently working on a new SoundTouchPlus integration that handles special source switching like you require. I finally got tired of libsoundtouch not being supported, so decided to write a custom_component and underlying library that can be distributed via HACS. Since it’s a new component name “e.g. SoundTouchPlus”, it won’t interfere with the built-in “SoundTouch” integration setup. You can also use the underlying library stand-alone if you wish. It’s a simple install to the “custom_components” directory, but I want to make it available via the HACS UI installer. I am still trying to figure out how to build the HACS installer.

To answer your initial question, I have the same scenario for my Bose ST300 setup with a Sharp Aquos TV, which requires the Source=“PRODUCT” and a sourceAccount=“TV” in order to watch TV. For my SoundTouchPlus, I would make a call to the standard media_player.select_source service like so - it allows you to pass the source, as well as a sourceAccount value (delimited by colon). I have not done anything with Spotify, so not sure what the source would be for that.

Example swith to Source with sourceAccount support:

service: media_player.select_source
data:
  source: PRODUCT:TV
target:
  entity_id: media_player.soundtouch_10

More info on the Python bosesoundtouchapi library and supporting features:
BoseSoundTouchApi Python 3 Library

2 Likes

Thank you so much.

I am not certain I understand correctly - is there some way I can install it already before you will make it available in HACS?

Regarding selecting Spotify as a source I have found a workaround. By installing Spotify integration from HACS it is possible to select the Soundtouch speaker as a source and it works well. Just as if you selected the speaker from the Spotify app.

I could zip up what I am currently testing if you would like to try it. Note that I have only tested it with a Bose ST10 and an ST300. It should work with the ST20 and ST30, and anything that supports the Bose SoundTouch WebSocket API.

It may take me a week or so to get the HACS install put together, as I have never done that before.

Let me know, and I can PM you what I have. I believe it’s just a simple unzip to the config\custom_components folder and restart of HA to recognize it.

I had some time today, and put together a HACS installer for my SoundTouchPlus integration. Use the following to install from HACS:

  1. go to HACS main menu.
  2. click on the 3-dot “overflow menu” in the upper right, and select “custom repositories” item.
  3. copy / paste https://github.com/thlucas1/homeassistantcomponent_soundtouchplus in the Repository textbox and select Integration for the category entry.
  4. click on “Add” to add the custom repository.
  5. you can then click on the SoundTouchPlus repository entry (you may need to filter your list first to find the new entry).
  6. click on “download” to start the download. It will install the soundtouchplus integration to your config/custom_components directory.
  7. restart HA to start using the component.

Note that I haven’t submitted any icons to the HACS branding repository yet, so the integration will show default icon placeholders. Everything else should work as expected though.

Let me know if you run into any issues.

btw, what Bose SoundTouch speaker models are you using? Just curious, as I have only tested with the ST10 and ST300 models.

1 Like

Bad to the bone Todd. Way to take matters into your own hands but still take the time to HACS it up for the rest of us. Inspiring me… I just don’t have the technical chops quite yet.

1 Like

This is fantastic! I really appreciate your help.

I have followed your steps and installed everything. I tried the select source option, but unfortunately it doesn’t work. PRODUCT:TV has turned on the speaker to the Soundtouch mode so there is some response but it didn’t then switch to TV mode and it threw an error: Failed to call service media_player.select_source. Unknown error

This is what I see in states:

And this is what I see under the IP address of the speaker if that’s any help:

I’m not very technical but please let me know if there is some way I can contribute. Thank you once again!

I’m using Soundtouch 520.

Your sources look similar to my ST300, but I do not see a PRODUCT source.

I forgot to mention in the reply above that CasE is important in the select_source values (e.g. PRODUCT:TV is different than product:tv).

Lets try this - turn on your ST520 and set it manually to the mode that you need it to be in to watch TV. Once you have that, go to a browser and bring up the following link (substitute x.x.x.x with your ip address for the ST520 device):
http://x.x.x.x:8090/nowPlaying.

The output should look something like this:

<nowPlaying deviceID="xxxxxxx" source="PRODUCT" sourceAccount="TV">
  <ContentItem source="PRODUCT" sourceAccount="TV" isPresetable="false"/>
  <art artImageStatus="SHOW_DEFAULT_IMAGE"/>
  <playStatus>PLAY_STATE</playStatus>
</nowPlaying>

Paste a copy of that back to me in a reply - I’m looking to see what you have for the source= and sourceAccount= values. You will need to specify the values for those in the media_player.select_source service.

btw, here is a list of my ST300 sources to compare:

<sources deviceID="xxxxxxxxx">
<sourceItem source="AIRPLAY" sourceAccount="xxxxx" status="UNAVAILABLE" isLocal="false" multiroomallowed="false">xxxxx</sourceItem>
<sourceItem source="QPLAY" sourceAccount="xxxxx" status="UNAVAILABLE" isLocal="true" multiroomallowed="true">xxxxx</sourceItem>
<sourceItem source="QPLAY" sourceAccount="xxxxx" status="UNAVAILABLE" isLocal="true" multiroomallowed="true">xxxxxx</sourceItem>
<sourceItem source="BLUETOOTH" status="UNAVAILABLE" isLocal="true" multiroomallowed="true"/>
<sourceItem source="UPNP" sourceAccount="xxxxx" status="UNAVAILABLE" isLocal="false" multiroomallowed="true">xxxxx</sourceItem>
<sourceItem source="STORED_MUSIC_MEDIA_RENDERER" sourceAccount="xxxxx" status="UNAVAILABLE" isLocal="false" multiroomallowed="true">xxxxx</sourceItem>
<sourceItem source="PRODUCT" sourceAccount="HDMI_1" status="UNAVAILABLE" isLocal="true" multiroomallowed="true">HDMI_1</sourceItem>
<sourceItem source="NOTIFICATION" status="UNAVAILABLE" isLocal="false" multiroomallowed="true"/>
<sourceItem source="PRODUCT" sourceAccount="TV" status="READY" isLocal="true" multiroomallowed="true">TV</sourceItem>
<sourceItem source="SPOTIFY" sourceAccount="xxxxx" status="UNAVAILABLE" isLocal="false" multiroomallowed="true">xxxxx</sourceItem>
<sourceItem source="SPOTIFY" sourceAccount="xxxxx" status="UNAVAILABLE" isLocal="false" multiroomallowed="true">xxxxx</sourceItem>
<sourceItem source="TUNEIN" status="READY" isLocal="false" multiroomallowed="true"/>
<sourceItem source="LOCAL_INTERNET_RADIO" status="READY" isLocal="false" multiroomallowed="true"/>
<sourceItem source="ALEXA" status="READY" isLocal="false" multiroomallowed="true"/>
<sourceItem source="STORED_MUSIC" sourceAccount="xxxxxxx/0" status="READY" isLocal="false" multiroomallowed="true">Hue Bridge (x.x.x.x)</sourceItem>
</sources>

Notice that I have 2 “PRODUCT” sources - “TV” and “HDMI_1”. One is for the direct connection to the TV, the other is for an HDMI input. It’s odd though, as I do not see any “PRODUCT” sources in your list.

Also, you should be able to switch to your Spotify account using the select_source service call as well. You blurred out the sourceAccount value (and rightly so in a public forum) so I cannot tell you what to put exactly, but it will look something like this:

service: media_player.select_source
data:
  source: SPOTIFY:<your spotify sourceAccount value from sources>
target:
  entity_id: media_player.trash_2

I also created an “official announcement” of the new SoundTouchPlus component, for future readers of this thread …

I just developed a new SoundTouchPlus custom component if you’re interested. It can easily be installed via HACS as well. More information can be found in this forum post.

Switching to Spotify worked by following your guide.

Regarding the TV source, this is what I have when switched manually to TV in http://x.x.x.x:8090/now_playing

<nowPlaying deviceID="xxxxxxxxxx" source="LOCAL">
<ContentItem source="LOCAL" isPresetable="true"/>
</nowPlaying>

it is interesting as it is not even listed on my sources list :confused:

When I tried to modify the service call to call for LOCAL the speaker changed to Soundtouch mode.

So did that do what you needed then? It sounds like it’s still not working maybe. To be clear, did you generate the nowPlaying output when the ST-520 was playing content? or maybe when the input was idle (e.g. selected, but not playing any sound)?

Assuming your nowPlaying output was generated while the TV was playing sound, all you should need is this:

service: media_player.select_source
data:
  source: LOCAL
target:
  entity_id: media_player.trash_2

or maybe …

service: media_player.select_source
data:
  source: LOCAL:LOCAL
target:
  entity_id: media_player.trash_2

Yes. the nowPlaying output was generated when the speakers were in TV mode and playing the TV sound.

I have tried both calls but the result is as I’ve described: the speakers go to Soundtouch mode instead of the desired TV source :confused:

OK … I wonder if it has something to do with ARC or HDMI CEC control. How do you have your TV hooked up to the ST-520; e.g. what input on the ST-520 is the TV plugged into? And are you using any optical, coaxial or analog stereo audio cables? or just a single HDMI cable?

Also, what button(s) do you press on the ST-520 remote control to switch the input? There may be a possibility to call the remote_keypress service to select the correct input. Something like this, changing the key_id value from AUX_INPUT to your key id maybe:

service: soundtouchplus.remote_keypress
data:
  key_id: AUX_INPUT
  entity_id: media_player.trash_2

Sorry for all the questions - just trying to completely understand your setup.

Please do ask as much as it’s needed. I will try my best to provide the information to help me as well as other users who also might have called their speakers trash out of frustration with this topic haha :grinning:

I have the Tv connected via single HDMI cable. The input name (physical print) in the Bose system is “TV” and at the TV’s side it is the ARC HDMI output. I have CEC enabled so the speakers turn on when the TV is on and vice versa. However, if the Soundtouch mode is already playing for example spotify or any other source is selected, when the TV is turned on, the sound source on the speakers will not change to TV on the speakers automatically.

That’s why I have to press “TV” button on the remote to be able to use the TV.

On a separate note, having ability to press remote buttons from HA would be amazing as the home theatre speakers that are supposed to be behind you - I am using them to have audio in other areas of the long room where the speakers are located. I achieved that by setting the Surround value with the remote to max, and then I have music in the whole room. When I’m watching TV though, I would prefer to have the surround mode back to normal setting as it creates a lot of unwanted reverberance. It’s of course too much of a hassle to change it each time with the physical remote, but if I had an option for that through HA it would be amazing.

Sorry for a long post.