How to render the following template?

Hi,
I'm struggling for hours to find the right approach to render the following template to be rendered by Home Assistant at the end.

Right now I was able to use the template node to render the following template:

state_attr("{{{flow.entity_id}}}", "volume_level")*{{{flow.volume_factor}}}|float

Is there any way to render this kind of template while preserving the double curly braces at the beginning and the end? If so I should be able to pass the output to node-red-contrib-home-assistant-websocket (api-render-template) directly and finaly achive my goal :slight_smile:

{{ state_attr("{{{flow.entity_id}}}", "volume_level")*{{{flow.volume_factor}}}|float }}

Best regards
Mirko

Hi @gitmirko , welcome to the forum.

I assume you are using the core Template node for this?

If you check the sidebar help for that node, it explains what to do if you need {{/}} to appear in the generated content:

If you need to use {{ }} within your content, you can change the characters used to mark the templated sections. For example, to use [[ ]] instead, add the following line to the top of the template:
{{=[[ ]]=}}

1 Like

Example

{{=<%  %>=}} {{ <%={{ }}=%>state_attr("{{{flow.entity_id}}}", "volume_level")*{{{flow.volume_factor}}}|float }}

Thank you. This worked like a charm:

{{=[[ ]]=}}
{{ state_attr("[[flow.entity_id]]", "volume_level")*[[flow.volume_factor]]|float }}

I still have not found the part in the help where it states this information.

Thank you as well. I got it to work with the first approach right away.

Think it depends on node-red version but there is a link in the help to this page. mustache(5) - Logic-less templates.

I see in your use of change delimiter, you no longer require that html entities are not escaped i.e the {{{ has become [[.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.