Question on condition testing UI versus value_template

I saw somewhere configuration as a condition:

value_template: "{{ not is_state('sensor.person.car','home') }}"

Why not just configure in UI and test for state not_home instead ? That would seem the more straightforward and intuitive way, to me at least. I have a feeling one does not do what i think it does (mine)

sensor.person.car

Is a syntax error.
But disregarding that, a lot of us who has used HA for a few years never bother to update the templates/automations/scripts with the latest syntaxes.
We have a working configuration so we don’t bother changing it to not state because it really doesn’t do any difference.

So when answering a question you just look at your working automation and copy paste.

Sometimes I realize and edit before I post but I never update my own configuration.
:man_shrugging:

They both work the same way and readability is not worse in my opinion so I can’t say I would be much motivated to change.

1 Like