Templates have changed, bugged?

Not sure what's happened here, but templates seem to be broken, in entities and the template testing platform in tools:


As a test, this should reject all battery levels above 20.
None of those entities have a low battery (most are 100%).
It's very strange, because differing values in the last rejectattr clause give confusing results, like if I lower the value somehow I get more entities whereas I should get less.
I've only been using HA for about 3 months, and this has always worked up until now.
Can somebody check out if the templating is broken?

You're comparing strings, not actual numbers... so, that's the expected behavior.

As long as the strings have the same number of characters, you get "normal" results.
Your template has only "worked up until now" by coincidence or it was failing when you weren't looking.

2 Likes