@strato-automation/node-red-contrib-strato-automation
Version:
Strato Automation Official Node Red Library
238 lines (212 loc) • 10.8 kB
HTML
<script type="text/javascript">
RED.nodes.registerType('output-generic', {
category: 'Strato Automation',
color: '#f3b567',
defaults: {
name: { value: "", label: "Name" },
ocn_server_node: { type: "ocn-server", required: true, label: "OCN Server" },
device_instance: { value: "", required: false, label: "Device Instance", validate: RED.validators.number() },
object_id: { value: "", required: false, label: "Object ID" },
priority: { value: "9", required: false, label: "Priority" },
send_policy: { value: "On value changed", required: true, label: "Send Policy" },
initialized: { value: false },
source: { value: "mqtt", required: true, label: "Source" },
output_type: { value: "ip", required: true, label: "Output Type" },
bypass_priority: { value: false, required: true, label: "Bypass Priority" }
},
inputs: 1,
outputs: 2,
icon: "output.svg",
align: 'right',
paletteLabel: function () {
return "Output";
},
label: function () {
return this.name || (this.device_instance || "Output") + " " + this.object_id;
},
outputLabels: function (index) {
if (index === 0) return "Requested";
if (index === 1) return "Actual";
},
oneditprepare: function () {
var node = this;
$("#node-input-priority").typedInput({
types: [
{
options: [
{ value: "1", label: "Manual Life Safety (1)" },
{ value: "2", label: "Automatic Life Safety (2)" },
{ value: "3", label: "3" },
{ value: "4", label: "4" },
{ value: "5", label: "Critical Equipment Control (5)" },
{ value: "6", label: "Minimum On/Off (6)" },
{ value: "7", label: "OCN Special Event (7)" },
{ value: "8", label: "Manual Operator (8)" },
{ value: "9", label: "OCN Reserved (9)" },
{ value: "10", label: "10" },
{ value: "11", label: "11" },
{ value: "12", label: "12" },
{ value: "13", label: "13" },
{ value: "14", label: "14" },
{ value: "15", label: "15" },
{ value: "16", label: "16" },
]
}
]
})
$("#node-input-send_policy").typedInput({
types: [
{
value: false,
options: [
{ value: "Always", label: "Always" },
{ value: "On value changed", label: "On value changed" },
]
}
]
});
},
});
</script>
<script type="text/html" data-template-name="output-generic">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-server"></i> Name</label>
<input type="text" id="node-input-name">
</div>
<!-- Connection Settings -->
<div class="form-tips" style="margin-bottom: 20px;">
<b>Connection Settings</b>
</div>
<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>
<!-- Device Settings -->
<div class="form-tips" style="margin: 20px 0;">
<b>Device Settings</b>
</div>
<div style="padding-left: 10px; border-left: 3px solid #ddd;">
<div class="form-row">
<label for="node-input-device_instance"><i class="fa fa-microchip"></i> Device Instance</label>
<input type="text" id="node-input-device_instance" placeholder="e.g., 1234">
</div>
<div class="form-row">
<label for="node-input-object_id"><i class="fa fa-cube"></i> Object ID</label>
<input type="text" id="node-input-object_id" placeholder="e.g., AV-1">
</div>
<div class="form-row">
<label for="node-input-priority"><i class="fa fa-sort-numeric-asc"></i> Priority</label>
<input type="text" id="node-input-priority">
</div>
<div class="form-row">
<label for="node-input-bypass_priority"><i class="fa fa-sort-numeric-asc"></i> Bypass Priority</label>
<input type="checkbox" id="node-input-bypass_priority" style="width: auto; margin-top: 0;">
</div>
</div>
<!-- Communication Settings -->
<div class="form-tips" style="margin: 20px 0;">
<b>Communication Settings</b>
</div>
<div style="padding-left: 10px; border-left: 3px solid #ddd;">
<div class="form-row">
<label for="node-input-output_type"><i class="fa fa-exchange"></i> Protocol</label>
<select type="text" id="node-input-output_type" style="width: 70%;">
<option value="ip">IP</option>
<option value="mstp">MSTP</option>
</select>
</div>
<div class="form-row">
<label for="node-input-source"><i class="fa fa-database"></i> Data Source</label>
<select type="text" id="node-input-source" style="width: 70%;">
<option value="mqtt">MQTT (Recommended)</option>
<option value="api">API (HTTPS)</option>
</select>
</div>
<div class="form-row">
<label for="node-input-send_policy"><i class="fa fa-paper-plane"></i> Send Policy</label>
<input type="text" id="node-input-send_policy">
</div>
</div>
<div class="form-tips" style="margin-top: 20px;">
<p><i class="fa fa-info-circle"></i> Tip: You can dynamically override device instance, object ID, and priority through the input message.</p>
</div>
</script>
<script type="text/html" data-help-name="output-generic">
<p>A node that writes values to BACnet objects and optionally monitors their actual values.</p>
<h3>Inputs</h3>
<dl class="message-properties">
<dt>payload <span class="property-type">number | null</span></dt>
<dd>The value to write to the BACnet object. Use <code>null</code> to release the priority.</dd>
<dt class="optional">object_id <span class="property-type">string</span></dt>
<dd>Dynamically override the configured object ID if not provided in the node configuration (format: "type-instance")</dd>
<dt class="optional">device_instance <span class="property-type">number</span></dt>
<dd>Dynamically override the configured device instance if not provided in the node configuration</dd>
<dt class="optional">priority <span class="property-type">number</span></dt>
<dd>Dynamically override the configured priority level (1-16) if bypass_priority is set to true</dd>
</dl>
<h3>Outputs</h3>
<ol class="node-ports">
<li>Requested Value
<dl class="message-properties">
<dt>payload <span class="property-type">number | null</span></dt>
<dd>The value that was requested to be written</dd>
</dl>
</li>
<li>Actual Value
<dl class="message-properties">
<dt>payload <span class="property-type">number</span></dt>
<dd>The current value of the object (if status monitoring is enabled)</dd>
</dl>
</li>
</ol>
<h3>Configuration</h3>
<dl class="message-properties">
<dt>OCN Server <span class="property-type">config</span></dt>
<dd>The OCN Server configuration node to use for communication</dd>
<dt>Device Instance <span class="property-type">number</span></dt>
<dd>The instance number of the BACnet device</dd>
<dt>Object ID <span class="property-type">string</span></dt>
<dd>The object identifier in format "type-instance" (e.g., "AV-1")</dd>
<dt>Priority <span class="property-type">number</span></dt>
<dd>The BACnet priority level to write at (1-16)</dd>
<dt>Bypass Priority <span class="property-type">boolean</span></dt>
<dd>If true, the priority configuration will be bypassed by the message priority (msg.priority) if present</dd>
<dt>Send Policy <span class="property-type">string</span></dt>
<dd>
<ul>
<li><code>Always</code> - Send every value received</li>
<li><code>On value changed</code> - Only send when the value changes</li>
</ul>
</dd>
<dt>Source <span class="property-type">string</span></dt>
<dd>
<ul>
<li><code>MQTT</code> - Monitor actual values via MQTT (recommended)</li>
<li><code>API</code> - Monitor actual values via HTTP API polling</li>
</ul>
</dd>
<dt>Output Type <span class="property-type">string</span></dt>
<dd>
<ul>
<li><code>IP</code> - Write to IP BACnet devices</li>
<li><code>MSTP</code> - Write to MSTP BACnet devices</li>
</ul>
</dd>
<dt>Show Status <span class="property-type">boolean</span></dt>
<dd>Enable to show the actual and requested values in the node status</dd>
</dl>
<h3>Status</h3>
<dl class="message-properties">
<dt>Grey dot</dt>
<dd>Waiting for first value</dd>
<dt>Green dot</dt>
<dd>Actual value matches requested value (within resolution)</dd>
<dt>Yellow dot</dt>
<dd>Actual value differs from requested value</dd>
<dt>Red ring</dt>
<dd>Error condition (check debug tab for details)</dd>
</dl>
<h3>Details</h3>
<p>This node allows writing values to BACnet objects and optionally monitoring their actual values. When status monitoring is enabled, it will show whether the actual value matches the requested value, which is useful for verifying that writes were successful.</p>
<p>The node can be dynamically reconfigured by including <code>object_id</code>, <code>device_instance</code>, or <code>priority</code> in the input message. This allows a single node to write to different objects based on the flow logic.</p>
</script>