Bose soundtouch create_zone

Hi @jasebob, @mathea, @vandura231, @Hielke_Haan, @Reedstrr, @ranunculales, @juan11perez - in case you are still using SoundTouch with Home Assistant …

I have developed a new SoundTouchPlus integration to control my SoundTouch devices. It can also be easily installed via HACS. More info can be found on my GitHub Project page.

I also wrote the underlying bosesoundtouchapi python 3 library as well, which is packed with features. I basically got tired of libsoundtouch not being supported, so I wrote my own. More info on the API can be found on the Pypi.org page or the ReadTheDocs.io pages.

I have also started a SoundTouch WebServices API notes page that contains detailed information on some of the supported SoundTouch WebService API services. It’s been an uphill battle with the WebServices API, as Bose no longer publishes documentation. I have been able to figure out quite a few things: Pandora music service support, playing of https content items, tone controls (bass and treble), etc, besides the standard volume controls, preset switching, etc.

Hope it helps.

1 Like

Hi @thlucas! Great job and thanks for the effort!

Do you believe it would be possibile to add the snapshot/restore function? They did not use to work very well with the old libsoundtouch library.

Hi @override - snapshot and restore are already supported. Check out this wiki link for details.

Oh my god! It also does tts messages than resumes from where it left with the music! Amazing!!

1 Like

Yes, TTS notifications are supported on some SoundTouch devices. For example, I can play TTS notifications on my ST-10, but they won’t play for some reason on my bigger ST-300 soundbar. I am still trying to figure that one out, but it appears to be an issue in the Bose WebServices API that is restricting it.

Yeah the same with the soundtouch 20. But it works with the soundtouch 10!

@thlucas This looks great and I will take a look when I have some time over the holidays.

You mentioned difficulty getting the API information. Initially, Bose were very open and good to work with, they even had support staff answering questions about their API. But the more issues I reported the less responsive. A year or two later the whole support model changed.
But while it was up I pulled a PDF off their web portal page.

Do you still face unreliability problems from the Bose systems themselves? I have to power cycle the things every night with smart plugs to prevent them from going unresponsive and filling up logs. Or did you discover a workaround?
I was a fairly early adopter and I think my systems are all gen1 Bose hardware. I have a Touch-10, some Touch-20s, the SA-5 (outdoor amp) plus some WIreless link adapters (which are later and more reliable). I am willing to think that later hardware models have fewer problems.

What about the newer Bose systems, the “Sound Link Systems”. Do you know if these play together and work you integration? Or is it a totally different ecosystem? I can’t even figure out Bose’s strategy now because they don’t seem to be marketing an integrated range and I can’t tell if their soundbars integrate with their other sound link. Their latest speakers are Bluetooth. It almost looks like they are giving up to Sonos. My recent reading of reviews suggests Sonos has really caught up on the sound quality.

@jasebob Thank you so much for reaching out; I have been looking for that updated Bose SoundTouch Webservices API reference for months now! I have figured out most of the api calls listed in the reference myself, and a LOT more from poking around in the SoundTouch firmware update files. I have started my own “unofficial” SoundTouch WebService API reference on my GitHub Wiki if you’re interested. It documents other commands that are still supported (music service searches, tone controls, wireless discovery, firmware updates, and quite a few more).

As for unreliability problems, I have not experienced those. I purchased my ST-10 and ST-300 (with bass module) in December of 2017, but am not sure what generation they are. The ST-10 is model 416776 if that helps. I know the ST-300 issues quite a few <connectionStateUpdated state="NETWORK_WIFI_CONNECTED" up="true" signal="xxx" /> events over a 24 hour period, but there is no pattern to it. I believe this is due to the fact that the ST-300 sits further away from my wireless router than my ST-10 does, as I see 80-90% more connection state updated events from my ST-300. I believe the devices simply detect wireless router signal strength changes and issue an event; this is based on the connection state updated event signal attribute value (GOOD_SIGNAL, MARGINAL_SIGNAL, etc). I assign static IP addresses to both my devices, which I have heard (based on internet searches) helps for some reason.

The SoundTouchPlus integration (as well as the underlying bosesoundtouchapi python library) has SmartInspect tracing built in, so I can see all websocket events from the SoundTouch devices, and log them. I documented how to set up SmartInspect logging with the SoundTouchPlus integration if you want to give that a try - it might help you diagnose the problem better, as it logs events in real-time as they are happening. The SmartInspect logging console is free, but does have a Windows OS requirement for install.

I don’t think the newer “Sound Link System” products utilize the SoundTouch WebServices API (based on internet forum chatter), but am not 100% sure on that. I would think they would have some sort of API control built in (hopefully REST instead of web-services), as they can be controlled from an app. There have been quite a few complaints from owners having to have two different apps to control their Bose speakers.

To be honest, I have invested quite a few $$$ into just the two devices I have, and they work / sound great so I’m not really interested in updating at this point. I have heard good things about the Sonos brand, but am not familiar with the quality nor the underlying API controls.

Now that I have a solid underlying API built, my next goal is to solicit ideas for what people want to see in the SoundTouchPlus integration.

@jasebob FYI, I just pushed out release 1.0.20 of the SoundTouchPlus integration. It includes a new service that can be used to reboot the SoundTouch device.
YAML example:

service: soundtouchplus.reboot_device
data:
  entity_id: media_player.bose_st10_1

The device is unresponsive (of course) for about 45-60 seconds (ST-10 anyway) while it is rebooting, then is detected again in HA via ZeroConf when it comes back up.

Thought you would want to know since you indicated you were power cycling yours every night. I thought that would be a good feature to have. Note this will probably not work if your device becomes unresponsive, but give it a try when you get time and let me know how it works for you.

Hope it helps.

I am trying to figure out the reason why it’s not working - as far as i remember used to work on ST20 with the old libsoundtouch library via the tts.google_cloud_say service in home assistant

BTW, I can successfully play TTS via the DLNA Digital Media Renderer integration on ST20 - of course it will interrupt the music stream and i will have to manually resume playing from spotify

@override
Per the Bose SoundTouch WebServices API reference …

Audio Notifications are only available for SoundTouch 10, SoundTouch 20 Series III, and SoundTouch 30 Series III. Attempting to send an Audio Notification to an incompatible device will return a 403 Forbidden error.

If your ST-20 is not a series III then it won’t work.

I believe the DLNA Digital Media Renderer actually renders the text to a temporary (mp3) file that is played, which requires you to manually resume the spotify music stream play.

If the Bose device plays a TTS message via play_info then the device will take care of playing the TTS message (with a Google translate in between) and automatically resuming the media stream that is played.

Question: what does your yaml look like to play the tts message on the ST-20?
It should look something like this:

# play message using default english voice.
service: soundtouchplus.play_tts
data:
  entity_id: media_player.soundtouch_livingroom
  message: Hello World, How are you today?
  volume_level: 50

@thlucas that’s exactly how the message looks. I did not even know there were different series of soundtouch 20! Mine is for sure a series I or II then!

Thanks!

1 Like

Hi Todd

I installed this tonight. The installation and auto-discover were very smooth. Well done!

At the moment I have both the original integration and yours loaded. I didn’t expect that to be a problem, we are just pinging the status more often. I was able to start a Spotify play using your integration, but I found your integration is not updating the state of the entity. So my mini-media cards don’t fire up with volume controls and artwork. I assume you would have this working. Is there actually a need to un-install the original integration?

Also, the funniest thing… I also replaced my wifi over these holidays. I’ve always had Asus routers and I’d thought they were good and reliable. At least for all the other equipment I had. But I just put in a new Unifi network and all of a sudden the Bose systems are operating much, much better. No more log messages, no more stop-start playback. I have a feeling there was some incompatibility between the Asuz and Bose wifi.

@jasebob - Hi jasebob.

There should be no problem installing both the soundtouch and soundtouchplus integrations side-by-side; that’s the way I have mine installed. What SoundTouch model(s) are you working with (e.g SoundTouch 10? 300? 530? etc). I have only been able to test on the ST-10 and ST-300 models.

Did you enable the websocket functionality as part of the install process? It should have been enabled by default with the configure from zeroconf discovery. The websocket support supplies the volume (and other) updates to HA from the device, though polling should also do that if websocket support was disabled during setup.

Also, any log warnings or errors?

Some things to try:

  • ensure you have static IP addresses defined to all of your SoundTouch devices.
  • ensure connectivity (no firewall blocks) to port 8090 and 8080 to / from HA and the SoundTouch device.
  • ensure websocket support is enabled by specifying port 8080 for websockets and 8090 for web services.
  • try deleting a device and use the ‘Add Device’ button so that you can display the configuration options (instead of using zeroconf discovery config).

If none of the above work, then enable debug logging and try various functions (e.g. vol up / down, play spotify or tunein station, etc.) then send me a PM with the logs.

Hi Todd

So I removed one device and added it manually as you suggested and it came up working correctly. So it suggests the autoconfiguration is not working perfectly.
=> Its probably the web_socket ping.

Here are two entries in cor.config_entries. Family Room was the device I removed and re-added manually, and Sitting Room is the device that I added through auto-discover. Notice that source is zeroconf and ping_websocket_interval is 0 for the device auto-discovered.

      {
        "entry_id": "7b15200d83f8bb6ca16cc88fc431b94a",
        "version": 1,
        "domain": "soundtouchplus",
        "title": "Sitting Room",
        "data": {
          "name": "Sitting Room",
          "host": "192.168.50.225",
          "port": 8090,
          "port_websocket": 8080,
          "ping_websocket_interval": 0,
          "timeout": 15
        },
        "options": {},
        "pref_disable_new_entities": false,
        "pref_disable_polling": false,
        "source": "zeroconf",
        "unique_id": "Sitting Room",
        "disabled_by": null
      },
      {
        "entry_id": "23591506087f0b1f26aba2e1ac11f6b9",
        "version": 1,
        "domain": "soundtouchplus",
        "title": "Family Room",
        "data": {
          "name": "Family Room",
          "host": "192.168.50.156",
          "port": 8090,
          "port_websocket": 8080,
          "ping_websocket_interval": 300,
          "timeout": 15
        },
        "options": {},
        "pref_disable_new_entities": false,
        "pref_disable_polling": false,
        "source": "user",
        "unique_id": "Family Room",
        "disabled_by": null
      }

To be clear, its “Family Room” with ping_websocket_interval = 300 thats working.

Hi Todd

Another question for you, mostly about how you imagine using this.

I have custom code in the original SoundTouch to export the Preset list as a property for the entity. Its just a simple list with the itemName of the Preset under an attribute called soundtouch_preset.

I then use config-template-card with mini-media card’s button features to display the available presets and then play them on press,
image

Here is a code snipped of how I extract the property and display the button.

            buttons:
              - icon: mdi:numeric-1-box
                id: 1
                name: >-
                  ${states['media_player.kitchen'].attributes.soundtouch_presets[0]}
                type: playlist
              - icon: mdi:numeric-2-box
                id: 2
                name: >-
                  ${states['media_player.kitchen'].attributes.soundtouch_presets[1]}
                type: playlist

I see you have the Get Preset List service and its working fine (as is Get Recent List)
How do you imagine achieving the same result?
It seems I need to create a sensor.soundtouch_presets and use an automation to periodically refresh the list. Then its available in the state space for the front end cards to see

Hi Todd

Would you prefer I move these questions onto the Github pages?
FYI - I setup the debugger and Smart Inspect, its a nice interface.

Another observation, your new integration does not have the service functions from the original integration

  • CreateZone
  • AddZoneSlave
  • RemoveZoneSlave
  • PlayEverywhere

What is your plan for these?

These are the whole point of integration into HomeAssistant for me. I don’t tend to use the HA User Interface that much, I create zones and add or remove slaves according to what’s happening in the house. For example, Turn on the Kitchen peaker (usually with a preset button on the unit), I automatically join Dining and Sitting Room.

You also need these service calls so that the speaker_group function of mini-media-card can work. i.e. This code snippet will let you join / unjoin speakers and create the Group Management part of the card

  speaker_group:
    platform: soundtouch
    show_group_count: true
    sync_volume: true
    entities:
      - entity_id: media_player.soundtouch_kitchen
        name: Kitchen
      - entity_id: media_player.soundtouch_dining
        name: Dining
      - entity_id: media_player.soundtouch_sitting_room
        name: Sitting Room
      - entity_id: media_player.soundtouch_family_room
        name: Family Room
      - entity_id: media_player.soundtouch_master_bedroom
        name: Master Bedroom
      - entity_id: media_player.soundtouch_back_deck
        name: Back Deck

Note some suggestions for these functions.

I customized the AddZoneSlave service to call CreateZone automatically if the Zone did not already exist. This is very helpful in the UI, you can create tap actions that just calls AddZoneSlave and it works even if the zone needs creating.

I also added a new service function I called ToggleZoneSlave which adds or removes a slave to a zone which is an even better tap action for the UI. I also stick zwave buttons to the back of speakers and call ToggleZoneSlave to join / unjoin a speaker since Bose didn’t think of this!

@jasebob Sorry for the delay - I did not get an email from the forum that a reply had been posted.

Regarding the ping_websocket_interval setting … a value of 300 instructs the integration to perform a “keep-alive” ping to the device every 300 seconds (5 minutes). A value of 0 (zero) disables the “keep-alive” processing, and assumes the network is stable enough to keep the connection alive.

I would suggest a delete / re-add of the “Sitting Room” device to enable the keep-alive pings at the 300 second interval.

I created a wiki page documenting the various options in more detail if you want to have a look at that as well.

@jasebob
I just added a bunch of enhancements and documentation on presets, recently played items, and music service stations (e.g. Pandora). See the GitHub Project wiki page for more details. I just pushed out an integration update earlier today as well, so you might want to update to the latest to get these to work properly.

It basically reads the presets and recently played content lists from the SoundTouch device and displays them for selection. There is no manual programming of buttons or titles, as it pulls the information from the device. You can also tweak the display card to fit your look and feel, but it’s all template style coding so not for the faint of heart. :smiley: One space out of place and you are pulling your hair out! lol. The HASS-Browser_Mod 2 Custom Card is used to display the list, and provide tap action support.

For the Preset list, you can tap the preset to start playing it, or tap and hold to store the currently playing content as a preset.

Here’s some screen captures of what I have configured:

Presets

image

Recently Played

Pandora Music Service

@jasebob

Regarding zones … the SoundTouchPlus integration already provides Grouping support; the original soundtouch integration does not support the MediaPlayerEntityFeature.GROUPING, so it relies on custom services to perform the group functions.

With SoundTouchPlus, you can use the standard HA join and unjoin services to control grouping functionality (e.g. create zone, add / remove members, etc). It pretty much renders all of the above methods you mentioned moot, as you can do all of those with the join / unjoin service calls.

Examples:
Create group - bose_st10_1 is master, bose_st10_2,3,4 are members.

service: media_player.join
target:
  entity_id:
    - media_player.bose_st10_1
  device_id: []
  area_id: []
data:
  group_members:
    - media_player.bose_st10_2
    - media_player.bose_st10_3
    - media_player.bose_st10_4

Remove members bose_st10_2,3 from the group:

service: media_player.unjoin
data: {}
target:
  entity_id:
    - media_player.bose_st10_3
    - media_player.bose_st10_4

The mini-media player also supports the join / unjoin calls for grouping as well. Here is how I have mine configured (I have four ST-10’s and an ST-300). Just use platform: media_player (instead of platform: soundtouch):

...
    speaker_group:
      platform: media_player
      show_group_count: true
      sync_volume: true
      icon: mdi:speaker-multiple
      entities:
        - entity_id: media_player.bose_st10_1
          name: Bose ST10-1
        - entity_id: media_player.bose_st10_2
          name: Bose ST10-2
        - entity_id: media_player.bose_st10_3
          name: Bose ST10-3
        - entity_id: media_player.bose_st10_4
          name: Bose ST10-4
        - entity_id: media_player.bose_st300
          name: Bose ST-300 SoundBar

The underlying bosesoundtouchapi that I use utilizes “smart” zone creation, in that it will create a new zone if one does not exist. It will also add multiple members with 1 call, as opposed to creating a loop and adding them 1 at a time ( you can still do that too if you wish, it’s just slower).

I like the idea of the ToggleZoneSlave service that you mentioned. I went ahead and created a new feature request so that i would not forget it.

Hope it helps!