Once you got the Xaddr you can do getCurrentProfile and from the json extract the snapshot URL and/or the stream (rtsp) URL I realize we made different choices as to which javaScript onvif library to use, which can further confuse things. As I said I'll try to test, your onvif nodes once you've "released" them. I have four brands of allegedly onvif compatible cameras here and access to some higher end models.
There is one thing I'm fuzzy on, that is if the camera actually needs a password to answer the onvif probe or not. If its needed and different from the admin:adnim that seems to be the usual default, it'll break automatic discovery. None of the Onvif cameras I've had access to have failed to respond using the default admin:admin for the getCurrentProfile
Some reply with an "embedded password" as part of the URL, others don't, these often require user:passwd@IPaddress for access, for which admin:admin has worked for all the cameras I'be been able to try.
@Bart No worries, there is no hurry, and indeed, I must have missed your post, my mistake ... I'll wait for the new release.
Maybe some constructive feedback. I don't mind all the info from the discovery node, in my opinion it's best to provide all the info you can have. Everyone has different needs, and if the info is available, its not a big deal to extract just what you need.
Maybe (don't know it its possible) it would be convenient if, after the discovery node has run, to have a drop down list in the other nodes, where you just select the camera you want to attach. And if the discovery nodes can include profiles etc, this could be added as a drop down list also.
@prutspapa,
That is indeed something I have been considering. Think there are two major ways to implement this:
I have used the node-red way: create a Discovery-node. As soon as I get an input message, I send a broadcast on the network, and I create an output message containing the devices.
It could perhaps be more user-friendly to show a dropdown box in the config node, so you can just select an ip address from it. But then you might have to wait a couple of seconds until the discovery has finished...
Not sure which of both is best. Or perhaps I should offer both ways of working ...
P.S. I already do something similar in the Media node, for the automatic loading of profiles (from the camera) from which you can easily choose:
Then at least we have something to discuss...
But remember that this is only a beta version, so some stuff doesn't work yet correctly!!!
I have added all my TODO's and KNOWN ISSUES on my readme page. When I have time left, I will create Github issues for those...
All 'constructive' feedback is welcome! The config screens of my nodes should become MUCH more user friendly!! Perhaps we can copy some useful stuff from other tools, like the Onvif device manager. So I you have a better suggestion, please let the screenshots come...
Keep in mind that I will be absent from the Node-RED forum from 17 to 27 March !!
Won't be able to answer questions or do any fixes in that period...
Thanks in advance for all testing and ideas!!!!
Bart
A minor point but I think it might be worth increasing the default timeout on the discovery node. Mine took rather longer than 5 secs the first time. Unfortunately I don't know how long it took as on subsequent tries it came straight back. I will leave it a while and then see how long it takes.
If I have 'multiple messages' enabled does it send each one immediately it gets an answer or does it wait for the timeout and send them all?
Actually I am wondering if there is a bug in the timeout on the discovery. I realised that I know the answer to my multiple messages timeout question, as with multiple enabled my camera comes straight back (after the first try). However, with multiple disabled it seems to come back after 5 seconds even if I have 20 set in the timeout.
A question. In the onvif-config node should I put exactly the address that I get from XAddrs from the discovery node? In my case this is an array with one element http://192.168.x.xxx/onvif/device_service
I ask because it doesn't connect. Of course this could be a problem with the camera.
I have just looked back through the thread and saw one that suggests I should only put the IP address of the camera in the config node, not the full url returned by discovery. I tried that and it seems better in that it sat for several seconds saying initialising, but then dropped back to disconnected. A Catch node didn't give me any indication of what went wrong.
npm WARN saveError ENOENT: no such file or directory, open '/home/wally/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/home/wally/package.json'
npm WARN wally No description
npm WARN wally No repository field.
npm WARN wally No README data
npm WARN wally No license field.
+ node-red-contrib-onvif-nodes@0.0.1-beta.3
updated 1 package and audited 93 packages in 0.855s
found 0 vulnerabilities
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ โ
โ New minor version of npm available! 6.4.1 โ 6.9.0 โ
โ Changelog: https://github.com/npm/cli/releases/tag/v6.9.0 โ
โ Run npm install -g npm to update! โ
โ โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
But after stopping and restarting no onvif nodes were in my pallet. Looking in the .node-red/node_modules directory I don't see your onvif nodes.
Hey Colin (@Colin), it waits for the timeout and then send them all. That's how the Onvif library works ... I have added your feedback to the readme file now:
Congratulations, you have found the first bug ... I have fixed it on Github (not on NPM).
For clarity, I have also added a 'seconds' label after the timeout input field:
The disadvantage is that everybody would have to wait longer. In my case the cameras respond quickly, so then I would have to wait longer ... Would have been better if the output messages would be send as soon as a device responds...
No just the IP address...
In the Onvif Device Manager they call it 'Address':
Since you are not the only one with doubts about it, I have renamed it to 'IP address':
Walter (@krambriw), the Media node delivers the stream URL's (see here). Isn't that sufficient enough?
No idea. Will have a look whether I can get and show more error information.
I am not seeing that in multiple message mode (this is on Ubuntu if it makes a difference). Now that my camera has been probed once it appears to be responding immediately and when I click the inject to the discovery node I see the response immediately and then the node status stays on discovering for the 5 seconds. However, if I set it to single message mode then it waits till the end of the discovery then sends the message.
@colin,
This is the code snippet where the Onvif library calls my callback handler (which sets the node status to 'connected' or 'disconnected'):
this.cam = new onvif.Cam(options, function(err) {
if (err) {
setOnvifStatus(node, "disconnected");
}
else {
setOnvifStatus(node, "connected");
}
});
As you can see they also pass me 'err', but I don't do anything with that error at the moment.
When I for example change the user name in my config node:
@Colin:
I wasn't able to test this decently, since only 1 of my camera's support Onvif ...
But the behaviour you describe is perfect for me. Will put your summary on the readme page.
Thanks, that sees to have solved it. I'll stop and restart node-red as soon as I finish a test that is running now. I wasn't aware of that little tidbit.
At the moment, it should find six Onvif cameras on my subnet.