Bose SoundTouch

Anyone used the media_player.play_media service with HA? not sure i have it correct; inserting as such and keep getting config error. Thank you

media_player:

  • service: media_player.play_media
    data:
    entity_id: media_player.soundtouch_living_room
    media_content_id: 1…6
    media_content_type: PLAYLIST

Hello.
I dont know how you want to use this feature, but I am using it like this (it was metioned in forum somewhere):

In configurtion.yaml:

input_select:
   presets:
 name: 'SoundTouch Presets:'
 options:
   - None
   - Preset 1
   - Preset 2
   - Preset 3
   - Preset 4
   - Preset 5
   - Preset 6

In scripts.yaml

soundtouch_presets:
alias: SoundTouch Presets
sequence:
  - service: media_player.volume_set
    data: 
      entity_id: media_player.soundtouch
      volume_level: '0.2'
  - service: media_player.play_media
    data_template:
      entity_id: media_player.soundtouch        
      media_content_id: >
        {% if is_state("input_select.presets", "Preset 1") %} 1
        {% elif is_state("input_select.presets", "Preset 2") %} 2
        {% elif is_state("input_select.presets", "Preset 3") %} 3
        {% elif is_state("input_select.presets", "Preset 4") %} 4
        {% elif is_state("input_select.presets", "Preset 5") %} 5
        {% elif is_state("input_select.presets", "Preset 6") %} 6
        {% endif %}
      media_content_type: 'music'

I hope it helps.

Thank you Mike, much appreciated. I’m new to HA so further question:

Where do I insert the configuration.yaml element? under the media player: heading?

media_player:

  • input_select:
    presets:
    name: ‘SoundTouch Presets:’
    options:
    • None
    • Preset 1
    • Preset 2
    • Preset 3
    • Preset 4
    • Preset 5
    • Preset 6

and I didn’t have script file in my folders, so I just created one and pasted your script?

Hello again.
You can put input_select anywhere in configuration.yaml. It’s component itself like switch or media_player, so it’s not under anything, if you know what I mean.

I have scripts.yaml file in .homeassistant/includes folder so I had to put this code in my configuration.yaml file:

script: !include includes/scripts.yaml

More about splitting configuration files here:

Mike, brief note to thank you. Took longer than expected but got it working.

1 Like

Hi,

Has any of you figured out how to force a Soundtouch 300 soundbar to either start in “TV” mode or go from playing music to “TV” mode?

There is probably something wrong with my TVs CEC so this would be a great feature to solve via Hass…

Thanks,
Tobias

Mine is connected to the TV HDMI.if I start the TV it starts on tv.

Hi Juan,
I’m very new to Home Assistant.
Just got the server going this evening.
Bose Sountouch 10 found and connected.
I can switch it on and of; that works
Now I would like to have my Bose Sountouch 10 working with the 6 presets, but have no clue where I should put what.
I keep getting errors if I simply try to copy the above:

In configurtion.yaml:

input_select:
presets:
name: ‘SoundTouch Presets:’
options:

  • None
  • Preset 1
  • Preset 2
  • Preset 3
  • Preset 4
  • Preset 5
  • Preset 6
    In scripts.yaml

soundtouch_presets:
alias: SoundTouch Presets
sequence:

  • service: media_player.volume_set
    data:
    entity_id: media_player.soundtouch
    volume_level: ‘0.2’
  • service: media_player.play_media
    data_template:
    entity_id: media_player.soundtouch
    media_content_id: >
    {% if is_state(“input_select.presets”, “Preset 1”) %} 1
    {% elif is_state(“input_select.presets”, “Preset 2”) %} 2
    {% elif is_state(“input_select.presets”, “Preset 3”) %} 3
    {% elif is_state(“input_select.presets”, “Preset 4”) %} 4
    {% elif is_state(“input_select.presets”, “Preset 5”) %} 5
    {% elif is_state(“input_select.presets”, “Preset 6”) %} 6
    {% endif %}
    media_content_type: ‘music’.

I get this error:

Invalid config for [input_select]: expected a dictionary for dictionary value @ data[‘input_select’][‘name’]. Got ‘SoundTouch Presets:’
expected a dictionary for dictionary value @ data[‘input_select’][‘options’]. Got [‘None’, ‘Preset 1’, ‘Preset 2’, ‘Preset 3’, ‘Preset 4’, ‘Preset 5’, ‘Preset 6’]
expected a dictionary for dictionary value @ data[‘input_select’][‘presets’]. Got None. (See /config/configuration.yaml, line 86). Please check the docs at https://home-assistant.io/components/input_select/
Invalid config for [script]: expected a dictionary for dictionary value @ data[‘script’][‘alias’]. Got ‘SoundTouch Presets’
expected a dictionary for dictionary value @ data[‘script’][‘sequence’]. Got [OrderedDict([(‘service’, ‘media_player.volume_set’), (‘data’, OrderedDict([(‘entity_id’, ‘media_player.living_room’), (‘volume_level’, ‘0.2’)]))]), OrderedDict([(‘service’, ‘media_player.play_media’), (‘data_template’, OrderedDict([(‘entity_id’, ‘media_player.living_room’), (‘media_content_id’, '{% elif is_state(“input_select.presets”, “Preset 1”) %} 1 {% elif is_state(“input_select.presets”, “Preset 2”) %} 2 {% elif is_state(“input_select.presets”, “Preset 3”) %} 3 {% elif is_state("input_s…
expected a dictionary for dictionary value @ data[‘script’][‘soundtouch_presets’]. Got None. (See /config/configuration.yaml, line 71). Please check the docs at https://home-assistant.io/components/script/

Any idea what goes wrong here?
Many thanks in advance
Marc

Hi Marc. I’ve improved that much, since then. ;-). First create an input_number in your configuration.yaml file

soundtouch:
  name: Presets
  initial: 1
  min: 1
  max: 6
  step: 1
  mode: slider
  unit_of_measurement: step

Then add this automation in config file.

- id: bose_presets
  alias: Bose presets
  trigger:
  - platform: state
    entity_id: input_number.soundtouch
  action:
  - service: media_player.volume_set
    data:
      entity_id: media_player.soundtouch
      volume_level: 0.2
  - service: media_player.play_media
      data_template:
        entity_id: media_player.soundtouch
        media_content_id: '{{ trigger.to_state.state | int }}'
        media_content_type: 'music'

Hi Juan,
thanks for your reply.
As I said , I’m very new to this, so all help is much appreciated :slightly_smiling_face:
Did I understand correct that the first part goes in configuration.yaml and the second part in automation.yaml?
Other Question, if I may:
the “name: Preset” in the configuration.yaml part, is that just a given name or does it link to something else?
Same for “entity_id: media_player.soundtouch”; is “soundtouch” the name you find in the configuration of the Bose device itself or just a given name ( but always the same, that relates to the part in the configuration.yaml like the Soundtouch Living Room in below example )?

Example configuration.yaml

media_player:

  • platform: soundtouch
    host: 192.168.1.1
    port: 8090
    name: Soundtouch Living Room

Thanks in advance for your help

Kind regards
Marc

Marc, the location of the components (input number, automaiton) depends on your set up.
If you have an automations.yaml file then automation goes there
input_number will probably go in your configuration.yaml file as I dont think you’ve started splitting stuff.
So in the config you add the component
input_number:

and under it you add the input number I gave you.

the name allows you to call the device whatever you want. if you’ve named your sound touch “soundtouch living room” that’s how it’ll be called.

Once you add a component you need to go to the developers section (bottom left in the HA screen) to confirm the entity_id: name as this is what you need for automations etc.

Hi Juan,

I guess I must do something wrong or I misunderstood what you suggested.
The soundtouch works and is seen by the Home Assistant server, but I don’t get the 6 preset buttons . Is there a way to send pictures, maybe to your e-mail?
I took screenshots i would like to show from what I get now and a picture of what I would like to achieve . Sometimes a picture says more than 1000 words :slightly_smiling_face:

Marc you wont get the 6 buttons in the HA media player. That’s why you have to create an input number as per the example i gave you.

Sorry to bring all this up again but I am struggling with this one. I cannot get preset selection to work on any of my bose soundtouch systems. I think I have tried just about every suggestion and script I can find. Does anyone have a definitive solution that works and would be willing to help me? At this point I have moved all configs except for the auto discovery of my soundtouch systems so I can see them and turn them on/off, skip songs or adjust volume, all part of the discovery service. Any help would be greatly appreciated.

@trhessel - Try this, hope it helps.
Bose soundtouch create_zone

HI Juan, does this config still works ?
I’ve tried a lot of config… but no presets for me :frowning:

Could you help me please ?

yes, still works. this is my set up:

input_boolean:

living_preset_1:
  initial: off
  icon: mdi:numeric-1-box-outline
living_preset_2:
  initial: off
  icon: mdi:numeric-2-box-outline
living_preset_3:
  initial: off
  icon: mdi:numeric-3-box-outline
living_preset_4:
  initial: off
  icon: mdi:numeric-4-box-outline
living_preset_5:
  initial: off
  icon: mdi:numeric-5-box-outline
living_preset_6:
  initial: off
  icon: mdi:numeric-6-box-outline
master_preset_1:
  initial: off
  icon: mdi:numeric-1-box-outline
master_preset_2:
  initial: off
  icon: mdi:numeric-2-box-outline
master_preset_3:
  initial: off
  icon: mdi:numeric-3-box-outline
master_preset_4:
  initial: off
  icon: mdi:numeric-4-box-outline
master_preset_5:
  initial: off
  icon: mdi:numeric-5-box-outline
master_preset_6:
  initial: off
  icon: mdi:numeric-6-box-outline

automation:

- id: media_bose_presets_on_dash
  alias: Media Bose prests on dash
  initial_state: true
  trigger:
  - platform: state
    entity_id:
    - input_boolean.living_preset_1
    - input_boolean.living_preset_2
    - input_boolean.living_preset_3
    - input_boolean.living_preset_4
    - input_boolean.living_preset_5
    - input_boolean.living_preset_6
    - input_boolean.master_preset_1
    - input_boolean.master_preset_2
    - input_boolean.master_preset_3
    - input_boolean.master_preset_4
    - input_boolean.master_preset_5
    - input_boolean.master_preset_6
    to: 'on'
  action:
  - service_template: media_player.play_media
    data_template:
      entity_id: >
        {% if trigger.entity_id.split('.')[1].split('_')[0] == "living" %} media_player.livingroom
        {% else %} media_player.masterroom {% endif %}
      media_content_id: '{{ trigger.entity_id.split(".")[1].split("_")[2].split("_")[0] | int }}'
      media_content_type: 'music'
  - condition: or
    conditions:
    - condition: state
      entity_id: media_player.masterroom
      state: 'off'
    - condition: state
      entity_id: media_player.livingroom
      state: 'off'        
  - service_template: media_player.volume_set
    data:
      entity_id: media_player.masterroom
      volume_level: 0.4
  - service_template: media_player.volume_set
    data:
      entity_id: media_player.livingroom
      volume_level: 0.2

lovelace card

  - type: custom:vertical-stack-in-card #vertical-stack
    cards:
    - type: custom:card-modder
      style:
        border-radius: 15px
      card:
        type: custom:mini-media-player
        entity: media_player.masterroom
        name: Master SoundTouch
        artwork: cover
        toggle_power: true
        group: true
        volume_stateless: true
        icon: mdi:radio            
        show_source: true
        tts:
          platform: google_translate      
    - type: custom:card-modder
      style:
        border-radius: 15px
      card:
        type: glance
        columns: 6 #        title: Master SoundTouch
        show_state: false
        show_name: false
        entities:
        - entity: input_boolean.master_preset_1
          tap_action: 
            action: toggle
        - entity: input_boolean.master_preset_2
          tap_action: 
            action: toggle
        - entity: input_boolean.master_preset_3
          tap_action: 
            action: toggle
        - entity: input_boolean.master_preset_4
          tap_action: 
            action: toggle
        - entity: input_boolean.master_preset_5
          tap_action: 
            action: toggle
        - entity: input_boolean.master_preset_6
          tap_action: 
            action: toggle

Hi,

just had a look at your card and I honestly think you can get rid of your input boolean, because the mini-media-player also supports the buttons ‘natively’.

My config:

          - type: custom:mini-media-player
            entity: media_player.slaapkamer
            name: Bose Soundtouch 10
            artwork: cover
            toggle_power: true
            group: true
            volume_stateless: true
            icon: mdi:radio
            show_source: true
            tts:
              platform: google_translate      
            shortcuts:
              columns: 3
              buttons:
                - icon: mdi:numeric-1-box
                  type: playlist
                  id: 1
                - icon: mdi:numeric-2-box
                  type: playlist
                  id: 2
                - icon: mdi:numeric-3-box
                  type: playlist
                  id: 3
                - icon: mdi:numeric-4-box
                  type: playlist
                  id: 4
                - icon: mdi:numeric-5-box
                  type: playlist
                  id: 5
                - icon: mdi:numeric-6-box
                  type: playlist
                  id: 6

2 Likes

HI, yes it does. Awsome, Thank you !!!

Hello,

my Bose Soundtouch is missing the power button like other media players, can you insert it?

Best regards

Philipp