Spotify Media Player delay

Hello, everyone.

I installed the Spotify component on my HA in order to use the media controller on the front end UI. Everything works like a charm, and I’m able to play, pause and skip tracks; however, I am facing one issue. It seems to take HA 20-30 seconds after the song changes before HA updates the current song on the UI.

Does anyone know if it is possible to increase the HA to Spotify poll rate in order to decrease the time it takes for the UI element to update?

1 Like

Hi guys,

I was wondering the same thing as @Tophat17.
Did anyone found an issue ?
Thank you.

Regards,
Ripper2909

Unfortunately not. I’m still looking for an answer.

I made a custom integration that is the original but just changed the scan interval in the python code from 30 seconds to 1 second. I don’t know how stable it is long term. I also don’t know how Spotify would like that many requests that frequently and I assume if there’s a lot of requests it stops accepting them and could possibly not be compliant with their terms of service. I assume that’s why there’s lag in the regular integration.

Here’s the Integration

1 Like

I’ve been trying to fix this for the longest time (well, it wasn’t ever really a priority, but it was really annoying) and gave up trying to do it properly, so I ended up just making a node-red loop to update the entity every second if spotify is playing.

The loop is triggered by spotify going into “playing” state, and keeps running as long as spotify stays in that state, updating the spotify entity and checking the state once every second.

I can think of at least a dozen ways this can break, but it works for the time being, and most of my automations are hacked together and barely working so it doesn’t bother me.

2 Likes

OMG thank you sooo much for this idea !
I just did the same in an automation, if it could help anyone :slight_smile:

alias: '[OK] Spotify Refresher'
description: ''
trigger:
  - platform: state
    entity_id: media_player.spotify_ripper2909
condition: []
action:
  - repeat:
      while:
        - condition: state
          entity_id: media_player.spotify_ripper2909
          state: playing
      sequence:
        - delay:
            hours: 0
            minutes: 0
            seconds: 0
            milliseconds: 500
        - service: homeassistant.update_entity
          target:
            entity_id: media_player.spotify_ripper2909
        - delay:
            hours: 0
            minutes: 0
            seconds: 0
            milliseconds: 500
mode: single
3 Likes

Huh, didn’t think about using an automation. That’s cool though! I thought it was hard-coded in the integration!

Thanks, Ripper2909! Your code works flawlessly for keeping Spotify data current!