button-card icon indicating copy to clipboard operation
button-card copied to clipboard

[Help] Force update/refresh

Open Krojack opened this issue 3 years ago • 2 comments

So I'm using the HA Twitch integration for some streams. I have everything I want working fine with displaying the button-card except for one problem, the background-image. It pulls the URL from the ${entity.attributes.entity_picture} attribute but I need to refresh it every ~5 minutes. Twitch updates this image with a snapshot of the stream every so often.

I can't use the triggers_update because the entity doesn't update when the entity_picture attribute changes. It's a static URL. The Twitch entity only triggers an update when the streamer starts, stops, changes game name or changes stream title.

Is there some other way I can trigger the button-card to update the background image every 5 or so minutes? I was thinking maybe something like the following?

state_display: |
  [[[
    if (entity.state === 'streaming') {
      // some timer that triggers every 5 minutes.
    }
  ]]]

Krojack avatar Apr 29 '21 17:04 Krojack

Did you ever find a solution for this? Hitting a similar issue

kdkavanagh avatar Apr 22 '23 03:04 kdkavanagh

I did not. I ended up not using button-card and going another route.

My work-a-round was to add each streamers image to a generic camera entry. I just add the following URL as the still image.

https://static-cdn.jtvnw.net/previews-ttv/live_user_feliciaday-852x480.jpg

Going to that URL while the streamer is offline will redirect to a default grey image. So then I just use a conditional card to hide the picture-entity card when the streamer is offline.

Krojack avatar Apr 22 '23 14:04 Krojack