It works in developers->template but in the automation i got the error “Error in describing condition: Cannot read properties of undefined (reading ‘includes’)”
Hi. Please format your code by putting it in a code block </> in the editor menu. Indenting matters, and it gets destoyed by the forum this way. Plus I’m pretty sure this won’t work in the template tester:
First of all, templates need to be in quotes if you put them in a single line in yaml. Plus your template starts with three { instead of two.
Then:
It seems there is a space in there that should not be there. That means the states function does not return a number because the entity does not exits. The next problem is that
will error in an automation if what is left is not a number - developer tools is more forgiving. To prevent it, provide a default for int:
I think the problem is outside what you show us. I suspect you are including your own yaml automations? My advice would be to write the automation in the automation editor and check the yaml from there to see how the yaml should look. When doing that, the outer quotes from the template must be removed.
But as said, the problem is most likely no longer in what you show us, but i. how you try to add it to your configuration.