Skip to content

allow card_param to be a path #480

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mrnerdhair
Copy link

This parses card_param as a path to a property rather than the name of a property which must be on an immediate child. This is useful if you'd like to use a wrapper card rather than a card which shows entities directly.

@ildar170975
Copy link

@mrnerdhair
Could you post an example where this feature can be used?
I guess you mean this case:

type: some_card
...
some_option:
  ...
  option_to_be_populated:
    - ...
    - ...
...

and then you can use

card_param: some_option.option_to_be_populated

But I do not recall a card with such structure.

@mrnerdhair
Copy link
Author

I was trying to do something along the lines of this, where card.entities was the correct path:

type: custom:mod-card
card:
  type: vertical-stack
  entities: []
card_mod:
  style: |
    ha-card {
      // ...
    }

@ildar170975
Copy link

ildar170975 commented Dec 6, 2024

Well, mod-card could be a good example - but:
mod-card is needed for cards w/o ha-card - and vertical-stack is a good example, but it does not have an entities option. Perhaps you should have meant a cards option:

type: custom:auto-entities
card_param: card.cards
card:
  type: custom:mod-card
  card:
    type: vertical-stack
  card_mod: ...
filter:
  include:
    - domain: person
      options:
        type: entity

Do you know any other possible applications apart of mod-card?

@MaxMyzer
Copy link

MaxMyzer commented Apr 9, 2025

It would also be nice if auto-entities allowed populating individual cards instead of a combined card (ie, behave like a vertical stack, horizontal stack, grid, or similar custom card such as Mushroom card: chips), but that is a little different.

Sorry, this might seem a little off-topic, but all the examples I found ended up falling into that category.

@ildar170975
Copy link

It would also be nice if auto-entities allowed populating individual cards instead of a combined card (ie, behave like a vertical stack, horizontal stack, grid

If you mean “I wish AE to populate cards in stacks/grid” - this is already possible.

@MaxMyzer
Copy link

MaxMyzer commented Apr 9, 2025

If you mean “I wish AE to populate cards in stacks/grid” - this is already possible.

If I have something like this:

type: horizontal-stack
cards:
  - type: entity
    entity: sensor.entity
  - type: entity
    entity: sensor.entity2

I can't use AE, because it can't put entities under cards, and it can't put each entity under a new entry. The desired result would look like this:

type: custom:auto-entities
filter: # filtering
card:
  type: horizontal-stack
  cards:
    - type: entity
      entity: populate[0]
    - type: entity
      entity: populate[1]

Which can't be done - at least as far as I can tell based on the documentation.

@ildar170975
Copy link

In your scenario, you need to populate a list of objects inside a list of objects. Not sure if this can be achieved if card_param is a “path”((

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants