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

Hi,

thanks for this great work, I love this integration!
When starting a podcast it plays the very last episode. Let’s say this is a daily podcast and that I didn’t listen the last 3 episodes, would it be possible to start playing from the latest not listened podcast?

Thank you!

Hi guys,

Amazing integration and it solved my problem when playing spotify in the entire house on my various chromecast devices. When my driveway cameras gets triggered they will stream the feed to some of my Nest Hubs, but when the stream ends, then my Spotify wouldn’t start the playback.

I just have one question though, have any of you some smart way of checking which devices are currently playing? My automation with “choices” gets quite long, if I need to make sure to have all the combinations of where Spotify is being casted to. I do only have one account, but a lot of speakers.

Would it be possible to “check” what media_players are currently playing using the “app_name” Spotify and then ensure it will start the playback afterwards? Any ideas?

Hi there - I was able to get spotcast working and can call the service to play something, but ONLY if I’m already playing spotify. I’m trying to play on my Roku, which is on, but if the spotify app isn’t active, then the service call spotcast.start fails because it can’t find the device. As soon as I turn on spotify manually on the Roku, the same service call works fine.

Is there a known issue with activating Roku devices that I should be aware of? Thanks!

Hi there!
Resuming Spotify by spotcast stopped working a few days ago in my installation.

Therefore I tried fix suggested by Gramatus (Cast device not launching properly, but works if timeout is ignored · Issue #365 · fondberg/spotcast · GitHub) - but it did not work for me :frowning:.

The errors are:

* Failed to get device id from Spotify
* No device with id "325aa8d34def661425395d3ddc117266" known by Spotify; Known devices: []

Spotify as such is working, but not resuming after interruption.
sp_key & sp_dc renewed

Does somebody experienced this error? Did you manage to solve it somehow?

Home Assistant 2022.12.7
Supervisor 2022.12.0
Frontend 20221213.1
Spotcast v3.6.30 + fix by Gramatus

2 Likes

Stopped working weeks ago. Will there be an update sometimes soon? I tried to manually fix it like some others here but it always ends in a broken integration which hinders me to restart my HA instance

3 Likes

Same here, no spotify anymore.

Get this in de log :

Is there a way to use a template to select the account in the service call?

      - name: Night Rider
        type: service
        id: spotcast.start
        data:
          device_name: Master Speaker
          account: {{ states('input_select.spotify_accounts') }}
          uri: spotify:playlist:37i9dQZF1DX6GJXiuZRisr
          random_song: true
          shuffle: true

when called produces this:

      - name: Night Rider
        type: service
        id: spotcast.start
        data:
          device_name: Master Speaker
          account:
            '[object Object]': null
          uri: spotify:playlist:37i9dQZF1DX6GJXiuZRisr
          random_song: true
          shuffle: true

I just installed a new Nest Hub.
The settings from other Nest speakers cannot be used on the Nest Hub for some reason.

I copied the same settings from my other nest spreaker and only changed the name (copied from developer tools and is correct)

Can someone confirm what is causing the issue?

Part of my config:


type: custom:mini-media-player
entity: media_player.nesthub7858
artwork: material
soundmode: icon
style: |
  .mmp__bg {
    opacity: 1 !important;
    background: url("/local/images/radio/music_background3.jpg") center center / cover !important;
  }
info: short
icon: mdi:music-circle-outline
hide:
  icon: true
shortcuts:
  columns: 4
  buttons:
    - name: XXXXX
      icon: mdi:spotify
      type: service
      id: spotcast.start
      data:
        entity_id: media_player.nesthub7858
        uri: spotify:playlist: XXXXXXXX

When I try to play this I get the following notification on my Home Assistant screen

Failed to call service spotcast.start. Could not find device with name NestHub7858

Error logs:

This error originated from a custom integration.

Logger: custom_components.spotcast.spotcast_controller
Source: custom_components/spotcast/spotcast_controller.py:234
Integration: Spotcast (documentation, issues)
First occurred: 9:21:09 PM (1 occurrences)
Last logged: 9:21:09 PM

Could not find device NestHub7858 from hass.data
Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/spotcast/spotcast_controller.py:88
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 9:21:09 PM (1 occurrences)
Last logged: 9:21:09 PM

[2604076264] Could not find device with name NestHub7858
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 200, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1755, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1798, in _execute_service
    await self._hass.async_add_executor_job(
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/spotcast/__init__.py", line 190, in start_casting
    spotify_device_id = spotcast_controller.get_spotify_device_id(
  File "/config/custom_components/spotcast/spotcast_controller.py", line 234, in get_spotify_device_id
    spotify_cast_device = SpotifyCastDevice(
  File "/config/custom_components/spotcast/spotcast_controller.py", line 62, in __init__
    self.castDevice = self.getChromecastDevice(device_name)
  File "/config/custom_components/spotcast/spotcast_controller.py", line 88, in getChromecastDevice
    raise HomeAssistantError(
homeassistant.exceptions.HomeAssistantError: Could not find device with name NestHub7858

Edit: got it working by switching to device_id. However this is different behaviour compared to other devices and doesn’t work after a while since the spotify_device_id will dissapear from Spotify after power-off the Hub

is there anyway to remember the place in the playlist? I paused the playlist that was playing and then came back to it a few hours after and it had lost the place and restarted at the start! I saw something earlier around notifications but not sure how that works?

Hello,

Is there any way to add a song to queue/play next?

This has been good for me

Hello and thanks for this amazing tool!

I’m working on an automation and would like to just resume the music, that I’ve been listening to on my phone, on my Nest minis, as soon as I get home. Any way to configure the service to just resume the currently played playlist instead of specifying an additional URI?

Thanks a lot! :slight_smile:

1 Like

The URI is optional, so just specify the entity_ID and set force_playback to true and it will resume the last thing played in Spotify.

This is all you need:

service: spotcast.start
data:
  force_playback: true
  entity_id: media_player.everywhere

And a huge thanks to @fondberg for creating this. It’s wonderful!

1 Like

Hi guys,

Just installed and configured spotcast, and when trying to use it I get some errors both when using the name and the device id.


Does anyone know what the problem could be?

Is it possible for the “choose player” button to be a tap once for list, and then scroll/select?

having to hold it down isn’t intuitive, and most people are tapping it once, only for it to select a player that is in that position on the list and start playing.

Hope that made sense.

is it possible to use homepod mini as media player?? …

currently i have 2 media players… one google chromecast connected to my TV & the second one is homepod.

when i try to select the output, it only shows chromecast. the homepod is not even seen in the list…

is it possible to use homepod mini as media player?? …

Maybe, but not with Spotcast.

Unless I missed it, Apple’s Homepod Mini doesn’t support Chromecast, which is why it’s not showing up in the list of Chromecast devices.

1 Like

Hi! I cannot get past the first step of activating Alexa with a silent track…any way you can send me the yaml of this first action? Maybe I’m typing the wrong track format…
Mine is like this:


service: media_player.play_media
data:
  media_content_type: playlist
  media_content_id: >-
    https://open.spotify.com/playlist/6Acq3ODPWuOuyWStlBrbPL?si=zID1_25ESFWAvNGlInEAPA&dd=1
target:
  entity_id: media_player.spotify_fd

If I run this action I get this error:

image

Ah no, as I wrote in the post before the one you replied to - I did that action as a routine in the Alexa app as a workaround. So no yaml.

However, I’m not using Spotcast anymore now.

I created an input_boolean toggle but I don’t know which routine to create in alexa in order to wake up the device and then send the Spotify commands…what kind of routine and how did you manage it?