@uns-kit/node-red-contrib-uns 0.1.2
Node-RED interface for UNS connectivity with UNS DataHub based on uns-kit.
@uns-kit/node-red-contrib-uns
Node-RED interface for UNS connectivity with UNS DataHub based on uns-kit.
It provides a standalone UNS runtime inside Node-RED for subscribing to and publishing UNS messages.
Nodes
uns-in: subscribe to UNS MQTT messages and emit Node-RED messagesuns-out: publish UNS MQTT messages from Node-REDuns-config: shared hidden config node forUnsProxyProcessuns-mqtt-connection: shared hidden config node for MQTT connection settings
Requirements
- Node.js
>=20 - Node-RED
- MQTT broker reachable by Node-RED
Install
From your Node-RED user directory or project:
npm install @uns-kit/node-red-contrib-uns
For local development from a local checkout:
npm install ../node-red-contrib-uns
Configuration
uns-config
Shared runtime settings:
Process: requiredUnsProxyProcessnameMQTT connection: default MQTT connection for the process and proxiesInstance mode:force,wait, orhandoverHandover: enable or disable handover logic
uns-in
UNS config: requiredMQTT connection: optional override, otherwise inherits fromuns-configProxy name: optional, defaults to the selected connection idInput topics: MQTT subscriptions
Status values:
connectingpassive subscriberactive subscriber- temporary
received ...
uns-out
UNS config: requiredMQTT connection: optional override, otherwise inherits fromuns-configProxy name: optional, defaults to the selected connection id- identity fields:
TopicAssetAsset descriptionObject typeObject IDVirtual groupAttribute
Status values:
connectingpassive publisheractive publisher- temporary
published ...
uns-in output
uns-in emits:
{
"topic": "enterprise/site/area/line/asset/sensor/main/temp",
"payload": {
"data": {
"dataGroup": "sensor",
"time": "2026-07-06T08:45:34.907Z",
"value": 40.07,
"uom": "A",
"valueType": "number"
}
},
"unsEvent": {},
"unsPacket": {}
}
msg.payload contains the parsed UNS message body. msg.unsPacket contains the raw UNS packet received from MQTT.
uns-out input
Identity can come from node configuration and be overridden by msg.uns.
Supported runtime overrides:
msg.uns.topicmsg.uns.assetmsg.uns.assetDescriptionmsg.uns.objectTypemsg.uns.objectIdmsg.uns.virtualGroupmsg.uns.attribute
Single attribute with data
{
"uns": {
"topic": "enterprise/site/area/line/",
"asset": "asset",
"objectType": "sensor",
"objectId": "main",
"attribute": "temp",
"virtualGroup": "data"
},
"payload": {
"data": {
"dataGroup": "sensor",
"time": "2026-07-06T08:45:34.907Z",
"value": 40.07,
"uom": "A"
}
}
}
Single attribute with table
{
"uns": {
"topic": "enterprise/site/area/line/",
"asset": "asset",
"objectType": "sensor",
"objectId": "main",
"attribute": "measurements",
"virtualGroup": "data"
},
"payload": {
"table": {
"dataGroup": "sensor_table",
"time": "2026-07-06T08:45:34.907Z",
"columns": [
{ "name": "current", "type": "double", "value": 40.07, "uom": "A" }
]
}
}
}
Multiple attributes in one publish
{
"uns": {
"topic": "enterprise/site/area/line/",
"asset": "asset",
"objectType": "energy-resource",
"objectId": "main",
"virtualGroup": "data"
},
"payload": {
"attributes": [
{
"attribute": "current",
"data": {
"dataGroup": "sensor",
"time": "2026-07-06T08:45:34.907Z",
"value": 12.3,
"uom": "A"
}
},
{
"attribute": "voltage",
"data": {
"dataGroup": "sensor",
"time": "2026-07-06T08:45:34.907Z",
"value": 230.1,
"uom": "V"
}
}
]
}
}
Also supported:
[
{
"attribute": "current",
"data": {
"dataGroup": "sensor",
"value": 12.3,
"uom": "A"
}
},
{
"attribute": "voltage",
"data": {
"dataGroup": "sensor",
"value": 230.1,
"uom": "V"
}
}
]
If time is missing in data or table, the node generates the current ISO timestamp automatically.
uns-out output
After publish, uns-out forwards:
msg.payload: the exact UNS packet body sent to MQTT for that attributemsg.topic: the full published MQTT topicmsg.uns: the resolved UNS identity used for that attribute
If multiple attributes are published in one input message, uns-out emits one output message per attribute.
Development
Run a quick load check:
npm run check
Publishing
Prepare the package:
npm run check
npm pack
Log in to npm:
npm login
Publish the package:
npm publish --access public
Publish a new version:
npm run patch
npm publish
Other version bumps:
npm run minor
npm publish
npm run major
npm publish
Contact
Kristjan Cuznar[email protected]