Idea/Help: Solving Spotify device discovery with Google Assistant SDK?

Context

Issue

One of the biggest problems with Spotify and casting to devices on Hassio (and other places) is that in order to cast or control a cast device, the cast session needs to have happened before (1, 2, 3, 4, 5, etc). In other words, it is not possible to select the Source of Spotify to Chromecast, if the device was not very recently used.

Consequences

As a result, it is impossible to have scripts or Automation rules that changes the source. For example, I want that when you get home, the music that I am listening on Spotify automatically casts to Chromecast Audio. This would fail as the device would not be recognized (even when added manually) by the Spotify API. First, you would need to go the mobile app or web, cast to the device, then you wold be able to do it.

Potential Solution

A way to do it is via Google Assistant, which allows to say “play music” (or “play X song”). I was thinking whether we could leverage Google Assistant to make the first cast (make the device available), then once controllable, you can change Spotify playlist.

Example

Play current Spotify playlist (in your phone) into Chromecast Audio would be something like:

  1. Get information of what’s playing on Spotify
  2. Make a call to Google Assistant to say “play music”
  3. When music is playing, control the device to cast what was being played before.

Questions

Would the Google Assistant SDK addon somehow allow to send a command (not by voice but) via an automation, script or service call?

1 Like