Input_text empty, conditional display, no syntax to show empty?

I have an entity defined to hold a date, or to be empty. I want to display it in lovelace only when not empty. I cannot find a working syntax for the conditional card (or entity filter) that works.

Entity definition (the long date pattern is just a validity check):

input_text:
  ac_override_until:
    pattern: '(^$|^\d\d\d\d-(0?[1-9]|1[0-2])-(0?[1-9]|[12][0-9]|3[01]) (00|[0-9]|1[0-9]|2[0-3]):([0-9]|[0-5][0-9])$)'
    name: "Hold Until"

I’ve tried a variety of lovelace entries like:

            - type: conditional
              conditions: 
              - entity: input_text.ac_override_until
                state_not: X
              card:
                type: entities
                entities: 
                - input_text.ac_override_until

Leaving the “X” missing or with two quotes (i.e. empty string) give a syntax error in lovelace as “misconfigured”. Putting “null” (without quotes) is accepted but appears to mean the string not the missing value. I cannot use the “state” as opposed to “state_not” because the string can hold any date value.

Just not possible? Or is there a syntax I am missing.

I’m avoiding some calculated value as it seems kludgy but that appears to be the only thing I can think of.

I might be wrong, but i think the conditional and also the state-switch need a defined state.
What comes to my mind at the moment is a template binary sensor that counts the characters of the input_text

binary_sensor:
  - platform: template
    sensors:
      ac_override_until_is_empty:
        value_template: "{{ states('input_text.ac_override_until') | length == 0 }}"

for the conditional entity.

EDIT: Sorry, forgot the auto_entities, maybe this card will do it.

Thanks, @VDRainer, I did something similar but actually just checked against blank in an if/else, but was hoping not to create yet another derivative sensor – I have a bunch of those now for other reasons, it always feels like a kludge.

I’ll check auto_entities tomorrow (out now), the error I’m getting in conditional looks perhaps implementation specific, so a different filter implementation may make it work.

What shows when the input_text is empty on lovelace is “(Empty text)”, but what shows on the states page is an empty box. It does not show “undefined”, which you can generate with a bad template for example. So I’m assuming what it has is “defined” but empty in some fashion; not sure how represented internally, my guess is a null? Or maybe an empty string. Will experiment further later today.

I tried it with the auto-entities card and it works.

type: 'custom:auto-entities'
show_empty: false
card:
  type: entities
filter:
  include:
    - domain: input_text
  exclude:
    - state: ''

@VDRainer, yes, that works perfectly (though I restricted it to an entity_id).

I’d suggest that might be a weakness if not a bug in the normally included conditional card.

Thank you. Now have one less junk entity to carry around, which makes no practical difference but makes it feel a bit more elegant.

I nearly started a new thread on this, but realized that just entering a space into the state field worked!

This may not have been the case in 2019… but it works today.