Spotcast - custom component to start playback on an idle chromecast device

It works too with Google Devices?

@cediqqu
Not for sure on that, as I do not own any Google devices.

You would just have to try it.

action: spotcast.start
data:
  limit: 20
  force_playback: false
  random_song: false
  repeat: "off"
  shuffle: false
  offset: 0
  ignore_fully_played: false
  entity_id: media_player.ruimte1
  uri: spotify:playlist:37i9dQZF1DWWn9pcJIAKFl?si=d64afee1ee1347c7
  country: BE
  start_volume: 40

gives me ā€œFailed to perform the action spotcast.start. Could not find spotify media player.ā€ What am I doing wrong ?

I will try :wink: thanks for your work!!

I am not sure if I am missing something. But I have a few buttons on my dashboard to start playing music on specific speakers or speaker groups (Chromecast).
Using this:

    tap_action:
      action: call-service
      service: spotcast.start
      data:
        entity_id: media_player.sovrum
        category: Chill
        country: SE
        random_song: true
        shuffle: true
        repeat: track
      target: {}

But for some reason it does not start playing, I can hear it connecting to the Chromecast audio device, but it is not sending a play command. So it does seem to send the correct playlist to the speaker but not playing it?

Spotcast Issue: One Google Home Device Stopped Working

Hey everyone, Iā€™m having a peculiar issue with Spotcast in Home Assistant and could use some community insights. Hereā€™s the situation:

The Problem

  • I have two Google Home devices, but suddenly one of them stopped working with Spotcast.
  • The non-working device still functions fine when controlled directly through the Spotify app.

Symptoms

  1. When trying to use Spotcast with the problematic device, I get: ā€œHomeAssistantError: Failed to get device id from Spotifyā€
  2. The device isnā€™t visible in Spotify API responses through Home Assistant, but it shows up in my Spotify app.
  3. If I start playback on the device via the Spotify app, it temporarily becomes visible in Spotify API, but using its ID in the service call after the speaker goes off it still results in a error.

What Iā€™ve Tried

  • Renewed my sp_dc and sp_key values and restarted HA
  • Tried various service call configurations (entity_id, device_name, device_id)

The Weird Part

The other Google Home device works perfectly fine with Spotcast with the same service call. Nothing changed in my setup when this issue started.

Has anyone encountered something similar or have ideas on what might be causing this? Any troubleshooting steps I might have missed?

Thanks in advance for any help!

Here is the Bug I opened: Only one Google Home device Stopped working Ā· Issue #459 Ā· fondberg/spotcast Ā· GitHub

I have set up Spotcast but I have an issue that the Spotify Integration does not display my Chromecast Devices only two standalone TV connections and Web Player (Chrome) .

I have looked in Spotify and there are two TV devices and a heading called ā€œGoogle Cast Devicesā€ that when I drill down on contain all of my devices in the Google Cast integration are present/

It just seems that these devices cannot be seen as they are at the second level not the primary level.

Any help in resolving would be appreciated.

UPDATE : Created and checked the [sensor.chromecast_devices] and the Chromecast devices are present, but reloading the Spotify / SpotifyPlus Integrations does not make the devices appear in the Source options of either integration.

OK, got the Spotify card working now with Spotcast and using that I can select a GoogleCast Device that then enables the device in Spotify / Spotcast integrations for a limited period of time.

Can anyone advise what that period of time is ? Also if there is anyway I can run a cycling Automation to keep the cast devices visible to the integration ? Itā€™s not a pretty solution but it could help in enabling the additional functionality in the SpotifyPlus integration.

does someone know how to completely remove spotcast settingsā€¦

I keep getting invalid client after Iā€™ve added integrationā€¦

INVALID_CLIENT: Invalid client

Iā€™m sure itā€™s because I used the sp_key instead of oauth client when I was doing the setupā€¦ Iā€™ve completely deleted the HACS integrationā€¦ and I even looked here: .storage/core.config_entries and there are no entries for itā€¦

Iā€™m playing with 5.0.0.0

Iā€™ve also tried to ovewrite the page with the correct client_idā€¦ and it works but the call back fails with 500 Internal Server Error - Server got itself in trouble and Iā€™m pretty sure itā€™s because the link proably is encoding the secret on the outgoing requestā€¦

anyways, would be lovely if someone knew how to reset the integration.

Are you having the 500 error when trying to go into configure?

As soon as I try to add the integration here, it goes straight to the websiteā€¦

https://accounts.spotify.com/authorize?

Wait a minute youā€™re the one doing the PRs! Cool! lol

oh ok, I though you might have stumble on one of my mistake with the option flow. If your issue is with the OAuth credentials, when you are in the ā€œDevices & Integrationā€ you can click on the 3 dots in the top right corner and select ā€œApplication Credentialsā€ you should be able to remove the saved credentials.

Also I just pushed build 4, I would suggest to install it before trying to reinstall. Thanks for trying out the beta.

There should be an entry for Spotcast that you can delete. If you need further help, please ask

Wait a minute youā€™re the one doing the PRs! Cool! lol

I was about to post a message about the beta release and saw your post, wasnā€™t about to left you hanging while I make my announcement

Hi Everyone,

I wanted to take the time to announce that I am releasing today the first build of Spotcast V5. I have been hard at work in the last 3 months doing a full rewrite of the Spotcast integration to modernise it and improve it as much as possible. This new version is bringing a lot of improvements in the way Spotcast works, while also bringing this integration to the modern Home Assistant with web interface configuration and ability to re-authenticate without reboot.

Iā€™m at a point where I wonā€™t be able to find improvements or bugs anymore and need the help of the community to stress test the heck out of it. So for any one interested, you can download the latest build in pre-release in HACS (at the moment of writing, we are at 5.0.0-b4.

Some of the improvements in the current version of the beta are:

  • a very significant improvement in start playback delay (from 15-2- to 1-2 seconds from personal experience)
  • Rewrite of the core system with its own OAuth manager
  • Separation of Spotcast functionalities is separate services
  • Rebuild of the websocket API
  • Creation of Spotify connect device media_players
  • Creation of Service Sensors
  • Creation of a configuration flow to enable configuring Spotcast from the UI
  • Creation of an option flow to permit modifying options without restarting Home Assistant
  • Creation of a reauth process for when credentials expires

Also in the backlog, we have a new logo to go with the release pending approval from the ha-brand repository.

If anyone is interested, please download the beta, try it, try to break it and send me feedback.

Hope everyone will enjoy this new step forwards for Spotcast.

5 Likes

Is the new beta of spotcast working only with premium users?

We talked about it in DM, but I want to make the information generally available to everyone. This is a regression bug. Iā€™ll be working on fixing this one after work. I also created a free account to also test for non premium features from now own to ensure I donā€™t integrate more bug like this one going forward

1 Like

Hi, Iā€™m trying the V5, Iā€™m not an expert user, but Iā€™m happy to try it. The thing I need most is the ability to see my google home and my chromecast to be able to send music directly from Home assistant.
from Github I see this function:
spotcast.transfer_playback
will this work to transfer music from a google home device to a google home group? I am looking for a solution to automate music from a device to the group because google home often does not do this function

Yes that will work. Chromecast groups are their own media_players in Home Assistant, simply select it as the target when using the transfer playback service

1 Like

thanks,
I tried from developer tools, actions to insert this:

action: spotcast.transfer_playback
data:
  media_player:
    entity_id: media_player.gruppo_cucina
  account: XXXXXXXXXXXXXXXXXX

but it doesnā€™t work
answer spotcast.transfer_playback Unknown error
I tried both specifying the account and not specifying it
I apologize for writing here, I donā€™t want to go too off topic, but I have no idea where to ask this

what version are you currently on? There was a bug in the transfer_playback service I fixed this morning. You need to make sure to be on 5.0.0-b5. If you still have the same error with this build, please open a ticket in the repo so I can track it.

1 Like