thomasloven / lovelace-auto-entities

🔹Automatically populate the entities-list of lovelace cards
MIT License
1.25k stars 113 forks source link

`auto-entities` inserts extraneous `entity` option into the destination card #234

Closed ildar170975 closed 2 years ago

ildar170975 commented 2 years ago

Let's create a stack of graph cards.

Here is one graph card w/o auto-entities:

type: custom:apexcharts-card
series:
  - entity: sensor.cleargrass_1_co2
graph_span: 1h

image

The code for the stack:

type: custom:auto-entities
card:
  type: vertical-stack
  title: auto-stack
unique: true
show_empty: true
card_param: cards
filter:
  include:
    - entity_id: sensor.cleargrass_1_*
      options:
        type: custom:apexcharts-card
        series:
          - entity: this.entity_id
        graph_span: 1h

The output: image

Seems that auto-entiites inserts an entity option into the destination card. Since apexcharts-card does not accept extraneous options - the error is shown.

The error is not shown when using with history-graph card since the history-graph accepts extraneous options: image

But the apexcharts-card gives an error: image

thomasloven commented 2 years ago

Yes. That's what auto-entities does. It "Automatically populate lovelace cards with entities matching certain criteria."

You can change this somewhat with card_param, but not to this extent. That would get much too messy.

ildar170975 commented 2 years ago

Yes. That's what auto-entities does. It "Automatically populate lovelace cards with entities matching certain criteria."

OK, but the card is supposed to fill the "entities" option of another card (which is a list), not "entity", am I right?

thomasloven commented 2 years ago

Sorry. I read too many issues yesterday.

What auto-entities does in your case is populate the cards: list, as expected. But just like if it was an entities: list it fills it with

- entity: sensor.xxx
  any_options: go here
- entity: sensor.yyy
  any_options: go here

I.m.o. erroring out on extra properties should be considered a bug in apexchart-card. Unused properties should just be ignored. Otherwise that would break the card with e.g. card-mod or even if something changes in Home Assistant, like the (relatively) recent addition of view_layout for cards...

ildar170975 commented 2 years ago

Thomas, I got your point, thank you!