node-red-contrib-hikvision-ultimate
Version:
A native set of nodes for Hikvision (and compatible) Cameras, Alarms, Radars, NVR, Doorbells, etc.
211 lines (165 loc) • 8.92 kB
HTML
<script type="text/javascript">
RED.nodes.registerType('hikvisionUltimateAxPro', {
category: 'Hikvision Ultimate',
color: '#C0C0C0',
defaults: {
name: { value: "" },
topic: { value: "" },
server: { type: "AXPro-config", required: true },
outputtype: { value: 0 },
},
inputs: 1,
outputs: 2,
outputLabels: function (i) {
var ret = "";
switch (i) {
case 0:
return "Payload";
break;
case 1:
return "Error";
break;
case 2
:
return "";
break;
default:
break;
}
},
icon: "node-raw-icon.svg",
label:
function () {
var label = "AX Pro"
if (this.name !== undefined && this.name.length > 0) {
label = this.name;
}
return label;
},
paletteLabel: function () {
return "AX Pro";
},
oneditprepare: function () {
},
oneditsave: function () {
}
});
</script>
<script type="text/html" data-template-name="hikvisionUltimateAxPro">
<div class="form-row">
<label for="node-input-server">Alarm Panel</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-outputtype"><i class="fa fa-tasks"></i> Output msg</label>
<select id="node-input-outputtype">
<option value=0>All</option>
<option value=1>Alarm related events</option>
<option value=2>Zone status change events</option>
</select>
</div>
</script>
<script type="text/markdown" data-help-name="hikvisionUltimateAxPro">
## AX PRO Alarm node (Ax Pro and AX Pro Hybrid)
<img src='https://raw.githubusercontent.com/Supergiovane/node-red-contrib-hikvision-ultimate/master/img/axproPicture.jpg' width="100%">
This node receives all events sent by your AX Pro alarm.<br/>
You will receive not only Alarms etc, but also zone status, even if the AX Pro is disarmed.<br/>
You can also arm, disarm, silence alarm etc...<br/>
<img src='https://raw.githubusercontent.com/Supergiovane/node-red-contrib-hikvision-ultimate/master/img/axpro.png' width="100%">
**Copy this code and paste it into your flow**
<details><summary>View code</summary>
> Adjust the nodes according to your setup
```javascript
[{"id":"7c370c1cabe6fd89","type":"hikvisionUltimateAxPro","z":"e9a7cd97842ffa10","name":"Ax Pro","topic":"","server":"2dfc48091d46ead3","outputtype":"0","x":350,"y":200,"wires":[["893818dce1fc2c20"],["01e634bd9098e528"]]},{"id":"893818dce1fc2c20","type":"debug","z":"e9a7cd97842ffa10","name":"Event","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":530,"y":180,"wires":[]},{"id":"01e634bd9098e528","type":"debug","z":"e9a7cd97842ffa10","name":"Connection Error","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":570,"y":260,"wires":[]},{"id":"ddc2d752e0c13937","type":"inject","z":"e9a7cd97842ffa10","name":"Disarm Area 1","props":[{"p":"disarmArea","v":"1","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":150,"y":280,"wires":[["7c370c1cabe6fd89"]]},{"id":"b33ec376180a53bc","type":"inject","z":"e9a7cd97842ffa10","name":"Arm Away Area 1","props":[{"p":"armAwayArea","v":"1","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":140,"y":160,"wires":[["7c370c1cabe6fd89"]]},{"id":"6145bfa8991c1831","type":"inject","z":"e9a7cd97842ffa10","name":"Arm Stay Area 1","props":[{"p":"armStayArea","v":"1","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":140,"y":200,"wires":[["7c370c1cabe6fd89"]]},{"id":"189b2eb17cb67a52","type":"inject","z":"e9a7cd97842ffa10","name":"Clear Alarm Area 1","props":[{"p":"clearAlarmArea","v":"1","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":130,"y":240,"wires":[["7c370c1cabe6fd89"]]},{"id":"40ce4b0d34bedf21","type":"comment","z":"e9a7cd97842ffa10","name":"Hikvision AX Pro Alarm Control and Event receiver","info":"","x":230,"y":120,"wires":[]},{"id":"2dfc48091d46ead3","type":"AXPro-config","host":"192.168.1.10","port":"80","name":"AX Pro","authentication":"sha256-salted","protocol":"http","heartbeattimerdisconnectionlimit":"2","deviceinfo":"[object Object]"}]
```
</details>
<br/>
**Configuration**
|Property|Description|
|--|--|
| Output msg | - "All": Outputs both Alarm events and Zone status changes <br/>- "Alarm related events": Outputs only alarm related events <br/>- "Zone status change events": Outputs only status changes in zones, even if the alarm is disarmed|
### Inputs
: armAwayArea (number) : Area number (for example 1). Arm Away the selected area.
: armStayArea (number) : Area number (for example 1). Arm Stay the selected area.
: disarmArea (number): Area number (for example 1). Disarm the selected area.
: disarmAllAreas (boolean): **true** to disarm all areas at once.
: clearAlarmArea (number): Area number (for example 1). Clear alarm of the selected area.
: clearAllAlarmAreas (boolean): **true** to clear the alarm of all areas at once.
Examples:<br/>
```javascript
msg.armAwayArea = 1 // To Arm Away Area 1
msg.armStayArea = 1 // To Arm Stay Area 1
msg.disarmArea = 1 // To Disarm Area 1
msg.disarmAllAreas = true // To disarm all areas at once
msg.clearAlarmArea = 1 // To clear alarm on Area 1
msg.clearAllAlarmAreas = true // To clear alarm of all areas at once
return msg;
```
### Outputs
1. Standard output
: payload (string) : the standard output of the command.
2. Standard error
: payload (string) : the standard error of the command, **true** if the node is DISCONNECTED to the server, otherwise **false** ONCE RECONNECTED
### Details
The pin 1 emits a msg with the following JSON object's priperties
```json
// FOR CID EVENTS
CIDEvent: {
"code":1401, // This is the reference code of the event. Please see the ISAPI docs or try by yourself, by watching the output while playing with your alarm
"name":"Supergiovane",
"type":"armAndDisarm",
"trigger":"2022-12-22T17:33:56+01:00",
"upload":"2022-12-22T17:33:56+01:00",
"system":1,
"subSystemName":"Casa"
}
```
```json
// FOR ZONE UPDATE EVENT
zoneStatus: {
"id":1,
"name":"Zona cablata 2",
"status":"trigger",
"sensorStatus":"normal",
"magnetOpenStatus":true,
"tamperEvident":false,
"shielded":false,
"bypassed":false,
"armed":false,
"isArming":false,
"alarm":false,
"reason":"break",
"subSystemNo":1,
"linkageSubSystem":[
1
],
"detectorType":"magneticContact",
"stayAway":false,
"zoneType":"Instant",
"accessModuleType":"localTransmitter",
"moduleChannel":2,
"zoneAttrib":"wired",
"deviceNo":3,
"abnormalOrNot":false
}
```
***CID Events common codes***
CID Events refers to a field "code" in the Alarm event output<br/>
The most common event codes are: 3401 (Arm Away), 3441 (Arm Stay), 1401 (Disarmed), 1759 (Intrusion Alarm)<br/>
For other codes, please see the list below. Click to view it larger.
<a href='https://raw.githubusercontent.com/Supergiovane/node-red-contrib-hikvision-ultimate/master/img/CIDEvents/1.png' _target='blank'> <img src='https://raw.githubusercontent.com/Supergiovane/node-red-contrib-hikvision-ultimate/master/img/CIDEvents/1.png' ></a>
<a href='https://raw.githubusercontent.com/Supergiovane/node-red-contrib-hikvision-ultimate/master/img/CIDEvents/2.png' _target='blank'><img src='https://raw.githubusercontent.com/Supergiovane/node-red-contrib-hikvision-ultimate/master/img/CIDEvents/2.png' ></a>
<a href='https://raw.githubusercontent.com/Supergiovane/node-red-contrib-hikvision-ultimate/master/img/CIDEvents/3.png' _target='blank'><img src='https://raw.githubusercontent.com/Supergiovane/node-red-contrib-hikvision-ultimate/master/img/CIDEvents/3.png' ></a>
<a href='https://raw.githubusercontent.com/Supergiovane/node-red-contrib-hikvision-ultimate/master/img/CIDEvents/4.png' _target='blank'><img src='https://raw.githubusercontent.com/Supergiovane/node-red-contrib-hikvision-ultimate/master/img/CIDEvents/4.png' ></a>
<a href='https://raw.githubusercontent.com/Supergiovane/node-red-contrib-hikvision-ultimate/master/img/CIDEvents/5.png' _target='blank'><img src='https://raw.githubusercontent.com/Supergiovane/node-red-contrib-hikvision-ultimate/master/img/CIDEvents/5.png' ></a>
[SEE THE README FOR FULL HELP AND SAMPLES](https://github.com/Supergiovane/node-red-contrib-hikvision-ultimate)
[Find it useful? Support the project!](https://www.paypal.me/techtoday)
</script>