thomasloven / lovelace-auto-entities

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

Question: Is it possible to exclude depending of helper value? #354

Open ghost opened 1 year ago

ghost commented 1 year ago

I wish to exclude all entities with a value lower then a input_number helper. Is that possible?

ildar170975 commented 1 year ago

Possible only by using the "template" option.

mindgam3s commented 8 months ago

not really as you have to built the whole entity filter yourself then .. if there would be support for placeholders or jinja templating inside the 'filter: include: state: ' block this would be really awesome!

eg:

type: custom:auto-entities
show_empty: false
card:
  title: critical batteries
  type: entities
filter:
  include:
    - attributes:
        device_class: battery
      state: < {{ states(input_helper.battery_treshold_critical) }}
    - attributes:
        device_class: battery
      state: 'on'
  exclude: []
ildar170975 commented 8 months ago

not really as you have to built the whole entity filter yourself then ..

Again, check docs for the "template" option.

mindgam3s commented 5 months ago

again, you would have to built the whole entity filter yourself

or can you tell me how i can use jinja and filter out all entites that have a state set to X while also replacing state Y with value Z? I don't think so ...

and no rejectattr and map(attribute='state') don't work here as I won't have the whole entity afterwards anymore...

ildar170975 commented 5 months ago

Well, you do not want to use jinja and want the author to add more additional options. Suggest to ask in Community about using jinja.