Hello everyone.
I’m stuck with automation, that turns light in entrance hall on arriving. It does simple thing, motion sensor looks for motion, device tracker watches for presence of family group, and if motion detected and nobody at home, it turns the light on.
Value template works perfect in dev_tools, but when i’m trying to check config, i get error
“while parsing a block mapping
in “/home/homeassistant/.homeassistant/automations.yaml”, line 167, column 5
expected , but found ‘’
in “/home/homeassistant/.homeassistant/automations.yaml”, line 168, column 87”
Column 87 is beginning of [‘No motion since’], beetween single quote and “No”.
I think this is a bug, because jinja syntax allows this construction.
I can guarantee you they are not wrong (if used as I suggested. Maybe you replaced all the single quote characters with double quote characters??? If you did then, yes, that would be wrong.) But whatever works for you.
Yeah, that’s not correct. @pnbruckner’s method is correct. The only reason that’s working for you is because of another issue. When that issue is fixed, this will error for you. I suggest moving to @pnbruckner’s method.
your value template is flat out wrong. There is an issue in value templates where strings are concatenated by default inside yaml. Your code is incorrect in the fact that you have 5 strings together, the strings being:
When this bug is fixed, your template will error because of this. Those double single quotes that you have are not correct.
You should replace the double single quotes with double quotes. So that the entire string is encapsolated inside single quotes and the template itself uses double quotes. As @pnbruckner said and you blissfully ignored.
I’m confused. In YAML, two single-quote characters in a row, in a string this is quoted with single-quote characters, is just an escaped single-quote character. What bug are you referring to?
Well, you learn something new every day. Of course yaml is the code that adds different ways to escape single quotes. I was under the impression that it was a bug and it was concatenating the strings. Which in turn just happened to work. My mistake.