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

Should be the issue. Didn’t want to update Hassio because I wouldn’t have the time to troubleshoot right now. Think I will upgrade this weekend, so I’ll let you know if that helps!

Thanks!

Just updated to 0.92.1, this fixes the problem! Great!

It takes about 6-8 seconds to actually play a song after executing the command. Is this normal (for now)?

Yeah I’m seeing the same currently on .92.1

After a reboot my google does appear ad playing on HA

It’s just the delay

It takes time because it needs to launch the app after discovering hr device

I don’t know python, but am happy to help in anyway I can.

1 Like

This binary sensor will detect if Spotify is playing on a specific Google Chromecast device. I use it for my automations that automatically toggle the amp when audio is playing. Reason for this template sensor is the media_player device shows as ‘off’ when the cast was started from Spotcast, even when the device is in fact playing.

binary_sensor:
  - platform: template
    sensors:
      stereo_spotcasting:
        friendly_name: "Stereo is playing Spotcast" 
        value_template: "{{ is_state_attr('media_player.spotify','source','Stereo') and is_state('media_player.spotify','playing') }}"

Of course replace ‘Stereo’ with your device name.

2 Likes

noob question but how do i use this:

cd /config/custom_components && git clone https://github.com/fondberg/spotcast.git

thanks!

@Mikomi instead of that you can just download the files and put them in /config/custom_components/spotcast/

Thanks!
Sensor.chromecast_devices detects them now. But they dont show up he source selection of my Spotify media player. Or does this only work with the custom playlist card?

@Mikomi this component and the spotify-card custom card doesn’t use the media_player spotify… yet… I am thinking of merging my components functionality somehow in media_player.spotify.

This components sensor just lists the chromecast devices in your network and media_player.spotify doesn’t make use of chromecast devices, only logged in started Spotify connect devices… phew… this isa little bit of a mess but hopefully this can be sorted out in the future

1 Like

Aha, this explains a lot. Thanks for the detailed information. So if im correct i need to craft custom “buttons” for my playlists or use the custom card, right?
Thanks for your work it was what I wanted for a while now.

Depends on your usecase is to start Spotify playback on idle chromecast devices then yes. If it is to start playing a playlist on an already launched Spotify connect device (which launching Spotify on a chromecast device does) then stick with media_player.spotify

I just tried out the custom spotify playlist card but I have no sources to choose from.
Do I need to configure something else? thanks!

edit: i made a button to play a specific playlist and i can’t tell you how much i love this!!
to bad speaker groups are not supported :frowning:

Speaker groups would be awesome. If someone knows how to debug that in pychromecast it would be great

My gut feeling tells me it’s either Spotify themselves that block casting to groups or spotipy that’s the culprit here. I made a simple librespot/icecast/liquidsoap docker container and casting the broadcast url to groups with pychromecast using blocking mode works. (latest github version).

1 Like

Maybe you are right but it would be interesting to trace the traffic when starting casting from chrome. I don’t have time now but if someone traces I can add the functionality in relevant libs (spotipy or pychromecast)

Hi @fondberg, first of all big thanks for this wonderful custom component, it works amazingly well in combination with the spotify-card :slight_smile:

Would it somehow be possible to create multiple instances with different Spotify accounts for each instance?
I created different lovelace spotify-cards for my family members, each with a different Spotify client-id.
However each card starts playing from my Spotify account if I select a (spotcast) source in the card.
Just wondering :slight_smile:

Thanks! It would be quite simple if we agree on a way to send some identifier in the call to the service. The components configuration would.of course also need to be changed to be able to take multiple account username/password pairs. Can you think of a way to add this without breaking backwards compatability?

Thanks! This is exactly the only thing that was still missing from my HA. My life is perfect now :ok_hand:.

1 Like

Just to clarify for others. Upgrading to 0.92 did solve the errors! Thanks!