Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95919

Help with escape characters in template

$
0
0

@Juggler wrote:

I’m trying to write an action with an event template. Without the template, the event looks like:

- event: homeassistantCube
  event_data:
    notifications: [{title: 'Goodnight security', severity: 'warning', options: {detail: 'All is well... sleep tight', dismissable: 'true'}}]

I would like to add the following into the above as a random integer: {{ range(1,99999) | random }}}, so the event would look something like:

- event: homeassistantCube
  event_data_template:
    notifications: [{title: 'Goodnight security', severity: 'warning', options: {detail: 'All is well... sleep tight', dismissable: 'true', serverId: {{ range(1,99999) | random }} }}]

I know the above is incorrect, but I cannot figure how to escape it properly. Can any Jinja ninjas help me out?

J.

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 95919

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>