There are two string escaping characters. '
or "
.
here:
{{as_timestamp(state_attr ('sun.sun','next_noon')) | timestamp_custom("%H:%M", true)}}
both is used.
So adding a "
on the outside will cause
"{{as_timestamp(state_attr ('sun.sun','next_noon')) | timestamp_custom("
%H:%M", true)}}"
when you use >-
and a line break you can use both in the string since none of them is needed to enclose the template.
When HA saves templates it’s usually converted to:
'{{as_timestamp(state_attr (''sun.sun'',''next_noon'')) | timestamp_custom(''%H:%M'', true)}}'
So double '
each time.
So in short there is many ways to do it. I should have used '
as you did in the timestamp_custom but I didn’t think about it.
Since I usually do these mistakes with using both, I have started using >-
to my sensors.