Need help with appending entity_picture url attribute to ha url

i only helped others with it, because i never used anything like that.
i know someone had a working situation, but dont know who anymore.
but i also think i remember i saw something about it being broken again.

the cashing is about the same url.
wasnt it that a counting nr at the end of the url did help there?

maybe create the same url twice for the pic, and let AD change between the 2?

Hey Rene. That’s an interesting idea. I’m guessing the iframe does a sort of round robin then with the urls and refresh set to 10 would switch urls every ten sec?

I found something that half works. I’m using the iPad kiosk pro app that aimc turned me on too when I was first getting my feet wet.

In the app settings there’s an option to clear all cache when returned to the homepage(first tab on my dashboard). Once I go back to that page and return the sonos page it’s refreshed. But I don’t like that. I have a lot of people over to play pool and I want to leave the sonos page open by the pool table to be able to look quickly and change quickly. With that solution I have to set a timeout value in the app that takes it back to the homepage. Setting the homepage as the sonos page is not a way I’d like to go. I’ll try out your suggestions and report back. Thanks again!

Alright!!! Got it finally!!! This so awesome!

I tried that multiple urls but didnt have any luck.

The solution was to use that camera component, camera widget, and a template for the url :slight_smile:

So in my configuration.yaml

camera:
  - platform: generic
    still_image_url: https://xxx.duckdns.org/api/media_player_proxy/media_player.bedroom?{{ states.media_player.bedroom.attributes.token }}'

Then take that url you get from that camera entity in HA and add &api_password=yourhapassword to the end of the url, then add it to your dash file:

bedroom_media_art:
    widget_type: camera
    entity_picture: https://_xxx_.duckdns.org/api/camera_proxy/camera.generic_camera?token=_reallylongstringofcharectors_&api_password=_yourhapassword_
    refresh: 10

Now without changing dashboards or any interaction at all with the dashboard when the song changes, the dashboard changes to the new artwork in a few seconds.

Perfect!!! Thanks for all the help @rene ! You left enough bread crumbs around this forum to piece it together :slight_smile:

1 Like

very nice solution!!
the first step, gettin back to the source, and take it from there, was the smart move.
thx for sharing, it will help me help others :wink:

1 Like

Thank you sir!

1 Like

OK, lets keep going :slight_smile:
When im watching TV and the sonos are not playing music, the image is just absent. Thats fine its transparant doesnt look like theres an error or anything like that. BUT…Id like to use an image for when nothing is playing, maybe a picture of me lol or a picture of my tv…something. Using widget style I see you have the option for some css stuff…
widget_style: "background: white;"
but could you set the background to an image? So if no artwork is available it would just display what is “behind” the artwork?

One thing about sonos is the control is sometimes a pain…but now this solves that, im loving it.

you could try something like:

widget_style: "background-image:url(anything)"

i think it should show when no pic is in front.

Unfortunately no go. It looks like the no image stays in front and never displays what’s behind it.

I wonder if I create some if statement to say if tv or if not playing display. I not sure I could do that with dashboard though…

Any ideas? I would like to do it in ha rather than appdaemon. I don’t understand appdaemon lol:frowning:

if it still shows the “no picture” you probably need conditional css.
so something in the css that says “if pic is empty then hide”
unfortunatly i dont know if and how that is possible without changing the javascript from the widgets.

Alright, I appreciate it. Gave me a place to start looking

1 Like

Not sure what I´m getting wrong here.
Put this i the configuration.yaml file:

camera:

… and this in the test.dash file:

media_player:
widget_type: camera
entity_picture: http://10.0.0.27/api/camera_proxy/camera.generic_camera?token=e972ad54463cb9b1463ad247111f599084351683da23ccb46034234609a659ed&api_password=MyPaAsS
refresh: 10

In the Homeassistant states page I get:
screenshot1

In the dashboard, the widget shows a broken image link.

Any advice?

If you take your camera url and paste it in a browser do you get the image?

If I put this part in, I get a 404 : Not found:

http://10.0.0.27:8123/api/media_player_proxy/media_player.spotify/

If I paste the url from the dash-file, I get a ERR_CONNECTION_REFUSED

http://10.0.0.27/api/camera_proxy/camera.generic_camera?token=e972ad54463cb9b1463ad247111f599084351683da23ccb46034234609a659ed&api_password=SECRETPASS

If I take the url form media_player.spotify and paste into the browser, the album art appers:

http://10.0.0.27:8123/api/media_player_proxy/media_player.spotify?token=8c76ca1e8bd2d2c68cb5c743eb687276f91cf35315b8422f549513db5864e4ee&cache=c0a97f062071cab9

… however not getting the artwork on the home assistant frontend or on the dashboard. Any ideas?

in HA you use

still_image_url: http://10.0.0.27:8123/api/media_player_proxy/media_player.spotify?{{ states.media_player.spotify.attributes.token }}’

and the state is probably only the token
so then it should be

still_image_url: http://10.0.0.27:8123/api/media_player_proxy/media_player.spotify?token={{ states.media_player.spotify.attributes.token }}’

in HA.

but i have no clue how to ket the changing token into the dashboard.

Same outcome I´m afraid, but thanks.

i think you should look in your home assistant logfiles why it isnt working.
and if there is nothing you should use debugging for home assistant. (setting loglevels different for cams.)
or search for spotify on the forum.

This works for the changing token.

  - platform: generic
    name: Bedroom Sonos
    still_image_url: 'https://xx.duckdns.org/api/media_player_proxy/media_player.bedroom?{{ states.media_player.bedroom.attributes.token }}'

its that token. @witno Try what I just posted in this link…hint hint nudge nudge @rene LOL

also make sure when you put that url together it doesnt add anything when you hit enter. I use a mac and chrome and everything i put those urls together it slides an unwelcomed /index on me. i forget. i get mad. i do it again anyway.

Let me know if this helps

1 Like

can you share your code of the media player dashboard?