Some of the guys on Dr ZZZ FB asked for this code. I got the original idea from Smart Home Solver, with a few extras.
So you need a script for each room;
And they look like this:
Make sure the “source” is the frendly name of your Alexa device as it shows in the Alexa app
alias: Spotify Change Source to Bathroom
sequence:
- service: media_player.select_source
data:
entity_id: media_player.spotify_account
source: Bathroom
entity_id: media_player.spotify_account
mode: single
Then same for the automations X 2:
I put “not” conditions in for my multiroom groups so if I’m having a party ect it should not change (haven’t tested that yet though)
Also add the device your switching to otherwise it will cut out for a second everytime it switches over to itself.
alias: 'Motion: Spotify Source Bathroom'
description: ''
trigger:
- type: motion
platform: device
device_id: id
entity_id: binary_sensor.bathroom_motion
domain: binary_sensor
condition:
- condition: state
entity_id: media_player.spotify_account
state: playing
- condition: not
conditions:
- condition: or
conditions:
- condition: state
entity_id: media_player.casual
state: playing
- condition: state
entity_id: media_player.everywhere
state: playing
- condition: state
entity_id: media_player.amps
state: playing
- condition: state
entity_id: media_player.bathroom
state: playing
action:
- service: script.spotify_change_source_to_bathroom
data: {}
entity_id: media_player.spotify_account
mode: single
Its pretty simple really, but pretty cool. Time will tell if its a gimmick though lol