I'm trying to access my IP cameras from the RPi and be able to control them. I'm already accessing the feed via RTSP, but I want to control them via ONVIF. I installed python onvif (pip install onvif), and I'm able to establish a connection using mycam = ONVIFCamera('',8899,'admin','','/etc/onvif/wsdl/'). But as soon as I connect, the camera stops responding (actually I think it reboots) and python returns this:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/onvif/client.py", line 227, in __init__
  File "/usr/local/lib/python2.7/dist-packages/onvif/client.py", line 237, in update_xaddrs
    services = self.devicemgmt.GetServices({'IncludeCapability': False})
  File "/usr/local/lib/python2.7/dist-packages/onvif/client.py", line 31, in wrapped
    raise ONVIFError(err)
onvif.exceptions.ONVIFError: Unknown error: <urlopen error [Errno 111] Connection refused>

I can configure it without problems by using ONVIF Device Manager, so it's definitely something wrong with the library.

So, the question would be, does anyone know how to make it work? I'm following the examples here.

  • Why would you consider the camera rebooting to be a library problem? Jul 4 '17 at 17:46
  • @StephenRauch Because, so far, the problem is only reproducible when I try to connect using this library. If I use any other app readily available, it works fine. Jul 4 '17 at 19:09
  • 1
    All that implies is that the library is doing something slightly different to other apps (for all we know, the others may all rely on another library). The fact the camera reboots suggests a camera-side issue (if a standard client request can cause a reboot, that's a DoS vulnerability plain and simple). Still, I'd suggest reporting the issue (including useful details like make and model of the camera) to the python-onvif repo
    – Dave Jones
    Jul 5 '17 at 17:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.