This is an interesting usecase, and if you have a home assistant setup with our plugin it would be fairly easy to build yourself. If you have a home assistant setup, you can use an automation roughly like the one below to do what you want. Basically just have an automation/a few automations that watch for track changes in the given Spotify stream(s), check that the competing Spotify streams media_track attribute is set to None or their default as a method of seeing that they aren’t currently playing anything before connecting the relevant zone(s) and/or group(s) to the related stream
There are some rough points on this, such as race conditions when you start streaming to multiple things around the same time as well as the fact that it’s somewhat laborious to build for the first time (something I’d like to solve with a blueprint, but can’t provide a time estimate on when that’d be available), but in 95% of cases this type of thing will do what you want and you should only need to set it up once:
alias: Autospot
description: “”
triggers:
- trigger: state
entity_id:- media_player.amplipi_stream_1001
- media_player.amplipi_stream_1002
attribute: media_track
conditions: [ ]
actions:
- if:
- condition: and
conditions:- condition: template
value_template: >-
{{ state_attr(‘media_player.amplipi_stream_1001’, ‘media_track’)
not in [None, ‘Connect to Spotify 1 on Spotify Connect’, ‘Connect
to Spotify 2 on Spotify Connect’, ‘Connect to Spotify 3 on Spotify
Connect’, ‘Connect to Spotify 4 on Spotify Connect’] }} - condition: template
value_template: >-
{{ state_attr(‘media_player.amplipi_stream_1002’, ‘media_track’)
in [None, ‘Connect to Spotify 1 on Spotify Connect’, ‘Connect to
Spotify 2 on Spotify Connect’, ‘Connect to Spotify 3 on Spotify
Connect’, ‘Connect to Spotify 4 on Spotify Connect’] }}
then:
- condition: template
- action: media_player.select_source
metadata: {}
data:
source: Spotify 1
target:
entity_id: media_player.amplipi_group_104
else: - if:
- condition: and
conditions:- condition: template
value_template: >-
{{ state_attr(‘media_player.amplipi_stream_1001’,
‘media_track’) in [None, ‘Connect to Spotify 1 on Spotify
Connect’, ‘Connect to Spotify 2 on Spotify Connect’, ‘Connect
to Spotify 3 on Spotify Connect’, ‘Connect to Spotify 4 on
Spotify Connect’] }} - condition: template
value_template: >-
{{ state_attr(‘media_player.amplipi_stream_1002’,
‘media_track’) not in [None, ‘Connect to Spotify 1 on Spotify
Connect’, ‘Connect to Spotify 2 on Spotify Connect’, ‘Connect
to Spotify 3 on Spotify Connect’, ‘Connect to Spotify 4 on
Spotify Connect’] }}
then:
- condition: template
- action: media_player.select_source
metadata: {}
data:
source: Spotify 2
target:
entity_id: media_player.amplipi_group_104 - action: media_player.volume_mute
metadata: {}
data:
is_volume_muted: false
target:
entity_id: media_player.amplipi_group_104
mode: single
- condition: and
- condition: and
Relatedly to your other thread, if you were to get a home assistant setup you could build physical buttons/dials/switches in any given room that would allow you to change the volume of your stream without touching our app or home assistant (beyond the initial setup). While that isn’t what you’d like re: matching spotify’s volume control setting, it is a step closer to the interest of never touching our app (also, if relevant, any guests or other people who don’t want to use our app can go to amplipi.local while connected to your network and reach the controls with no added installations)