thomasloven / lovelace-auto-entities

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

No card type configured #374

Open anthurta opened 11 months ago

anthurta commented 11 months ago

Hello,

I am trying to use auto-entities with no success so far. If I try this, it works perfectly: type: custom:auto-entities card: type: custom:layout-card layout_type: custom:grid-layout layout: grid-template-columns: repeat(auto-fit,minmax(clamp(100%/(3 + 1) + 0.1%, 100px,100%),1fr)) grid-template-rows: repeat(auto-fit,1fr) align-items: stretch margin: 0 padding: 0 grid-gap: 0.5rem width: 100% height: 100% card_param: cards filter: include: - area: cocina domain: /switch|sensor/ options: type: custom:button-card color: auto-no-temperature entity_id: this.entity_id template: nspanel show_state: false sort: method: friendly_name numeric: false reverse: false ignore_case: true card_mod: style: | :root{ height:100%; } ha-card{ height:480px; width:480px; }

But if I try using specific entities, it does not work:

type: custom:auto-entities card: type: custom:layout-card layout_type: custom:grid-layout layout: grid-template-columns: repeat(auto-fit,minmax(clamp(100%/(3 + 1) + 0.1%, 100px,100%),1fr)) grid-template-rows: repeat(auto-fit,1fr) align-items: stretch margin: 0 padding: 0 grid-gap: 0.5rem width: 100% height: 100% card_param: cards entities: - switch.luces_cocina_frigorifico sort: method: friendly_name numeric: false reverse: false ignore_case: true card_mod: style: | :root{ height:100%; } ha-card{ height:480px; width:480px; }

The message is: No card type configured

I am assuming it should be a very simple thing, but I have been looking at these for two days and no luck!

Thanks

ildar170975 commented 11 months ago

You mixed here 3 more custom plugins. Suggest to minimize to a standard Entities card to test with.

anthurta commented 11 months ago

Thanks for your comment. The challenge is still there:

type: custom:auto-entities card: type: grid card_param: cards entities: - switch.luces_cocina_frigorifico sort: method: friendly_name numeric: false reverse: false ignore_case: true card_mod: style: | :root{ height:100%; } ha-card{ height:480px; width:480px; }

And the result is still No card type configured

Thanks

ildar170975 commented 11 months ago

Please re-read my post. Your code with card-mod, a Grid and with UNDEFINED inserted card is not what I suggested.

anthurta commented 11 months ago

Not sure if I get what you are suggesting then. Adding something like this, works:

type: entities entities: - switch.luces_cocina_frontal

And something like this, works as well:

type: custom:auto-entities card: type: entities entities: - switch.luces_cocina_frontal - switch.luces_cocina_frigorifico

So then, adding some more functionality, it does work as well:

type: custom:auto-entities card: type: custom:layout-card color: auto-no-temperature layout_type: custom:grid-layout layout: grid-template-columns: repeat(auto-fit,minmax(clamp(100%/(3 + 1) + 0.1%, 100px,100%),1fr)) grid-template-rows: repeat(auto-fit,1fr) align-items: stretch margin: 0 padding: 0 grid-gap: 0.5rem width: 100% height: 100% entities: - switch.luces_techo_despacho - switch.luces_cocina_frigorifico - switch.luces_cocina_mesa sort: method: friendly_name numeric: false reverse: false ignore_case: true

Now, if I add the card_param: cards, stop to work:

type: custom:auto-entities card: type: custom:layout-card color: auto-no-temperature layout_type: custom:grid-layout layout: grid-template-columns: repeat(auto-fit,minmax(clamp(100%/(3 + 1) + 0.1%, 100px,100%),1fr)) grid-template-rows: repeat(auto-fit,1fr) align-items: stretch margin: 0 padding: 0 grid-gap: 0.5rem width: 100% height: 100% card_param: cards entities: - switch.luces_techo_despacho - switch.luces_cocina_frigorifico - switch.luces_cocina_mesa sort: method: friendly_name numeric: false reverse: false ignore_case: true

So that seems to be problem. The point is that if instead of using entities, I use the filter, everything works right. I think I don't understand the way this works. Any help?

ildar170975 commented 11 months ago

I suggested you to simplify your case. You seem to be not understanding how this card works. Here is the shortest case from this Repo:

type: custom:auto-entities
card:
  type: entities
filter:
  include:
    - domain: binary_sensor
      attributes:
        device_class: motion

Here the Entities card (type: entities) is filled by conventional entity rows; entities are defined by "include" filter.

Another case from this Repo:

type: custom:auto-entities
card:
  type: grid
card_param: cards
filter:
  include:
    - domain: sensor
      options:
        type: entity

Here the Grid card (type: grid) is filled with cards (card_param: cards) - and these cards are Entity cards (type: entity).

In your NOT REALLY SIMPLIFIED case there is also a Grid card, here is a simplified version of your code:

type: custom:auto-entities
card: 
 type: grid
card_param: cards
entities:
  - switch.luces_cocina_frigorifico

Here the Grid card is filled with cards - but it is not specified which cards to use!

It does not matter which way of defining entities you use - ether by defining a filter or by defining exact entities (entities). But the 2st way allows you to define options - where you may define a type of each entry.

So, you case should be rewritten like:

type: custom:auto-entities
card:
  type: custom:layout-card
  ...
card_param: cards
filter:
  include:
    - area: ...
      options:
        type: custom:button-card
        ...

or

type: custom:auto-entities
card:
  type: custom:layout-card
  ...
card_param: cards
filter:
  include:
    - entity_id: MY_FIXED_ENTITY_ID
      options:
        type: custom:button-card
        ...

These questions should be asked in the dedicated Community thread, GitHub should be used for reporting bugs and proposing FRs.