Spotify connect active device sensor

Edit2: Done, this is the template sensor required to get the active output. It will return the name of the device:

- platform: template
      value_template: '{{ states.media_player.spotify.attributes.source }}'

Edit: Forget it, after successfully configuring the Spotify component, I have found that much of the feature that I requested is already there. I think that it will probably be possible to set up an automation based on the source attribute. I will post when I have it!

Today an idea came to me. I’m planning on connecting an Echo device to an audio player in order to remotely use it as an Spotify connect device. The problem that I see, is that I have no way to automatically power on the amplifier when I choose the device as an audio output on Spotify.
It could be great if the Spotify component on Hass had a sensor to detect which audio output is active via Spotify connect, or even better, be able to choose it via home assistant.
This way we could make automations that turned on certain device if a audio device was marked as active.
I have been looking at the Spotify API and this data is available:
Even better, we could control the volume of these devices or choose them via Hass.
What do you think?


You finally managed to use Spotify connect to trigger an automation?

Thank you!