node-red-contrib-hikvision-ultimate
Version:
A native set of nodes for Hikvision (and compatible) Cameras, Alarms, Radars, NVR, Doorbells, etc.
162 lines (150 loc) • 5.65 kB
HTML
<script type="text/javascript">
RED.nodes.registerType('hikvisionUltimatePTZ', {
category: 'Hikvision Ultimate',
color: '#C0C0C0',
defaults: {
name: { value: "" },
topic: { value: "" },
server: { type: "Hikvision-config", required: true },
channelID: { value: "1" },
PTZPreset: { value: "1" },
waitForCameraPositionReached: { value: false }
},
inputs: 1,
outputs: 2,
outputLabels: function (i) {
var ret = "";
switch (i) {
case 0:
return "Status";
break;
case 1:
return "Error";
break;
case 2
:
return "";
break;
default:
break;
}
},
icon: "ptz-icon.svg",
label:
function () {
var label = "PTZ"
if (this.name !== undefined && this.name.length > 0) {
label = this.name;
}
return label + " " + this.PTZPreset;
},
paletteLabel: function () {
return "PTZ";
},
oneditprepare: function () {
},
oneditsave: function () {
}
});
</script>
<script type="text/x-red" data-template-name="hikvisionUltimatePTZ">
<div class="form-row">
<b>PTZ node</b>    <span style="color:red"><i class="fa fa-question-circle"></i> <a target="_blank" href="https://github.com/Supergiovane/node-red-contrib-hikvision-ultimate"><u>Help online</u></a></span>
<br/>
<br/>
<label for="node-input-server">Server</label>
<input type="text" id="node-input-server" />
</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="Name">
</div>
<div class="form-row">
<label for="node-input-topic"><i class="fa fa-tasks"></i> Node topic</label>
<input type="text" id="node-input-topic" placeholder="Node's own topic">
</div>
<div class="form-row">
<label for="node-input-channelID"><i class="fa fa-tasks"></i> Camera</label>
<select id="node-input-channelID">
<option value="1">1 (DEFAULT)</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
<option value="31">31</option>
<option value="32">32</option>
</select>
<div class="form-tips" style="margin-top:11px">
Leave 1 if your camera has only one channel (most of the time)
</div>
</div>
<div class="form-row">
<label for="node-input-PTZPreset"><i class="fa fa-tasks"></i> Preset</label>
<select id="node-input-PTZPreset">
<option value="1">Preset 1</option>
<option value="2">Preset 2</option>
<option value="3">Preset 3</option>
<option value="4">Preset 4</option>
<option value="5">Preset 5</option>
<option value="6">Preset 6</option>
<option value="7">Preset 7</option>
<option value="8">Preset 8</option>
<option value="9">Preset 9</option>
<option value="10">Preset 10</option>
<option value="11">Preset 11</option>
<option value="12">Preset 12</option>
<option value="13">Preset 13</option>
</select>
</div>
<div class="form-row">
<label for="node-input-waitForCameraPositionReached"><i class="fa fa-clock-o"></i> Wait mode</label>
<input type="checkbox" id="node-input-waitForCameraPositionReached" style="display:inline-block; width:auto; vertical-align:top;">
<span style="margin-left:8px;">Wait for camera position reached</span>
<div class="form-tips" style="margin-top:11px">
Disabled: PIN 1 outputs <b>true</b> as soon as the camera accepts the PTZ goto command.<br/>
Enabled: PIN 1 waits until the camera position settles, by polling the PTZ absolute position (`/absoluteEx`).
</div>
</div>
</script>
<script type="text/x-red" data-help-name="hikvisionUltimatePTZ">
<p>
<a href="https://www.paypal.me/techtoday" target="_blank"><img src='https://img.shields.io/badge/Donate-PayPal-blue.svg?style=flat-square' width='30%'></a>
</p>
<p>
<b>Default mode</b>: the node outputs <b>true</b> on PIN 1 as soon as the camera accepts the PTZ goto request. This is the historical behavior and it does <b>not</b> verify that the camera has already reached the preset position.
</p>
<p>
<b>Wait for camera position reached</b>: when enabled, the node first sends the PTZ goto command and then polls the camera absolute PTZ position until the movement settles. Only then it outputs <b>true</b> on PIN 1.
</p>
<p>
This mode is slower by design and requires the camera to support absolute PTZ position reading via <code>/ISAPI/PTZCtrl/channels/<ID>/absoluteEx</code>. If the camera does not support it, or if the position cannot be confirmed within the timeout, PIN 2 reports an error.
</p>
<p>
PIN 2 reports connection/request errors in both modes.
</p>
</script>