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

It needs to be supported first in pychromecast I’m afraid and then it wouldn’t be that hard to implement in this

For everybody with issues please follow the issue on github: https://github.com/fondberg/spotcast/issues/34

I would, of course, choose the day after this component stops working to choose to install this component. :cold_sweat:

Niklas posted the following in the GitHub discussion of the new issue:

Oh no! If I am correct this means Spotify changed the way a browser token is retrieved. That is bad as this library uses the unofficial way to get a token because it is required for chromecast devices.
I will need to investigate this…

Just wanted to chime in that we appreciate your efforts and any updates on resolving the issue are very much appreciated.

Just released v2.3 which fixes the broken token error. Please test it out.
Thanks @AlexLadd and @bendikrb for your help!

2 Likes

should be fixed in the new release

Fixed in 2.3

1 Like

Thank you for the new Spotcast version (2.3). Works perfectly!

Version 2.3 runs (without any reconfiguring) perfectly!

This is really great. I was wondering if there was any way to repeat?

I have now released 2.4 which removes the quick fix for spotify token and adds it properly.

@jerobins I merged a PR today which adds repeat option

3 Likes

I’m have some trouble to install Spotcast. I installed it through HACS, latest release 2.4.
When I try to add this to my config.yaml the file seems to be corrupted and is not valid

spotcast:
  username: [email protected]
  password: mysecretspotifypassword

I even cannot find the spotcast service into the dev section.

I’m running Home Assistant 0.100.2

any suggestion ?

Awesome, thanks so much.

This component works perfectly, thank you!

Hello, today, I’ve installed this component. It’s something I’ve been looking for for a long time. At first, it worked!
But in the evening, when I wanted to experiment with some automations, it stopped working :frowning:. When I try to launch the script manually, I get this error: ‘NoneType’ object has no attribute ‘find’.

What is wrong? Also, I’m new to HA, so sorry if some information is missing. Code of the script bellow.

play_music_on_speakers:
  sequence:
    - alias: Spustit hudbu v obýváku
      service: spotcast.start
      data:
        device_name : "Speakers"

EDIT: I’ve just found out that if I start music on my phone (the liked songs “playlist”) and let it play, the scripts starts working and transfers the music from the phone to Chromecast. Is there any way of just transferring the stopped music to my Chromecast?

This works great and was something I was doing for casting other things before I found out that on SOME chromecast devices you can completely turn off the bleep blop sound. I was able to turn it off on 2 chromecast audio dongles but not my soundbar with chromecast audio built in, or my home minis. It’s a setting for the device in the google home app called playback sounds.

1 Like

Is it possible to use this component to play a random spotify playlist similiar to this

[edit] works fantastically

Hi,

I have just set up my first hassio. Its running at my synology nas.
what i’m trying to accomplish is to start a spotify playlist on either when i press a button or automatically on event. I have tried both on my bluesound, chromecast and google home.
But nothing happens. I managed to get custom: spotify-card to work but it drops all devices without hassio, web player (chrome) and local-computer.

The spotcast service is up running.

I use this script:
script:
  start_playlist_xmas:
    - service: spotcast.start
      data_template:
        device_name: google vardagsrum
        uri: spotify:user:spotify:playlist:4Mm14OcrRVHKp7U2zpDp4j
        media_content_type: playlist

Sat Nov 30 2019 08:50:06 GMT+0100 (Central European Standard Time)

Could not find device google vardagsrum from hass.data, falling back to pychromecast scan

Connection lost. Reconnecting…

Yes this is possible. It is undocumented right now. You just pass “random” as string as URI and spotcast will start playback of a random playlist

Device name is case sensitive.

Hi,
Thanks that helped me for alot of things. But now i got another error message. failed to call service script/start_playlist_xmas extra keys are not allowed @data[’ media_content_type’]