Need help with appending entity_picture url attribute to ha url

if 2 people are using in same moment two media player?

each mediaplayer has its own sensors

1 Like

Just not sure what I’m missing here, but I get no camera image for the media player (even with a browser). In case it matters this is a google home media player playing Spotify music. I do get the image with this media_player link on a browser:

http://192.168.0.16:8123/api/media_player_proxy/media_player.home_group?token=236d5f9189ec9109161afd042913a7f1f89e32817139f7ebb3d6235188eeb63a

Here’s my config, any help appreciated!

Camera.yml

Dashboard.dash

media_picture:
widget_type: camera
entity_picture: http://192.168.0.16:8123/api/camera_proxy/camera.now_playing
refresh: 10

check your dashboard file. It should be the camera HA creates.

bedmediaart:
    widget_type: camera
    entity_picture: https://xxx.xxx.xxx/api/camera_proxy/camera.bedroom_sonos?token=32a99cf84de20f8eacc8024longerthanthis43c50d64ad&api_password=stayout12!
    refresh: 10

Ugh! Thank you! I didn’t realize the token was required on the camera url!

1 Like

why you use the above and not
entity_picture: https://xxx.xxx.xxx/api/media_player_proxy/media_player.bedroom_sonos

?

p.s. I tried with camera and was not working, so I tried media_player and is working

it doesnt refresh on the dashboard. when the song changes it doesnt grab the new pic

camera was not working for me, any hint on whyu?

this also in the url of the hadashboard?

Yea it will be in the attributes of that entity

I tried many times, I always get ERR_INVALID_RESPONSE in browser

https://xxx.duckdns.org/api/camera_proxy/camera.spotify?token=xxx10dbfe188762213bfa466238c195dde9?api_password=xxx

if you get a bad response in your browser when you try to reach home assistant through the “normal” API its mostly user error.
i dont think token is needed (but it could be in some cases and then it could be changing) depending on the cameratype.
you try to reach an outside address so there could be many reasons why you cant reach it.
but i think that the most common case when something cant be reached with HA API is that it is misconfigured in HA.
can you see the cam in the HA GUI?
can you find that specific cam in your entity list?
can you see the attributes from that cam?

When I put camera.spotify does not come (spotify/image not available)
Yes the camera.spotify is there as entity
Attributes?

If I use media_player_proxy/media_player.spotify it shows the picture

I copy paste the token from the entity id list in HA (camera.spotify) and add the api password (I tried also without token and or without password

{{ states.media_player.spotify.attributes.token }}

This is empty value

{{ states.camera.spotify.attributes.entity_picture }}

Is
/api/camera_proxy/camera.spotify?token=a2834500a94decc8c3b13e7cf9ed0c7e9e5c7826b065b44d8316bb162c489b7c

This site can’t be reached
The webpage at https://xxx.duckdns.org/api/camera_proxy/camera.spotify?token=a2834500a94decc8c3b13e7cf9ed0c7e9e5c7826b065b44d8316bb162c489b7c&api_password=xxx might be temporarily down or it may have moved permanently to a new web address.
ERR_INVALID_RESPONSE

so the camera isnt configured as above is mentioned because you need the attribute token.

That’s the full list

{
“access_token”: “b33666dc236654ce032f768eb53e5ba6d4f878df3596ae2ff58ec3ea75c319f4”,
“friendly_name”: “spotify”,
“entity_picture”: “/api/camera_proxy/camera.spotify?token=b33666dc236654ce032f768eb53e5ba6d4f878df3596ae2ff58ec3ea75c319f4”,
“custom_ui_state_card”: “state-card-custom-ui”
}

I tried this, same behavior

I am tired, I give up

#
 platform: generic
    still_image_url: https://2.duckdns.org/api/media_player_proxy/media_player.spotify?{{ states.media_player.spotify.attributes.access_token }}
    name: spotify

The below code is what I use. Maybe it will be of some help to you.

camera:
  - platform: generic
    name: Spotify Cover
    still_image_url: >
      {% if not is_state("media_player.spotify", "playing")%}
        https://xxxxxx.org/local/spotify_logo.png
      {% else %}
        https://xxxxxx.org{{ states.media_player.spotify.attributes.entity_picture }}
      {% endif %}

In my www/ folder I have a spotify_logo.png picture to use when nothing is playing on spotify.

3 Likes