I don’t have an ATV but my Yamaha AVR has spotify built in
For the media player I can set
data:
entity_id: media_player.kitchen_avr
source: Spotify
In the spotify component I can choose source as my Yamaha AVR
source: RX-V479
It seems to be quite slow in response to commands (pause/play seems to take at least 5 seconds) so perhaps you need a delay between activating device and setting input, then setting spotify component to source you want to control.
This works for me using a script for the action.
automation…
- alias: spottytest
trigger:
platform: xxxx
action:
- service: media_player.turn_on
entity_id: media_player.kitchen_avr
- service: media_player.select_source
data:
entity_id: media_player.kitchen_avr
source: Spotify
- delay: 10
- service: script.turn_on
entity_id: script.yam_spt_tst
Script.
yam_spt_tst:
sequence:
- service: media_player.select_source
data:
entity_id: media_player.spotify
source: RX-V479
- service: media_player.play_media
data:
entity_id: media_player.spotify
media_content_id: 'spotify:user:113469951:playlist:7r2Md6JaYjE5TQZCwPCSKn'
media_content_type: 'playlist'