Template sensor: how to set a friendly name with a non-legacy syntax?

You probably want to switch those else’s back to None. Otherwise your state will be [] as a string instead of unavailable.

EDIT: In some cases you’ll want "" instead of None so that it doesn’t mess up your name.

1 Like

I think there’s an “availability” line I should be using instead of that, but I haven’t figured that out yet.

My impression (guess) is that the code would test the availability and only if that’s true would it try to evaluate the value_template.

edit: oh, for the names/icons… yeah. Those should be blanks (“”)

{{ value_json is defined }}

Not much to it. But it’s not a waterfall for rest, meaning you’ll still get erroneous [] in your state changes before it goes unavailable.

no, it uses the name as the entityid, not friendly name…

That has nothing to do with what Mike was talking about. Why revive this thread, just to say that?

2 Likes