Supergiovane / node-red-contrib-hikvision-ultimate

A native set of node for Hikvision Cameras, Doorbells, Alarms, Radars etc.
https://www.facebook.com/supergiovaneDev
MIT License
46 stars 12 forks source link

Events and raw events channelID is always 3 #59

Closed E1cid closed 6 months ago

E1cid commented 6 months ago

Hi, this is my first look at your Hikvision node, Just set it up with Annke DW8KD, Set up was easy thank you for you work and effort.

Describe the bug All messages received have a channelID of 3. The NVR is set up with 5 cameras and receive push notifications to App(Annke vission) with the correct channels.

not sure if this is a node bug or an Annke issue. To Reproduce

This is the flow i am running in Node-red that should show bug,

[{"id":"ebe2c455ba98e980","type":"hikvisionUltimateAlarmRaw","z":"d1395164b4eec73e","name":"","topic":"","server":"57396bb160431248","x":450,"y":4600,"wires":[["cab57abb03a1bc86"],[]]},{"id":"48977067315883f2","type":"debug","z":"d1395164b4eec73e","name":"debug 2473","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload.eventDescription","statusType":"msg","x":1010,"y":4540,"wires":[]},{"id":"cab57abb03a1bc86","type":"trigger","z":"d1395164b4eec73e","name":"","op1":"","op2":"","op1type":"pay","op2type":"nul","duration":"5","extend":true,"overrideDelay":false,"units":"s","reset":"","bytopic":"topic","topic":"payload.channelID","outputs":1,"x":640,"y":4580,"wires":[["023e21c1a9692a35"]]},{"id":"023e21c1a9692a35","type":"change","z":"d1395164b4eec73e","name":"","rules":[{"t":"set","p":"temp","pt":"msg","to":"[\"\",\"camera_rear\",\"camera_garden\",\"camera_front\",\"camera_side\",\"spare_5\"]","tot":"json"},{"t":"set","p":"payload.channelName","pt":"msg","to":"temp[msg.payload.channelID]","tot":"msg"},{"t":"set","p":"#:(file)::camera_motion[msg.payload.eventDescription][msg.payload.channelName]","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":4600,"wires":[["48977067315883f2"]]},{"id":"57396bb160431248","type":"Hikvision-config","host":"192.168.1.12","port":"80","name":"home cctv","authentication":"digest","protocol":"http","heartbeattimerdisconnectionlimit":"2","deviceinfo":"{\"?xml\":\"\",\"DeviceInfo\":{\"deviceName\":\"home cctv\",\"deviceID\":\"48414735-3538-3436-3134-3c1bf8098885\",\"model\":\"DW81KD\",\"serialNumber\":\"DW81KD0820230913CCWRAG5584614WCVU\",\"macAddress\":\"3c:1b:f8:09:88:85\",\"firmwareVersion\":\"V4.26.131\",\"firmwareReleasedDate\":\"build 230707\",\"encoderVersion\":\"V5.0\",\"encoderReleasedDate\":\"build 220905\",\"deviceType\":\"IPC\",\"telecontrolID\":255,\"hardwareVersion\":202293808}}","debuglevel":"no"}]

This is always the payload received from raw node no matter the camera that triggers event


{
    "ipAddress": "192.168.1.12",
    "portNo": 80,
    "protocol": "HTTP",
    "macAddress": "fe:1b:f8eo:09:88:85",
    "channelID": 3,
    "dateTime": "2024-01-21T18:41:2100:00",
    "activePostCount": 3,
    "eventType": "VMD",
    "eventState": "active",
    "eventDescription": "Motion alarm"
}
``

**Expected behavior**
ChannelId to range from 1 - 5

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Hikvision-Ultimate Version**
 node-red-contrib-hikvision-ultimate
1.1.14

**Are you running node-red behind homematic, docker or anything similar?**
 Node-Red running alone in termux android box

**Additional context**
nodejs 20.2.0
node-red 3.1.3
Supergiovane commented 6 months ago

Hi Tomorrow i’ll take a look!

E1cid commented 6 months ago

OK, cheers. Here is the response to the flow posted For events motion ,video loss and tamper,. Removed most data for ease of viewing. It would seem that motion alarm events is the only alarm event that is only outputting channelID 3. I triggered all 5 cameras with motion events and video loss events, i only triggered 2 cameras with tamper events.

{
    "Motion alarm": {
        "camera_front": {
            "channelID": 3,
        }
    },
    "videoloss alarm": {
        "spare_5": {
            "channelID": 5,
        },
        "camera_garden": {
            "channelID": 2,
        },
        "camera_side": {
            "channelID": 4,
        },
        "camera_front": {
            "channelID": 3,
        },
        "camera_rear": {
            "channelID": 1,
        }
    },
    "shelteralarm alarm": {
        "spare_5": {
            "channelID": 5,
        },
        "camera_garden": {
            "channelID": 2,
        }
    }
}
Supergiovane commented 6 months ago

Hi i've tested yet again with my Hikvision NVR and it works correctly. I've saw, you wrote .channelID in camel case, but you should use lowercase. Please see this screenshot:

Node-RED___Flow_2

Please change channelID to channelid in all your nodes and retry.

E1cid commented 6 months ago

I copied and pasted the incoming alarm from raw node, and it is camel case. It strange as the video loss alarms are correct, as are the tamper alarms. This may be an issue in the Annke software, thought I would check with you before raising it with Annke.

[edit] The event node has channelid. The raw event node has payload.channelID.

Both only ever state 3 no matter which camera gives motion alarm.

Supergiovane commented 6 months ago

Hi, the RAW node, outputs the raw data coming from your NVR or Camera. If you enable the debug log, you can wiew it in your console and maybe paste it here, so i can understand, what the Annke told us. Please add a banana here, and restart node-red.

Node-RED___192_168_1_16

Thanks.

E1cid commented 6 months ago

Adding 192.168.1.12banana result

"Hikvision-config: FETCH ERROR: request to http://192.168.1.12banana/ISAPI/Event/notification/alertStream failed, reason: getaddrinfo ENOTFOUND 192.168.1.12banana"

without banana and debug set

<EventNotificationAlert version="1.0" xmlns="http://www.std-cgi.com/ver20/XMLSchema">
<ipAddress>192.168.1.12</ipAddress>
<portNo>80</portNo>
<protocol>HTTP</protocol>
<macAddress>3c:1b:f8:09:88:85</macAddress>
<channelID>0</channelID>
<dateTime>2024-01-22T11:46:3100:00</dateTime>
<activePostCount>0</activePostCount>
<eventType>videoloss</eventType>
<eventState>inactive</eventState>
<eventDescription>videoloss alarm</eventDescription>
</EventNotificationAlert>
"BANANA SBANANATO XML -> JSON {"EventNotificationAlert":{"ipAddress":"192.168.1.12","portNo":80,"protocol":"HTTP","macAddress":"3c:1b:f8:09:88:85","channelID":0,"dateTime":"2024-01-22T11:46:3100:00","activePostCount":0,"eventType":"videoloss","eventState":"inactive","eventDescription":"videoloss alarm"}}"
BANANA PROCESSING
Content-Type: application/xml; charset="UTF-8"
Content-Length: 465

<EventNotificationAlert version="1.0" xmlns="http://www.std-cgi.com/ver20/XMLSchema">
<ipAddress>192.168.1.12</ipAddress>
<portNo>80</portNo>
<protocol>HTTP</protocol>
<macAddress>3c:1b:f8:09:88:85</macAddress>
<channelID>0</channelID>
<dateTime>2024-01-22T11:46:4100:00</dateTime>
<activePostCount>0</activePostCount>
<eventType>videoloss</eventType>
<eventState>inactive</eventState>
<eventDescription>videoloss alarm</eventDescription>
</EventNotificationAlert>
22/01/2024, 11:46:41
msg : string[304]
"BANANA SBANANATO XML -> JSON {"EventNotificationAlert":{"ipAddress":"192.168.1.12","portNo":80,"protocol":"HTTP","macAddress":"3c:1b:f8:09:88:85","channelID":0,"dateTime":"2024-01-22T11:46:4100:00","activePostCount":0,"eventType":"videoloss","eventState":"inactive","eventDescription":"videoloss alarm"}}"

22/01/2024, 11:44:36
msg : string[161]
"Hikvision-config: FETCH ERROR: request to http://192.168.1.12banana/ISAPI/Event/notification/alertStream failed, reason: getaddrinfo ENOTFOUND 192.168.1.12banana"
22/01/2024, 11:45:16
msg : string[161]
"Hikvision-config: FETCH ERROR: request to http://192.168.1.12banana/ISAPI/Event/notification/alertStream failed, reason: getaddrinfo ENOTFOUND 192.168.1.12banana"
22/01/2024, 11:45:58
msg : string[161]
"Hikvision-config: FETCH ERROR: request to http://192.168.1.12banana/ISAPI/Event/notification/alertStream failed, reason: getaddrinfo ENOTFOUND 192.168.1.12banana"
22/01/2024, 11:46:32
msg : string[555]
string[555]
BANANA PROCESSING
Content-Type: application/xml; charset="UTF-8"
Content-Length: 465

<EventNotificationAlert version="1.0" xmlns="http://www.std-cgi.com/ver20/XMLSchema">
<ipAddress>192.168.1.12</ipAddress>
<portNo>80</portNo>
<protocol>HTTP</protocol>
<macAddress>3c:1b:f8:09:88:85</macAddress>
<channelID>0</channelID>
<dateTime>2024-01-22T11:46:3100:00</dateTime>
<activePostCount>0</activePostCount>
<eventType>videoloss</eventType>
<eventState>inactive</eventState>
<eventDescription>videoloss alarm</eventDescription>
</EventNotificationAlert>
22/01/2024, 11:46:32
msg : string[304]
"BANANA SBANANATO XML -> JSON {"EventNotificationAlert":{"ipAddress":"192.168.1.12","portNo":80,"protocol":"HTTP","macAddress":"3c:1b:f8:09:88:85","channelID":0,"dateTime":"2024-01-22T11:46:3100:00","activePostCount":0,"eventType":"videoloss","eventState":"inactive","eventDescription":"videoloss alarm"}}"
22/01/2024, 11:46:41
msg : string[555]
string[555]
BANANA PROCESSING
Content-Type: application/xml; charset="UTF-8"
Content-Length: 465

<EventNotificationAlert version="1.0" xmlns="http://www.std-cgi.com/ver20/XMLSchema">
<ipAddress>192.168.1.12</ipAddress>
<portNo>80</portNo>
<protocol>HTTP</protocol>
<macAddress>3c:1b:f8:09:88:85</macAddress>
<channelID>0</channelID>
<dateTime>2024-01-22T11:46:4100:00</dateTime>
<activePostCount>0</activePostCount>
<eventType>videoloss</eventType>
<eventState>inactive</eventState>
<eventDescription>videoloss alarm</eventDescription>
</EventNotificationAlert>
22/01/2024, 11:46:41
msg : string[304]
"BANANA SBANANATO XML -> JSON {"EventNotificationAlert":{"ipAddress":"192.168.1.12","portNo":80,"protocol":"HTTP","macAddress":"3c:1b:f8:09:88:85","channelID":0,"dateTime":"2024-01-22T11:46:4100:00","activePostCount":0,"eventType":"videoloss","eventState":"inactive","eventDescription":"videoloss alarm"}}"
22/01/2024, 11:46:50
msg : string[555]
string[555]
BANANA PROCESSING
Content-Type: application/xml; charset="UTF-8"
Content-Length: 465

<EventNotificationAlert version="1.0" xmlns="http://www.std-cgi.com/ver20/XMLSchema">
<ipAddress>192.168.1.12</ipAddress>
<portNo>80</portNo>
<protocol>HTTP</protocol>
<macAddress>3c:1b:f8:09:88:85</macAddress>
<channelID>0</channelID>
<dateTime>2024-01-22T11:46:5000:00</dateTime>
<activePostCount>0</activePostCount>
<eventType>videoloss</eventType>
<eventState>inactive</eventState>
<eventDescription>videoloss alarm</eventDescription>
</EventNotificationAlert>
22/01/2024, 11:46:50
msg : string[304]
"BANANA SBANANATO XML -> JSON {"EventNotificationAlert":{"ipAddress":"192.168.1.12","portNo":80,"protocol":"HTTP","macAddress":"3c:1b:f8:09:88:85","channelID":0,"dateTime":"2024-01-22T11:46:5000:00","activePostCount":0,"eventType":"videoloss","eventState":"inactive","eventDescription":"videoloss alarm"}}"
22/01/2024, 11:47:00
msg : string[555]
string[555]
BANANA PROCESSING
Content-Type: application/xml; charset="UTF-8"
Content-Length: 465

<EventNotificationAlert version="1.0" xmlns="http://www.std-cgi.com/ver20/XMLSchema">
<ipAddress>192.168.1.12</ipAddress>
<portNo>80</portNo>
<protocol>HTTP</protocol>
<macAddress>3c:1b:f8:09:88:85</macAddress>
<channelID>0</channelID>
<dateTime>2024-01-22T11:46:5900:00</dateTime>
<activePostCount>0</activePostCount>
<eventType>videoloss</eventType>
<eventState>inactive</eventState>
<eventDescription>videoloss alarm</eventDescription>
</EventNotificationAlert>
22/01/2024, 11:47:00
msg : string[304]
"BANANA SBANANATO XML -> JSON {"EventNotificationAlert":{"ipAddress":"192.168.1.12","portNo":80,"protocol":"HTTP","macAddress":"3c:1b:f8:09:88:85","channelID":0,"dateTime":"2024-01-22T11:46:5900:00","activePostCount":0,"eventType":"videoloss","eventState":"inactive","eventDescription":"videoloss alarm"}}"
22/01/2024, 11:47:04
msg : string[544]
"BANANA PROCESSING↵Content-Type: application/xml; charset="UTF-8"↵Content-Length: 454↵↵<EventNotificationAlert version="1.0" xmlns="http://www.std-cgi.com/ver20/XMLSchema">↵<ipAddress>192.168.1.12</ipAddress>↵<portNo>80</portNo>↵<protocol>HTTP</protocol>↵<macAddress>3c:1b:f8:09:88:85</macAddress>↵<channelID>3</channelID>↵<dateTime>2024-01-22T11:47:0300:00</dateTime>↵<activePostCount>1</activePostCount>↵<eventType>VMD</eventType>↵<eventState>active</eventState>↵<eventDescription>Motion alarm</eventDescription>↵</EventNotificationAlert>↵"
22/01/2024, 11:47:04
msg : string[293]
"BANANA SBANANATO XML -> JSON {"EventNotificationAlert":{"ipAddress":"192.168.1.12","portNo":80,"protocol":"HTTP","macAddress":"3c:1b:f8:09:88:85","channelID":3,"dateTime":"2024-01-22T11:47:0300:00","activePostCount":1,"eventType":"VMD","eventState":"active","eventDescription":"Motion alarm"}}"
22/01/2024, 11:47:04
msg : string[544]
"BANANA PROCESSING↵Content-Type: application/xml; charset="UTF-8"↵Content-Length: 454↵↵<EventNotificationAlert version="1.0" xmlns="http://www.std-cgi.com/ver20/XMLSchema">↵<ipAddress>192.168.1.12</ipAddress>↵<portNo>80</portNo>↵<protocol>HTTP</protocol>↵<macAddress>3c:1b:f8:09:88:85</macAddress>↵<channelID>3</channelID>↵<dateTime>2024-01-22T11:47:0400:00</dateTime>↵<activePostCount>2</activePostCount>↵<eventType>VMD</eventType>↵<eventState>active</eventState>↵<eventDescription>Motion alarm</eventDescription>↵</EventNotificationAlert>↵"
22/01/2024, 11:47:04
msg : string[293]
"BANANA SBANANATO XML -> JSON {"EventNotificationAlert":{"ipAddress":"192.168.1.12","portNo":80,"protocol":"HTTP","macAddress":"3c:1b:f8:09:88:85","channelID":3,"dateTime":"2024-01-22T11:47:0400:00","activePostCount":2,"eventType":"VMD","eventState":"active","eventDescription":"Motion alarm"}}"
22/01/2024, 11:47:06
msg : string[544]
string[544]
BANANA PROCESSING
Content-Type: application/xml; charset="UTF-8"
Content-Length: 454

<EventNotificationAlert version="1.0" xmlns="http://www.std-cgi.com/ver20/XMLSchema">
<ipAddress>192.168.1.12</ipAddress>
<portNo>80</portNo>
<protocol>HTTP</protocol>
<macAddress>3c:1b:f8:09:88:85</macAddress>
<channelID>3</channelID>
<dateTime>2024-01-22T11:47:0500:00</dateTime>
<activePostCount>3</activePostCount>
<eventType>VMD</eventType>
<eventState>active</eventState>
<eventDescription>Motion alarm</eventDescription>
</EventNotificationAlert>
"BANANA SBANANATO XML -> JSON {"EventNotificationAlert":{"ipAddress":"192.168.1.12","portNo":80,"protocol":"HTTP","macAddress":"3c:1b:f8:09:88:85","channelID":3,"dateTime":"2024-01-22T11:47:0500:00","activePostCount":3,"eventType":"VMD","eventState":"active","eventDescription":"Motion alarm"}}"

Motion alarm output from raw node

{"ipAddress":"192.168.1.12","portNo":80,"protocol":"HTTP","macAddress":"3c:1b:f8:09:88:85","channelID":3,"dateTime":"2024-01-22T11:47:0500:00","activePostCount":3,"eventType":"VMD","eventState":"active","eventDescription":"Motion alarm"}
BANANA PROCESSING
Content-Type: application/xml; charset="UTF-8"
Content-Length: 465

<EventNotificationAlert version="1.0" xmlns="http://www.std-cgi.com/ver20/XMLSchema">
<ipAddress>192.168.1.12</ipAddress>
<portNo>80</portNo>
<protocol>HTTP</protocol>
<macAddress>3c:1b:f8:09:88:85</macAddress>
<channelID>0</channelID>
<dateTime>2024-01-22T11:47:1500:00</dateTime>
<activePostCount>0</activePostCount>
<eventType>videoloss</eventType>
<eventState>inactive</eventState>
<eventDescription>videoloss alarm</eventDescription>
</EventNotificationAlert>
Supergiovane commented 6 months ago

Hi, thank you for the very detailed infos.

This is only an "heartbeat" signal, used to monitor the NVR status.

<activePostCount>0</activePostCount>
<eventType>videoloss</eventType>
<eventState>inactive</eventState>
<eventDescription>videoloss alarm</eventDescription>

The other event: Motion alarm has always the channelID = 3. If you get the channelID = 3 by testing the motion event of each camera, that means that the NVR sends a wrong channel ID.

E1cid commented 6 months ago

Ok that's what I thought. Cheers for your time. Looks like I need to contact Annke support. I will close the issue if you have not done so already