Bose SoundTouch w/ TTS and source switching

Is anyone using TTS with SoundTouch speakers and if so, how do you deal with source switching? I have tried ARC/CEC and direct HDMI in while set to AUX with the same outcome.

I will be listening to music or watching a movie/TV, and fire off a test TTS notification, it takes a couple of seconds to switch streams and starts out quiet (I will miss the first part of the speech unless I am excepting it) but it will play the notification and then I will manually have to switch back to the original source to get audio.

Its pretty awesome that TTS is now supported in SoundTouch (I would have sent it back if I could have), but the manual switching of the source is a PITA. Iā€™m just curious to see if anyone else has any experience with this problem?

It took me a little bit to figure this out but I just found a workaround for switching the source to the TV by issuing a shell command :smiley: Hope it works for you!

in configuration.yaml add this

shell_command:
  tv_force_audio: "echo \"sys select PRODUCT TV\" > /dev/tcp/INSERT_IP_TO_SOUNDTOUCH/17000"

then you can add a script that calls the command in the scripts.yaml:

scene_test:
  alias: Scene Test
  sequence:
  - service: shell_command.tv_force_audio

@tarcus2k thank you for sharing. not working on mine. You running soundtouch 300?

Gents, there is a solution. Requires a bit of set up, but it works!

As per the guide Bose doesnā€™t do https. Bose SoundTouch - Home Assistant
So if youā€™re using standard ssl set up it wont work.

Following the guide the solution is to use Nginx reverse proxy server.

Follow the set up guide here:

include the part at the bottom talking about http.

after that it works.

This is setting up a reverse proxy. I guess Iā€™m confused as to how that relates to the SoundTouch switching source to play TTS, then not switching to the previous source?

Hi guys, Im new to HA and learning. I also have a soundtouch 300 and am setting it up with HA now.
The soundtouch component in HA doesnā€™t seem to map up so many of the functions on the soundtouch.
So we could improve it. Iā€™ve done some research and found that soundtouch has an API och tcp port 8090.
The API isnā€™t a normal REST, it communicates with XML but normal HTTP GET and POST commands.

For example:
Open a shell and use cURL to get the sources with:
curl -X GET http://bose:8090/sources

The bose returns output like:

<?xml version="1.0" encoding="UTF-8" ?> Plex Media Server: JF-DELL ZEN: ben: Ben laptop mp3 HDMI_1

To select one of the sources listed by the command above you have to post back
XML like this:

Iā€™m currently experimenting with the bose API.
More info at https://developer.bose.com/forums/soundtouch-audio-notification-api

1 Like

I feel this is doable with Node-red. Not sure how the TTS is setup but in node-red what you can do is call the service and have SoundTouch play your audio and then second node would set the source back to what it was.

The newest version of libsoundtouch apparently supports a snapshot save/restore feature that hasnā€™t found itā€™s way into HA yet.

Sorry to bring this thread alive again, but the snapshot feature of libsoundtouch v0.8 is still not available in HA.

Can someone with the skills and knowledge please add this feature?

Sonos is just not an option in my household :smiley:

I am very happy to announce that I have a working version of the SoundTouch component that is able to snapshot and restore. I saw your post and I also wanted to have this feature for a long time.

The only issue I have is that libsoundtouch v0.8 doesnā€™t support Tune In and HDMI switching (like the lifestyle 600/650 product). I was able to fix that, but the last time that I opened a Pull request to the Home assistant core project, they refused this kind of fix.

I have a working version of the Soundtouch component in my home assistant by putting the ā€˜soundtouchā€™ folder in my custom_components folder.

Do you have HACS? I can provide a custom component over HACS.

Hiā€¦

Sounds awesomeā€¦
Yes I use hacs. Would be happy to do some testing :+1:t3:

Please try the following:

Some questions as second user, to hear about your expectations:

  • Does this work like expected?
  • Volume is part of the snapshot & restore service. Is this applicable for all your use cases? Or should that be a boolean option to choose for a volume snapshot or not?
  • This module is replacing the entire original soundtouch component, is that ok for you? Or should this HACS component only register the snapshot and restore service? (still need to test if this is feasible)

Hello Michael,

it is a nice integration. I have one question. In the example I see that restore and snapshot are shown only for one entity. Does the normal notation for entity_idā€™s like

entity_id: mediaplayer_one, mediaplayer_two, ā€¦

also works for this component or can I only save one snapshot for one entity? Objective is to write a script for tts message and select based on status on/off whether a snapshot is made and the entity is switched off after the tts message.

Regards,

Volker

I have a similar task Iā€™d like to setup a script for:

Iā€™d like to save the state (check if switched on/off and if on, save the source playing) of all Bose Soundtouch (2x ST10, 4x ST20, 1x ST30) speakers in the house.
Then Iā€™d like to broadcast a TTS to all speakers and afterwards restore back all the previous states:
If the SoundTouch was on and playing before the broadcast, switch back to the previous source and play.
If the SoundTouch was off before the broadcast, switch it off again after the broadcast.

Any idea of the best way to accomplish this?

Hello Andreas,

I am not sure, whether you meanwhile figured it out, but I use a general automatization in which I assign values to fields and hand them over to scripts. I replaced names with general placeholders in the text below.

alias: doorbell
description: ''
trigger:
  - platform: state
    entity_id: binary_sensor.doorbell
    from: 'off'
    to: 'on'
condition: []
action:
  - service: script.my_script_tts_to_bose 
    data_template:
      message: somebody is at the door!
      mediaplayer_on: |-
        {{expand('group.soundtouch_speaker')
              |selectattr('state', 'eq', 'playing')
              |map(attribute='entity_id')|join(',') }}
      mediaplayer_off: |-
        {{expand('group.soundtouch_speaker')
              |selectattr('state', 'eq', 'off')
              |map(attribute='entity_id')|join(',') }}
      spotify_status: '{{states.media_player.spotify_account.state}}'
      count_off: >-
        {{expand('group.soundtouch_speaker')| 

        selectattr('state', 'eq', 'off') |map(attribute='entity_id')|list|count
        }}
      wave_volume: >-
        {{
        states.media_player.wave_soundtouch_livingroom.attributes['volume_level']

        }}
      1_volume: |-
        {{ states.media_player.1_soundtouch_10.attributes['volume_level']
        }}
      name_volume: |-
        {{ states.media_player.name.attributes['volume_level']
        }}
      master: media_player.wave_soundtouch_livingroom
      slaves: media_player.name, media_player.1_soundtouch_10
      tts_speaker: >-
        media_player.wave_soundtouch_livingroom, media_player.name,
        media_player.1_soundtouch_10
      delay: '00:00:07'
      volume: 0.7
mode: queued
max: 5
alias: my_script_tts_to_bose
sequence:
  - service: media_player.volume_set
    target:
      entity_id: group.soundtouch_speaker
    data:
      volume_level: 0.1
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 0
  - service: media_player.turn_on
    target:
      entity_id: '{{master}}'
  - choose:
      - conditions:
          - condition: template
            value_template: '{{spotify_status == ''playing''}}'
        sequence:
          - service: media_player.media_play_pause
            target:
              entity_id: media_player.spotify_account
    default:
      - service: media_player.media_play_pause
        target:
          entity_id: group.soundtouch_speaker
  - service: soundtouch.create_zone
    data:
      master: '{{master}}'
      slaves: '{{slaves}}'
  - service: media_player.volume_set
    data:
      entity_id: '{{tts_speaker}}'
      volume_level: '{{volume}}'
  - service: tts.cloud_say
    data:
      entity_id: '{{master}}'
      message: '{{message}}'
  - delay: '{{delay}}'
  - choose:
      - conditions:
          - condition: template
            value_template: '{{ wave_volume > 0}}'
        sequence:
          - service: media_player.volume_set
            target:
              entity_id: media_player.wave_soundtouch_livingroom
            data:
              volume_level: '{{wave_volume}}'
    default:
      - service: media_player.volume_set
        target:
          entity_id: media_player.wave_soundtouch_livingroom
        data:
          volume_level: 0.2
  - choose:
      - conditions:
          - condition: template
            value_template: '{{ 1_volume > 0}}'
        sequence:
          - service: media_player.volume_set
            target:
              entity_id: media_player.1_soundtouch_10
            data:
              volume_level: '{{1_volume}}'
    default:
      - service: media_player.volume_set
        target:
          entity_id: media_player.1_soundtouch_10
        data:
          volume_level: 0.2
  - choose:
      - conditions:
          - condition: template
            value_template: '{{ name_volume > 0}}'
        sequence:
          - service: media_player.volume_set
            target:
              entity_id: media_player.name
            data:
              volume_level: '{{name_volume}}'
    default:
      - service: media_player.volume_set
        target:
          entity_id: media_player.name
        data:
          volume_level: 0.2
  - choose:
      - conditions:
          - condition: template
            value_template: '{{count_off != 0}}'
        sequence:
          - service: media_player.turn_off
            target:
              entity_id: '{{mediaplayer_off}}'
    default: []
  - choose:
      - conditions:
          - condition: template
            value_template: '{{spotify_status == ''playing''}}'
        sequence:
          - service: media_player.media_play_pause
            target:
              entity_id: media_player.spotify_account
    default: []
description: Textausgabe auf Boselautsprechern
fields:
  message:
    description: Der Berichttext
    example: Jemand ist an der Haustuer
  mediaplayer_on:
    description: angeschaltete Lautsprecher
    example: media_player.wave_soundtouch_livingroom
  mediaplayer_off:
    description: ausgeschaltete Lautsprecher
    example: media_player.wave_soundtouch_livingroom
  spotify_on:
    description: Zustand Spotifyspieler
    example: true
  count_off:
    description: Anzahl der ausgeschalteten Lautsprecher
    example: 1
  wave_volume:
    description: Laustaerke des Waveradios
    example: 1 0.25
  1_volume:
    description: Laustaerke 1s Lautsprecher
    example: 1 0.25
  name_volume:
    description: Laustaerke name Lautsprechers
    example: 1 0.25
  master:
    description: Masterlautsprecher
    example: media_player.wave_soundtouch_livingroom
  slaves:
    description: Slavelautsprecher
    example: media_player.name
  tts_speaker:
    description: Sprachausgabelautsprecher
    example: media_player.name
  delay:
    description: Zeit fuer die Sprachausgabe
    example: '00:00:15'
  volume:
    description: Lautstaerke
    example: '0.1'
mode: parallel
max: 4
icon: mdi:text-to-speech

The script does not work seamless yet. The tts signal is only transmitted to the master. The slaves are switched on, but they do not broadcast the message. I tested the general syntax in the developer section without fields and then it works. I must have made a small error in the field definition. In addition, as described in other posts the bose speakers are delicate. Everything works for weeks and months and suddenly you have a hickup and cannot adress them well, neither via home assistant nor via spotify directly.

Regards,

Volker

Hi Volker,
Very much appreciated, thank you very much! That looks promising, I will check it out when thereā€™s more time during the holiday season.
Best
Andreas

@michaelg
Michael

Iā€™ve installed your latest build in custom components and used your script but I get an error saying it cant find the soundtouch.snapshot service. Any suggestions as to what this might be ?

Thanks

@michaelg, I have the same issue: snapshot service not available. Can you help?

Any reason why this feature is not part of home assistant core?

Edit:

This issue causes the error: missing version key for future Home Assistant Release Ā· Issue #1 Ā· geertsmichael/soundtouch Ā· GitHub, I have created a PR, hopefully @michaelg will merge it to make the integration usable again.

In the meantime just go in the file editor, open /config/custom_components/soundtouch/manifest.json and add "version": "1.1.0"

Not sure if this thread is still followed, but thought I would mention ā€¦

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.

It supports the snapshot store / restore functionality, as well as extended source_select processing for both source= and sourceaccount= values required by Bose SoundTouch devices.

It also supports a Play TTS custom service that plays a Google TTS message via a service call and automatically resumes playing of previous source (no snapshot store / restore required). Note that the notification functionality is only supported on the ST-10,20,30 devices and NOT the ST-300 for some odd reason (Bose limitation, not mine). Example:

service: soundtouchplus.play_tts
data:
  entity_id: media_player.soundtouch_10
  message: Hello World, this is a TTS notification message
  artist: TTS Notification
  album: Google TTS
  track: Hello World
  tts_url: >-
    http://translate.google.com/translate_tts?ie=UTF-8&tl=EN&client=tw-ob&q={saytext}
  volume_level: 50

Hope it helps!