Bose Soundtouch - Source selection & presets
After integrating the Bose sound system - I found it a bit weird that the source switching wasn’t enabled by default. I kinda understand why now after digging through the APIs …- but it’s not an insurmountable issue that couldn’t be coded up in future. I also wanted to select my preset favourites (1-6) and that standard integration didn’t work for me out the box.
I figured there was a way to get it all working without digging in the standard integration, and I was right. I just couldn’t find an all in one guide. I hope that someone who’s a bit better (well - a developer) would be happy to take my learnings and update the standard integration. If someone who’s got a bit more time could write a custom-component out of my stuff?
Until then - here’s my all in one guide using standard components for changing source (TV, Spotify & Amazon Prime Music) and selecting presets 1->6. It does however require a bit of digging into how stuff’s set up in your environment.
Attributes you will need: tenacity, a brain, patience and troubleshooting.
Specific information you’ll need to substitute into the appropriate places in config:
- IP address of your Bose Soundtouch device
- spotify ID
- email address you signed up for amazon with
URLs to get information to help you out after you’ve got your Bose Soundtouch’s IP address (substitute soundtouch-lounge for the ip address):
http://soundtouch-lounge:8090/info
http://soundtouch-lounge:8090/sources
http://soundtouch-lounge:8090/now_playing
If you want more than play button, preset buttons 1->6, spotify, amazon prime music and TV sources, have fun:
Bose API documentation: https://developer.bose.com/guides/bose-soundtouch-api/bose-soundtouch-api-reference (you’ll need a developer account - a few minutes to register)
Without further ado, here’s my set-up which I hope you can copy, paste and edit in a few minutes to get it all working (sans personal info?):
configuration.yaml
shell_command: # can place this into a !include shell_command.yaml
#soundtouch - preset selectors (use release for selecting - press for setting preset to current playing)
bose_preset_1_press: curl -X POST -H 'application/xml;charset=utf-8' -d '<?xml version="1.0" ?><key state="press" sender="Gabbo">PRESET_1</key>' http://<soundtouch ip address>:8090/key
bose_preset_1_release: curl -X POST -H 'application/xml;charset=utf-8' -d '<?xml version="1.0" ?><key state="release" sender="Gabbo">PRESET_1</key>' http://<soundtouch ip address>:8090/key
bose_preset_2_press: curl -X POST -H 'application/xml;charset=utf-8' -d '<?xml version="1.0" ?><key state="press" sender="Gabbo">PRESET_2</key>' http://<soundtouch ip address>:8090/key
bose_preset_2_release: curl -X POST -H 'application/xml;charset=utf-8' -d '<?xml version="1.0" ?><key state="release" sender="Gabbo">PRESET_2</key>' http://<soundtouch ip address>:8090/key
bose_preset_3_press: curl -X POST -H 'application/xml;charset=utf-8' -d '<?xml version="1.0" ?><key state="press" sender="Gabbo">PRESET_3</key>' http://<soundtouch ip address>:8090/key
bose_preset_3_release: curl -X POST -H 'application/xml;charset=utf-8' -d '<?xml version="1.0" ?><key state="release" sender="Gabbo">PRESET_3</key>' http://<soundtouch ip address>:8090/key
bose_preset_4_press: curl -X POST -H 'application/xml;charset=utf-8' -d '<?xml version="1.0" ?><key state="press" sender="Gabbo">PRESET_4</key>' http://<soundtouch ip address>:8090/key
bose_preset_4_release: curl -X POST -H 'application/xml;charset=utf-8' -d '<?xml version="1.0" ?><key state="release" sender="Gabbo">PRESET_4</key>' http://<soundtouch ip address>:8090/key
bose_preset_5_press: curl -X POST -H 'application/xml;charset=utf-8' -d '<?xml version="1.0" ?><key state="press" sender="Gabbo">PRESET_5</key>' http://<soundtouch ip address>:8090/key # used for setting if called on its own ... long press
bose_preset_5_release: curl -X POST -H 'application/xml;charset=utf-8' -d '<?xml version="1.0" ?><key state="release" sender="Gabbo">PRESET_5</key>' http://<soundtouch ip address>:8090/key # used for press & release function
bose_preset_6_press: curl -X POST -H 'application/xml;charset=utf-8' -d '<?xml version="1.0" ?><key state="press" sender="Gabbo">PRESET_6</key>' http://<soundtouch ip address>:8090/key
bose_preset_6_release: curl -X POST -H 'application/xml;charset=utf-8' -d '<?xml version="1.0" ?><key state="release" sender="Gabbo">PRESET_6</key>' http://<soundtouch ip address>:8090/key
bose_play_press: curl -X POST -H 'application/xml;charset=utf-8' -d '<?xml version="1.0" ?><key state="press" sender="Gabbo">PLAY</key>' http://<soundtouch ip address>:8090/key
bose_play_release: curl -X POST -H 'application/xml;charset=utf-8' -d '<?xml version="1.0" ?><key state="release" sender="Gabbo">PLAY</key>' http://<soundtouch ip address>:8090/key
#soundtouch - source selectors
bose_amazon_music: curl -X POST -H 'application/xml;charset=utf-8' -d '<?xml version="1.0" ?><ContentItem source="AMAZON" type="tracklist" location="library/playlists/A1F83G8C2ARO7P_3AB01FSVTHAY/#playable" sourceAccount="<your.email@address>"></ContentItem>' http://<soundtouch ip address>:8090/select #why can't I resume without specifying a 'location' aka track/playlist?
bose_tv_source: curl -X POST -H 'application/xml;charset=utf-8' -d '<?xml version="1.0" ?><ContentItem source="PRODUCT" sourceAccount="TV"></ContentItem>' http://<soundtouch ip address>:8090/select
bose_spotify: curl -X POST -H 'application/xml;charset=utf-8' -d '<?xml version="1.0" ?><ContentItem source="SPOTIFY" type="uri" sourceAccount="<account ID>"></ContentItem>' http://<soundtouch ip address>:8090/select #documentation on bose api was missing 'type="URI"' for restarting web streaming services
scripts.yaml
# soundtouch - preset selector
bose_preset_1:
alias: Soundtouch Preset 1
description: "Switches to pre-set 1 station"
sequence:
#Release
- service: shell_command.bose_preset_1_release
alias: Release button 1
- event: LOGBOOK_ENTRY
event_data:
name: Lounge - preset 1 switch
message: Lounge sound to Radio BBC1
entity_id: media_player.soundtouch_300_living_room
domain: media_player
# soundtouch - preset selector
bose_preset_2:
alias: Soundtouch Preset 2
description: "Switches to pre-set 2 station"
sequence:
#Release
- service: shell_command.bose_preset_2_release
alias: Release button 2
- event: LOGBOOK_ENTRY
event_data:
name: Lounge - preset 2 switch
message: Lounge sound to Radio Preset 2
entity_id: media_player.soundtouch_300_living_room
domain: media_player
# soundtouch - preset selector
bose_preset_3:
alias: Soundtouch Preset 3
description: "Switches to pre-set 3 station"
sequence:
#Release
- service: shell_command.bose_preset_3_release
alias: Release button 3
- event: LOGBOOK_ENTRY
event_data:
name: Lounge - preset 3 switch
message: Lounge sound to Radio BBC3
entity_id: media_player.soundtouch_300_living_room
domain: media_player
# soundtouch - preset selector
bose_preset_4:
alias: Soundtouch Preset 4
description: "Switches to pre-set 4 station"
sequence:
#Release
- service: shell_command.bose_preset_4_release
alias: Release button 4
- event: LOGBOOK_ENTRY
event_data:
name: Lounge - preset 4 switch
message: Lounge sound to Radio BBC4
entity_id: media_player.soundtouch_300_living_room
domain: media_player
# soundtouch - preset selector
bose_preset_5:
alias: Soundtouch Preset 5
description: "Switches to pre-set 5 station"
sequence:
#Release
- service: shell_command.bose_preset_5_release
alias: Release button 5
- event: LOGBOOK_ENTRY
event_data:
name: Lounge - preset 5 switch
message: Lounge sound to Radio BBC5
entity_id: media_player.soundtouch_300_living_room
domain: media_player
# soundtouch - preset set
# use the press function without calling release on the specified preset number
# soundtouch - preset selector
bose_preset_6:
alias: Soundtouch Preset 6
description: "Switches to pre-set 6 station"
sequence:
#Press
- service: shell_command.bose_preset_6_press
alias: Press button 6
#Release
- service: shell_command.bose_preset_6_release
alias: Release button 6
- event: LOGBOOK_ENTRY
event_data:
name: Lounge - preset 6 switch
message: Lounge sound to Radio BBC6
entity_id: media_player.soundtouch_300_living_room
domain: media_player
#source switch
# soundtouch - TV selector
bose_souce_tv:
alias: Soundtouch TV Source
description: "Switches to pre-set 6 station"
sequence:
#Press
- service: shell_command.bose_tv_source
alias: Press TV button
- event: LOGBOOK_ENTRY
event_data:
name: Lounge - TV Switch
message: Lounge sound to TV
entity_id: media_player.soundtouch_300_living_room
domain: media_player
# soundtouch - Spotify selector
bose_souce_spotify:
alias: Soundtouch resume spotify play
description: "Switches to spotify source and plays"
sequence:
#Press
- service: shell_command.bose_spotify
alias: Press Spotify button
#Press play
- service: shell_command.bose_play_release
alias: Press button play
#Release play
- service: shell_command.bose_play_release
alias: Release button play
- event: LOGBOOK_ENTRY
event_data:
name: Lounge - Spotify Switch
message: Lounge sound to Spotify
entity_id: media_player.soundtouch_300_living_room
domain: media_player
# soundtouch - Amazon music selector
bose_souce_amazon:
alias: Soundtouch resume Amazon play
description: "Switches to spotify source and plays"
sequence:
#Press
- service: shell_command.bose_amazon_music
alias: Press Amazon button
#Press play
- service: shell_command.bose_play_release
alias: Press button play
#Release play
- service: shell_command.bose_play_release
alias: Release button play
- event: LOGBOOK_ENTRY
event_data:
name: Lounge - Amazon Switch
message: Lounge sound to Amazon
entity_id: media_player.soundtouch_300_living_room
domain: media_player
Lovelace UI yaml file
# a new tab for media - the full one contains my tv too, hence the icon. :)
## media
- title: Media
icon: mdi:video-vintage
path: media
cards:
## bose soundtouch
- cards:
#source selection
- entities:
#type: glance
#tv source
- type: entity-button
entity: script.bose_souce_tv
icon: mdi:television
icon_height: 50px
name: TV Source
show_name: true
tap_action:
action: call-service
service: script.bose_souce_tv
#spotify source
- type: entity-button
entity: script.bose_souce_spotify
icon: mdi:spotify
icon_height: 50px
name: Spotify
show_name: true
tap_action:
action: call-service
service: script.bose_souce_spotify
#amazon
- type: entity-button
entity: script.bose_souce_amazon
icon: mdi:amazon
icon_height: 50px
name: Amazon Prime Music
show_name: true
tap_action:
action: call-service
service: script.bose_souce_amazon
show_state: false
type: glance
#preset selection row a
- entities:
#type: glance
#Preset 1
- type: entity-button
entity: script.bose_preset_1
icon: mdi:numeric-1-box-outline
icon_height: 50px
name: Preset 1
show_name: true
tap_action:
action: call-service
service: script.bose_preset_1
#Preset 2
- type: entity-button
entity: script.bose_preset_2
icon: mdi:numeric-2-box-outline
icon_height: 50px
name: Preset 2
show_name: true
tap_action:
action: call-service
service: script.bose_preset_2
#Preset 3
- type: entity-button
entity: script.bose_preset_3
icon: mdi:numeric-3-box-outline
icon_height: 50px
name: Preset 3
show_name: true
tap_action:
action: call-service
service: script.bose_preset_3
show_state: false
type: glance
#preset selection row b
- entities:
#type: glance
#Preset 4
- type: entity-button
entity: script.bose_preset_4
icon: mdi:numeric-4-box-outline
icon_height: 50px
name: Preset 4
show_name: true
tap_action:
action: call-service
service: script.bose_preset_4
#Preset 5
- type: entity-button
entity: script.bose_preset_5
icon: mdi:numeric-5-box-outline
icon_height: 50px
name: Preset 5
show_name: true
tap_action:
action: call-service
service: script.bose_preset_5
#Preset 6
- type: entity-button
entity: script.bose_preset_6
icon: mdi:numeric-6-box-outline
icon_height: 50px
name: Preset 6
show_name: true
tap_action:
action: call-service
service: script.bose_preset_6
show_state: false
type: glance
#custom card experiment
#- type: custom:button-card
# icon: mdi:spotify
# action: service
# service:
# domain: rest_command
# action: lounge_soundbar_spotify
#- type: custom:button-card
# icon: mdi:television
# action: service
# service:
# domain: rest_command
# action: lounge_soundbar_tv
# data:
#standard bose media player contorl
- entity: media_player.soundtouch_300_living_room
name: Living room soundbar
type: media-control
title: Bose
type: vertical-stack
Here’s a picture for proof of life:
Looking forward to seeing where this goes.