SpotifyPlus Integration

@ryanhindinger
The restriction violated can occur for a number of reasons when using the player_media_play_context service:

  • playlist uri does not exist.
  • Playlist uri exists, but is private / not public.
  • If offset position is supplied, but exceeds the number of items in the playlist.

Can you post your script so we can see what it looks like?

Sure–most if it the nonsense required to get the Roku and the AV Amp all rowing in the same direction before any Spotify services get called, but here is the whole script:

alias: Play Spotify Weekday Mornings
sequence:
  - action: remote.send_command
    metadata: {}
    data:
      num_repeats: 1
      delay_secs: 0.4
      hold_secs: 0
      command: home
    target:
      entity_id: remote.living_room_roku_ultra
  - delay:
      hours: 0
      minutes: 0
      seconds: 15
      milliseconds: 0
  - action: remote.send_command
    metadata: {}
    data:
      num_repeats: 1
      delay_secs: 0.4
      hold_secs: 0
      command: home
    target:
      entity_id: remote.living_room_roku_ultra
  - delay:
      hours: 0
      minutes: 0
      seconds: 15
      milliseconds: 0
  - if:
      - condition: state
        entity_id: person.ryan_hindinger
        state: home
    then:
      - action: notify.mobile_app_ryans_iphone_13
        metadata: {}
        data:
          message: Starting the weekday morning music playlist in the living room.
          title: Music Assistant
  - if:
      - condition: state
        entity_id: media_player.tx_nr6100
        state: "off"
    then:
      - action: media_player.turn_on
        metadata: {}
        data: {}
        target:
          entity_id: media_player.tx_nr6100
  - delay:
      hours: 0
      minutes: 0
      seconds: 15
      milliseconds: 0
  - action: media_player.volume_set
    metadata: {}
    data:
      volume_level: 0.2
    target:
      entity_id: media_player.tx_nr6100
  - delay:
      hours: 0
      minutes: 0
      seconds: 5
      milliseconds: 0
  - alias: Select MLB
    action: input_select.select_option
    metadata: {}
    data:
      option: MLB
    target:
      entity_id: input_select.living_room_tv_source_select
  - action: input_select.select_option
    metadata: {}
    data:
      option: Spotify
    target:
      entity_id: input_select.living_room_tv_source_select
    alias: Select Spotify
  - delay:
      hours: 0
      minutes: 1
      seconds: 10
      milliseconds: 0
  - action: media_player.select_source
    metadata: {}
    data:
      source: Living Room Roku Ultra
    target:
      entity_id:
        - media_player.spotifyplus_ryanhindinger
  - choose:
      - conditions:
          - condition: state
            entity_id: person.liz_carlson
            state: home
        sequence:
          - alias: Play 'Weekday Mornings'
            action: media_player.play_media
            data:
              media:
                media_content_id: spotify:playlist:1GnjPfvJ54k4iwyu1sgh3k
                media_content_type: playlist
                metadata:
                  title: Weekday Mornings
                  thumbnail: >-
                    https://mosaic.scdn.co/640/ab67616d00001e0257df7ce0eac715cf70e519a7ab67616d00001e02dc30583ba717007b00cceb25ab67616d00001e02ec5ce98ef144aa3a59dd56b1ab67616d00001e02f72f1e38e9bd48f18a17ed9b
                  media_class: playlist
                  children_media_class: track
                  navigateIds:
                    - {}
                    - media_content_type: spotify_user_playlists
                      media_content_id: spotify_user_playlists
                    - media_content_type: playlist
                      media_content_id: spotify:playlist:1GnjPfvJ54k4iwyu1sgh3k
                  browse_entity_id: media_player.spotifyplus_ryanhindinger
            target:
              entity_id: media_player.spotifyplus_ryanhindinger
          - action: media_player.shuffle_set
            metadata: {}
            data:
              shuffle: true
            target:
              entity_id: media_player.spotifyplus_ryanhindinger
      - conditions:
          - condition: not
            conditions:
              - condition: state
                entity_id: person.liz_carlson
                state: home
        sequence:
          - alias: Play 'Christmas'
            action: media_player.play_media
            data:
              media:
                media_content_id: spotify:playlist:5XwhnWhx57ut9QRyw9kKTj
                media_content_type: playlist
                metadata:
                  title: Pop’n’Stuff
                  thumbnail: >-
                    https://mosaic.scdn.co/640/ab67616d00001e024121faee8df82c526cbab2beab67616d00001e0269d05d032251b59ae738096aab67616d00001e028863bc11d2aa12b54f5aeb36ab67616d00001e02b03e92f4e7dcd9db3a06c869
                  media_class: playlist
                  children_media_class: track
                  navigateIds:
                    - {}
                    - media_content_type: spotify_user_playlists
                      media_content_id: spotify_user_playlists
                    - media_content_type: playlist
                      media_content_id: spotify:playlist:5XwhnWhx57ut9QRyw9kKTj
                  browse_entity_id: media_player.spotifyplus_ryanhindinger
            target:
              entity_id: media_player.spotifyplus_ryanhindinger
          - action: media_player.shuffle_set
            metadata: {}
            data:
              shuffle: true
            target:
              entity_id: media_player.spotifyplus_ryanhindinger
  - repeat:
      count: 40
      sequence:
        - repeat:
            count: 2
            sequence:
              - action: media_player.volume_up
                metadata: {}
                data: {}
                target:
                  entity_id: media_player.tx_nr6100
        - delay:
            hours: 0
            minutes: 0
            seconds: 3
            milliseconds: 0
mode: single
icon: hass:play
description: ""

1 Like
Registratore: homeassistant.components.media_player
Fonte: helpers/entity_platform.py:1118
Integrazione: Lettore multimediale (documentazione, problemi)
Prima occorrenza: 6 gennaio 2026 03:01:15 (7947 occorrenze)
Ultimo accesso: 09:30:09

Updating spotifyplus media_player took longer than the scheduled update interval 0:00:01

Hi everyone,

I’m looking for some advice regarding the Spotify Plus integration. While I usually ignore minor errors as the integration seems to work fine most of the time, I’ve noticed a massive flood of warnings in my logs since yesterday.

The log says: Updating spotifyplus media_player took longer than the scheduled update interval 0:00:01

This has occurred over 7,000 times in a very short period. I realize the 1-second polling interval might be too aggressive for my setup or connection latency.

I have a couple of questions:

  1. Is there a recommended way to increase the update interval or mitigate this log spam?
  2. I noticed that these errors persist even when the account owner is not at home. Would it be better to “turn off” or disable the integration when the user is away to avoid unnecessary API calls? Or is there a more elegant way to handle this without losing functionality?

I’d appreciate any suggestions on how to optimize this and clean up my logs.

Thanks in advance!

1 Like

Hi Todd, I would like to complete an automation that I use when I am going out from home, that transfer the device connected to SpotifyPlus from my Hi-Fi to my iphone. Basically if I am listening to something, when I trigger this automation at the moment the music stop playing, now I would like to “prepare” the Iphone to be ready to resume, and when I jump in my car and the sensor.activity of my Iphone is updated to “automotive”, start to play the music (maybe with a bit of delay). Most of the time it happens that my phone is idle and the playback start on the previously connected device, or it doesn’t start at all. If I open the Spotify App it resume it or complete the music transfer.

Note that at the moment I start my car, my phone is still connected to my wifi.

If this is possible how should I do it correctly? Playback transfer doesn’t find my Iphone, possibly the Spotify app is idle and then not connected to Spotify server.

@Diegocampy
Check out the SpotifyPlus integration Log Filtering wiki topic.

These messages are generated by Home Assistant when the Spotify Web API servers are sluggish to respond.

1 Like

@Sofa_Surfer
The only way that could work is if the Spotify App is open / active on your iPhone at the time the transfer playback was issued. There is no way (that I know of) to open / activate the Spotify App on the iPhone via automation.

The iPhone only presents itself to the Spotify player device list when the Spotify App is open / active on the device. Your Hi-Fi device is different, in that the Spotify Connect Zeroconf server is always running when it’s powered on (or in standby mode).

You might check the HA Companion App docs to see if it’s possible to send a command via it’s message processing to open an app on the phone. If that could be done, then you could transfer playback to it. Or there might be a way through Apple Home Kit to do it? Just not sure on that one.

Hope it helps!

1 Like

@Sofa_Surfer
Regarding opening Spotify Mobile App via automation … I played around with the HA Companion App notify command, and this is the closest I could come to opening Spotify Mobile on my iPhone 16 Pro Max.

I tried a couple of different ways (see YAML below). Basically, you had to have your HA Companion App open / running in the background in order for it to work. You also had to manually confirm that the HA Companion App could open the Spotify App. Maybe not the perfect solution, but a starting point.

description: ""
mode: single
triggers: []
conditions: []
actions:
  - action: notify.mobile_app_todds_iphone_iosapp
    data:
      message: Tap to open Spotify
      title: Open Spotify?
      data:
        url: spotify://
  - action: notify.mobile_app_todds_iphone_iosapp
    data:
      title: Open Spotify?
      message: Tap to open Spotify Mobile App
      data:
        push:
          sound:
            name: default
            critical: 1
            volume: 1
        actions:
          - action: URI
            title: Open Spotify Mobile App
            uri: spotify://

1 Like

Thank you! I will play tonight with this start. I was also thinking to Iphone shortcuts and automations, but haven’t checked yet the possibilities.
I will let everyone know if I can do something useful!

1 Like

Thank you so much for your help! You are definitely one of the most active developers I’ve encountered, always providing clear and fast answers to everyone.

I really appreciate your patience, especially since I could have found this information myself in the documentation. Thank you for not ‘scolding’ me and for the incredible amount of time and effort you dedicate to this project. It is truly appreciated

1 Like

@ryanhindinger
I would recommend changing the play_media calls to use the SpotifyPlus player_media_play_context service instead. This would also get rid of the media_player.select_source and media_player.shuffle_set service calls as well, since those are options on the player_media_play_context call.

Example:

alias: Play Spotify Weekday Mornings
sequence:
  - choose:
      - conditions:
          - condition: state
            entity_id: person.liz_carlson
            state: home
        sequence:
          - alias: Play 'Weekday Mornings'
            action: spotifyplus.player_media_play_context
            data:
              entity_id: media_player.spotifyplus_ryanhindinger
              context_uri: spotify:playlist:1GnjPfvJ54k4iwyu1sgh3k
              device_id: "Living Room Roku Ultra"
              shuffle: true
      - conditions:
          - condition: not
            conditions:
              - condition: state
                entity_id: person.liz_carlson
                state: home
        sequence:
          - alias: Play 'Christmas'
            action: spotifyplus.player_media_play_context
            data:
              entity_id: media_player.spotifyplus_ryanhindinger
              context_uri: spotify:playlist:5XwhnWhx57ut9QRyw9kKTj
              device_id: "Living Room Roku Ultra"
              shuffle: true

The above replaces the following sequence steps. Note that I am not sure how the play_media utilizes the extra metadata values.

  - action: media_player.select_source
    metadata: {}
    data:
      source: Living Room Roku Ultra
    target:
      entity_id:
        - media_player.spotifyplus_ryanhindinger
  - choose:
      - conditions:
          - condition: state
            entity_id: person.liz_carlson
            state: home
        sequence:
          - alias: Play 'Weekday Mornings'
            action: media_player.play_media
            data:
              media:
                media_content_id: spotify:playlist:1GnjPfvJ54k4iwyu1sgh3k
                media_content_type: playlist
                metadata:
                  title: Weekday Mornings
                  thumbnail: >-
                    https://mosaic.scdn.co/640/ab67616d00001e0257df7ce0eac715cf70e519a7ab67616d00001e02dc30583ba717007b00cceb25ab67616d00001e02ec5ce98ef144aa3a59dd56b1ab67616d00001e02f72f1e38e9bd48f18a17ed9b
                  media_class: playlist
                  children_media_class: track
                  navigateIds:
                    - {}
                    - media_content_type: spotify_user_playlists
                      media_content_id: spotify_user_playlists
                    - media_content_type: playlist
                      media_content_id: spotify:playlist:1GnjPfvJ54k4iwyu1sgh3k
                  browse_entity_id: media_player.spotifyplus_ryanhindinger
            target:
              entity_id: media_player.spotifyplus_ryanhindinger
          - action: media_player.shuffle_set
            metadata: {}
            data:
              shuffle: true
            target:
              entity_id: media_player.spotifyplus_ryanhindinger
      - conditions:
          - condition: not
            conditions:
              - condition: state
                entity_id: person.liz_carlson
                state: home
        sequence:
          - alias: Play 'Christmas'
            action: media_player.play_media
            data:
              media:
                media_content_id: spotify:playlist:5XwhnWhx57ut9QRyw9kKTj
                media_content_type: playlist
                metadata:
                  title: Pop’n’Stuff
                  thumbnail: >-
                    https://mosaic.scdn.co/640/ab67616d00001e024121faee8df82c526cbab2beab67616d00001e0269d05d032251b59ae738096aab67616d00001e028863bc11d2aa12b54f5aeb36ab67616d00001e02b03e92f4e7dcd9db3a06c869
                  media_class: playlist
                  children_media_class: track
                  navigateIds:
                    - {}
                    - media_content_type: spotify_user_playlists
                      media_content_id: spotify_user_playlists
                    - media_content_type: playlist
                      media_content_id: spotify:playlist:5XwhnWhx57ut9QRyw9kKTj
                  browse_entity_id: media_player.spotifyplus_ryanhindinger
            target:
              entity_id: media_player.spotifyplus_ryanhindinger
          - action: media_player.shuffle_set
            metadata: {}
            data:
              shuffle: true
            target:
              entity_id: media_player.spotifyplus_ryanhindinger

Hi! First of all, thank you for the work you’ve put into SpotifyPlus. I really appreciate it, and I’m sharing this only as hopefully constructive feedback after setting it up.

I set this up yesterday because Spotcast had stopped working. It took me a while to get the tokens working properly for Chromecast players.

A couple of quick notes:
• macOS terminal commands: On Mac, the commands need to use python3 rather than python for things to run correctly. It might be worth calling that out explicitly in the docs where the terminal commands are shown.
• Service naming / documentation: I did eventually figure it out from the documentation, but the player_media_play_context service name could be clearer (or at least highlighted/explained a bit more) so it’s easier to understand what it’s for at a glance.
• Danish characters bug: I also filed a small GitHub bug regarding a token issue with Danish characters (æ/ø/å). In my case, it was resolved by changing my username so it didn’t include “ø”.

One more suggestion: it’s great that when configuring a Spotify user you can already select a default device from a dropdown that shows the (long) player ID in parentheses. It would be awesome if something similar were possible when choosing a device while building an automation, so you don’t have to spend time hunting down/copying IDs manually.

Anyway, thanks again for making this. I’m happy it’s working now, and I can use Spotify in Home Assistant again!

1 Like

@DIY-techie
Thank you for the feedback, much appreciated.

Work is already in progress on supporting unicode characters in the username credentials. I am just surprised that it took this long (over 2 years) for that to manifest itself. All of the Spotify Connect examples that I followed use the ‘ascii’ encoding, but after looking at the Spotify API docs UTF-8 is fully supported. That will be fixed in the next release.

Regarding the macOS terminal commands … I think the use of python versus python3 to execute a script depends on how you install (or configure the default) python environment, correct? No other users have reported issues with python, but then again I don’t know how many are macOS users. Did you also use python3 AuthTokenGenerator.py to execute the script? or just python AuthTokenGenerator.py? I can make a note of that in the wiki docs.

Regarding the Service naming / documentation … There are so many different endpoints in the Spotify Web API, so I had to come up with a naming standard that equates a service to the corresponding Web API endpoint. Since context play and track play are both part of the Spotify Web API \ Player \ Start a Users Playback endpoint, it was necessary to split them apart into 2 separate services. Unfortunately these names cannot be changed, as they have been in place for awhile now (over 2 years).

Regarding the device_id: argument, you can specify friendly device names there if you want to (insteadof device id). The only time you need to specify a device id is if the device in question supports both Spotify Connect ZeroConf and Google Cast protocol (e.g. Wiim devices, etc). In those cases, you will see duplicate device names (with different device ID’s) in the device list, so you have to refer to the device with it’s ID value (instead of name).

Unfortunately, the auto-fill of device names / id’s for the automation editor is not possible, as these values are resolved at run-time and are / could constantly change. Unlike entity-id’s, which are defined and know to HA internals.

Hope it helps!

1 Like

Thank you, Todd, for taking a look at this. I fonally got a chance this morning to attempt to swap out my scripting for the player_media_play_context action like you suggested, but now I am getting a different, immediate error that I am not able to glean much from:

@ryanhindinger
Can you post the updated (complete) script?

The ERROR_MISSING_ACTION denotes that the action parameter was missing on the Spotify Connect Zeroconf call. This usually denotes a problem with discovery of the device that is trying to be activated.

I will also need to see the output of the following service call to see what the discovery process found for the Living Room Roku Ultra device.

action: spotifyplus.get_spotify_connect_device
data:
  entity_id: media_player.spotifyplus_ryanhindinger
  device_value: Living Room Roku Ultra
  activate_device: true

Hey Todd, I think I can pin this new error on the Roku, but here is the new script:

alias: Play Spotify Weekday Mornings
sequence:
  - action: remote.send_command
    metadata: {}
    data:
      num_repeats: 1
      delay_secs: 0.4
      hold_secs: 0
      command: home
    target:
      entity_id: remote.living_room_roku_ultra
  - delay:
      hours: 0
      minutes: 0
      seconds: 15
      milliseconds: 0
  - action: remote.send_command
    metadata: {}
    data:
      num_repeats: 1
      delay_secs: 0.4
      hold_secs: 0
      command: home
    target:
      entity_id: remote.living_room_roku_ultra
  - delay:
      hours: 0
      minutes: 0
      seconds: 15
      milliseconds: 0
  - if:
      - condition: state
        entity_id: person.ryan_hindinger
        state: home
    then:
      - action: notify.mobile_app_ryans_iphone_13
        metadata: {}
        data:
          message: Starting the weekday morning music playlist in the living room.
          title: Music Assistant
  - if:
      - condition: state
        entity_id: media_player.tx_nr6100
        state: "off"
    then:
      - action: media_player.turn_on
        metadata: {}
        data: {}
        target:
          entity_id: media_player.tx_nr6100
  - delay:
      hours: 0
      minutes: 0
      seconds: 15
      milliseconds: 0
  - action: media_player.volume_set
    metadata: {}
    data:
      volume_level: 0.2
    target:
      entity_id: media_player.tx_nr6100
  - delay:
      hours: 0
      minutes: 0
      seconds: 5
      milliseconds: 0
  - alias: Select MLB
    action: input_select.select_option
    metadata: {}
    data:
      option: MLB
    target:
      entity_id: input_select.living_room_tv_source_select
  - action: input_select.select_option
    metadata: {}
    data:
      option: Spotify
    target:
      entity_id: input_select.living_room_tv_source_select
    alias: Select Spotify
  - delay:
      hours: 0
      minutes: 1
      seconds: 10
      milliseconds: 0
  - choose:
      - conditions:
          - condition: state
            entity_id: person.liz_carlson
            state: home
        sequence:
          - alias: Play 'Weekday Mornings'
            action: spotifyplus.player_media_play_context
            data:
              entity_id: media_player.spotifyplus_ryanhindinger
              context_uri: spotify:playlist:1GnjPfvJ54k4iwyu1sgh3k
              device_id: Living Room Roku Ultra
              shuffle: true
      - conditions:
          - condition: not
            conditions:
              - condition: state
                entity_id: person.liz_carlson
                state: home
        sequence:
          - alias: Play 'Christmas'
            action: spotifyplus.player_media_play_context
            data:
              entity_id: media_player.spotifyplus_ryanhindinger
              context_uri: spotify:playlist:5XwhnWhx57ut9QRyw9kKTj
              device_id: Living Room Roku Ultra
              shuffle: true
  - repeat:
      count: 40
      sequence:
        - repeat:
            count: 2
            sequence:
              - action: media_player.volume_up
                metadata: {}
                data: {}
                target:
                  entity_id: media_player.tx_nr6100
        - delay:
            hours: 0
            minutes: 0
            seconds: 3
            milliseconds: 0
mode: single
icon: hass:play
description: ""

And here is the response I get when I run the get_spotify_connect_device action on it as requested while the Roku is playing:

user_profile:
  country: US
  display_name: ryanxxx
  email: [email protected]
  id: ryanhindinger
  product: premium
  type: user
  uri: spotify:user:ryanhindinger
result:
  Id: d95ecc64-b6f3-5ec2-9911-048a7bc5a853
  Name: Living Room Roku Ultra
  Title: "\"Living Room Roku Ultra\" (d95ecc64-b6f3-5ec2-9911-048a7bc5a853)"
  IsActiveDevice: true
  IsChromeCast: false
  IsInDeviceList: true
  IsRestricted: false
  IsSonos: false
  WasReConnected: false
  DeviceIdActivated: null
  DeviceInfo:
    SpotifyError: 0
    Status: 101
    StatusString: OK
    ResponseSource: null
    InteractionIDs: []
    AccountReq: null
    ActiveUser: ""
    Aliases: []
    Availability: NOT-LOADED
    BrandDisplayName: roku
    ClientId: 4916bf2fd1c54ff2bace038314d21f39
    DeviceId: d95ecc64-b6f3-5ec2-9911-048a7bc5a853
    DeviceType: TV
    GroupStatus: NONE
    LibraryVersion: 3.203.233-g11721767
    ModelDisplayName: 4662rw
    ProductId: "2"
    PublicKey: SU5WQUxJRA==
    RemoteName: Living Room Roku Ultra
    ResolverVersion: "1"
    Scope: umbrella-tv
    SupportedCapabilities: "3"
    SupportedDrmMediaFormats:
      - Drm: 1
        Formats: 70
      - Drm: 2
        Formats: 70
    TokenType: default
    Version: 2.9.0
    VoiceSupport: null
    HasActiveUser: false
    HasAliases: false
    IsAvailable: false
    IsBrandSonos: false
  DiscoveryResult:
    Id: "\"d95ecc64-b6f3-5ec2-9911-048a7bc5a853\" (192.168.86.157:51823)"
    DeviceName: d95ecc64-b6f3-5ec2-9911-048a7bc5a853
    Domain: .local
    HostIpAddress: 192.168.86.xxx
    HostIpAddresses:
      - 192.168.86.xxx
    HostIpPort: 51823
    HostTTL: 120
    IsChromeCast: false
    IsDynamicDevice: false
    Key: d95ecc64-b6f3-5ec2-9911-048a7bc5a853._spotify-connect._tcp.local.
    Name: d95ecc64-b6f3-5ec2-9911-048a7bc5a853._spotify-connect._tcp.local.
    Priority: 0
    OtherTTL: 4500
    Server: YJ003H866477.local.
    ServerKey: yj003h866477.local.
    ServiceType: _spotify-connect._tcp.local.
    Weight: 0
    Description: Spotify Connect Zeroconf Device
    Properties:
      - Name: CPath
        Value: /zc
    SpotifyConnectCPath: /zc
    SpotifyConnectVersion: null
    ZeroconfApiEndpointAddUser: http://192.168.86.157:51823/zc?action=addUser&version=
    ZeroconfApiEndpointGetInformation: http://192.168.86.157:51823/zc?action=getInfo&version=
    ZeroconfApiEndpointResetUsers: http://192.168.86.157:51823/zc?action=resetUsers&version=
  ZeroconfResponseInfo:
    SpotifyError: null
    Status: null
    StatusString: null
    ResponseSource: null
    InteractionIDs: []

As soon as I send Roku back to its Home screen this action fails with an unknown error (according to HA anyway).

So when I run the full script it works because the full script put the Roku in the Spotify app. Without that, the player_media_play_context action fails.

1 Like

Thank you for the thorough response! That all makes sense.

Yes — python without the 3 is not a valid command on my system (“zsh: command not found: python”).

I’m not quite sure how to use friendly names here. With Spotcast, I could click target and select a speaker from a list (e.g., when using it in an automation or script) - similar to the media player play media service. In SpotifyPlus, I only see the Device ID field:

Since I can’t remember the entity names of my players (like media_player.nesthubb606), I copy the device ID from the dropdown in the configuration flow.

Also, it might be helpful if the text “Entity ID of the SpotifyPlus device that will make the request to the Spotify Web API.” was phrased more like the Spotify account/profile you want to use (i.e., which SpotifyPlus instance/account is making the Web API request). That description would have been clearer to me.

Thanks again. I am happy that it works - these are just suggestions.

1 Like

@ryanhindinger

I think I understand what’s going on … the Roku device does not advertise its presence to Spotify Connect Zeroconf unless the Spotify App is started on the Roku device. To confirm that, you could call the get_spotify_connect_device action with the Spotify App not active on the Roku device. With that said, just curious if the Spotify Mobile App (running on your phone) displays the “Living Room Roku Ultra” device entry without the Spotify App running on the Roku?

I don’t have a Roku to test with, so cannot confirm that.

Hey Todd–so I was curious and checked because I have like four Rokus in the house. All of them advertise themselves as available to the app, but none of them respond to the get_spotify_connect_device unless the app is active. So that’s an oddity.

1 Like

@DIY-techie
Regarding “friendly names”, these would be the names (not device ID’s) of the devices as they appear in the SpotifyPlus integration source list. These are actually Spotify Connect remote names (if you want to get technical). Do not confuse these device names (e.g. “Nest Audio 01”) with HA entity names (e.g. media_player.nest_audio_01) - they are not the same. The HA entity names could represent a device(s) for a manufacturer specific media player, but these are not used by the SpotifyPlus integration media player.

You can specify either the device name or the id to start play on the device.

# play context by device name:
service: spotifyplus.player_media_play_context
data:
  entity_id: media_player.spotifyplus_john_s
  context_uri: spotify:playlist:6M8n0Sp9895BXEE0MbGPde
  device_id: "Nest Audio 01"

# play context by device id:
service: spotifyplus.player_media_play_context
data:
  entity_id: media_player.spotifyplus_john_s
  context_uri: spotify:playlist:6M8n0Sp9895BXEE0MbGPde
  device_id: c90704879d4d6281c6f98d35fa3d069929bbbbd0

The SpotifyPlus integration source_list state attribute contains the available device names that you can specify for the device_id argument:

You can get a list of device id’s using the the SpotifyPlus get_spotify_connect_devices service, if you want to use a device id instead:

action: spotifyplus.get_spotify_connect_devices
data:
  entity_id: media_player.spotifyplus_todd_l
  refresh: true

I will update the service descriptions in a future release for the entity_id value. Something like Entity ID of the SpotifyPlus service account that will make the request to the Spotify Web API.

I’ve recently started getting some timeout errors. In my device list from the action spotifyplus.get_spotify_connect_devices, I have a home speaker group (see long paste below). When I try to connect to the speakers with spotifyplus.player_media_play_context or using the action spotifyplus.get_spotify_connect_device, I get a timeout error (even with the activate option set to true):

Error: Could not activate Spotify Cast application on Chromecast device "2bf3e489ca91766b277d3d288f35d8d4": Execution of wait timed out after 20.0 s.

Once I manually connect to the speakers through the spotify app, I’m then able to connect via spotifyplus. I thought setting the activate_device option to true would resolve this, but I’m not sure what else to try now.

user_profile:
  country: US
  display_name: Mexander
  email: [email protected]
  id: 9zl3zsevhs6lqk1wnhter6j4o
  product: premium
  type: user
  uri: spotify:user:9zl3zsevhs6lqk1wnhter6j4o
result:
  AgeLastRefreshed: 1006.60227394104
  DateLastRefreshed: 1768193005.846904
  ItemsCount: 6
  Items:
    - Id: 8ed23e57572077f6f5c112b63c0b6279
      Name: Bedroom speaker
      Title: "\"Bedroom speaker\" (8ed23e57572077f6f5c112b63c0b6279)"
      IsActiveDevice: false
      IsChromeCast: true
      IsInDeviceList: false
      IsRestricted: false
      IsSonos: false
      WasReConnected: false
      DeviceIdActivated: null
      DeviceInfo:
        SpotifyError: null
        Status: null
        StatusString: null
        ResponseSource: null
        InteractionIDs: []
        AccountReq: null
        ActiveUser: ""
        Aliases: []
        Availability: ""
        BrandDisplayName: Google Inc.
        ClientId: null
        DeviceId: 8ed23e57572077f6f5c112b63c0b6279
        DeviceType: CastAudio
        GroupStatus: null
        LibraryVersion: null
        ModelDisplayName: Google Home
        ProductId: null
        PublicKey: null
        RemoteName: Bedroom speaker
        ResolverVersion: null
        Scope: null
        SupportedCapabilities: null
        SupportedDrmMediaFormats: []
        TokenType: null
        Version: null
        VoiceSupport: null
        HasActiveUser: false
        HasAliases: false
        IsAvailable: true
        IsBrandSonos: false
      DiscoveryResult:
        Id: "\"Bedroom speaker\" (192.168.1.80:8009)"
        DeviceName: Bedroom speaker
        Domain: .local
        HostIpAddress: 192.168.1.80
        HostIpAddresses:
          - 192.168.1.80
        HostIpPort: 8009
        HostTTL: 120
        IsChromeCast: true
        IsDynamicDevice: false
        Key: d4dac7d8-5db0-e99a-d1e2-4242cc2858ea
        Name: Google-Home-d4dac7d85db0e99ad1e24242cc2858ea._googlecast._tcp.local.
        Priority: 0
        OtherTTL: 4500
        Server: Google-Home-d4dac7d85db0e99ad1e24242cc2858ea._googlecast._tcp.local.
        ServerKey: Google-Home-d4dac7d85db0e99ad1e24242cc2858ea._googlecast._tcp.local.
        ServiceType: _googlecast._tcp.local.
        Weight: 0
        Description: Chromecast Zeroconf Device
        Properties:
          - Name: CPath
            Value: /na
          - Name: VERSION
            Value: "1.0"
          - Name: cast_type
            Value: audio
        SpotifyConnectCPath: /na
        SpotifyConnectVersion: "1.0"
        ZeroconfApiEndpointAddUser: http://192.168.1.80:8009/na?action=addUser&version=1.0
        ZeroconfApiEndpointGetInformation: http://192.168.1.80:8009/na?action=getInfo&version=1.0
        ZeroconfApiEndpointResetUsers: http://192.168.1.80:8009/na?action=resetUsers&version=1.0
      ZeroconfResponseInfo:
        SpotifyError: null
        Status: null
        StatusString: null
        ResponseSource: null
        InteractionIDs: []
    - Id: 2bf3e489ca91766b277d3d288f35d8d4
      Name: Home speakers
      Title: "\"Home speakers\" (2bf3e489ca91766b277d3d288f35d8d4)"
      IsActiveDevice: false
      IsChromeCast: true
      IsInDeviceList: false
      IsRestricted: false
      IsSonos: false
      WasReConnected: false
      DeviceIdActivated: null
      DeviceInfo:
        SpotifyError: null
        Status: null
        StatusString: null
        ResponseSource: null
        InteractionIDs: []
        AccountReq: null
        ActiveUser: ""
        Aliases: []
        Availability: ""
        BrandDisplayName: Google Inc.
        ClientId: null
        DeviceId: 2bf3e489ca91766b277d3d288f35d8d4
        DeviceType: CastAudio
        GroupStatus: null
        LibraryVersion: null
        ModelDisplayName: Google Cast Group
        ProductId: null
        PublicKey: null
        RemoteName: Home speakers
        ResolverVersion: null
        Scope: null
        SupportedCapabilities: null
        SupportedDrmMediaFormats: []
        TokenType: null
        Version: null
        VoiceSupport: null
        HasActiveUser: false
        HasAliases: false
        IsAvailable: true
        IsBrandSonos: false
      DiscoveryResult:
        Id: "\"Home speakers\" (fe80::4607:bff:fe81:cf12:32108)"
        DeviceName: Home speakers
        Domain: .local
        HostIpAddress: fe80::4607:bff:fe81:cf12
        HostIpAddresses:
          - fe80::4607:bff:fe81:cf12
        HostIpPort: 32108
        HostTTL: 120
        IsChromeCast: true
        IsDynamicDevice: false
        Key: 70a9df57-513d-4dc8-a0f1-057b058a9b88
        Name: >-
          Google-Cast-Group-70A9DF57513D4DC8A0F1057B058A9B88-1._googlecast._tcp.local.
        Priority: 0
        OtherTTL: 4500
        Server: >-
          Google-Cast-Group-70A9DF57513D4DC8A0F1057B058A9B88-1._googlecast._tcp.local.
        ServerKey: >-
          Google-Cast-Group-70A9DF57513D4DC8A0F1057B058A9B88-1._googlecast._tcp.local.
        ServiceType: _googlecast._tcp.local.
        Weight: 0
        Description: Chromecast Zeroconf Device
        Properties:
          - Name: CPath
            Value: /na
          - Name: VERSION
            Value: "1.0"
          - Name: cast_type
            Value: group
        SpotifyConnectCPath: /na
        SpotifyConnectVersion: "1.0"
        ZeroconfApiEndpointAddUser: http://fe80::4607:bff:fe81:cf12:32108/na?action=addUser&version=1.0
        ZeroconfApiEndpointGetInformation: http://fe80::4607:bff:fe81:cf12:32108/na?action=getInfo&version=1.0
        ZeroconfApiEndpointResetUsers: http://fe80::4607:bff:fe81:cf12:32108/na?action=resetUsers&version=1.0
      ZeroconfResponseInfo:
        SpotifyError: null
        Status: null
        StatusString: null
        ResponseSource: null
        InteractionIDs: []
    - Id: b8581271559fd61aa994726df743285c
      Name: Kitchen speaker
      Title: "\"Kitchen speaker\" (b8581271559fd61aa994726df743285c)"
      IsActiveDevice: false
      IsChromeCast: true
      IsInDeviceList: false
      IsRestricted: false
      IsSonos: false
      WasReConnected: false
      DeviceIdActivated: null
      DeviceInfo:
        SpotifyError: null
        Status: null
        StatusString: null
        ResponseSource: null
        InteractionIDs: []
        AccountReq: null
        ActiveUser: ""
        Aliases: []
        Availability: ""
        BrandDisplayName: Google Inc.
        ClientId: null
        DeviceId: b8581271559fd61aa994726df743285c
        DeviceType: CastAudio
        GroupStatus: null
        LibraryVersion: null
        ModelDisplayName: Google Nest Mini
        ProductId: null
        PublicKey: null
        RemoteName: Kitchen speaker
        ResolverVersion: null
        Scope: null
        SupportedCapabilities: null
        SupportedDrmMediaFormats: []
        TokenType: null
        Version: null
        VoiceSupport: null
        HasActiveUser: false
        HasAliases: false
        IsAvailable: true
        IsBrandSonos: false
      DiscoveryResult:
        Id: "\"Kitchen speaker\" (192.168.1.82:8009)"
        DeviceName: Kitchen speaker
        Domain: .local
        HostIpAddress: 192.168.1.82
        HostIpAddresses:
          - 192.168.1.82
        HostIpPort: 8009
        HostTTL: 120
        IsChromeCast: true
        IsDynamicDevice: false
        Key: 8a350c1c-855f-2b51-a57b-ead952d33466
        Name: >-
          Google-Nest-Mini-8a350c1c855f2b51a57bead952d33466._googlecast._tcp.local.
        Priority: 0
        OtherTTL: 4500
        Server: >-
          Google-Nest-Mini-8a350c1c855f2b51a57bead952d33466._googlecast._tcp.local.
        ServerKey: >-
          Google-Nest-Mini-8a350c1c855f2b51a57bead952d33466._googlecast._tcp.local.
        ServiceType: _googlecast._tcp.local.
        Weight: 0
        Description: Chromecast Zeroconf Device
        Properties:
          - Name: CPath
            Value: /na
          - Name: VERSION
            Value: "1.0"
          - Name: cast_type
            Value: audio
        SpotifyConnectCPath: /na
        SpotifyConnectVersion: "1.0"
        ZeroconfApiEndpointAddUser: http://192.168.1.82:8009/na?action=addUser&version=1.0
        ZeroconfApiEndpointGetInformation: http://192.168.1.82:8009/na?action=getInfo&version=1.0
        ZeroconfApiEndpointResetUsers: http://192.168.1.82:8009/na?action=resetUsers&version=1.0
      ZeroconfResponseInfo:
        SpotifyError: null
        Status: null
        StatusString: null
        ResponseSource: null
        InteractionIDs: []

... other speakers cut out for brevity ...
1 Like