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

[Support] Start/Stop-Events for Linedetection? #31

Closed ozett closed 2 years ago

ozett commented 2 years ago

Hello Supergiovane, great moduel! thanks!

Describe the bug longtime user auf node-red-contrib-hikvision v1.1.0. now i found your node. seems to be better supported and more information. but i am missing start/stop events for (Line-)Detections. How do i get them?

Screenshots from node-red-contrib-hikvision v1.1.0. : image

Hikvision-Ultimate Version 1.0.56

Are you running node-red behind homematic, docker or anything similar? Node-Red running alone in ubuntu 20.x lts

Additional context like to use ony starting events ... but cannot filter on this... in your node, i only see always same eventState": "active"

Supergiovane commented 2 years ago

Hi If i recall correctly, Line detection does have only one event, that is “Active”. If you want to ditch into that, please use RAW Alarm node to obtain all events emitted from your camera.

ozett commented 2 years ago

verysuperquick reply, thanks. i will lookup the RAW Alarm and see if i can build a trigger only for start, but the other node seems to have some coding for start/stop. https://github.com/henry-spanka/node-hikvision-api/blob/master/Hikvision.js#L200 as i am no coder, i cannot qualify if its maybe possible to take this into your node... 🤔

ozett commented 2 years ago

i will experiment with the raw alarm, thanks for that hint. hope it works out for start/stop... image

Supergiovane commented 2 years ago

Hi Yes, but natively, start and stop events are emitted only for some smart events. There are many hikvision firmware versions and each of that, can do things differently. Hikvision-ultimate must handle all these firmwares, so i must “stick” with standards command as mich as possible.

ozett commented 2 years ago

sorry to bother a last time, but it looks like active/inactive is the natural toggle of the eventstate. you have it already in for emtpy-detection https://github.com/Supergiovane/node-red-contrib-hikvision-ultimate/blob/c6ec6053618d504619e398a3e001999abb50c4a3/nodes/hikvisionUltimateAlarm.js#L272

dont you want to put in a toggle active/inactive ? looks no great deal to a noob. (but dont do it only for me..was just a curious idea because nearly already there..)

edit: 2nd thought: shouldnt the raw-node show up "inactive" when it comes raw-in from the cam?

-- image

Supergiovane commented 2 years ago

Hi I grab what your cam outputs. I take the raw message and use that for various events in the alarm node. If the camera doesn’t emit the “inactive” event, i cannot handle that. Often a cam doesn’t even emit an “active” event! For event trapping, i must read other properties in the event stream. I’ve no seen how the other node works, but maybe it traps the “inactive” event coming from other stream events than the line crossing. For example, a cam can stream the event line crossing and the event “intrusion detection” simultaneously and for more than one zone. Hikvision-ultimate can handle that and, to do that, it must obey to the events emitted from the camera. Sincerely, there are many API version and firmware versions behaving differently. The IVMS app can handle all these different versions because there is a developer task force behind that, well knowing the API. We as open source devs, are alone with poor documentartion. This shows you, how terrifyng is working with hik undocumented (or bad documented) apis. Unfortunately i cannot change the current behavior, because it can impact with other users. Can you simply trap the “active” event and work only that? Alarm node does emit an event everytime someone crosses the line. You could then force the “inactive” event manually with a function node, for example, if you need that. I hope you understand. I wish to help you, but i’m limited to the events your cam streams.

ozett commented 2 years ago

Great (and detailed) Answer, thanks. i supected that a simple linecrossing could barely have a stop. maybe only if you configure bi-directional smart-events for lines. What is possible on some of my hikvision cams. i am new to your node, looks great and i will play around with it the next days to see what i can do with it in my homeautomation and AI-NVR. thanks so far, regards.toz