Person Cards - Show Off Yours

Hi, I have one more issue. Your code is working fine 99% of occasion to show the “zone” in Friendly Name. But…if the zone contains more than 1 word, such as “San Lunas” or “San Diego”. The return value is “null”. I think the code is probably not being able to insert/replace the single space right after the word “San” with an underscore “". The ideal outcome of the code would be “zone.san_lunas”, so the code could translate the defined zone name into Friendly Name. Now it probably becomes
“zone.san lunas” instead, therefore, it returns to a “null” value. Is it possible to modify the code that if there’s “space” or more than 1 word in states(person), then insert "
” in between the 2 words?

Thank you

can you test this @rog889

{% if is_states(entity,“home”) -%}
Home
{% elif is_state(entity, “not_home”) %}
Away
{%- else -%}
{{states(entity)}}
{%- endif %}

It does work now! Thank you! BTW, I had to do the same thing for the badge icon and badge color. Now, it’s working with multiple words in a zone! Thank you very much AGAIN!!!

:smile: :smiley:

This is not my card but belongs in this thread. @ElVit has done a fantastic job.

image

1 Like