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
51 stars 11 forks source link

channelid: "0" eveytime #20

Closed sgoudelis closed 3 years ago

sgoudelis commented 3 years ago

Hello,

The alarm messages I am getting from all cameras look like this:

object
payload: true
topic: ""
channelid: "0"
zone: 0
description: "Motion alarm"
_msgid: "8bf02a97.c12208"

Any ideas what I should look at to fix this?

Supergiovane commented 3 years ago

Hi What camera models are you using?

sgoudelis commented 3 years ago

Sorry I forgot to mention, my NVR is a DS-7608NXI-I2 / 4S

Supergiovane commented 3 years ago

Hi Have you applied any filter on the channel/zone in the hikvision-ultimate node? I need to view your flow. Can you export the affected nodes flow and paste it here?

sgoudelis commented 3 years ago
[
    {
        "id": "96157519.0e3098",
        "type": "hikvisionUltimateAlarm",
        "z": "5f97174a.93e3c8",
        "name": "",
        "topic": "",
        "server": "e80d9d2b.a4398",
        "reactto": "vmd",
        "devicetype": 0,
        "filterzone": "0",
        "alarmfilterduration": 0,
        "alarmfilterperiod": 0,
        "channelID": "0",
        "x": 310,
        "y": 1900,
        "wires": [
            [
                "e29f4890.8145e8"
            ],
            [
                "e29f4890.8145e8"
            ]
        ]
    },
    {
        "id": "e80d9d2b.a4398",
        "type": "Hikvision-config",
        "host": "redacted",
        "port": "80",
        "name": "nvr",
        "authentication": "digest",
        "protocol": "http",
        "heartbeattimerdisconnectionlimit": "2",
        "deviceinfo": "{\"DeviceInfo\":{\"$\":{\"version\":\"1.0\",\"xmlns\":\"http://www.hikvision.com/ver20/XMLSchema\"},\"deviceName\":\"nvr\",\"deviceID\":\"48433830-3636-3732-3734-4447cccf8217\",\"model\":\"DS-7608NXI-I2/4S\",\"serialNumber\":\"DS-7608NXI-I2/4S0820181218CCRRC80667274WCVU\",\"macAddress\":\"44:47:cc:cf:82:17\",\"firmwareVersion\":\"V4.1.18\",\"firmwareReleasedDate\":\"build 200120\",\"encoderVersion\":\"V5.0\",\"encoderReleasedDate\":\"build 200109\",\"deviceType\":\"DVR\",\"telecontrolID\":\"255\"}}"
    }
]
Supergiovane commented 3 years ago

Ok please let me some time. Tomorrow morning once in office, i’ll take a look!

sgoudelis commented 3 years ago

Yeah, sure no problem

Supergiovane commented 3 years ago

Hello Stratos i've tested yet with an DS-7616NI-I2 NVR and the resulting payload is OK.

Node-RED

What type of cameras do you have attached to your nvr?

sgoudelis commented 3 years ago

Good morning,

I have a DS-2CD2347G1-LU and two DS-2CD2043G0-I20

Supergiovane commented 3 years ago

They are pretty new. Do you have updated the NVR firmware?

I need to ditch into what your NVR tells to the node via the API. If you're able to send me a log, please add banana to the end of your NVR IP.

Like this: I need either a screenshot of the debug's window or a terminal node-red text log immediately after you received a motion alarm from your NVR:

massimosaccani_—_node-red_TMPDIR__var_folders_8s__4sx2m0s0p3g70ynb0gf84tr0000gn_T____CFBundleIdentifier_com_apple_Terminal_—_80×24_e_Node-RED
sgoudelis commented 3 years ago

hikvision.log I think this is what you are looking for.

Supergiovane commented 3 years ago

Hi exactly, but it contains only "videoloss alarm". This is not an alarm, is the Hikvision's "funky" way to do an heartbeat, telling the receiver that the NVR is alive. I need the log after you had a "motion alarm" event.

sgoudelis commented 3 years ago

hikvision 2.txt

I think this has some Motion alarms in there

Supergiovane commented 3 years ago

Ok got it. Despite your NVR tells that it's using API Version 2.0, they don't adhere 100% to it. Not so strange with Hikvision. Please let me some minutes to fix the issue...

Supergiovane commented 3 years ago

Hi V. 1.0.49 is out with the fix. You should see the new version in minutes. Please let me know if it solved your issue.

sgoudelis commented 3 years ago

I am still waiting for node-red to pick up the new version. Is there a way to trigger an update so that node-red knows there is a new version ? Or does it just take time ?

Supergiovane commented 3 years ago

Nope. You can only wait.

sgoudelis commented 3 years ago

Ok its updated. I am getting this now.

"BANANA SBANANATO XML -> JSON {"EventNotificationAlert":{"$":{"version":"1.0","xmlns":"http://www.hikvision.com/ver20/XMLSchema"},"ipAddress":"192.168.60.25","portNo":"80","protocol":"HTTP","macAddress":"44:47:cc:cf:82:17","dynChannelID":"4","dateTime":"2021-07-01T09:54:13+02:00","activePostCount":"33","eventType":"VMD","eventState":"active","eventDescription":"Motion alarm"}}"

The id (dynChannelID) 4 is correct for that camera. But the rest of the messages still have channelid 0.

Supergiovane commented 3 years ago

You can delete the "banana" and look at the debug node. It should be OK. Your NVR doesnt' send the channelID, only the dynChannelID.

sgoudelis commented 3 years ago

I deleted the "banana" string and the payload of the message looks like this:

object
payload: true
topic: ""
channelid: "0"
zone: 0
description: "Motion alarm"
_msgid: "503354bd.be950c"

I do not see anything related in the node-red console output. Am I missing something ? How can I use the dynChannelID ?

Supergiovane commented 3 years ago

You see again "0"? You should now see 4. I take a loog again. Be patient for a minute.

Supergiovane commented 3 years ago

Can you please restart node-red?

sgoudelis commented 3 years ago

I just did again, i get the same behavior.

Supergiovane commented 3 years ago

Ok. Let me some more time. Unfortunately, that's not simple to reproduce without your NVR

Supergiovane commented 3 years ago

Hi again. I tested again, by reproducing your message and it works. Can you please paste the content of this zip file, into your .node-red/node_modules/node-red-contrib-hikvision-ultimate/nodes folder and restart node-red. You should see "Stratos" after the channelID. I need to be sure you have the latest version.

hikvisionUltimateAlarm.js.zip

sgoudelis commented 3 years ago

I got this now:

object
payload: true
topic: ""
channelid: "4Stratos"
zone: 0
description: "Motion alarm"
_msgid: "20072864.c7e028"
Supergiovane commented 3 years ago

Yes, so it works. ChannelID is 4. Are you sure to have updated hikvision ultimate to 1.0.49? Here the same file without Stratos. hikvisionUltimateAlarm.js.zip

sgoudelis commented 3 years ago

Yeah thats weird it did not update and I thought it did because I saw the new version already installed and now I see that it did not updated earlier. I just updated and restarted and everything works fine. Thank you very much, you are a wonderful person!

Supergiovane commented 3 years ago

Good to know. Thank you to you for raising the issue. If you have other trouble, let me know. Cheers from Italy.