ONVIF Error: Optional Action Not Implemented

Hi All,

Im trying to setup an ONVIF HikVision Camera, I have the following configuration:

camera:
  - platform: onvif
    host: 1.1.1.1
    name: driveway
    port: 80

I have enabled debugging in the logs and i get the following error, but i cant find anything about what this means:

2019-03-22 15:52:00 DEBUG (SyncWorker_2) [homeassistant.components.camera.onvif] Connecting with ONVIF Camera: 1.1.1.1 on port 80
2019-03-22 15:52:00 DEBUG (SyncWorker_2) [homeassistant.components.camera.onvif] Couldn't setup camera 'driveway'. Error: Optional Action Not Implemented

It appears to be the correct port as without a port it gives a 404 error, but i cant find anything about what “Optional Action not implemented” means.

Any help would be appreciated :slight_smile:

Steve

Same problem here on a Hikvision DS-2CD2335FWD-I or DS-2CD2032-I.

- platform: onvif
    host: 10.1.10.27
    username: !secret hvcam_user
    password: !secret hvcam_password
    port: 80
    name: onvif_test

[homeassistant.components.onvif.camera] Connecting with ONVIF Camera: 10.1.10.27 on port 80
[homeassistant.components.onvif.camera] Couldn't setup camera 'onvif_test'. Error: Optional Action Not Implemented

Same problem here. I’m using a cheap Blackbox S camera since it supports ONVIF (after a manual firmware update). ONVIF Device Manage detects the camera, and I’m able to login to it and view a live stream. However in Home Assistant, I’m getting the same Error: Optional Action Not Implemented log message.

My configuration:

    name: test_camera
    host: 192.168.2.190
    port: 8000
    username: !secret camera_username
    password: !secret camera_password

From my debug logs, it does appear that its attempting to communicate with the camera:

2019-04-23 17:47:47 DEBUG (SyncWorker_14) [suds.wsdl] wsdl at 'file:///usr/local/lib/python3.7/site-packages/onvif/wsdl/media.wsdl' loaded:
(Definitions){
 [ ... cut ... ]
Content:
        ('cache', <suds.cache.ObjectCache object at 0x7f170236b898>)
        ('faults', True)
        ('transport', <suds.transport.http.HttpAuthenticated object at 0x7f1702175a20>)
        ('service', None)
        ('port', None)
        ('location', 'http://192.168.2.190:8000/onvif/device_service')
        ('soapheaders', ())
        ('wsse', None)
        ('doctor', None)
        ('xstq', True)
        ('prefixes', True)
        ('retxml', False)
        ('prettyxml', False)
        ('autoblend', False)
        ('cachingpolicy', 0)
        ('plugins', [])

The final error:

HEADERS: {'Content-Type': 'application/soap+xml', 'SOAPAction': '"http://www.onvif.org/ver10/media/wsdl/GetProfiles"', 'Content-type': 'application/soap+xml', 'Soapaction': '"http://www.onvif.org/ver10/media/wsdl/GetProfiles"'}
MESSAGE:
b'<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:ns0="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://www.onvif.org/ver10/media/wsdl"><SOAP-ENV:Header><wsse:Security mustUnderstand="true"><wsse:UsernameToken><wsse:Username>admin</wsse:Username><wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">b&apos;+lBjLbAMvhEb922eSzx2e46Es38=&apos;</wsse:Password><wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">b&apos;MmY0ODEwMzJhNzVlZmU5OTBhMzEwZjgyZTcyMzM0NjM=&apos;</wsse:Nonce><wsu:Created>2019-04-23T21:50:19.704302+00:00</wsu:Created></wsse:UsernameToken></wsse:Security></SOAP-ENV:Header><ns0:Body><ns1:GetProfiles/></ns0:Body></SOAP-ENV:Envelope>'
2019-04-23 17:50:19 DEBUG (SyncWorker_6) [suds.metrics] b'<?xml version="1.0" encoding="UTF-8"?>\r\n<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:soapenc="http://www.w3.org/2003/05/soap-encoding" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:tds="http://www.onvif.org/ver10/device/wsdl" xmlns:trt="http://www.onvif.org/ver10/media/wsdl" xmlns:timg="http://www.onvif.org/ver20/imaging/wsdl" xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:tptz="http://www.onvif.org/ver20/ptz/wsdl" xmlns:tan="http://www.onvif.org/ver20/analytics/wsdl" xmlns:tst="http://www.onvif.org/ver10/storage/wsdl" xmlns:ter="http://www.onvif.org/ver10/error" xmlns:dn="http://www.onvif.org/ver10/network/wsdl" xmlns:tns1="http://www.onvif.org/ver10/topics" xmlns:tmd="http://www.onvif.org/ver10/deviceIO/wsdl" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl" xmlns:wsoap12="http://schemas.xmlsoap.org/wsdl/soap12" xmlns:http="http://schemas.xmlsoap.org/wsdl/http" xmlns:d="http://schemas.xmlsoap.org/ws/2005/04/discovery" xmlns:wsadis="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:wsrf-bf="http://docs.oasis-open.org/wsrf/bf-2" xmlns:wsntw="http://docs.oasis-open.org/wsn/bw-2" xmlns:wsrf-rw="http://docs.oasis-open.org/wsrf/rw-2" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:wsrf-r="http://docs.oasis-open.org/wsrf/r-2" xmlns:trc="http://www.onvif.org/ver10/recording/wsdl" xmlns:tse="http://www.onvif.org/ver10/search/wsdl" xmlns:trp="http://www.onvif.org/ver10/replay/wsdl" xmlns:tnsext="http://www.meari.com.cn/2011/event/topics" xmlns:extwsd="http://www.onvifext.com/onvif/ext/ver10/wsdl" xmlns:extxsd="http://www.onvifext.com/onvif/ext/ver10/schema"><env:Body><env:Fault><env:Code><env:Value>env:Receiver</env:Value>\r\n<env:Subcode><env:Value>ter:ActionNotSupported</env:Value>\r\n<env:Subcode><env:Value>ter:InvalidOperation</env:Value>\r\n</env:Subcode>\r\n</env:Subcode>\r\n</env:Code>\r\n<env:Reason><env:Text xml:lang="en">Optional Action Not Implemented</env:Text>\r\n</env:Reason>\r\n</env:Fault>\r\n</env:Body>\r\n</env:Envelope>\r\n'
sax duration: 1 (ms)
2019-04-23 17:50:19 DEBUG (SyncWorker_6) [homeassistant.components.onvif.camera] Couldn't setup camera 'test_camera'. Error: Optional Action Not Implemented```

In case anyone finds this on google later: I am able to use the Blackbox S CamHome camera with rtsp using this stream:

stream_source: "rtsp://username:[email protected]:8554/Streaming/Channels/101"

I also had to append ?latest to my HA url before it worked, which I found here

I’m still not sure why ONVIF isn’t working though (which means no ptz control)