Skip to content

Templates

Use the Templates page to build reusable, versioned configuration that many Edges share: assets, LAN Reach entries, agent settings and variables.

A template holds only the parts of the configuration it sets. Each Edge combines it with the other layers described in Edge configuration. Owners and Admins can create and edit templates. Other roles can view them.

The Templates list

Column Meaning
Name Click it to open the template editor.
Scope org: any Edge in the organization can use it. site: only Edges in that site can use it.
State Active, or Archived. You cannot publish a new version of an archived template or assign it to a group or Edge.

Create a template

  1. Open Templates.
  2. Enter a Template name.
  3. Choose the scope: Organization, or Site and then the site. Only Owners can create a site template.
  4. Click Create.
  5. Click the new template's name to open the editor.

Versions and publishing

Every save creates a new numbered version. The editor toolbar has three controls:

Control What it does
Load a version Opens an earlier version, listed as v1 draft, v2 published and so on.
Save version Saves the current content as a new draft version. Edges that follow the latest published version do not change.
Publish Saves the current content as a new version and publishes it.

Groups and Edges that leave Version blank follow the latest published version. When you publish, Watchtower delivers the new version to those Edges as a rollout. To test a draft first, set its version number on one Edge's Config tab (see Edge configuration).

Editor tabs

Assets

Defines the devices the Edge reads and the metrics it collects.

Control What it sets
Add asset Adds an empty asset.
asset_id Unique id: lowercase letters, digits and hyphens, 2 to 63 characters.
Name Display name, 1 to 128 characters.
Protocol opcua, s7, modbus-tcp, enip, sparkplug-b or simulator. Changing it clears the connection fields.
Connection fields The fields for the chosen protocol, such as host, port or endpoint URL. A password field takes a secret reference sec_… (see Edge configuration).
Add metric / Remove Adds or removes a metric by name. Rows with an empty name are dropped.
Remove asset Removes the asset.

The form sets metric names only. Set each metric's source (its address on the device), data_type, unit and report, and the asset's collection, on the JSON tab. See Edge config document for the fields of each protocol.

LAN Reach

Lists the devices on the plant network that operators may reach through the Edge with the Privitty App. Click Add reach entry and fill in the four fields:

Field Example Rule
id hmi-web Lowercase letters, digits and hyphens, up to 63 characters. Unique. Rows without an id are dropped.
ip 192.0.2.10 IPv4 address.
port 443 1 to 65535.
label HMI web UI 1 to 128 characters. Operators see this name.

This entry produces the following in the template body:

{
  "lan_reach": {
    "whitelist": [
      { "id": "hmi-web", "ip": "192.0.2.10", "port": 443, "label": "HMI web UI" }
    ]
  }
}

When an Edge applies the configuration, its LAN Reach list becomes exactly the combined list. For how operators use it, see LAN Reach.

Agent

Setting What it controls Allowed Default
Log level Detail of the Edge's log. error, warn, info, debug, trace info
Outbox max MB Space the Edge uses to keep readings while it is offline. When full, the oldest readings are dropped. 1 to 10240 256
Outbox max age hours How long the Edge keeps unsent readings. 1 to 8760 168
Confirm timeout seconds How long the Edge waits after applying a change before it confirms or rolls back. 1 to 86400 120
Roll back when a connector fails Also roll back if an asset restarted by the change does not connect. on or off off

The tab writes all five settings. For what a rollback means, see Edge configuration.

Variables

Variables let one template serve Edges that differ in a few values, such as a PLC address.

  1. Click Add variable.
  2. Enter a name, choose a type (string, integer, ipv4 or port), select Required if every Edge must supply a value, and optionally enter a default.
  3. Use the variable as a string value in the body, on the JSON tab:
    • "${plc_ip}" as the whole value becomes the typed value. An integer or port stays a number.
    • "opc.tcp://${plc_ip}:4840" inside a longer string is replaced as text.

Set the values on a group or an Edge. See Edge configuration.

JSON

Shows the whole template body in an editor that checks it against the configuration schema. Use it for fields the forms do not cover, such as metric sources, report and update_policy. Problems appear as warnings, because a template does not need to contain every required field. If the text is not a JSON object, you see Template JSON must be an object. and cannot leave the tab.

{
  "assets": {
    "schema": "wt.config.assets/v1",
    "assets": [
      {
        "asset_id": "tank-plc",
        "name": "Tank PLC",
        "protocol": "modbus-tcp",
        "connection": { "host": "${plc_ip}", "port": 502 },
        "metrics": [
          { "name": "tank_level", "source": { "table": "holding_register", "address": 0 }, "data_type": "uint16", "unit": "%" }
        ]
      }
    ]
  }
}