#"Dynamic" filter in auto-entities?

1 messages · Page 1 of 1 (latest)

opal bramble
#

I use the auto-entities card to only show entities with battery levels below 40% which work fine.

Now, I would like the 40% to be fetched from an input_number to make it a bit more dynamic. I thought it would be as simple as replacing 40 with "{{ states("input_number.lovelace_battery_level_min") | round(0)}}"

But I can't get it to work, so I'd appreciate some guidance.

Today:

type: custom:auto-entities
filter:
  include:
    - state: < 40 
      attributes:
        device_class: battery
        unit_of_measurement: "%"
sort:
  ignore_case: true
  method: state
  numeric: true
card:
  type: entities
show_empty: true
sour bolt
#

Looking at the auto entities list - I'm not 100% sure the state filter supports templates like that, normally they'd show an example and they only have static strings.
There is a template filter demonstrated template: "{{states.light | selectattr('state', '==', 'on') | map(attribute='entity_id') | list}}"
Which you could use to filter down all batteries to those with a value less than your input number

rose mantle
#

That's correct. Templates are actually very computationally expensive, and they'd have to run many many many times for each auto-entities card. So the only way to do this is a template filter.

dawn matrix