@uns-kit/node-red-contrib-uns 0.1.2

Node-RED interface for UNS connectivity with UNS DataHub based on uns-kit.

npm install @uns-kit/node-red-contrib-uns

@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 messages
  • uns-out: publish UNS MQTT messages from Node-RED
  • uns-config: shared hidden config node for UnsProxyProcess
  • uns-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: required UnsProxyProcess name
  • MQTT connection: default MQTT connection for the process and proxies
  • Instance mode: force, wait, or handover
  • Handover: enable or disable handover logic

uns-in

  • UNS config: required
  • MQTT connection: optional override, otherwise inherits from uns-config
  • Proxy name: optional, defaults to the selected connection id
  • Input topics: MQTT subscriptions

Status values:

  • connecting
  • passive subscriber
  • active subscriber
  • temporary received ...

uns-out

  • UNS config: required
  • MQTT connection: optional override, otherwise inherits from uns-config
  • Proxy name: optional, defaults to the selected connection id
  • identity fields:
    • Topic
    • Asset
    • Asset description
    • Object type
    • Object ID
    • Virtual group
    • Attribute

Status values:

  • connecting
  • passive publisher
  • active 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.topic
  • msg.uns.asset
  • msg.uns.assetDescription
  • msg.uns.objectType
  • msg.uns.objectId
  • msg.uns.virtualGroup
  • msg.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 attribute
  • msg.topic: the full published MQTT topic
  • msg.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]

Node Info

Version: 0.1.2
Updated 1 day ago
License: MIT
Rating: not yet rated

Categories

Actions

Rate:

Downloads

0 in the last week

Nodes

  • uns-config
  • uns-mqtt-connection
  • uns-in
  • uns-out

Keywords

  • node-red
  • uns
  • mqtt
  • iot
  • unified namespace
  • sparkplug

Maintainers