# Mustache Templates

When using templates the top level is a property of the message object: msg.payload would be {{payload}}.

You can access flow, global, and states contexts {{flow.foobar}} {{global.something}}. For the states context you can use {{entity.domain.entity_id}} to get the state or drill further down {{entity.light.kitchen.attributes.friendly_name}}.

  • {{entity.light.kitchen}} and {{entity.light.kitchen.state}} are equivalent

By default, Mustache will replace certain characters with their HTML escape codes. To stop this happening, you can use triple braces: {{{payload}}}.


Mustache templates work well with strings but if you're trying to insert a JSON object somewhere you're better off using a JSONata expression or doing with a function node and passing it in as an input.