@strato-automation/node-red-contrib-strato-automation
Version:
Strato Automation Official Node Red Library
140 lines (134 loc) • 6.73 kB
HTML
<script type="text/javascript">
RED.nodes.registerType('output-ip', {
category: 'deprecated',
color: '#f3b567',
defaults: {
ocn_server_node: { type: "ocn-server", required: true, label: "ocn server" },
connection_id: { value: "", required: true, label: "connection id" },
network_number: { value: "", required: true, label: "network number", validate: RED.validators.number() },
device_instance: { value: "", required: true, label: "device instance", validate: RED.validators.number() },
object_id: { value: "", required: true, label: "object id" },
priority: { value: "8", required: true, label: "priority" },
send_policy: { value: "On value changed", required: true, label: "On value changed" },
initialized: { value: false },
source: { value: "mqtt", required: true, label: "source" }
},
inputs: 1,
outputs: 2,
icon: "output.svg",
align: 'right',
paletteLabel: function () {
return "Output IP";
},
label: function () {
return this.device_instance + " " + this.object_id;
},
outputLabels: function (index) {
if (index === 0) return "Requested";
if (index === 1) return "Actual";
},
oneditprepare: function () {
var node = this;
if (node.connection_id == "")
$("#node-input-connection_id").val(localStorage.getItem('default_connection_id') || "");
if (node.network_number === "")
$("#node-input-network_number").val(localStorage.getItem('default_network_number') || "");
if (node.device_instance === "")
$("#node-input-device_instance").val(localStorage.getItem('default_device_instance') || "");
if (node.object_id === "")
$("#node-input-object_id").val(localStorage.getItem('default_out_obj_id') || "");
$("#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" },
]
}
]
});
$
},
oneditsave: function () {
var node = this;
if (node.connection_id !== "")
localStorage.setItem('default_connection_id', node.connection_id);
if (node.network_number !== "")
localStorage.setItem('default_network_number', node.network_number);
if (node.device_instance !== "")
localStorage.setItem('default_device_instance', node.device_instance);
if (node.object_id !== "")
localStorage.setItem('default_out_obj_id', node.object_id);
}
});
</script>
<script type="text/html" data-template-name="output-ip">
<!-- NODE HAS BEEN DEPRECATED-->
<div class="form-row">
<p style="color:red;"><b>Deprecated:</b> This node is deprecated and will be removed in a future release. Please migrate to <i>OUTPUT</i>.</p>
</div>
<div class="form-row">
<label for="node-input-ocn_server_node" style="min-width: 130px;"><i class="fa fa-tag"></i> OCN server</label>
<input type="ocn-server" id="node-input-ocn_server_node" placeholder="ocn server">
</div>
<div class="form-row">
<label for="node-input-connection_id" style="min-width: 130px;"><i class="fa fa-tag"></i> Connection ID</label>
<input type="text" id="node-input-connection_id" placeholder="connection id">
</div>
<div class="form-row">
<label for="node-input-network_number" style="min-width: 130px;"><i class="fa fa fa-tag"></i> Network</label>
<input type="text" id="node-input-network_number" placeholder="network number">
</div>
<div class="form-row">
<label for="node-input-device_instance" style="min-width: 130px;"><i class="fa fa-tag"></i> Device Instance</label>
<input type="text" id="node-input-device_instance" placeholder="device instance">
</div>
<div class="form-row">
<label for="node-input-object_id" style="min-width: 130px;"><i class="fa fa-tag"></i> Object ID</label>
<input type="text" id="node-input-object_id" placeholder="object id">
</div>
<div class="form-row">
<label for="node-input-priority" style="min-width: 130px;"><i class="fa fa-tag"></i> Priority</label>
<input type="text" id="node-input-priority">
</div>
<div class="form-row">
<label for="node-input-send_policy" style="min-width: 130px;"><i class="fa fa-tag"></i> Send</label>
<input type="text" id="node-input-send_policy" placeholder="option">
</div>
<!-- Drop down list mqtt / api -->
<div class="form-row">
<label for="node-input-source" style="min-width: 130px;"><i class="fa fa-tag"></i> Source</label>
<select type="text" id="node-input-source">
<option value="mqtt">MQTT</option>
<option value="api">API (HTTPS)</option>
</select>
</div>
</script>
<script type="text/html" data-help-name="output-ip">
<h1>THIS NODE HAS BEEN DEPRECATED. DO NOT USE IT.</h1>
</script>