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

Just upgrade.

I did , i just dont understand what hes talking about

You’ll be fine.

1 Like

do upgrade

2 Likes

Ive updated the install but still not able to cast to my devices…

Sent u a PM with my codes

Really hope that u can help…

2 Likes

Thank you so much for fixing the Spotcast integration. It is one of my most used.

For those who are looking for a code sample on how to use, I posted one a while back here: Media browser, Spotify, select output device? - #4 by jtnn60

ive tried, update but it still dont works :frowning:

Anyone that can look on my code and tell me what im doing wrong :(. ?

As I wrote in the DM, you should start with verifying that a simple service start call works, if not then you need to check the logs for that error you get and post that here as a pastebin link

im getting this error:
Failed to cast media spotify:playlist:37i9dQZF1DX9Bom9R0tCgx. Please make sure the URL is: Reachable from the cast device and either a publicly resolvable hostname or an IP address

im simply trying with your guide first…

Running simple scrip like this:

  alias: Start summar rewind in office
  sequence:
    - service: spotcast.start
      data:
        spotify_device_id: "7195af83e3044e449c2adf786ed72d92"
        uri : "spotify:playlist:37i9dQZF1CAiFMqgF92dBd"
        random_song: true```

Start summar rewind in office: Error executing script. Error for call_service at pos 1: Could not get spotify token
#Pastebin log here
https://pastebin.com/uF6sLMPE

Choose player
no devices found

same problem…

how did you solve?

@fondberg help please :frowning:

Hiu Red Bull

1 - You must get client_id and client_secret on https://developer.spotify.com/
2 -Config Yaml
spotify:
client_id: !secret spotify_client_id
client_secret: !secret spotify_client_secret
3 - Instal Spotify in Integration
4 - Install Spotcast in HACS (V 3.5.2)
5 - Config Yaml
spotcast:
sp_dc: !secret sp_dc
sp_key: !secret sp_key
accounts:
dan:
sp_dc: !secret dan_sp_dc
sp_key: !secret dan_sp_key
eythan:
sp_dc: !secret eythan_sp_dc
sp_key: !secret eythan_sp_key

Hi.

i did all that: but im getting: Failed to cast media spotify:playlist:7FvCHKzqYNtNCNdZ83bFYm. Please make sure the URL is: Reachable from the cast device and either a publicly resolvable hostname or an IP address

yes… my config is this

media_player:
###########################################################

Media Player Spotify

###########################################################

  • platform: spotify
    client_id: !secret spotify_CLIENT_ID
    client_secret: !secret spotify_CLIENT_SECRET
    aliases:
    abc123def456: ‘Living Room’
    9183abas000: ‘Bed Room’

spotcast:
sp_dc: !secret sp_dc
sp_key: !secret sp_key

I solved it by going:

Enter the Edit Settings dialog of your newly-created application and add a Redirect URI:

https://<your_home_assistant_url_or_local_ip>:<port>/auth/external/callback

instead of
https://<your_home_assistant_url_or_local_ip>:<port>//api/spotify`

Thanks

I’ve just created an issue as 3.5.4 is throwing me errors “Failed to get device id from Spotify” when trying to use a 2nd account - using the primary account everything works fine.

If anyone else sees this error, you can track it here.

I’ve also created an issue for last update.

Before this I just needed entity_id and uri to call the service from dev tools.

Now I need also force_playback, random_song, repeat and offset.

Yeah, I see. I guess this is unintended as all values are optional. The fix is easy (and created a PR for it already).

To apply the fix manually yourself:

  • open /custom_components/spotcast/services.yaml
  • look for any instances of required: true and replace by required: false
  • save and restart HA
1 Like

so the issue only occurs in dev tools?

1 Like

Yes. services.yaml describes how services can be called through the UI, but the actual spotcast service is described in the python code.

1 Like