Need help with appending entity_picture url attribute to ha url

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?

what are you looking for? how to get the picture? theres a lot of components on there

I just finished figuring out how to keep the pic updated based on what im doing. if im listening to music i get the entity pic of what im watching is displayed and if im watching tv the pic of what im watching is displayed. and the volume stays true no matter where the volume is changed. you want those two things? the buttons are scrtipts that call a playlist or station on my sonos

same for me

if possible all, so I will getthe bits and pieces I will use

no problem. ill post in a couple, im on a work call right now.

it’s working, only problem is when there is no picture (the media_player is off) … maybe possible to put a picture that nothing is playing?

Did you ever get to see that pic using the url? you need to solve that problem first

yes solved, it was nothing because the media_player was off. I wish that when the media_player has no picture that we could put in the dashboard a predefined picture (like nothing is playing)

Hats what I just finished. If plex is playing it takes that pic priority 1. Sonos priory’s 2 if it’s off it uses a standard image. I’m almost done

Ohh very cool.

BTW the token is not needed

Duh. Still not getting it working here. I can paste the
… entity_picture: /api/media_player_proxy/media_player.spotify?token=d3ca78b8d7310bb7ce82d3fb6eb9c536b6765eba25a5f2925ed2618c09da73ef&cache=3dcc718b563e0c4c

url in the browser and get album art, however the
http://10.0.0.27:8123//api/camera_proxy/camera.generic_camera?

is a 404

The full url with token:
http://10.0.0.27:8123/api/camera_proxy/camera.generic_camera?token=90390cb82a1c15fa8f3516a177340dd8774dd6b322744905b75cd6ded36cd30d

ERR_INVALID_RESPONSE

Ive found that the token is not needed sometimes. but thats not good, i dont want it to work sometimes. So I added the token. Here are a few things that should help: *I use sonos, but Im sure this should work with other media players too.

**Get currently playing info:**
- platform: template
  sensors:
    lr_playing:
      value_template: ' {{states.media_player.living_room.attributes.media_title}}<br />{{states.media_player.living_room.attributes.media_artist}} '

**get current volume level**
- platform: template
  sensors:
    living_room_vol:
      value_template: "{{ states.media_player.living_room.attributes.volume_level }}"
      friendly_name: Living Room Volume

**this is the old one. this just pulls the current pic of whats playing:**
- platform: template
  sensors:
    mediapic_bed:
      value_template: https://xxx.xxx.xxx/api/media_player_proxy/media_player.bedroom?{{ states.media_player.bedroom.attributes.token }}
      friendly_name: Bedroom Now Playing

**This is part of the code that I use to say what picture it needs.  * i still need to clean it up on my side**
- platform: template
  sensors:
    lrtest:
      value_template: >
        {% if is_state('media_player.plex_living_room', 'playing') %}
          Plex
        {% elif is_state('media_player.living_room', 'playing') %}
          Music
        {% endif %}

- platform: template
  sensors:
    lrtoomuch:
      friendly_name: "LR URL"
      value_template: >-
        {% if is_state('sensor.lrtest', 'Plex') %}
          https://xxx.xxx.xxx/api/media_player_proxy/media_player.plex_living_room?{{ states.media_player.plex_living_room.attributes.token }}
        {% elif is_state('sensor.lrtest', 'Music') %}
          https://xxx.xxx.xxx/api/media_player_proxy/media_player.living_room?{{ states.media_player.living_room.attributes.token }}
        {% endif %}

this is the camera for the entity pic:
  - platform: generic
    name: Living Room Playing
    still_image_url: "{{states('sensor.lrtoomuch')}}"

This changes the volume based on me moving the slider
- alias: Sonos Living Room Volume
  trigger:
    - platform: state
      entity_id: input_number.sonos_living_room_volume
  action:
    - service: media_player.volume_set
      data_template:
        entity_id: media_player.living_room
        volume_level: '{{ trigger.to_state.state }}'

This moves the slider if i change the volume elsewhere:

- alias: living room vol set input number
  trigger:
    platform: state
    entity_id: sensor.living_room_vol
  action:
    service: input_number.set_value
    data_template:
      entity_id: input_number.sonos_living_room_volume
      value: "{{ states.sensor.living_room_vol.state | float }}"

this is a script for playing a favorite:
oldrap:
  alias: "2k Rap"
  sequence:
    - service: media_player.sonos_join
      data:
        master: media_player.living_room
      entity_id:
        - media_player.basement
        - media_player.bedroom
        - media_player.living_room
    - service: media_player.volume_set
      data:
        entity_id:
          - media_player.basement
          - media_player.bedroom
          - media_player.living_room
        volume_level: "0.4"
    - service: media_player.select_source
      data_template:
        entity_id:
          - media_player.basement
          - media_player.bedroom
          - media_player.living_room
        source: '2K Hip-Hop'

**inputnumber**
sonos_living_room_volume:
  name: Living Room Volume
  initial: 0.3
  min: 0.0
  max: 1.0
  step: 0.1
1 Like