New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

node-red-contrib-hikvision-ultimate

Package Overview
Dependencies
Maintainers
1
Versions
121
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-red-contrib-hikvision-ultimate

A native set of nodes for Hikvision Cameras, Alarms, Radars etc.

  • 1.0.37
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
332
increased by121.33%
Maintainers
1
Weekly downloads
 
Created
Source

A native set of nodes for Hikvision Cameras, Alarms, Radars, NVR etc.

NPM version NPM downloads per month NPM downloads total MIT License JavaScript Style Guide Donate via PayPal Facebook

DESCRIPTION

This is a set of nodes to handle ISAPI Hikvision messages. It works exclusively with HIKVISION devices.
Works with cameras, NVR, Security Systems and also with specialized devices, like Radar (for example DS-PR1-60, DS-PR1-100 and DS-PR1-120).
Digest authentication: it should work with all devices.
All nodes are capable of auto reconnect if the connection is lost and are able to actively monitor the connection.
Be sure to have installed Node.js v12.3.0 or newer (issue a node -v command in a console, to check it out).

Note: for NVR/DVR, pleas remember to select "Notify Alarm Center" in the event window, otherwise the NVR won't emit any alarm event.

CHANGELOG



ALARM NODE

The alarm node connects to NVR, Camera, Alarm system, Radars, etc.. and outputs true/false in case of an alarm.
The node can be configured as Camera/NVR (with standard and smart events) or as Security System and Radar (with specific CID events, designed for these type of security devices)
You can optionally filter the alarms by CHANNEL, EVENT and ZONE.
For NVR/DVR, the Channel property is the CAMERA number, while for Cameras, is the image sensor number (normally 1).
The Zone property is the alarm zone (RADARS AND SECURITY SYSTEM), or the alert region number (CAMERAS AND NVR/DVR).
For RADAR and SECURITY SYSTEM device types, you can filter improper/false alams as well.

You can choose from many different alarms, including:

  • Video Motion Alarm (When motion is detected)
  • Local alarm input (it's the device's IO pigtail connector)
  • Line crossing (when someone crosses a line)
  • CID alarms
  • Many more.....

Flow Messages

The node outputs a payload on PIN 1 (TRUE on alarm start, FALSE on alarm end). Some alarm types only support the alarm start event.
The node outputs a payload on PIN 2, representing a connection error. TRUE if error, otherwise FALSE
This below is an example of msg output:

Output PIN 1

// Example of an event from NVR/Camera
msg.payload = {
  "payload": true,
  "topic": "",
  "channelid": "13", // This is the camera number for NVR, or the channel ID for cameras
  "zone": 0, // Zone or Region, see above, the explained difference
  "description": "Motion alarm",
  "_msgid": "386a613.89f259e"
}
// Example of an event from Security System or Radar
msg.payload = {
{
    "zone": 1, // This is the zone number that fired the alarm
    "payload": true, // true if alarm, otherwise false if alarm ended.
    "alarm": {
        "ipAddress": "192.168.1.25",
        "ipv6Address": "",
        "portNo": 80,
        "protocol": "HTTP",
        "macAddress": "BananaRama",
        "channelID": 1,
        "dateTime": "2012-01-13T03:58:19+01:00",
        "activePostCount": 1,
        "eventType": "cidEvent",
        "eventState": "active",
        "eventDescription": "CID event",
        "CIDEvent": {
            "code": 3103,
            "standardCIDcode": 3130,
            "type": "zoneAlarm",
            "trigger": "2012-01-13T03:58:19+01:00",
            "upload": "2012-01-13T03:58:19+01:00",
            "CameraList": [],
            "NVRList": [
                {
                    "id": 1,
                    "ip": "192.168.1.32",
                    "port": 8000,
                    "channel": 1
                }
            ],
            "zone": 1
        }
    }
    "_msgid": "b07e50f6.86a72"
}

Output PIN 2 (connection error)

msg = {
    "topic": "",
    "errorDescription": "", // This will contain the error rescription, in case of errors.
    "payload": false, // Or TRUE if error
    "_msgid": "dd5b3622.884a78"
}



ANPR (License Plate) NODE

This node works with Hikvision ANPR cameras.

Flow Messages

The payload contains the license plate number and the property plate contains other useful informations.

Output PIN 1

msg.payload = {
    "topic":"",
    "payload":"AB123CD", // This is the license plate
    "plate":{
        "captureTime":"20201130T114200+0100",
        "plateNumber":"AB123CD",
        "picName":"202011301142008600", // This is the picture's name of the license plate.
        "country":"ITA",
        "laneNo":"1",
        "direction":"forward",
        "matchingResult":"otherlist"
        }
    }

Output PIN 2 (connection error)

msg = {
    "topic": "",
    "errorDescription": "", // This will contain the error rescription, in case of errors.
    "payload": false, // Or TRUE if error
    "_msgid": "dd5b3622.884a78"
}



PTZ NODE

Recalls a PTZ pre-recorded preset.
Just select the preset in the configuration window and recall it by passing true as payload.

Flow Messages

The node outputs true on PIN 1 if the command is executed, otherwise an error on PIN 2.

Input

msg.payload = true; // Recalls the preset

Output PIN 1

msg.payload = {
{
    "payload": true, // true after the camera has reached the PTZ preset position
    "_msgid": "b07e50f6.86a72"
}

Output PIN 2 (connection error)

msg = {
    "topic": "",
    "errorDescription": "", // This will contain the error rescription, in case of errors.
    "payload": false, // Or TRUE if error
    "_msgid": "dd5b3622.884a78"
}



PICTURE NODE

This node gets a picture from the camera/NVR, ready to be shown in the dashboard UI.
You can rotate, resize, crop, overlay with text, zoom the image.
The overlay text is applied directly after the picture's manipulation. This behaves differently than the text overlay node (that uses the overlay functionality onboard the camera).
Pass true as payload to obtain the image.
You can, for example, link the Alarm node to the Picture node to get an image whenever an alarm occurs.
CAUTION: image handling is a very CPU/GPU consuming job. Use only if you have enough computational resources.


For the picture to show up directly into the flow, you can use this node developed by @riku

node-red-contrib-image-output



Copy this code and paste it into your flow

View code

Adjust the nodes according to your setup

[
  {
    "id": "604a8eaf.6d4ac",
    "type": "change",
    "z": "d61f370f.0413c",
    "name": "Setup msg",
    "rules": [
      {
        "t": "set",
        "p": "cid",
        "pt": "msg",
        "to": "",
        "tot": "date"
      },
      {
        "t": "set",
        "p": "attachments",
        "pt": "msg",
        "to": "[{\t \"filename\": 'image_' & $replace($now(),\":\",\"_\") & '.jpg', \t \"content\": $$.forEmail,\t \"cid\": \"\" & cid & \"\"\t}]",
        "tot": "jsonata"
      },
      {
        "t": "set",
        "p": "topic",
        "pt": "msg",
        "to": "See attached image",
        "tot": "str"
      },
      {
        "t": "set",
        "p": "payload",
        "pt": "msg",
        "to": "''",
        "tot": "jsonata"
      },
      {
        "t": "set",
        "p": "from",
        "pt": "msg",
        "to": "info@mysupersmarthome.it",
        "tot": "str"
      }
    ],
    "action": "",
    "property": "",
    "from": "",
    "to": "",
    "reg": false,
    "x": 430,
    "y": 120,
    "wires": [
      [
        "aad931f8.dc90c8"
      ]
    ]
  },
  {
    "id": "aad931f8.dc90c8",
    "type": "e-mail",
    "z": "d61f370f.0413c",
    "server": "mymta.myserver.com",
    "port": "25",
    "secure": false,
    "tls": false,
    "name": "info@mysupersmarthome.it",
    "dname": "Email",
    "x": 570,
    "y": 120,
    "wires": [
      
    ]
  },
  {
    "id": "8e957d25.a94278",
    "type": "hikvisionUltimatePicture",
    "z": "d61f370f.0413c",
    "name": "Ovest",
    "topic": "",
    "server": "eb73371b.af5208",
    "channelID": "7",
    "rotateimage": "0",
    "heightimage": "",
    "widthimage": "",
    "qualityimage": "100",
    "cropimage": "",
    "textoverlay": "",
    "textoverlayXY": "",
    "textoverlayWH": "",
    "textoverlayFont": "FONT_SANS_64_WHITE",
    "x": 250,
    "y": 120,
    "wires": [
      [
        "604a8eaf.6d4ac",
        "a7680ffd.f99168"
      ],
      [
        
      ]
    ]
  },
  {
    "id": "59408c5e.127414",
    "type": "inject",
    "z": "d61f370f.0413c",
    "name": "",
    "props": [
      {
        "p": "payload"
      },
      {
        "p": "topic",
        "vt": "str"
      }
    ],
    "repeat": "",
    "crontab": "",
    "once": false,
    "onceDelay": 0.1,
    "topic": "",
    "payload": "true",
    "payloadType": "bool",
    "x": 130,
    "y": 120,
    "wires": [
      [
        "8e957d25.a94278"
      ]
    ]
  },
  {
    "id": "a7680ffd.f99168",
    "type": "template",
    "z": "d61f370f.0413c",
    "name": "",
    "field": "payload",
    "fieldType": "msg",
    "format": "handlebars",
    "syntax": "mustache",
    "template": "",
    "output": "str",
    "x": 420,
    "y": 180,
    "wires": [
      [
        "32fa81d7.a2ada6"
      ]
    ]
  },
  {
    "id": "32fa81d7.a2ada6",
    "type": "ui_template",
    "z": "d61f370f.0413c",
    "group": "c1bf19aa.fe7fb8",
    "name": "",
    "order": 0,
    "width": "9",
    "height": "7",
    "format": " ",
    "storeOutMessages": true,
    "fwdInMessages": true,
    "resendOnRefresh": true,
    "templateScope": "local",
    "x": 580,
    "y": 180,
    "wires": [
      [
        
      ]
    ]
  },
  {
    "id": "e3fdf8b2.9fbc48",
    "type": "comment",
    "z": "d61f370f.0413c",
    "name": "Send an Email with image attachment and show it in the web UI",
    "info": "",
    "x": 310,
    "y": 80,
    "wires": [
      
    ]
  },
  {
    "id": "eb73371b.af5208",
    "type": "Hikvision-config",
    "host": "192.168.1.32",
    "port": "80",
    "name": "NVR",
    "authentication": "digest",
    "protocol": "http",
    "heartbeattimerdisconnectionlimit": "1",
    "deviceinfo": "[object Object]"
  },
  {
    "id": "c1bf19aa.fe7fb8",
    "type": "ui_group",
    "name": "Frame Grab",
    "tab": "e0f42233.22428",
    "order": 1,
    "disp": true,
    "width": "9",
    "collapse": false
  },
  {
    "id": "e0f42233.22428",
    "type": "ui_tab",
    "name": "NVR",
    "icon": "dashboard",
    "order": 13
  }
]


PROPERTY WINDOW

Flow Messages

The node outputs the image in in mamy formats on PIN 1, otherwise an error on PIN 2. On PIN 1 you'll have:
base64 JPG string format, ready for the UI Dashboard.
JPG Buffer, ready to be sent as email attachment.
pure base64 format, for many other uses.

Input

// To get the image
msg.payload = true; 
return msg;
// Dinamically set the overlay text
node.textoverlay = "Hello new overlay";
msg.payload = true; 
return msg;

Output PIN 1

msg = {
{
    "payload": "data:image/jpg;base64,/9j/4AAQSk...", // FOR THE DASHBOARD UI: Image as string in base64 format with JPG DATA header already there.
    "forEmail": "<buffer>", // FOR EMAIL: Image as buffer format, ready to be attached to an email as JPG attachment.
    "base64": "/9j/4AAQSk...", // FOR FURTHER MANIPULATION: Image as pure base64 string.
    "_msgid": "b07e50f6.86a72"
}
return msg;

Output PIN 2 (connection error)

msg = {
    "topic": "",
    "errorDescription": "", // This will contain the error rescription, in case of errors.
    "payload": false, // Or TRUE if error
    "_msgid": "dd5b3622.884a78"
}
return msg;



TEXT OVERLAY NODE

You can set the camera's text overlay. This node uses the camera's onboard text overlaying capabilities.
There are 4 rows avaiable, to be set from the configuration window or dinamically via msg input from flow.
Please note that not all cameras nor NVR/DVR (especially with old firmware) suppor setting the overlay text.

Copy this code and paste it into your flow

View code

Adjust the nodes according to your setup

[{"id":"7e79800b.afb8a8","type":"hikvisionUltimateText","z":"3f22f0c6.ff1328","name":"Overlay Text","server":"eb73371b.af5208","row1":"","row1XY":"","row2":"","row2XY":"","row3":"","row3XY":"","row4":"","row5XY":"","channelID":"1","x":510,"y":120,"wires":[]},{"id":"3aa8a40f.9a0964","type":"inject","z":"3f22f0c6.ff1328","name":"Go","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":170,"y":120,"wires":[["7e79800b.afb8a8"]]},{"id":"2b4d9297.75ee46","type":"comment","z":"3f22f0c6.ff1328","name":"Set the overlay text","info":"","x":190,"y":80,"wires":[]},{"id":"22dc37f9.b3b86","type":"function","z":"3f22f0c6.ff1328","name":"MSG Override","func":"// Override one or more rows\n// You can use from row1 to row4 to set the text\n// and from row1XY to row4XY to set the position in the format x,y (for example: 100,200)\n\n// Optionally set the channel. On NVR, this indicates the camera number\nmsg.channelid = 1;\n\n// Row 1\nmsg.row1 = \"Temperature: \" + msg.payload;\nmsg.row1XY = \"100,200\"; // Optionallly set the position\n\n// Row 2 (here we leave the position previosly set via the camera menu)\nmsg.row2 = \"Sun\";\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":320,"y":180,"wires":[["7e79800b.afb8a8"]]},{"id":"a91e43a0.ccbb2","type":"inject","z":"3f22f0c6.ff1328","name":"Go","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"22°c","payloadType":"str","x":170,"y":180,"wires":[["22dc37f9.b3b86"]]},{"id":"eb73371b.af5208","type":"Hikvision-config","host":"192.168.1.32","port":"80","name":"Server","authentication":"digest","protocol":"http","heartbeattimerdisconnectionlimit":"1","deviceinfo":"[object Object]"}]


Flow Messages

Pass anything you like as input msg, to set the text overlay.
You can override texts by passing some msg inputs. See samples below

Input

// Simply overlay the text set in the config window
msg.payload = true;
return msg;
// Override one or more rows
// You can use from row1 to row4 to set the text
// and from row1XY to row4XY to set the position in the format x,y (for example: 100,200)

// Optionally set the channel. On NVR, this indicates the camera number
msg.channelid = 1;

// Row 1
msg.row1 = "Temperature: " + msg.payload;
msg.row1XY = "100,200"; // Optionallly set the position

// Row 2 (here we leave the position previosly set via the camera menu)
msg.row2 = "Sun";

return msg;
// Delete all 4 rows
msg.row1 = "";
msg.row2 = "";
msg.row3 = "";
msg.row4 = "";
return msg;



XML NODE

This node allow you to send any XML you want to your devices.
Every device has own firmware, capabilities etc. so i decided to allow you to cover all your needs by adding this universal node.
Please read the ISAPI Hikvision documentation or dig into the Internet to learn what XML you can send. The limit is only your fantasy.

Copy this code and paste it into your flow

View code

Adjust the nodes according to your setup

[{"id":"3aa8a40f.9a0964","type":"inject","z":"3f22f0c6.ff1328","name":"Go","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":170,"y":120,"wires":[["49fbbee3.1cc7e"]]},{"id":"2b4d9297.75ee46","type":"comment","z":"3f22f0c6.ff1328","name":"Send your own XML","info":"","x":190,"y":80,"wires":[]},{"id":"49fbbee3.1cc7e","type":"hikvisionUltimateXML","z":"3f22f0c6.ff1328","name":"XML","server":"fb0c2de0.8a3da","XML":"<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<VideoOverlay version=\"1.0\" xmlns=\"http://www.hikvision.com/ver20/XMLSchema\">\n<fontSize>1</fontSize>\n<TextOverlayList size=\"6\">\n\n<TextOverlay version=\"1.0\" xmlns=\"http://www.hikvision.com/ver20/XMLSchema\">\n<id>1</id>\n<enabled>true</enabled>\n<positionX>464</positionX>\n<positionY>96</positionY>\n<displayText>HELLO WORLD</displayText>\n</TextOverlay>\n\n\n\n</TextOverlayList>\n</VideoOverlay>","path":"/ISAPI/System/Video/inputs/channels/1/overlays/text","method":"PUT","x":470,"y":120,"wires":[]},{"id":"fb0c2de0.8a3da","type":"Hikvision-config","host":"192.168.1.25","port":"80","name":"Radar Est","authentication":"digest","protocol":"http","heartbeattimerdisconnectionlimit":"1","deviceinfo":"{\"DeviceInfo\":{\"$\":{\"version\":\"1.0\",\"xmlns\":\"http://www.hikvision.com/ver20/XMLSchema\"},\"deviceName\":\"Net Module\",\"deviceID\":\"48443138-3031-3233-3932-988b0a858e51\",\"model\":\"CAM\",\"serialNumber\":\"20190509AARRD18012392\",\"macAddress\":\"BANANARAMA\",\"firmwareVersion\":\"V1.0.2\",\"firmwareReleasedDate\":\"build 191222\",\"hardwareVersion\":\"0x1001\",\"encoderVersion\":\"V5.0\",\"encoderReleasedDate\":\"build 000000\",\"deviceType\":\"Radar\",\"telecontrolID\":\"255\",\"localZoneNum\":\"8\",\"alarmOutNum\":\"4\",\"distanceResolution\":\"5.00\",\"detectDistance\":\"60.00\"}}"}]


Flow Messages

You can override all properties configured in the node, by passing some msg inputs. See samples below

Input

// Send your own XML to the device
// You can override the default config, with all these optional properties
// msg.method must be PUT, POST or GET (all uppercase)

msg.XML = ``; // Here goes your XML. These strange chars after the = allow you to do multiline text
msg.path = ""; // For example /ISAPI/System/Video/inputs/channels/1/overlays
msg.method = "PUT"; // This must be PUT, POST or GET (uppercase)

return msg;



RAW ALARM NODE

The RAW alarm node reacts to every message sent by the device. You can use this node when the other nodes doesn't fit your needs. It connects to NVR, Camera, Alarm system, Radars etc... and outputs the alarm received.

Flow Messages

The node outputs a payload on PIN 1 that can vary, depending on the alarm type sent by the connected device.
The node outputs a payload on PIN 2, representing a connection error. TRUE if error, otherwise FALSE
This below is an example of msg output (in this case, a movement detected from a radar)

Output PIN 1

msg.payload = {
    "topic": "",
    "payload": {
        "ipAddress": "192.168.1.25",
        "ipv6Address": "",
        "portNo": 80,
        "protocol": "HTTP",
        "macAddress": "banana",
        "channelID": 1,
        "dateTime": "2012-01-13T04:32:47+01:00",
        "activePostCount": 1,
        "eventType": "MultiRadarTargetEvent",
        "eventState": "active",
        "eventDescription": "MultiRadar Target Event",
        "MultiRadarTargetEventList": [
            {
                "targetID": 25,
                "isTargetDisappear": false,
                "targetType": "people",
                "Coordinate": {
                    "angle": 101.49,
                    "distance": 24.59
                },
                "speed": -0.2,
                "signalStrength": "strong",
                "TrackedInfoList": [],
                "trackedByIPC": false
            }
        ]
    },
    "_msgid": "dba1850a.2dc5e8"
}

Output PIN 2 (connection error)

msg = {
    "topic": "",
    "errorDescription": "", // This will contain the error rescription, in case of errors.
    "payload": false, // Or TRUE if error
    "_msgid": "dd5b3622.884a78"
}

HIKVISION DEVICES TESTED WITH THE NODE

This is a list of Hikvision models the users own and decided to share because it checked working with Hikvision-Ultimate.
This is only a partial model list. Hikvision-Ultimate should work with basically ALL Hikvision devices.
Click HERE to view the list of tested devices



Logo

Keywords

FAQs

Package last updated on 08 Apr 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc