Tags
Without tags, every value reaches a widget through its own wire: forty status LEDs fed by one PLC mean forty wires. With tags, one driver node feeds a tag table and a widget only says which tag it shows.
Tessera does not talk to devices: use the Node-RED driver nodes for OPC UA, Modbus, MQTT or your PLC, and send what they read to a tessera-tags node.
[driver node: read all variables] ──► [tessera-tags name: "PLC1"]The full name of a tag is <node name>/<key>: the driver sends { "P101_Run": true, "Tank1_Level": 62.3 } to the node PLC1 and the tags are PLC1/P101_Run and PLC1/Tank1_Level.
Try it
Section titled “Try it”The package ships a complete example, examples/tessera-tags.json (Import → Examples in the Node-RED editor, then open the dashboard at /tessera). It needs no device and no network:
- a simulated PLC (a
functionnode) sends three values every 2 seconds to atessera-tagsnode namedPLC1; one of them arrives under a long OPC UA node id and an alias renames it toTank1_Level; - the node lists its three tags with a type, unit and description (known tags) and has No data after set to 5 seconds;
- two status LEDs, a Stat and a progress bar are bound by tag, with no input wire;
- Stop PLC and Start PLC buttons make the simulator stop and resume: five seconds after you stop it, every tile bound to a tag dims and shows No data; they clear when you start it again.
Binding a widget to a tag
Section titled “Binding a widget to a tag”Set the widget’s tag property to the full name, for example the LED of an operator panel:
{ "type": "tessera-status", "label": "Pump P101", "style": "led", "tag": "PLC1/P101_Run"}The widget needs no input wire. When the tag’s value changes, the runtime calls the widget’s input() with a message whose payload is the value and whose topic is the tag name, exactly what a wire would deliver, so every widget that takes a value works as it already does and the state is stored for browsers that open the page later.
- A message reaches
PLC1and onlyP101_Runchanged (false→true). - The runtime finds the widgets bound to
PLC1/P101_Runand hands them the value. - Browsers receive the usual
statemessage and the LED turns to its running state. A browser opened later gets it ininit. - The driver stops sending for longer than the stale timeout: the LED shows “No data” (see below).
Switching the driver (another protocol, another PLC) changes only the flow in front of tessera-tags: the dashboard stays the same.
A tag can be bound before it exists. Until its first value the widget shows its empty state, or the No data overlay if the tag is already in the node’s known-tags list. A widget with both a wire and a tag shows the last value received, from either: allowed, not recommended.
In the editor, every widget that shows a value has a Tag field in its dialog (a button, a section and a notification have none: they ignore msg.payload, so a tag would do nothing, and a tag added by hand to a flow is ignored): click the field and the list opens by itself with every known tag (seen, or listed on a tessera-tags node), 50 at a time: scroll to the bottom for the next 50. Each row shows the name with its value type and quality. Type part of a name to filter the list (it starts again from the top), move with the arrow keys and press Enter, or click a row to pick it, or type any name; Escape closes the list. The visual builder has the same field in the inspector and a Tags tab to drag tags onto the page.
The tessera-tags node
Section titled “The tessera-tags node”It has the settings Name, No data after, Deadband, Aliases and Known tags, and no output (it only receives: nothing is written back to a device).
| You send | Result |
|---|---|
msg.payload is an object |
every key is a tag: { "P101_Run": true, "Tank1_Level": 62.3 } sets PLC1/P101_Run and PLC1/Tank1_Level |
msg.topic and a scalar msg.payload |
one tag, PLC1/<topic> |
msg.quality (optional) |
good, bad or uncertain (any case), for every tag of the message. Missing means good; any other value means uncertain, so a bad reading never looks good |
A Buffer payload is a scalar, not an object of tags: it needs a msg.topic. Anything else is an error in the Node-RED log and changes nothing. If one value of an object cannot be stored (a circular object, a BigInt), the other keys are still set and the error names the failing keys.
Use one node per source, with a different name each, so two PLCs can both have a Run tag. Two tessera-tags nodes with the same name share the prefix and write the same tags (the last message wins); both show a yellow status, “name” also used by another tags node, until one is renamed or removed.
The tag table
Section titled “The tag table”The runtime keeps the table: for each tag its value, quality, the time of its last change and optional meta (type, unit, description) from the known-tags list. It survives a deploy, so a widget you add later finds the value already there. A redeploy keeps the values the tags already have.
Only a tag whose value or quality changed is processed: a PLC that sends the same 300 values every 100 ms sends the dashboard nothing until one of them changes.
The table keeps a primitive as it is and an object or array as the browser would get it (the JSON form): a Buffer is stored as { "type": "Buffer", "data": [99, 100] }, toJSON() is honoured and function properties are dropped. A value that has no JSON form (a function, a circular object, a BigInt) cannot be stored.
Aliases
Section titled “Aliases”OPC UA node ids and MQTT topics make poor names. The Aliases table maps a topic → name: a msg.topic or an object key that has a row becomes <node name>/<name>, and every other key keeps its own name.
| Alias row | You send | Tag |
|---|---|---|
ns=2;s=Pump1.Run → P101_Run |
msg.topic = "ns=2;s=Pump1.Run", msg.payload = true |
PLC1/P101_Run |
plant/tank1/level → Tank1_Level |
msg.payload = { "plant/tank1/level": 62.3, "Mode": "auto" } |
PLC1/Tank1_Level and PLC1/Mode |
Both topic and name must be non-empty text. A row that is not (only possible when editing the flow JSON by hand) is skipped with one warning in the Node-RED log, and for a repeated topic the last row wins. The match is exact and case-sensitive.
Known tags
Section titled “Known tags”The table lists every tag it has seen. To have tags before their first value (drivers that cannot browse, such as register-based protocols), import a list in the node’s dialog: choose a file or paste text, then Import. The dialog shows how many tags are known; Clear empties the list, OK keeps it in the node (it is saved with the flow, in the tagList property).
name,type,unit,descriptionP101_Run,boolean,,"Pump 101, running"Tank1_Level,number,%,"Main tank level"[ { "name": "P101_Run", "type": "boolean", "description": "Pump 101, running" }, { "name": "Tank1_Level", "type": "number", "unit": "%" }]- CSV needs a header row with a
namecolumn;source,type,unitanddescriptionare optional, the order is free and empty header columns (trailing commas from a spreadsheet) are ignored. Fields are separated by commas; a field with a comma, a quote or a line break is quoted and a quote inside is doubled (""). A malformed quote rejects the whole file, and so does a file separated by semicolons or tabs (a spreadsheet export in some locales): the error says columns must be separated by commas. JSON is an array of objects; a row that is not an object is rejected. - A
nameis a key after the node name (and after the alias), like the keys you send:P101_Runon the nodePLC1is the tagPLC1/P101_Run. A leading<node name>/is accepted and removed, soPLC1/P101_RunandP101_Runare the same tag on the nodePLC1, and a list can be moved to another source by renaming the node. The prefix is removed before duplicates are looked for, soLevelandPLC1/Levelare one tag: the first row wins (its type, unit and description) and the other is reported; a row that is onlyPLC1/is rejected. - Rows are read defensively: at most 5000 tags and 1 MB of text (the node applies the same limits to the list in the flow JSON, and logs a warning with the number of rows ignored); fields must be text (name up to 200 characters, description 500); a row with an empty name, a bad field, the wrong number of columns or a name that is already listed is rejected and reported (with its row number) while the others are imported. Importing replaces the previous list.
- A listed tag exists from the deploy on with no value yet: its quality is
uncertainand widgets bound to it show the “No data” overlay until the first value arrives, then it goes away (also for a widget that was bound before the list reached the runtime). A redeploy keeps the values the tags already have. Itstype,unitanddescription(the ones that are not empty) are the tag’smeta, returned by the editor endpoint below (a listed tag without a type has notypethere); the builder uses the type to pick a widget before there is a value.
Map a whole device from one file
Section titled “Map a whole device from one file”Add a source column and the list also does the work of the Aliases table: a message whose msg.topic, or a payload key, is equal to source sets the tag <node name>/<name>, exactly like an alias. One file then holds the name, the mapping and the metadata of every tag, and one driver output (or one mqtt in with a wildcard) can feed a single tessera-tags node, with no switch and no wires per tag:
name,source,type,unit,descriptionFurnace1_Temp,planta/horno1/temp,number,°C,Furnace 1 temperatureTank1_Level,ns=2;s=Tank1.Level,number,%,Main tank levelLine1_Pressure,40001,number,bar,Air line 1 pressureP101_Run,,boolean,,Pump 101 (arrives already named)An MQTT topic, an OPC UA node id and a Modbus register key ({ "40001": 6.2 }) all work, in msg.topic with a scalar payload or as keys of an object payload. A key that is not a source keeps its own name, so the same node can also take keys that are already tag names.
- The Aliases table wins over a list
sourcewhen both map the same topic: the table is the explicit, per-row edit made in this node, while the list may be a file shared between nodes, so a local alias can always override it. - A
sourceis text with at most 500 characters and no control characters. A repeated source is rejected and reported (the first row wins, as with a repeated name). The dialog shows how many known tags have a source, and the editor endpoint returns it in each tag’smeta. examples/tags-sample.csvis a ready-to-import list of 20 plant tags (temperatures, pressures, flows, motors, valves, alarms) with MQTT, OPC UA and Modbus sources. It includes the three tags of the example flow: open the nodePLC1, choose the file under Import and press OK.
Stale data and quality: “No data”
Section titled “Stale data and quality: “No data””A green LED on a dead PLC is worse than a grey one, so a tag is never shown as its last good value when it may be out of date. Two things make a tag “no data”:
- No message for too long. Set No data after (seconds) on the
tessera-tagsnode: a tag that gets no message for that long becomes stale. Any message for the tag counts as an update, even with the same value, so the source must send periodically. It is off by default (0): many drivers (MQTT, OPC UA subscriptions) only report changes, and a steady value would wrongly show “No data”. When your driver polls (a read-all every second or every few seconds), set it to a bit more than the poll interval, for example 5 s for a 2 s poll, so one late reply does not flash the overlay. Leave it at 0 for a source that only sends changes. The node keeps one timer for all its tags, and stops it when the node is removed or redeployed. - Quality
bad. A message withmsg.quality = "bad".
The runtime then sends every widget bound to the tag props: { quality: "stale" } or { quality: "bad" } (the same props message as msg.ui; no new message type, so it works for every widget, extension widgets included). The dashboard dims the tile and shows a “No data” badge; the value underneath is still the last one received, but it is covered. When the tag is good again (a fresh message with quality good or uncertain) the runtime sends props: { quality: null } and the overlay goes away. It is sent only when it changes, a browser opened later gets it in init, and a widget created while its tag is already stale or bad starts with it. quality is therefore a reserved widget property.
When a tags node is removed or renamed
Section titled “When a tags node is removed or renamed”When a tessera-tags node is deleted or disabled (not on a plain redeploy), nothing can update its tags any more, so they become stale (see No data): widgets bound to them show “No data” instead of the last value. The tags stay in the table (and in the lists of the editor and the builder) until Node-RED restarts; a new node with that name brings them back with its first value. If another node with the same name is still running, nothing changes. A node that is renamed loses its old name the same way: the tags under the old name become stale (unless another node uses that name), and the renamed node starts filling the new ones. Every tag belongs to the node that last set or listed it, so a node named plant never touches the tags of a node named plant/PLC1, neither when it is removed nor with its No data after timeout.
Many tags, fast sources
Section titled “Many tags, fast sources”A driver that polls hundreds of tags every 100 ms must not flood the browsers, so the runtime reduces what it sends. The WebSocket protocol does not change.
- Coalescing, per widget. A bound widget is fed every change (its stored state, and so what a browser opened later gets in
init, is always the latest), but thestatemessage it produces is sent once per 100 ms window with the latest value: a burst of 10 changes within the window is one message. The first value after a quiet period waits 100 ms at most. The window is fixed: the poll rate the feature is for, and short enough that an operator can’t tell it from instant. The “No data” overlay is not delayed. - Charts and tables keep every point. A widget whose input appends (a chart’s points, a table in append mode) is never coalesced: each value is its own
append, as with a wire, so no point is lost. - Deadband. Set Deadband (absolute,
0= off, the default; a non-finite value such asInfinityalso means off) on thetessera-tagsnode and a number that moved less than the deadband from the stored value is ignored: the table and the widgets keep the old value and nothing is sent, but the message still counts as an update for No data after, so a steady sensor does not go stale. A move of exactly the deadband passes. The comparison is with the stored value, the last one that passed (never with the last one seen), so a slow drift of small steps still crosses the deadband instead of being held back forever. A quality change and a value that is not a number (text, booleans,NaN, objects) are never filtered.
The node’s deadband applies to every tag of the node; use another tessera-tags node (another name) for sources that need another one.
The builder and the editor’s list
Section titled “The builder and the editor’s list”The visual builder has a Tags tab beside Widgets and Layers: search the known tags, see each one’s live value, quality and type, and drag a tag onto the page to create a widget already bound to it. The widget depends on the tag’s type: a Status LED for a boolean, a Stat (the Value widget) for a number, Text for the rest. A Gauge would need a min and max that a tag does not carry, so it stays a choice you make in the palette. The widget is labelled with the tag’s key (P101_Run for PLC1/P101_Run) and, on Apply, becomes a normal undoable node edit. The inspector’s Tag field suggests the known tags too and still accepts any name.
The builder runs on the dashboard’s origin, without the editor’s admin token, so it asks the Node-RED editor that opened it for the list (a message on the editor bridge); the dashboard’s WebSocket carries nothing new. A tag that is neither seen nor listed is not in the list: type it in the inspector.
Both read the known tags from GET /tessera/tags?q=<text> on the Node-RED admin API (behind the same flows.read permission as the other Tessera editor endpoints). It is read-only and bounded: it returns { "total": <matches>, "tags": [...] } with at most 100 tags whose name contains q (any case), sorted by name. To page through them add offset (default 0) and, optionally, limit (default 50 when offset is given, at most 100): ?q=PLC1/&offset=50 is the second page of 50, and total stays the number of matches. Both must be non-negative integers, or the answer is 400. A request with neither returns the first 100, as before. Each is { "name", "quality", "type" }, where quality is good, bad, uncertain or stale (a stale tag reports stale even if its last quality was bad), type is the type of the current value (boolean, number, string, object, array or null; for a listed tag with no value yet, the type it was listed with), and meta appears when the tag has any. With ?value=1 each tag also carries its current value (what the builder’s Tags tab shows; the editor’s Tag field does not ask for it). Values are not truncated, so a very large object value makes the answer large.
Limits
Section titled “Limits”| What | Limit |
|---|---|
| Known-tags list | at most 5000 tags and 1 MB of text; name up to 200 characters, description 500 |
| Editor list | pages of 50 tags, at most 100 per answer (total says how many matched) |
| Coalescing window | 100 ms, fixed |
| Tag values | stored as JSON: no function, circular object or BigInt |
| Output | none: Tessera reads tags, it does not write to devices |
| Sending only to the browsers that show a page | not in this version: it needs a new message from the browser and affects every widget, so it is tracked on its own |
| Browsing a device’s address space (OPC UA) | not included: import a list; browsing could come later as an extension package |
Extension widgets
Section titled “Extension widgets”A widget from an extension package is fed from a tag by the runtime like any other, but the editor keeps only the properties listed in the node’s defaults when you save, deploy or import. Add tag: { value: '' } to the defaults of your node, or the tag is lost. To get the same Tag field with autocomplete: if your dialog calls TesseraEditor.commonRows, the Tag row appears by itself once tag is in the defaults. A dialog that does not use commonRows adds <input type="text" id="node-input-tag"> and calls window.TesseraEditor.tagField('node-input-tag') in oneditprepare, as example-knob does. Never both: the id would be duplicated.