uns_publish
Publishes already-read normalized numeric points to an MQTT broker or UNS, nesting dotted metrics into browsable topic levels and skipping non-numeric values.
Instructions
[READ][risk=low] Publish already-read normalized points to an MQTT broker / UNS.
Egress of data the agent already READ — NOT a control write. Each numeric point becomes a JSON
message on ``<topic_prefix>/<metric>``, with a dotted metric nested into topic levels
(``line1.temp`` -> ``plant/line1/temp``) so a Unified Namespace stays browsable. Non-numeric
points are skipped (use a historian sink for text/state). The topic is always derived from
``topic_prefix`` — it is never taken verbatim, so this cannot address a command topic. Needs the
extra: pip install iaiops[mqtt].
Args:
points: Collected point dicts (e.g. from *_read_many): {ref/metric, value, timestamp, ...}.
topic_prefix: Root of the topic tree (default 'iaiops'); wildcards are stripped.
host: Broker hostname or IP (default localhost).
port: Broker port; 0 picks 8883 with TLS else 1883.
username: Optional broker username.
password: Optional broker password.
use_tls: Use TLS to the broker.
qos: MQTT QoS 0/1/2 (default 0, fire-and-forget); values outside 0-2 are clamped.
retain: Ask the broker to retain the last value per topic (useful for a UNS).
Returns dict: {publisher, topic_prefix, broker, received, published, skipped_non_numeric}.
Example: uns_publish(points=[{"ref": "line1.temp", "value": 21.5}], topic_prefix="plant",
host="10.0.0.5").
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"points": "<points>"
},
"name": "uns_publish"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| qos | No | ||
| host | No | localhost | |
| port | No | ||
| points | Yes | ||
| retain | No | ||
| use_tls | No | ||
| password | No | ||
| username | No | ||
| topic_prefix | No | iaiops |