iantrich / config-template-card

📝 Templatable Lovelace Configurations
MIT License
441 stars 56 forks source link

Can we template other attributes? #26

Closed glassbase closed 4 years ago

glassbase commented 4 years ago

Checklist:

Release with the issue: 1.1.2 Last working release (if known): n/a Browser and Operating System: Browsers: Windows - Chrome, HA iOS app OS: HA Docker

Description of problem: It appears that I can only template name and icon - is that all this card supports?

Can we template other attributes like entity_picture, etc. I was trying to template an entity_picture on my media_player cards for integrations that do not provide entity_pictures like Android TV / Fire TV.

See above

Javascript errors shown in the web inspector (if applicable): n/a

Additional information: card config i was playing around with:

type: 'custom:config-template-card'
variables:
  - states['media_player.bedroom_mibox'].attributes.app_name
entities:
  - media_player.bedroom_tv
card:
  app_name: ${'test app_name'}
  media_title: ${'test media_title'}
  entity: media_player.bedroom_tv
  state: ${'idle'}
  icon: ${'mdi:apple'}
  name: ${'test name'}
  source: ${'test source'}
  type: ${'custom:mini-media-player'}
  entity_picture: ${'/local/images/netflix.jpg'}
iantrich commented 4 years ago

I am so confused as to what you're trying to achieve here..

glassbase commented 4 years ago

Ok yes the config i posted makes no sense on my end goal, but what I was trying to show/test/prove is that the only fields that get overwritten in the card are icon and name.

Is your card supposed to allow templating any attribute?

Edit - my main goal was to template the entity_picture of a media_player, but as i was trying to get it to change the entity_picture and it was not working, i added into the config trying to replace other fields to see what was supported by your card and not.

glassbase commented 4 years ago
card:
  entity: media_player.bedroom_tv
  entity_picture: '${''/local/images/netflix.jpg''}'
  type: '${''custom:mini-media-player''}'
entities:
  - media_player.bedroom_tv
type: 'custom:config-template-card'
variables:
  - 'states[''media_player.bedroom_mibox''].attributes.app_name'
iantrich commented 4 years ago

Anything is templatable, your issue is that there is no option named entity_picture in the mini-media-player

kalkih commented 4 years ago

@glassbase you should template the background option.