You shouldn’t surround the template in quotes for multiline templates. I don’t think it will work as you’ve written it. Mine should work fine as long as you switch to YAML mode.
Edit: Weird, looks like it needs the \ escaped. So this:
By the way, triggering on every state change event isn’t ideal if you’re running HA on an underpowered platform (like a Pi3B), but there isn’t really another way to do this. If you’re using a faster platform, it won’t be a problem.
You shouldn’t surround the template in quotes for multiline templates. I don’t think it will work as you’ve written it. Mine should work fine as long as you switch to YAML mode.
That’s odd, I copy paste your code, and when I go back to visual mode, and then back to yaml mode, the condition is changed a bit:
Yes, it (sometimes?) turns single-line templates into multiline. It’s equivalent, but also note that there are no surrounding quotes in the multiline version (which is correct).