@strato-automation/node-red-contrib-strato-automation
Version:
Strato Automation Official Node Red Library
173 lines (158 loc) • 5.66 kB
HTML
<script type="text/javascript">
RED.nodes.registerType('ocn-telemetry', {
category: 'Strato Automation',
color: '#f3b567',
defaults: {
name: { value: "", label: "Name" },
ocn_server_node: { type: "ocn-server", required: true, label: "OCN Server" },
},
inputs: 1,
outputs: 1,
icon: "font-awesome/fa-level-up",
paletteLabel: function() {
return "Telemetry";
},
label: function () {
return (this.name || "Telemetry")
},
outputLabels: function (index) {
return "Telemetry";
}
});
</script>
<script type="text/html" data-template-name="ocn-telemetry">
<!-- Basic Settings -->
<div class="form-tips" style="margin-bottom: 20px;">
<b>Basic Settings</b>
</div>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-bookmark"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Optional name for this telemetry node">
</div>
<!-- Connection Settings -->
<div class="form-tips" style="margin: 20px 0;">
<b>Connection Settings</b>
</div>
<div style="padding-left: 10px; border-left: 3px solid #ddd;">
<div class="form-row">
<label for="node-input-ocn_server_node"><i class="fa fa-server"></i> OCN Server</label>
<input type="ocn-server" id="node-input-ocn_server_node">
</div>
</div>
<div class="form-tips" style="margin-top: 20px;">
<p><i class="fa fa-info-circle"></i> Tip: This node retrieves historical telemetry data for specified BACnet objects within a time range.</p>
</div>
</script>
<script type="text/html" data-help-name="ocn-telemetry">
<p>A node that retrieves historical telemetry data from BACnet objects through the OCN Server.</p>
<h3>Inputs</h3>
<dl class="message-properties">
<dt>payload <span class="property-type">object</span></dt>
<dd>
Query parameters for telemetry data:
<pre>{
"uniqueObjectIds": [
{
"deviceInstance": number,
"objectType": number,
"objectInstance": number
},
...
],
"start": "ISO-8601 timestamp",
"stop": "ISO-8601 timestamp"
}</pre>
</dd>
</dl>
<h3>Outputs</h3>
<dl class="message-properties">
<dt>payload <span class="property-type">array</span></dt>
<dd>
Array of telemetry records, one per queried object:
<pre>[{
"deviceInstance": number,
"objectId": {
"type": number,
"instance": number
},
"values": [{
"value": number,
"highestPriority": number,
"reliability": number,
"statusFlags": number,
"eventState": number,
"timestamp": "ISO-8601 timestamp"
}, ...]
}]</pre>
Where:
<ul>
<li><code>value</code>: The object's value at the given timestamp</li>
<li><code>highestPriority</code>: Active BACnet priority (1-16)</li>
<li><code>reliability</code>: BACnet reliability enumeration</li>
<li><code>statusFlags</code>: BACnet status flags</li>
<li><code>eventState</code>: BACnet event state enumeration</li>
<li><code>timestamp</code>: Time of the reading (ISO-8601 format)</li>
</ul>
</dd>
</dl>
<h3>Configuration</h3>
<dl class="message-properties">
<dt>Name <span class="property-type">string</span></dt>
<dd>Optional name to identify the node in the flow</dd>
<dt>OCN Server <span class="property-type">config</span></dt>
<dd>The OCN Server configuration node to use for retrieving telemetry data</dd>
</dl>
<h3>BACnet Object Types</h3>
<p>Common object type numbers:</p>
<ul>
<li>0: Analog Input</li>
<li>1: Analog Output</li>
<li>2: Analog Value</li>
<li>3: Binary Input</li>
<li>4: Binary Output</li>
<li>5: Binary Value</li>
<li>13: Multi-state Input</li>
<li>14: Multi-state Output</li>
<li>19: Multi-state Value</li>
</ul>
<h3>Status Flags</h3>
<p>The statusFlags value is a bitfield containing:</p>
<ul>
<li>IN_ALARM (bit 0)</li>
<li>FAULT (bit 1)</li>
<li>OVERRIDDEN (bit 2)</li>
<li>OUT_OF_SERVICE (bit 3)</li>
</ul>
<h3>Example Usage</h3>
<p>Query example:</p>
<pre>{
"uniqueObjectIds": [
{
"deviceInstance": 213000,
"objectType": 2,
"objectInstance": 99
}
],
"start": "2025-03-26T00:27:21.073Z",
"stop": "2025-03-26T15:27:21.073Z"
}</pre>
<h3>Best Practices</h3>
<ul>
<li>Keep time ranges reasonable to avoid large data sets</li>
<li>Group related objects in a single query</li>
<li>Consider data resolution when selecting time ranges</li>
<li>Monitor response sizes when querying multiple objects</li>
</ul>
<h3>Error Handling</h3>
<ul>
<li>Invalid time ranges will result in an error</li>
<li>Non-existent objects will be skipped in the results</li>
<li>Server connection issues will be reported in the node status</li>
<li>Malformed queries will return an error response</li>
</ul>
<h3>Notes</h3>
<ul>
<li>All timestamps are in ISO-8601 format with UTC timezone</li>
<li>Values maintain their full precision as received from the device</li>
</ul>
</script>