henry-spanka / node-red-contrib-hikvision

Hikvision API for Node Red
MIT License
10 stars 1 forks source link

event-node expeption/error #6

Closed ozett closed 4 years ago

ozett commented 4 years ago

i am testing with 4 cameras to catch the line-crossing events... from time to time my node-red dies with this error:

28 Oct 19:39:42 - [red] Uncaught Exception:
28 Oct 19:39:42 - TypeError: Cannot read property 'eventType' of undefined
    at parser.parseString (/root/.node-red/node_modules/node-hikvision-api/Hikvision.js:189:60)
    at Parser.<anonymous> (/root/.node-red/node_modules/node-hikvision-api/node_modules/xml2js/lib/parser.js:306:18)
    at Parser.emit (events.js:189:13)
    at Parser.EventEmitter.emit (domain.js:441:20)
    at SAXParser.onclosetag (/root/.node-red/node_modules/node-hikvision-api/node_modules/xml2js/lib/parser.js:264:26)
    at emit (/root/.node-red/node_modules/sax/lib/sax.js:640:35)
    at emitNode (/root/.node-red/node_modules/sax/lib/sax.js:645:5)
    at closeTag (/root/.node-red/node_modules/sax/lib/sax.js:905:7)
    at SAXParser.write (/root/.node-red/node_modules/sax/lib/sax.js:1449:13)
    at Parser.exports.Parser.Parser.parseString (/root/.node-red/node_modules/node-hikvision-api/node_modules/xml2js/lib/parser.js:325:31)
    at Parser.parseString (/root/.node-red/node_modules/node-hikvision-api/node_modules/xml2js/lib/parser.js:5:59)
    at Hikvision.handleData (/root/.node-red/node_modules/node-hikvision-api/Hikvision.js:187:16)
    at Socket.emit (events.js:189:13)
    at Socket.EventEmitter.emit (domain.js:441:20)
    at addChunk (_stream_readable.js:288:12)
    at readableAddChunk (_stream_readable.js:269:11)
    at Socket.Readable.push (_stream_readable.js:224:10)
    at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:145:17)
root@deb8mpd-virt:~/.node-red#

any help or hints on this?

ozett commented 4 years ago

image

looks ok...anything i can check on this with the events or....?

ozett commented 4 years ago

https://github.com/nayrnet/node-hikvision-api/blob/master/hikvision.js#L179

looks like an exeption for unknown event-types (catch-all-other) is missing? if i could code it -- i would... 😭

ozett commented 4 years ago

something like here for "undefined"..?

https://github.com/Tsopic/hikvision-node-eventSubscribe/blob/master/cameraEventHandler.js#L134

henry-spanka commented 4 years ago

I didn't notice that before but I think some cameras send some kind of keep alive messages. Unfortunately this must be fixed in the Hikvision API project. I will probably fork the repository and do it myself as the API is not really maintained anymore.

ozett commented 4 years ago

.... I will probably fork the repository and do it myself as the API is not really maintained anymore.

that would be all the BEST!!!!! (original project seems abandoned)

i am no coder, but looks like only a exeption missing.. i am willing to help as much as i can....maybe testing again after fix...

🎉 🎉 🎉 👍

henry-spanka commented 4 years ago

No problem. Should be fixed. Please check if it still crashes.

ozett commented 4 years ago

how do i check? i tried to install the master right this minute, but got errors.. https://github.com/henry-spanka/node-red-contrib-hikvision/issues/4#issuecomment-547110782

henry-spanka commented 4 years ago

Yeah, I screwed up. Sorry! Try again.