Media browser, Spotify, select output device?

I dont see why it should be discussed in separate thread
topic is media browser , spotify , select output device

Well,
I want the media browser, spotify and as output sonos :wink:

This truly is a pity, it wont work

And what about my first question? if i start playback on device 1 and then 2; will it stop 1?

Can you head me up in the right direction to get it to sonos from spotify?
In 0.116 theres a chromecast mediaplayer coming too but i think that falls off too

Agreed! I really think there is a big interest in this. My guess is that using Sonos together with Spotify is a a common setup. The current media browser is a great start, though!

Separate thread would probably be better for visibility, as this thread was primarily related to Google devices, and have already been marked as solved.

Your first question: It would transfer the playback to the selected device.

I only know of a workaround which involves adding Spotify playlists as favorites in the Sonos app, and then you should be able to start them from the Sonos integration.

I cant give you any more details as I actually got rid of my 2 Sonos devices because of this limitation. I want to have full control of everything from Home Assistant, so I bought 8x JBL Link Music devices instead. They support Spotify Connect, AirPlay 2 and of course Cast, so they work great with Home Assistant thanks to the custom Spotcast integration.

As far as I know full and direct control from Spotify to Sonos via Home Assistant is currently not possible due to limitations in the Spotify API. If you do some Googling, you will see this have been an ongoing issue for several years, so I wouldn’t hold my breath waiting for a solution…

Pity

Truly pit,
i want to browse spotify and then play on any device, including spotify
Shame this still cant be done in HA

this is my script.yaml

script:
spotify_start:
alias: ‘Spotify: Start Playback’
sequence:
- service: spotcast.start
data:
entity_id: “{% set selected_device = states(‘input_select.chromecast_audio’).lower()
\ %} {{ ‘media_player.home_mini_audio_cast’ }} \n”
force_playback: true
mode: single
icon: mdi:spotify

this is my automations.yaml

automation:

  • id: spotify_device_selected
    alias: ‘Spotify: Device Selected’
    description: ‘Starts music playing on the selected Chromecast Audio device’
    trigger:
    • platform: state
      entity_id: input_select.chromecast_audio
      condition: []
      action:
    • service: spotcast.start
      data:
      entity_id: >
      {% set selected_device = states(‘input_select.chromecast_audio’).lower() %}
      {{ ‘media_player.’ + selected_device + ‘_audio_cast’ }}
      force_playback: true
      mode: single

and this is my entity of google media_player.home_mini

What a need make to resolve this?and it works?

I used your config last night and this worked perfectly to start my idle ouputs and continue my music after some idle time, for only a day.
I just came home from work and Spotify won/t start, forcing the output again. i started the Spotify app to get things going again but changing the active speaker does nothing. my config looks ok, i think :slight_smile:
I

`spotify:
  client_id: !??
  client_secret: !??

spotcast:
  sp_dc: !??
  sp_key: !??

  
input_select:
  chromecast_audio:
    name: Chromecast Audio
    options:
      - "Keuken Hub"
      - "Slaapkamer"
      - "Woonkamer Hub"
      - "Versterker"
      - "Televisie"
    icon: mdi:cast-audio

automations.  yaml


- id: spotify_device_selected
  alias: 'Spotify: Device Selected'
  description: 'Starts music playing on the selected Chromecast Audio device'
  trigger:
  - platform: state
    entity_id: input_select.speakers
  condition: []
  action:
  - service: script.turn_on
    entity_id: script.spotify_start
  mode: single

scripts

spotify_start:
  alias: 'Spotify: afspelen'
  sequence:
    - service: spotcast.start
      data:
        device_name: "{{ states('input_select.speakers') }}"
        force_playback: true
  mode: single
  icon: mdi:spotify`

any ideas?

thx in advance

1 Like

What happens when you execute the script through developers tools?

Hey,

Thanks for the reply.

Didn’t check that yet, but as most know there was a major malfunction @spotify/chromecast the last 2 days. So I hope that was the problem :slight_smile:
I am home tonight and hope that it’ll work again. I keep you posted

1 Like

Unfortunately it doesn’t work. Via developer tools when I start the script. I get the error that HA cannot find the device with the name unknown.

I’ve set up those two pieces of code, but how do I display it in my Lovelace please?

Hello,

You must do a media control card like this :

type: media-control
entity: media_player.spotify_jbm

and an entity card like this :

type: entities
entities:
  - input_select.chromecast_audio

Hey there.

I have alexas as media output rather than google devices and I can select output for Spotify.

What I seem to be the only one interested in, is the option to only play on the device you talk to as sometimes I might not want to disturb people which are in other rooms at times.

Is there I way I can talk to Alexa and she starts a scripts (using hassio cloud) that plays eg my playlist on the device I talk to only?

Hello and thanks for this workaround.

Only need to know if is any other way right now to do this?

and how reliable is this?

Edit: ok i found this Spotify Card with basically all the stuff

Hi @jtnn60,

Thx for that, very cool!
One question: should the “Spotify: Start Playback” disappear if at least one device is active, please? Because, as you can see below, for me it’s always displayed. However on your screenshot it isn’t.

image

Late reply but do you still happen to have that radiostation input control? looking for something likewise, and same country so that would make my life a lot easier ^^

Change the input in config.yaml into.

‘’’
input_select:
select_speaker:
‘’’

Then it will work!

Can you post the yams for radiostations and playlists as well?

Thanks

Never really used it, so removed it from my setup. So, sorry, don’t have it anymore…