Spotify TTS not working

I’m trying to use the Spotify media player to work for Text To Speech but no luck. That’s because it can play to my Echo dot (always on) so I can get notifications easily via speech. It works fine on my Apple TV but nothing happens when I try the Spotify media player. Have tried the same in the HA interface, trying to use TTS for Spotify, and nothing happens. If I play a song at the same time, it’s not even interrupted. Is it impossible? Below works for Apple TV but not for Spotify.

  - alias: 'Test dummy switch'
    trigger:
      - platform: state
        entity_id: switch.dummy_switch
        state: 'on'
    action:
      - service: tts.google_say
        data_template:
          entity_id: media_player.spotify
          message: 'Dummy switch is on'
      - service: tts.google_say
        data_template:
          entity_id: media_player.apple_tv_i_vardagsrum
          message: 'Dummy switch is on'

Spotify isn’t a traditional media player. You can only play media that is on Spotify, not any generated content.

Spotify does support playing local content but I believe it has to be indexed and doubt the Spotify Connect API offers such functionality. The TTS functionality in Apple TV is probably streaming from a given url which Spotify is not capable of.

The way I was thinking of getting round this is to find appropriate ‘songs’ on Spotify for home automation events, and to then automate the playing of these when the event occurs. Thus far I haven’t found any, but creating an album of recorded TTS samples might not be too difficult.

Edit: Seems getting ‘music’ on Spotify is a bit of a pain. Not impossible, but fiddly.

I see. Is there any other way of getting sounds from HA to play via TTS on an Echo Dot?

There is, but it’s complex and involves creating your own Alexa Skill - something like this. There are probably better tutorials out there, but this gives you a good idea of how tricky it is. That said, there are constant rumours of push notifications coming to Alexa, so maybe you could just wait for that?