#Bubble card + auto-entities template

1 messages · Page 1 of 1 (latest)

maiden leaf
#

This may be overkill but I really hate duplication and love things to be automatically generated. I've got a list of active google home alarms and timers stored in a sensor attribute and want to generate a dashboard for managing them. I've got something simple working like:

type: custom:auto-entities
card:
  type: entities
filter:
  template: |
    {{ state_attr('sensor.pending_alarms_timers', 'members') }}

However I want to ramp things up a notch. I see that auto entities supports more advanced templates. I'm trying to follow their example:

type: custom:auto-entities
card:
  type: entities
filter:
  template: |
    [{% for e in area_entities("bedroom") %}
      {'entity': '{{e}}',
       'name': 'Lamp at {{device_attr(e, "name").removesuffix("Light").removesuffix("Lights")}}',
      },
    {% endfor %}]

It works as a markdown card or mushroom entity but if I try and use bubble card as follows:

[{% for e in state_attr('sensor.pending_alarms_timers', 'members') %}
  {
    'type': 'custom:bubble-card',
    'card_type': 'button',
    'button_type: 'switch',
    'entity': '{{e}}',
  },
{% endfor %}]

It seems to explode the number of entities (see attached image) there should only be 2.

main karma
#

check in devtools > templates what the sensor actually returns

#

looks like your members attribute doesn't provide a proper list, but provides a string

maiden leaf
#

It also works perfectly with the mushroom card.

#

It's just bubble card that's having this issue.

main karma
#

What if you do it like this

{% set ns = namespace(cards=[]) %}
{% for e in state_attr('sensor.pending_alarms_timers', 'members') %}
  {% set ns.cards = ns.cards + [dict(
    type= 'custom:bubble-card',
    card_type= 'button',
    button_type= 'switch',
    entity= e
    )] %}
{% endfor %}
{{ ns.cards }}
maiden leaf
#

Interesting.

#

What's the difference between these? Why would this one work and not the previous?

#

Also why would mushroom work but not bubble?

#

Appreciate the help ❤️

main karma
#

Don't know, but glad to hear that it worked

maiden leaf
#

Fair enough.

#

I've tried a handful of cards so it might be a bubble specific issue.