Node-red-contrib-onvif-nodes macOS

Can you please specify step by step what you do (and with which of my nodes: Discovery node, Event node, ...) to get that error. I need to be able to reproduce it, in order to fix it.

  1. Have you also enabled you events in the web interface of your camera as I explained? Because if you don't tell your camera which events it needs to stream, then it won't stream any events.
  2. Which info is being displayed in the Event node status (i.e. the text that appears directly below the event node rectangle)?
  3. Do you see errors in the Debug sidepanel or in the Node-RED log?

Seems that there was 3 days ago a new version released of the onvif library that I use. They now allow to catch exceptions caused by responses from cameras that cannot be parsed. Perhaps that might be the case here. Don't know... I have asked them here for more information. But meanwhile I have again pushed a fix to github to show such errors in the Node-RED Debug sidebar. So if you can again install my node and then see in the Debug sidebar - after you have triggered the Discovery node - if we get extra information.

Yes I did.

I used the following flow

[{"id":"a19788d1.afaf98","type":"onvif-discovery","z":"50df184.124f2e8","name":"","timeout":5,"separate":true,"x":500,"y":480,"wires":[["ed0cc23.44c014"]]},{"id":"be6e8353.f7716","type":"inject","z":"50df184.124f2e8","name":"Start searching","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":280,"y":480,"wires":[["a19788d1.afaf98"]]},{"id":"ed0cc23.44c014","type":"debug","z":"50df184.124f2e8","name":"Onvif devices","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":700,"y":480,"wires":[]}]

Since we did not find a device.

When I use this flow and enter the IP address of the camera and user and password I get the following error.

TypeError: Cannot read property 'device' of undefined

[{"id":"748f5110.c57f7","type":"inject","z":"b3db206e.b7139","name":"Start listening","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":150,"y":1020,"wires":[["12ad9448.0899fc"]]},{"id":"12ad9448.0899fc","type":"change","z":"b3db206e.b7139","name":"","rules":[{"t":"set","p":"action","pt":"msg","to":"start","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":460,"y":1020,"wires":[["a8f7752e.2998f8"]]},{"id":"801f0dd.3e0b3f","type":"inject","z":"b3db206e.b7139","name":"Stop listening","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":150,"y":1060,"wires":[["b7dc815b.29f4a"]]},{"id":"b7dc815b.29f4a","type":"change","z":"b3db206e.b7139","name":"","rules":[{"t":"set","p":"action","pt":"msg","to":"stop","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":460,"y":1060,"wires":[["a8f7752e.2998f8"]]},{"id":"2774034b.91102c","type":"inject","z":"b3db206e.b7139","name":"Get event properties","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":1140,"wires":[["e59923ee.4db8d"]]},{"id":"e59923ee.4db8d","type":"change","z":"b3db206e.b7139","name":"","rules":[{"t":"set","p":"action","pt":"msg","to":"getEventProperties","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":460,"y":1140,"wires":[["a8f7752e.2998f8"]]},{"id":"120e35a2.b4da5a","type":"inject","z":"b3db206e.b7139","name":"Get event service capabilities","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":200,"y":1100,"wires":[["2c1017b7.e2e448"]]},{"id":"2c1017b7.e2e448","type":"change","z":"b3db206e.b7139","name":"","rules":[{"t":"set","p":"action","pt":"msg","to":"getEventServiceCapabilities","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":460,"y":1100,"wires":[["a8f7752e.2998f8"]]},{"id":"a8f7752e.2998f8","type":"onvif-events","z":"b3db206e.b7139","name":"","deviceConfig":"c6b46a46.8067f8","action":"","x":670,"y":1020,"wires":[["61d49191.38fb9"]]},{"id":"61d49191.38fb9","type":"switch","z":"b3db206e.b7139","name":"Topic ProcessorUsage","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"Monitoring/ProcessorUsage","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":880,"y":1020,"wires":[["9d4463a2.1d43d"]]},{"id":"9d4463a2.1d43d","type":"change","z":"b3db206e.b7139","name":"Get value","rules":[{"t":"set","p":"payload","pt":"msg","to":"data.value","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1080,"y":1020,"wires":[["97abe077.30ed"]]},{"id":"97abe077.30ed","type":"ui_chart","z":"b3db206e.b7139","name":"Camera CPU %","group":"22787703.a0e968","order":2,"width":0,"height":0,"label":"Camera CPU %","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"0","ymax":"110","removeOlder":1,"removeOlderPoints":"50","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":1260,"y":1020,"wires":[[]]},{"id":"c6b46a46.8067f8","type":"onvif-config","z":"","xaddress":"192.168.1.174","port":"80","name":"Hikvision"},{"id":"22787703.a0e968","type":"ui_group","z":"","name":"Web push notifications","tab":"80f0e178.bbf4a","disp":true,"width":"6","collapse":false},{"id":"80f0e178.bbf4a","type":"ui_tab","z":"","name":"Home","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

Yes is activated on the camera.
The status is OK.

@madmax,
Thanks for the feedback. Will have a look later, because it is the lady her birthday today. Which means limited Node-RED time today :slight_smile:

As you can see here I am also trying to find bugs in the discovery process meanwhile...

When I look at your corresponding screenshot, the Event node has status "disconnected":

image

When the node is disconnected, that is normally due to wrong ip/port/username/password. But of course there can also be a bug in the code. Because the whole (dis)connect recently has been rewritten for this issue, but it is not tested yet by the people that can reproduce the issue.

But I can imagine that a disconnected node results in errors like "TypeError: Cannot read property 'device' of undefined". Of course the message should become user friendly...

Does this error appear when you inject a message via the "start listening" button???

Ok thanks for confirming that!

I don't see any node status:

image

Is there also no status visible when you have injected an input message, to start the discovery?

I found also a bug in my discovery node, which I need to solve somehow (see discussion).

Seems other people with such a camera had the same issue with the library that I'm using ;-(

The IP address and the access data were correct.

The error comes when I click on start listening.

I only get the status that no device was found.

Which camera do you use?
I would like one that automatically recognizes people, cars and everything. It has to go via wifi.

Hmm I should have the possibility to debug this. Is there a possibility that you setup port forwarding to that cam on your router, and send me a private message with ip adress/username/password? You can cover it, because I don't need to see anything...

Most of my cams are prety old Panasonic cams.
I have also one Hikvision DS-2CD2442FWD-IW to experiment with Onvif...
You can better start a new discussion (category "hardware") to ask people which cam they advise...

I just sent you a message.

@madmax,
When I use the flow you had shared above, I also get "disconnected" when testing your camera.
Remark: I don't get that TypeError when I start listening when not connected...

However I see this in your camera's settings:

When I change the port number in the config screen from port 80 to 8000 then I get "connected":

Remark: when I add a Debug node to the output of the Event node, I don't see any events after I started listening. Not sure which events you have activated and if those occur at this moment...

Can you change the Onvif port number and test your events locally?

Hello!

I forwarded that with the Proto, it was always at 8000.

I have set everything so with me he does not connect.


@madmax,
Under the cover, I use the onvif library.

I see now that on my system version 0.6.3 of that library was installed, while their latest version is 0.6.5 (which has been published about 7 days ago).

I have now installed version 0.6.5 to make sure I have the same setup as you. But I see that your camera is not available anymore. Could you please make it public again? I will try to find some time tomorrow evening to test it again with the updated library.

That is the last thing I can try to analyse your problem.

Hello!

OK I just released it. You can access it again.

Hi @madmax,
I can confirm that with the latest version, I indeed have exactly the same issues as you have reported.
Now I need to start debugging... But I have only few spare time in the evenings, so you might have to leave your cam public available for a couple of days. Hopefully that is not a problem ...

OK I do.

Many thanks for your help.

You are welcome.
The TypeError seemed to be because the Onvif library - for some reason not clear to me yet - does not fetch the capabilities (e.g. events, ptz, ...) from your camera. So it doesn't know whether it supports events.
In my (local) version I have now fixed this, to show a new status in this case:

image

But that doesn't help you very much.
I need to figure out why the hell I don't get your cam's capabilities :exploding_head:

Seems that recently (see this pull request), they have replaced capabilities by services...