For the complete documentation index, see llms.txt. This page is also available as Markdown.

Twig templating in Eliona

Introduction to Twig Templating

Eliona uses -> [External Link] Twig, a powerful and flexible templating engine for JavaScript and PHP, for the dynamic generation of message content. Twig makes it possible to define templates that are used by external messaging services such as SMS, Google Chat, Slack, or email.

Twig.js Version

The currently implemented version of Twig.js in Eliona is 1.17.1. The full documentation and implementation notes are available at the following links:


Twig Syntax and Functions

Twig syntax makes it possible to insert and process dynamic content in templates. Some commonly used functions are:

Output variables

{{ alarm.val }}  {# Outputs the value of the alarm #}
{{ asset.name }}  {# Displays the name of the affected asset #}

Use conditions

{% if alarm.prio == 1 %}
    Warning: High priority!
{% else %}
    Normal alarm.
{% endif %}

Use loops

Format strings


Available Templates and Variables in Eliona

Eliona offers various template types for different use cases:

Each of these templates supports specific variables that are dynamically populated with the respective data.


Ticket Template

Available variables

The ticket template can be used to automatically generate ticket notifications. The following variables are available:

Example of a Ticket Template


Alarm Template

Available variables

The alarm template is based on a test dataset and contains extensive details about alarms and their associated assets.

Example of an Alarm Template


User Template

The User Template allows access to user-specific information — especially for notification purposes (e.g. email, chat, or alarm forwarding). It can be used in all templates where user data is available.

Available variables

Example of a User Template


Password Reset Template

Available variables

The password reset template is used in Eliona to send users an email with a link to reset their password.

Example of a Password Reset Template


yAxis Formatter

The yAxis Formatter determines the display of the axis label in charts. It shows the current value of the data series together with additional attribute information.

Available variables for the yAxis formatter

  • {{unit}} – Unit of the value (e.g. °C, %, kWh)

  • {{value}} – The current value of the data series

  • {{attribute}} – Name of the attribute

  • {{gai}} – Global asset ID

  • {{aggregatedDataField}} – Data field for aggregation

  • {{aggregatedDataRaster}} – Grid with which the data was aggregated

  • {{aggregatedDataType}} – Type of aggregation (e.g. average, sum)

Example of a yAxis formatter

Result for temperature data:22.5 °C (room temperature)


Legend Template

The Legend Template determines the display of the Legend label in charts. It describes the data series by combining the name of the asset or data series with attribute information.

Available variables for the legend template

  • {{unit}} – Unit of the value (e.g. °C, %, kWh)

  • {{attribute}} – Name of the attribute

  • {{gai}} – Global asset ID

  • {{name}} – Name of the asset or data series

  • {{aggregatedDataField}} – Data field for aggregation

  • {{aggregatedDataRaster}} – Grid with which the data was aggregated

  • {{aggregatedDataType}} – Type of aggregation (e.g. average, sum)

Example of a legend template

Result for a temperature sensor:Air conditioner office 1 - room temperature (°C)


Conclusion

Twig.js enables flexible and efficient use of templates in Eliona. By using Twig variables and functions, personalized content can be generated for tickets, alarms, and emails. More information about the Twig syntax is available in the official documentation: -> [External Link] Twig.js Wiki.

Was this helpful?