node-red-contrib-axis-com
Version:
Simplified integration with Axis devices
124 lines (108 loc) • 3.5 kB
HTML
<script type="text/x-red" data-template-name="Axis ACAP">
<div class="form-row">
<label for="node-input-preset"><i class="icon-tag"></i> Device</label>
<input type="text" id="node-input-preset">
</div>
<div class="form-row">
<label for="node-input-action"><i class="icon-tag"></i> Action</label>
<select id="node-input-action">
<option value="ACAP Status">ACAP Status</option>
<option value="Start ACAP">Start ACAP</option>
<option value="Stop ACAP">Stop ACAP</option>
<option value="Remove ACAP">Remove ACAP</option>
<option value="Install ACAP">Install ACAP</option>
</select>
</div>
<div class="form-row user_input_acap">
<label for="node-input-acap"><i class="icon-tag"></i> ACAP</label>
<input type="text" id="node-input-acap" placeholder="Optional. Overrides msg.payload">
</div>
<div class="form-row user_input_filename">
<label for="node-input-filename"><i class="icon-tag"></i> Filename</label>
<input type="text" id="node-input-filename" placeholder="Full path to ACAP eap file">
</div>
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="">
</div>
</script>
<script type="text/javascript">
RED.nodes.registerType('Axis ACAP',{
category: 'Axis',
color: '#FFCC33',
defaults: {
name: {value:""},
preset: {type:"Device Access"},
action: { value:"ACAP Status"},
acap: {value:""},
filename: {value:""}
},
icon: "font-awesome/fa-puzzle-piece",
inputs:1,
outputs:1,
label: function() {
return this.name || this.action;
},
oneditprepare: function() {
$("#node-input-action").change(function() {
var action = $("#node-input-action").val();
$(".user_input_acap").hide();
$(".user_input_filename").hide();
switch (action) {
case "ACAP Status":
case "Start ACAP":
case "Stop ACAP":
case "Remove ACAP":
$(".user_input_acap").show();
break;
case "Install ACAP":
$(".user_input_filename").show();
break;
}
});
}
});
</script>
<script type="text/x-red" data-help-name="Axis ACAP">
<h2>Inputs & Outputs</h2>
Set the device and call an action.
Each action will only output on success.
Use a Catch node to get detailed errors.
<br/><br/>
<p>
<b>ACAP Status</b><br/>
List all installed ACAPs and their status
<dl class="message-properties">
<dt>msg.acap<span class="property-type">string</span></dt>
<dd>Optional ACAP id to request a specific ACAP</dd>
</dl>
</p><br/>
<p>
<b>Start ACAP</b><br/>
<dl class="message-properties">
<dt>msg.payload<span class="property-type">string</span></dt>
<dd>ACAP package id</dd>
</dl>
</p><br/>
<p>
<b>Stop ACAP</b><br/>
<dl class="message-properties">
<dt>msg.payload<span class="property-type">string</span></dt>
<dd>ACAP package id</dd>
</dl>
</p><br/>
<p>
<b>Remove ACAP</b><br/>
<dl class="message-properties">
<dt>msg.payload<span class="property-type">string</span></dt>
<dd>ACAP package id</dd>
</dl><br/>
</p>
<p>
<b>Install ACAP</b><br/>
<dl class="message-properties">
<dt>msg.filename<span class="property-type">string</span></dt>
<dd>Full path to ACAP eap</dd>
</dl>
</p><br/>
</script>