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):
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
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.