When I hard code the value of the attribute or the templated sensor (see link) the picture works
/api/media_player_proxy/media_player.living_room?token=1124256fa1cae8e1be0c476c2ce881aaf523ff4cfeaba2b1866759033a944f8b&cache=d05f973fec3e2c7b
When I hard code the value of the attribute or the templated sensor (see link) the picture works
/api/media_player_proxy/media_player.living_room?token=1124256fa1cae8e1be0c476c2ce881aaf523ff4cfeaba2b1866759033a944f8b&cache=d05f973fec3e2c7b
See picture when I hard code url
put the template in double quotes or use the multiline indicator >
and move the template to the next line.
This
turns into this after I save
still no image
Please reread this
I don’t mean to be dense but even tho I didn’t provide a picture I also used the multilane indicator and got the same result.
when you say put the template on double quotes, did I do that right?
what would be the notation when I use the multiline indicator?
Thanks a lot for the help
No this is what a template wrapped in double quotes would look like:
image: "{{ states('sensor.sonos_media') }}"
I provided it already
image: >
{{ states('sensor.sonos_media') }}
Double quotes result in this
Doesn’t work
(edit) Multiline turns into something else (sorry had an indentation issue before):
What doesn’t work about the first image?
In the multiline indicator, the template needs to be indented by 2 spaces from image, like my example.
Result for both is no image
instead of using that template to grab the state, just use the state_attr template in it instead, see if that works.
Ok I don’t know if this plays a role in the behavior im seeing, but all of this is wrapped in a fullscreen card add-on called home kit that makes rows and columns so I can organize mi view like so:
The code I use to prepare this Lovelace view is:
- title: Tiles
background: center / cover no-repeat fixed url("/local/bg2.jpg")
path: Tiles
panel: true
icon: 'hass:tablet'
style:
opacity: 50
badges: null
cards:
- type: 'custom:homekit-card'
title: tablet
style: |
:host {
font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}
useBrightness: false
useTemperature: false
tileHoldAnimation: true
titleColor: '#FFF'
enableColumns: true
statePositionTop: true
rows:
- row: 1
columns:
- column: 1
tileOnRow: 3
entities:
I have no idea, I don’t use that card. Does that card support images?
Does that card support templates for any field?
Yes, in that little circle it has an option called image that receives a url as string and displays it there
What im beginning to think is it doesn’t play well with gettin a variable instead of the string.
I would assume that the custom mini card doesn’t support templates as most lovelace does not support templates.
FYI, searched the Mini Media Player thread for “image:” and couldn’t find an example that employed a template. That thread contains over 2000 posts so there ought to be at least one if the option supported a template. I think the conclusion here is that it doesn’t.
Yeah, I just tried to do the attribute directly with
- type: 'custom:mini-media-player'
entity: media_player.living_room
name: Music
image: {{ state_attr('media_player.living_room', 'entity_picture') }}
speaker_group:
sync_volume: true
platform: sonos
show_group_count: true
expanded: false
entities:
- entity_id: media_player.Living_Room
name: Sonos Play
- entity_id: media_player.Living_Room_2
name: Sonos SL
and it doesn’t let me save, as if there is an issue with the code,
if I do multiline it doesn’t work either, it just quotes it out . so I guess it doesn’t do templates
Thanks for all the help, I hope this helps anyone that is pulling their hair out looking for the same solution
This is because you don’t have the template wrapped in quotes. It think’s it’s an object otherwise. Which is tripping you up. The editors in the UI do not validate your code, they only validate valid yaml. I.e. They don’t check if templates work, they don’t check if your data is correct. They just look at the shape of the yaml.
What helps is to review the custom card’s documentation, and its discussion thread, to learn how it works. This prevents making erroneous assumptions about how it works. The documentation for Mini Media Player doesn’t mention if any of its many options support templates and its associated discussion thread contains no examples of image:
with a template.
Like Petro said, most cards don’t support templates. The standard cards don’t and only a few custom cards do (and when they do it’s usually documented because it’s a special feature).
Hello,
First of all, your lovelace config looks great and I tried to find the homekit add-on card without success. Maybe you could direct me to where I could find it.
Secondly, did you manage to find a solution for the dynamic picture entity?
Thanks.