Templatable state_filter in entity-filter (or list of entities with templatable filter)

Hi all,
anyone knows if it is possible to use a template in a state_filter attribute of an entity-filter card ?
What I’m trying to do is to only display rooms which dew point temperature is “near” outside temperature so to prevent molding.
I’ve thought of using an entity-filter card in wihich I’d put such an entity-filter but it seems that attribute isn’t templatable.
Thanks in advance

Have you found a solution for this?

Supposedly https://github.com/gadgetchnnel/lovelace-card-templater will do it, but I can’t get it to do anything other than combine words, like the example does… kinda pointless.

It is not possible to use a Template in any of the standard HA Lovelace Dashboard Cards, with the exception of the “Markdown” Card.
This is because the Cards are typically rendered entirely client-side (using Javascript in the client/app’s web browser), and the HA Template renderer is only implemented in Python on the server. (In theory the HA Template renderer could be replicated on the client-side using jinja-js or something similar, but that hasn’t been implemented.)

The way lovelace-card-templater works is by having the client (Javascript) make calls to the server to render each Template on the server, then the client uses the results from the server to finish rendering the Card on the client. However, this is rather messy and inefficient, which is why it isn’t supported in other standard HA Cards.

An alternative option is to use config-template-card, which lets you use Javascript templates/code to dynamically configure other Cards (entirely on the client).

Simple example using config-card-template:

type: custom:config-template-card
entities:
  - sensor.outdoor_temp
card:
  type: entity-filter
  entities:
    - sensor.room_dew_point
  conditions:
    - condition: numeric_state
      above: "${+states['sensor.outdoor_temp'].state + 5}"
  show_empty: false

(The + before states is Javascript magic to convert the state from a string to a number. Depending on your use case, you may want to explicitly check for and handle ‘unknown’ or ‘unavailable’ states, and/or check for and handle number conversion errors using Javascript’s isNan(value).)

I think something like this should work in lovelace-card-templater, although I haven’t tested it (and this will require server calls to render the Template, unlike the above which requires no server calls):

type: custom:card-templater
entities:
  - sensor.outdoor_temp
card:
  type: entity-filter
  entities:
    - sensor.room_dew_point
  conditions:
    - condition: numeric_state
      above_template: "{{ (states('sensor.outdoor_temp') | float) + 5 }}"
  show_empty: false