question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Types of Card for Templates

See original GitHub issue

Is there a way to get templates to display a certain type of card for those that match the template? For example, I’m looking to make a card that has an input select at the top, and then a list of media players under it. After a LONG time of messing with it, I finally got it to at least display the entities I wanted, but now I’m trying to get them to display as the right type of cards. Is it possible to set the media players that the template spits out to be a different type of card than the rest similar to my second example below, but with templates?

card:
  show_header_toggle: false
  title: Volume Control
  type: entities
filter:
  include:
    - entity_id: input_select.alexa_wha_groups
  template: >
    {%if is_state('input_select.alexa_wha_groups','Master Bedroom')%}{% for
    entity_id in states.group.alexa_wha_master_bedroom.attributes.entity_id
    %}{{- entity_id }},{% endfor %}

    {%elif is_state('input_select.alexa_wha_groups','Downstairs')%}{% for
    entity_id in states.group.alexa_wha_downstairs.attributes.entity_id %}{{-
    entity_id }},{% endfor %}

    {%elif is_state('input_select.alexa_wha_groups','Upstairs')%}{% for
    entity_id in states.group.alexa_wha_upstairs.attributes.entity_id %}{{-
    entity_id }},{% endfor %}

    {%elif is_state('input_select.alexa_wha_groups','Everywhere')%}{% for
    entity_id in states.group.alexa_wha_everywhere.attributes.entity_id %}{{-
    entity_id }},{% endfor %}

    {%elif is_state('input_select.alexa_wha_groups','Everywhere but the Living
    Room')%}{% for entity_id in
    states.group.alexa_wha_everywhere_but_living_room.attributes.entity_id %}{{-
    entity_id }},{% endfor %}

    {%endif%}
show_empty: true
type: 'custom:auto-entities'
card:
  show_header_toggle: false
  title: Audio Players
  type: entities
filter:
  exclude:
    - state: standby
  include:
    - entity_id: media_player.spotify_media_player
      options:
        artwork: cover
        group: true
        hide:
          icon: true
          power: true
        info: short
        type: 'custom:mini-media-player'
    - group: group.audio_players
      options:
        artwork: cover
        group: true
        hide:
          icon: true
          power: true
          source: true
        info: short
        type: 'custom:mini-media-player'
show_empty: false
type: 'custom:auto-entities'

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
i00commented, Jan 24, 2020

Yep … I have this issue too … appears to be no way to set options for a template filter 😦

0reactions
Garulfcommented, Aug 10, 2021

Sorry I just cant get this to work.

I have a template that returns all Google Home Speakers:

{% set data = namespace(entities=[]) %} 
{% for entity in states['media_player'] | map(attribute='entity_id') %}
  {% if device_attr(entity, 'manufacturer') == 'Google Inc.' %}
    {% set data.entities = data.entities + [entity] %}
  {% endif %}
{% endfor %} 
{{ data.entities | join(", ") }}

and I’d like to display each entity in a type: grid as a custom:button-card.

Any help would be greatly appreciated.

Read more comments on GitHub >

github_iconTop Results From Across the Web

110 Different card styles and templates ideas - Pinterest
Apr 29, 2012 - Explore Linda Lafreniere's board "different card styles and templates", followed by 204 people on Pinterest. See more ideas about...
Read more >
Top 5 Card Template Design Categories For 2022
Here Is The Curated List Of Top 5 Card Template Design Categories For 2022 · 01. Greeting Card Template · 02. Note Card...
Read more >
Free printable card templates you can customize - Canva
Make your thoughtful and touching messages shine with Canva's free card templates that you can customize, print, and give to others on any...
Read more >
Plastic Card Templates - CARDSource
When creating a plastic gift card, membership, or one of many programs, you'll need to create a card. Here are plastic card templates...
Read more >
Playing Cards : Formatting & Templates - Print & Play
Standard Card Templates ; Standard Large, 3.5” x 5”, AI ; Standard Jumbo, 3.5” x 5.5”, AI ; Tarot, 2.75” x 4.75”, AI...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found