Support for ONVIF (standard for IP cameras etc)

I am wondering if someone with significantly more coding ability than myself would be able to have the ONVIF component listen in for events produced by the camera? I have ONVIF cameras which have in-built motion detection and from what I’ve read it is possible to grab ‘motion detected’ event data from the camera and use that externally, ie: for Hass to start an automation etc.

Some links here:
This talks about intercepting signals for use with zoneminder but the principal is the same

someone who got it working

apparently ‘ONVIF Device Manager’ lets you probe for the event data

some code that could possibly help…

This would be an awesome addition to the component as it would allow Hass to send snapshots in notifications without being told to by some third party device / software. The camera could detect motion and Hass see the event posted on the network then act accordingly.

I don’t have the required skill to figure this out unfortunately, just a dumb electrician :confused:

The Axis component uses the onvif event stream for push notifications from cameras. Axis specific implementation though

Hmm, I’ll take a look at the axis implementation.
To see if I can add it.

Not right off the bat. Haven’t bothered with the generic onvif specification since I only cared for supporting Axis implementation.

Just PM if you have questions

Yeah, it would be nice if a generic version could be implemented that would hopefully work on all ONVIF cams irrelevant of manufacturer

Here is a v3 version that should work in Hass.io. onvif v3
Please note it’s a work in progress as i bug fix some support for cameras.
Any assistance in working on it would be great.

How would I get this installed in Hass.io?

1 Like

I’ve added a comment to the gist. But here is the rough idea

  1. Add custom_components folder to config folder
  2. Under the custom_components folder create a camera folder
  3. Under the camera folder you need to save the onvif.py file

This will override the standard component
Please provide feedback with camera type if it works or if it doesn’t.

So far I’ve tested it on Sricam, Android IP Cam App.

Now I’m desperate to get home so I can try this!

I have loaded this custom component and used the below config but I dont get the camera show up in Hass at all and I get an epic long error log… Camera is a CCD-Cam Dome, model EC-IV6423P

camera version details:
image

config.yaml

logger:
  logs:
    custom_components.camera.onvif: debug

ffmpeg:
camera: !include cameras.yaml

cameras.yaml

- platform: onvif
  host: 192.168.0.101
  name: Front Door
  username: admin
  password: admin
  port: 554

log… (it keeps going for eternity!.. I cut it short)

2017-12-04 11:30:41 INFO (MainThread) [homeassistant.components.camera] Setting up camera.onvif
2017-12-04 11:30:42 DEBUG (MainThread) [custom_components.camera.onvif] ONVIF Version: 201711272243 - Attempting to communicate with ONVIF Camera: 192.168.0.101 on port 554
2017-12-04 11:30:42 DEBUG (MainThread) [suds.wsdl] reading wsdl at: file:///usr/lib/python3.6/site-packages/onvif/wsdl/devicemgmt.wsdl …
2017-12-04 11:30:42 DEBUG (MainThread) [suds.transport.http] opening (file:///usr/lib/python3.6/site-packages/onvif/wsdl/devicemgmt.wsdl)
2017-12-04 11:30:43 DEBUG (MainThread) [suds.metrics] b’<?xml version="1.0" encoding="utf-8"?>\r\n<?xml-stylesheet type="text/xsl" href="../../../ver20/util/onvif-wsdl-viewer.xsl"?>\r\n\r\n<wsdl:definitions xmlns:wsdl=“http://schemas.xmlsoap.org/wsdl/” xmlns:soap=“http://schemas.xmlsoap.org/wsdl/soap12/” xmlns:xs=“http://www.w3.org/2001/XMLSchema” xmlns:tds=“http://www.onvif.org/ver10/device/wsdl” targetNamespace=“http://www.onvif.org/ver10/device/wsdl”>\r\n\twsdl:types\r\n\t\t<xs:schema targetNamespace=“http://www.onvif.org/ver10/device/wsdl” xmlns:tt=“http://www.onvif.org/ver10/schema” xmlns:tds=“http://www.onvif.org/ver10/device/wsdl” elementFormDefault=“qualified” version=“2.4.2”>\r\n <xs:import namespace=“http://www.onvif.org/ver10/schema” schemaLocation="./onvif.xsd"/>\r\n\t\t\t\r\n\t\t\t<xs:element name=“GetServices”>\r\n\t\t\t\txs:complexType\r\n\t\t\t\t\txs:sequence\r\n\t\t\t\t\t\t<xs:element name=“IncludeCapability” type=“xs:boolean”>\r\n\t\t\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\t\t\txs:documentationIndicates if the service capabilities (untyped) should be included in the response.</xs:documentation>\r\n\t\t\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t\t\t</xs:element>\r\n\t\t\t\t\t</xs:sequence>\r\n\t\t\t\t</xs:complexType>\r\n\t\t\t</xs:element>\r\n\t\t\t<xs:element name=“GetServicesResponse”>\r\n\t\t\t\txs:complexType\r\n\t\t\t\t\txs:sequence\r\n\t\t\t\t\t\t<xs:element name=“Service” type=“tds:Service” maxOccurs=“unbounded”>\r\n\t\t\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\t\t\txs:documentationEach Service element contains information about one service.</xs:documentation>\r\n\t\t\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t\t\t</xs:element>\r\n\t\t\t\t\t</xs:sequence>\r\n\t\t\t\t</xs:complexType>\r\n\t\t\t</xs:element>\r\n\t\t\t\r\n\t\t\t<xs:complexType name=“Service”>\r\n\t\t\t\txs:sequence\r\n\t\t\t\t\t<xs:element name=“Namespace” type=“xs:anyURI”>\r\n\t\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\t\txs:documentationNamespace of the service being described. This parameter allows to match the service capabilities to the service. Note that only one set of capabilities is supported per namespace.</xs:documentation>\r\n\t\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t\t</xs:element>\r\n\t\t\t\t\t<xs:element name=“XAddr” type=“xs:anyURI”>\r\n\t\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\t\txs:documentationThe transport addresses where the service can be reached. The scheme and IP part shall match the one used in the request (i.e. the GetServices request).</xs:documentation>\r\n\t\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t\t</xs:element>\r\n\t\t\t\t\t<xs:element name=“Capabilities” minOccurs=“0”>\r\n\t\t\t\t\t\txs:complexType\r\n\t\t\t\t\t\t\txs:sequence\r\n\t\t\t\t\t\t\t\t<xs:any namespace="##any" processContents=“lax”>\r\n\t\t\t\t\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\t\t\t\t\txs:documentationThe placeholder for the service capabilities. The service capability element shall be returned here. For example for the device service that would be the tds:DeviceServiceCapabilities element (not complextype).</xs:documentation>\r\n\t\t\t\t\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t\t\t\t\t</xs:any>\r\n\t\t\t\t\t\t\t</xs:sequence>\r\n\t\t\t\t\t\t</xs:complexType>\r\n\t\t\t\t\t</xs:element>\r\n\t\t\t\t\t<xs:element name=“Version” type=“tt:OnvifVersion”>\r\n\t\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\t\txs:documentationThe version of the service (not the ONVIF core spec version).</xs:documentation>\r\n\t\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t\t</xs:element>\r\n\t\t\t\t\t<xs:any namespace="##any" processContents=“lax” minOccurs=“0” maxOccurs=“unbounded”/>\r\n\t\t\t\t</xs:sequence>\r\n\t\t\t\t<xs:anyAttribute processContents=“lax”/>\r\n\t\t\t</xs:complexType>\r\n\t\t\t\r\n\t\t\t<xs:element name=“GetServiceCapabilities”>\r\n\t\t\t\txs:complexType\r\n\t\t\t\t\txs:sequence/\r\n\t\t\t\t</xs:complexType>\r\n\t\t\t</xs:element>\r\n\t\t\t<xs:element name=“GetServiceCapabilitiesResponse”>\r\n\t\t\t\txs:complexType\r\n\t\t\t\t\txs:sequence\r\n\t\t\t\t\t\t<xs:element name=“Capabilities” type=“tds:DeviceServiceCapabilities”>\r\n\t\t\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\t\t\txs:documentationThe capabilities for the device service is returned in the Capabilities element.</xs:documentation>\r\n\t\t\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t\t\t</xs:element>\r\n\t\t\t\t\t</xs:sequence>\r\n\t\t\t\t</xs:complexType>\r\n\t\t\t</xs:element>\r\n\t\t\t\r\n\t\t\t<xs:complexType name=“DeviceServiceCapabilities”>\r\n\t\t\t\txs:sequence\r\n\t\t\t\t\t<xs:element name=“Network” type=“tds:NetworkCapabilities”>\r\n\t\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\t\txs:documentationNetwork capabilities.</xs:documentation>\r\n\t\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t\t</xs:element>\r\n\t\t\t\t\t<xs:element name=“Security” type=“tds:SecurityCapabilities”>\r\n\t\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\t\txs:documentationSecurity capabilities.</xs:documentation>\r\n\t\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t\t</xs:element>\r\n\t\t\t\t\t<xs:element name=“System” type=“tds:SystemCapabilities”>\r\n\t\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\t\txs:documentationSystem capabilities.</xs:documentation>\r\n\t\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t\t</xs:element>\r\n\t\t\t\t\t<xs:element name=“Misc” type=“tds:MiscCapabilities” minOccurs=“0”>\r\n\t\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\t\txs:documentationCapabilities that do not fit in any of the other categories.</xs:documentation>\r\n\t\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t\t</xs:element>\r\n\t\t\t\t</xs:sequence>\r\n\t\t\t</xs:complexType>\r\n\t\t\t<xs:element name=“Capabilities” type=“tds:DeviceServiceCapabilities”/>\r\n\t\t\t\r\n\t\t\t<xs:complexType name=“NetworkCapabilities”>\r\n\t\t\t\t<xs:attribute name=“IPFilter” type=“xs:boolean”>\r\n\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\txs:documentationIndicates support for IP filtering.</xs:documentation>\r\n\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t</xs:attribute>\r\n\t\t\t\t<xs:attribute name=“ZeroConfiguration” type=“xs:boolean”>\r\n\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\txs:documentationIndicates support for zeroconf.</xs:documentation>\r\n\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t</xs:attribute>\r\n\t\t\t\t<xs:attribute name=“IPVersion6” type=“xs:boolean”>\r\n\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\txs:documentationIndicates support for IPv6.</xs:documentation>\r\n\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t</xs:attribute>\r\n\t\t\t\t<xs:attribute name=“DynDNS” type=“xs:boolean”>\r\n\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\txs:documentationIndicates support for dynamic DNS configuration.</xs:documentation>\r\n\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t</xs:attribute>\r\n\t\t\t\t<xs:attribute name=“Dot11Configuration” type=“xs:boolean”>\r\n\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\txs:documentationIndicates support for IEEE 802.11 configuration.</xs:documentation>\r\n\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t</xs:attribute>\r\n\t\t\t\t<xs:attribute name=“Dot1XConfigurations” type=“xs:int”>\r\n\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\txs:documentationIndicates the maximum number of Dot1X configurations supported by the device</xs:documentation>\r\n\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t</xs:attribute>\r\n\t\t\t\t<xs:attribute name=“HostnameFromDHCP” type=“xs:boolean”>\r\n\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\txs:documentationIndicates support for retrieval of hostname from DHCP.</xs:documentation>\r\n\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t</xs:attribute>\r\n\t\t\t\t<xs:attribute name=“NTP” type=“xs:int”>\r\n\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\txs:documentationMaximum number of NTP servers supported by the devices SetNTP command.</xs:documentation>\r\n\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t</xs:attribute>\r\n\t\t\t\t<xs:attribute name=“DHCPv6” type=“xs:boolean”>\r\n\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\txs:documentationIndicates support for Stateful IPv6 DHCP.</xs:documentation>\r\n\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t</xs:attribute>\r\n\t\t\t\t<xs:anyAttribute processContents=“lax”/>\r\n\t\t\t</xs:complexType>\r\n\t\t\t\r\n\t\t\t<xs:simpleType name=“EAPMethodTypes”>\r\n\t\t\t\t<xs:list itemType=“xs:int”/>\r\n\t\t\t</xs:simpleType>\r\n\t\t\t<xs:complexType name=“SecurityCapabilities”>\r\n\t\t\t\t<xs:attribute name=“TLS1.0” type=“xs:boolean”>\r\n\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\txs:documentationIndicates support for TLS 1.0.</xs:documentation>\r\n\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t</xs:attribute>\r\n\t\t\t\t<xs:attribute name=“TLS1.1” type=“xs:boolean”>\r\n\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\txs:documentationIndicates support for TLS 1.1.</xs:documentation>\r\n\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t</xs:attribute>\r\n\t\t\t\t<xs:attribute name=“TLS1.2” type=“xs:boolean”>\r\n\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\txs:documentationIndicates support for TLS 1.2.</xs:documentation>\r\n\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t</xs:attribute>\r\n\t\t\t\t<xs:attribute name=“OnboardKeyGeneration” type=“xs:boolean”>\r\n\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\txs:documentationIndicates support for onboard key generation.</xs:documentation>\r\n\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t</xs:attribute>\r\n\t\t\t\t<xs:attribute name=“AccessPolicyConfig” type=“xs:boolean”>\r\n\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\txs:documentationIndicates support for access policy configuration.</xs:documentation>\r\n\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t</xs:attribute>\r\n\t\t\t\t<xs:attribute name=“DefaultAccessPolicy” type=“xs:boolean”>\r\n\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\txs:documentationIndicates support for the ONVIF default access policy.</xs:documentation>\r\n\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t</xs:attribute>\r\n\t\t\t\t<xs:attribute name=“Dot1X” type=“xs:boolean”>\r\n\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\txs:documentationIndicates support for IEEE 802.1X configuration.</xs:documentation>\r\n\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t</xs:attribute>\r\n\t\t\t\t<xs:attribute name=“RemoteUserHandling” type=“xs:boolean”>\r\n\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\txs:documentationIndicates support for remote user configuration. Used when accessing another device.</xs:documentation>\r\n\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t</xs:attribute>\r\n\t\t\t\t<xs:attribute name=“X.509Token” type=“xs:boolean”>\r\n\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\txs:documentationIndicates support for WS-Security X.509 token.</xs:documentation>\r\n\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t</xs:attribute>\r\n\t\t\t\t<xs:attribute name=“SAMLToken” type=“xs:boolean”>\r\n\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\txs:documentationIndicates support for WS-Security SAML token.</xs:documentation>\r\n\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t</xs:attribute>\r\n\t\t\t\t<xs:attribute name=“KerberosToken” type=“xs:boolean”>\r\n\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\txs:documentationIndicates support for WS-Security Kerberos token.</xs:documentation>\r\n\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t</xs:attribute>\r\n\t\t\t\t<xs:attribute name=“UsernameToken” type=“xs:boolean”>\r\n\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\txs:documentationIndicates support for WS-Security Username token.</xs:documentation>\r\n\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t</xs:attribute>\r\n\t\t\t\t<xs:attribute name=“HttpDigest” type=“xs:boolean”>\r\n\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\txs:documentationIndicates support for WS over HTTP digest authenticated communication layer.</xs:documentation>\r\n\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t</xs:attribute>\r\n\t\t\t\t<xs:attribute name=“RELToken” type=“xs:boolean”>\r\n\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\txs:documentationIndicates support for WS-Security REL token.</xs:documentation>\r\n\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t</xs:attribute>\r\n\t\t\t\t<xs:attribute name=“SupportedEAPMethods” type=“tds:EAPMethodTypes”>\r\n\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\txs:documentationEAP Methods supported by the device. The int values refer to the IANA EAP Registry.</xs:documentation>\r\n\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t</xs:attribute>\r\n\t\t\t\t<xs:attribute name=“MaxUsers” type=“xs:int”>\r\n\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\txs:documentationThe maximum number of users that the device supports.</xs:documentation>\r\n\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t</xs:attribute>\r\n\t\t\t\t<xs:anyAttribute processContents=“lax”/>\r\n\t\t\t</xs:complexType>\r\n\t\t\t\r\n\t\t\t<xs:complexType name=“SystemCapabilities”>\r\n\t\t\t\t<xs:attribute name=“DiscoveryResolve” type=“xs:boolean”>\r\n\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\txs:documentationIndicates support for WS Discovery resolve requests.</xs:documentation>\r\n\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t</xs:attribute>\r\n\t\t\t\t<xs:attribute name=“DiscoveryBye” type=“xs:boolean”>\r\n\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\txs:documentationIndicates support for WS-Discovery Bye.</xs:documentation>\r\n\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t</xs:attribute>\r\n\t\t\t\t<xs:attribute name=“RemoteDiscovery” type=“xs:boolean”>\r\n\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\txs:documentationIndicates support for remote discovery.</xs:documentation>\r\n\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t</xs:attribute>\r\n\t\t\t\t<xs:attribute name=“SystemBackup” type=“xs:boolean”>\r\n\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\txs:documentationIndicates support for system backup through MTOM.</xs:documentation>\r\n\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t</xs:attribute>\r\n\t\t\t\t<xs:attribute name=“SystemLogging” type=“xs:boolean”>\r\n\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\txs:documentationIndicates support for retrieval of system logging through MTOM.</xs:documentation>\r\n\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t</xs:attribute>\r\n\t\t\t\t<xs:attribute name=“FirmwareUpgrade” type=“xs:boolean”>\r\n\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\txs:documentationIndicates support for firmware upgrade through MTOM.</xs:documentation>\r\n\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t</xs:attribute>\r\n\t\t\t\t<xs:attribute name=“HttpFirmwareUpgrade” type=“xs:boolean”>\r\n\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\txs:documentationIndicates support for system backup through MTOM.</xs:documentation>\r\n\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t</xs:attribute>\r\n\t\t\t\t<xs:attribute name=“HttpSystemBackup” type=“xs:boolean”>\r\n\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\txs:documentationIndicates support for system backup through HTTP.</xs:documentation>\r\n\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t</xs:attribute>\r\n\t\t\t\t<xs:attribute name=“HttpSystemLogging” type=“xs:boolean”>\r\n\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\txs:documentationIndicates support for retrieval of system logging through HTTP.</xs:documentation>\r\n\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t</xs:attribute>\r\n\t\t\t\t<xs:attribute name=“HttpSupportInformation” type=“xs:boolean”>\r\n\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\txs:documentationIndicates support for retrieving support information through HTTP.</xs:documentation>\r\n\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t</xs:attribute>\r\n\t\t\t\t<xs:anyAttribute processContents=“lax”/>\r\n\t\t\t</xs:complexType>\r\n\t\t\t\r\n\t\t\t<xs:complexType name=“MiscCapabilities”>\r\n\t\t\t\t<xs:attribute name=“AuxiliaryCommands” type=“tt:StringAttrList”>\r\n\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\txs:documentationLists of commands supported by SendAuxiliaryCommand.</xs:documentation>\r\n\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t</xs:attribute>\r\n\t\t\t\t<xs:anyAttribute processContents=“lax”/>\r\n\t\t\t</xs:complexType>\r\n\t\t\t\r\n\t\t\t<xs:element name=“GetDeviceInformation”>\r\n\t\t\t\txs:complexType\r\n\t\t\t\t\txs:sequence/\r\n\t\t\t\t</xs:complexType>\r\n\t\t\t</xs:element>\r\n\t\t\t<xs:element name=“GetDeviceInformationResponse”>\r\n\t\t\t\txs:complexType\r\n\t\t\t\t\txs:sequence\r\n\t\t\t\t\t\t<xs:element name=“Manufacturer” type=“xs:string”>\r\n\t\t\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\t\t\txs:documentationThe manufactor of the device.</xs:documentation>\r\n\t\t\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t\t\t</xs:element>\r\n\t\t\t\t\t\t<xs:element name=“Model” type=“xs:string”>\r\n\t\t\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\t\t\txs:documentationThe device model.</xs:documentation>\r\n\t\t\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t\t\t</xs:element>\r\n\t\t\t\t\t\t<xs:element name=“FirmwareVersion” type=“xs:string”>\r\n\t\t\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\t\t\txs:documentationThe firmware version in the device.</xs:documentation>\r\n\t\t\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t\t\t</xs:element>\r\n\t\t\t\t\t\t<xs:element name=“SerialNumber” type=“xs:string”>\r\n\t\t\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\t\t\txs:documentationThe serial number of the device.</xs:documentation>\r\n\t\t\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t\t\t</xs:element>\r\n\t\t\t\t\t\t<xs:element name=“HardwareId” type=“xs:string”>\r\n\t\t\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\t\t\txs:documentationThe hardware ID of the device.</xs:documentation>\r\n\t\t\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t\t\t</xs:element>\r\n\t\t\t\t\t</xs:sequence>\r\n\t\t\t\t</xs:complexType>\r\n\t\t\t</xs:element>\r\n\t\t\t\r\n\t\t\t<xs:element name=“SetSystemDateAndTime”>\r\n\t\t\t\txs:complexType\r\n\t\t\t\t\txs:sequence\r\n\t\t\t\t\t\t<xs:element name=“DateTimeType” type=“tt:SetDateTimeType”>\r\n\t\t\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\t\t\txs:documentationDefines if the date and time is set via NTP or manually.</xs:documentation>\r\n\t\t\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t\t\t</xs:element>\r\n\t\t\t\t\t\t<xs:element name=“DaylightSavings” type=“xs:boolean”>\r\n\t\t\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\t\t\txs:documentationAutomatically adjust Daylight savings if defined in TimeZone.</xs:documentation>\r\n\t\t\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t\t\t</xs:element>\r\n\t\t\t\t\t\t<xs:element name=“TimeZone” type=“tt:TimeZone” minOccurs=“0”>\r\n\t\t\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\t\t\txs:documentationThe time zone in POSIX 1003.1 format</xs:documentation>\r\n\t\t\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t\t\t</xs:element>\r\n\t\t\t\t\t\t<xs:element name=“UTCDateTime” type=“tt:DateTime” minOccurs=“0”>\r\n\t\t\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\t\t\txs:documentationDate and time in UTC. If time is obtained via NTP, UTCDateTime has no meaning</xs:documentation>\r\n\t\t\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t\t\t</xs:element>\r\n\t\t\t\t\t</xs:sequence>\r\n\t\t\t\t</xs:complexType>\r\n\t\t\t</xs:element>\r\n\t\t\t<xs:element name=“SetSystemDateAndTimeResponse”>\r\n\t\t\t\txs:complexType\r\n\t\t\t\t\txs:sequence\r\n\t\t\t\t\t</xs:sequence>\r\n\t\t\t\t</xs:complexType>\r\n\t\t\t</xs:element>\r\n\t\t\t\r\n\t\t\t<xs:element name=“GetSystemDateAndTime”>\r\n\t\t\t\txs:complexType\r\n\t\t\t\t\txs:sequence/\r\n\t\t\t\t</xs:complexType>\r\n\t\t\t</xs:element>\r\n\t\t\t<xs:element name=“GetSystemDateAndTimeResponse”>\r\n\t\t\t\txs:complexType\r\n\t\t\t\t\txs:sequence\r\n\t\t\t\t\t\t<xs:element name=“SystemDateAndTime” type=“tt:SystemDateTime”>\r\n\t\t\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\t\t\txs:documentationContains information whether system date and time are set manually or by NTP, daylight savings is on or off, time zone in POSIX 1003.1 format and system date and time in UTC and also local system date and time.</xs:documentation>\r\n\t\t\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t\t\t</xs:element>\r\n\t\t\t\t\t</xs:sequence>\r\n\t\t\t\t</xs:complexType>\r\n\t\t\t</xs:element>\r\n\t\t\t\r\n\t\t\t<xs:element name=“SetSystemFactoryDefault”>\r\n\t\t\t\txs:complexType\r\n\t\t\t\t\txs:sequence\r\n\t\t\t\t\t\t<xs:element name=“FactoryDefault” type=“tt:FactoryDefaultType”>\r\n\t\t\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\t\t\txs:documentationSpecifies the factory default action type.</xs:documentation>\r\n\t\t\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t\t\t</xs:element>\r\n\t\t\t\t\t</xs:sequence>\r\n\t\t\t\t</xs:complexType>\r\n\t\t\t</xs:element>\r\n\t\t\t<xs:element name=“SetSystemFactoryDefaultResponse”>\r\n\t\t\t\txs:complexType\r\n\t\t\t\t\txs:sequence\r\n\t\t\t\t\t</xs:sequence>\r\n\t\t\t\t</xs:complexType>\r\n\t\t\t</xs:element>\r\n\t\t\t\r\n\t\t\t<xs:element name=“UpgradeSystemFirmware”>\r\n\t\t\t\txs:complexType\r\n\t\t\t\t\txs:sequence\r\n\t\t\t\t\t\t<xs:element name=“Firmware” type=“tt:AttachmentData”/>\r\n\t\t\t\t\t</xs:sequence>\r\n\t\t\t\t</xs:complexType>\r\n\t\t\t</xs:element>\r\n\t\t\t<xs:element name=“UpgradeSystemFirmwareResponse”>\r\n\t\t\t\txs:complexType\r\n\t\t\t\t\txs:sequence\r\n\t\t\t\t\t\t<xs:element name=“Message” type=“xs:string” minOccurs=“0” maxOccurs=“1”/>\r\n\t\t\t\t\t</xs:sequence>\r\n\t\t\t\t</xs:complexType>\r\n\t\t\t</xs:element>\r\n\t\t\t\r\n\t\t\t<xs:element name=“SystemReboot”>\r\n\t\t\t\txs:complexType\r\n\t\t\t\t\txs:sequence/\r\n\t\t\t\t</xs:complexType>\r\n\t\t\t</xs:element>\r\n\t\t\t<xs:element name=“SystemRebootResponse”>\r\n\t\t\t\txs:complexType\r\n\t\t\t\t\txs:sequence\r\n\t\t\t\t\t\t<xs:element name=“Message” type=“xs:string”>\r\n\t\t\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\t\t\txs:documentationContains the reboot message sent by the device.</xs:documentation>\r\n\t\t\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t\t\t</xs:element>\r\n\t\t\t\t\t</xs:sequence>\r\n\t\t\t\t</xs:complexType>\r\n\t\t\t</xs:element>\r\n\t\t\t\r\n\t\t\t<xs:element name=“RestoreSystem”>\r\n\t\t\t\txs:complexType\r\n\t\t\t\t\txs:sequence\r\n\t\t\t\t\t\t<xs:element name=“BackupFiles” type=“tt:BackupFile” minOccurs=“1” maxOccurs=“unbounded”/>\r\n\t\t\t\t\t</xs:sequence>\r\n\t\t\t\t</xs:complexType>\r\n\t\t\t</xs:element>\r\n\t\t\t<xs:element name=“RestoreSystemResponse”>\r\n\t\t\t\txs:complexType\r\n\t\t\t\t\txs:sequence/\r\n\t\t\t\t</xs:complexType>\r\n\t\t\t</xs:element>\r\n\t\t\t\r\n\t\t\t<xs:element name=“GetSystemBackup”>\r\n\t\t\t\txs:complexType\r\n\t\t\t\t\txs:sequence/\r\n\t\t\t\t</xs:complexType>\r\n\t\t\t</xs:element>\r\n\t\t\t<xs:element name=“GetSystemBackupResponse”>\r\n\t\t\t\txs:complexType\r\n\t\t\t\t\txs:sequence\r\n\t\t\t\t\t\t<xs:element name=“BackupFiles” type=“tt:BackupFile” minOccurs=“1” maxOccurs=“unbounded”/>\r\n\t\t\t\t\t</xs:sequence>\r\n\t\t\t\t</xs:complexType>\r\n\t\t\t</xs:element>\r\n\t\t\t\r\n\t\t\t<xs:element name=“GetSystemSupportInformation”>\r\n\t\t\t\txs:complexType\r\n\t\t\t\t\txs:sequence/\r\n\t\t\t\t</xs:complexType>\r\n\t\t\t</xs:element>\r\n\t\t\t<xs:element name=“GetSystemSupportInformationResponse”>\r\n\t\t\t\txs:complexType\r\n\t\t\t\t\txs:sequence\r\n\t\t\t\t\t\t<xs:element name=“SupportInformation” type=“tt:SupportInformation”>\r\n\t\t\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\t\t\txs:documentationContains the arbitary device diagnostics information.</xs:documentation>\r\n\t\t\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t\t\t</xs:element>\r\n\t\t\t\t\t</xs:sequence>\r\n\t\t\t\t</xs:complexType>\r\n\t\t\t</xs:element>\r\n\t\t\t\r\n\t\t\t<xs:element name=“GetSystemLog”>\r\n\t\t\t\txs:complexType\r\n\t\t\t\t\txs:sequence\r\n\t\t\t\t\t\t<xs:element name=“LogType” type=“tt:SystemLogType”>\r\n\t\t\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\t\t\txs:documentationSpecifies the type of system log to get.</xs:documentation>\r\n\t\t\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t\t\t</xs:element>\r\n\t\t\t\t\t</xs:sequence>\r\n\t\t\t\t</xs:complexType>\r\n\t\t\t</xs:element>\r\n\t\t\t<xs:element name=“GetSystemLogResponse”>\r\n\t\t\t\txs:complexType\r\n\t\t\t\t\txs:sequence\r\n\t\t\t\t\t\t<xs:element name=“SystemLog” type=“tt:SystemLog”>\r\n\t\t\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\t\t\txs:documentationContains the system log information.</xs:documentation>\r\n\t\t\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t\t\t</xs:element>\r\n\t\t\t\t\t</xs:sequence>\r\n\t\t\t\t</xs:complexType>\r\n\t\t\t</xs:element>\r\n\t\t\t\r\n\t\t\t<xs:element name=“GetScopes”>\r\n\t\t\t\txs:complexType\r\n\t\t\t\t\txs:sequence\r\n\t\t\t\t\t</xs:sequence>\r\n\t\t\t\t</xs:complexType>\r\n\t\t\t</xs:element>\r\n\t\t\t<xs:element name=“GetScopesResponse”>\r\n\t\t\t\txs:complexType\r\n\t\t\t\t\txs:sequence\r\n\t\t\t\t\t\t<xs:element name=“Scopes” type=“tt:Scope” minOccurs=“1” maxOccurs=“unbounded”>\r\n\t\t\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\t\t\txs:documentationContains a list of URI definining the device scopes. Scope parameters can be of two types: fixed and configurable. Fixed parameters can not be altered.</xs:documentation>\r\n\t\t\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t\t\t</xs:element>\r\n\t\t\t\t\t</xs:sequence>\r\n\t\t\t\t</xs:complexType>\r\n\t\t\t</xs:element>\r\n\t\t\t\r\n\t\t\t<xs:element name=“SetScopes”>\r\n\t\t\t\txs:complexType\r\n\t\t\t\t\txs:sequence\r\n\t\t\t\t\t\t<xs:element name=“Scopes” type=“xs:anyURI” minOccurs=“1” maxOccurs=“unbounded”>\r\n\t\t\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\t\t\txs:documentationContains a list of scope parameters that will replace all existing configurable scope parameters.</xs:documentation>\r\n\t\t\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t\t\t</xs:element>\r\n\t\t\t\t\t</xs:sequence>\r\n\t\t\t\t</xs:complexType>\r\n\t\t\t</xs:element>\r\n\t\t\t<xs:element name=“SetScopesResponse”>\r\n\t\t\t\txs:complexType\r\n\t\t\t\t\txs:sequence\r\n\t\t\t\t\t</xs:sequence>\r\n\t\t\t\t</xs:complexType>\r\n\t\t\t</xs:element>\r\n\t\t\t\r\n\t\t\t<xs:element name=“AddScopes”>\r\n\t\t\t\txs:complexType\r\n\t\t\t\t\txs:sequence\r\n\t\t\t\t\t\t<xs:element name=“ScopeItem” type=“xs:anyURI” minOccurs=“1” maxOccurs=“unbounded”>\r\n\t\t\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\t\t\txs:documentationContains a list of new configurable scope parameters that will be added to the existing configurable scope.</xs:documentation>\r\n\t\t\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t\t\t</xs:element>\r\n\t\t\t\t\t</xs:sequence>\r\n\t\t\t\t</xs:complexType>\r\n\t\t\t</xs:element>\r\n\t\t\t<xs:element name=“AddScopesResponse”>\r\n\t\t\t\txs:complexType\r\n\t\t\t\t\txs:sequence\r\n\t\t\t\t\t</xs:sequence>\r\n\t\t\t\t</xs:complexType>\r\n\t\t\t</xs:element>\r\n\t\t\t\r\n\t\t\t<xs:element name=“RemoveScopes”>\r\n\t\t\t\txs:complexType\r\n\t\t\t\t\txs:sequence\r\n\t\t\t\t\t\t<xs:element name=“ScopeItem” type=“xs:anyURI” minOccurs=“1” maxOccurs=“unbounded”>\r\n\t\t\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\t\t\txs:documentationContains a list of URIs that should be removed from the device scope.
\r\n\t\t\t\t\t\t\t\t\tNote that the response message always will match the request or an error will be returned. The use of the response is for that reason deprecated.\r\n\t\t\t\t\t\t\t\t</xs:documentation>\r\n\t\t\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t\t\t</xs:element>\r\n\t\t\t\t\t</xs:sequence>\r\n\t\t\t\t</xs:complexType>\r\n\t\t\t</xs:element>\r\n\t\t\t<xs:element name=“RemoveScopesResponse”>\r\n\t\t\t\txs:complexType\r\n\t\t\t\t\txs:sequence\r\n\t\t\t\t\t\t<xs:element name=“ScopeItem” type=“xs:anyURI” minOccurs=“0” maxOccurs=“unbounded”>\r\n\t\t\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\t\t\txs:documentationContains a list of URIs that has been removed from the device scope</xs:documentation>\r\n\t\t\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t\t\t</xs:element>\r\n\t\t\t\t\t</xs:sequence>\r\n\t\t\t\t</xs:complexType>\r\n\t\t\t</xs:element>\r\n\t\t\t\r\n\t\t\t<xs:element name=“GetDiscoveryMode”>\r\n\t\t\t\txs:complexType\r\n\t\t\t\t\txs:sequence\r\n\t\t\t\t\t</xs:sequence>\r\n\t\t\t\t</xs:complexType>\r\n\t\t\t</xs:element>\r\n\t\t\t<xs:element name=“GetDiscoveryModeResponse”>\r\n\t\t\t\txs:complexType\r\n\t\t\t\t\txs:sequence\r\n\t\t\t\t\t\t<xs:element name=“DiscoveryMode” type=“tt:DiscoveryMode”>\r\n\t\t\t\t\t\t\txs:annotation\r\n\t\t\t\t\t\t\t\txs:documentation\r\n\t\t\t\t\t\t\t\t\tIndicator of discovery mode: Discoverable, NonDiscoverable.\r\n\t\t\t\t\t\t\t\t</xs:documentation>\r\n\t\t\t\t\t\t\t</xs:annotation>\r\n\t\t\t\t\t\t</xs:element>\r\n\t\t\t\t\t</xs:sequence>\r\n\t\t\t\t</xs:complexType>\r\n\t\t\t</xs:element>\r\n\t\t\t\r\n\t\t\t<xs:element

The port is wrong, 554 is the rtsp port you need to specify the onvif port try 5000.

but if I run a port scan on the camera’s IP address I don’t get any service available on port 5000, only 554, 80 and 8080… wouldn’t that mean that 5000 wont work? I’ll give it a try though

I’d probably try 8080 or 80

2017-12-18 14:06:52 ERROR (MainThread) [homeassistant.components.camera] Error while setting up platform onvif
Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.5/site-packages/zeep/xsd/valueobjects.py”, line 134, in getattribute
return self.values[key]
KeyError: ‘_token’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_component.py”, line 171, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=self.hass.loop)
File “/usr/lib/python3.5/asyncio/tasks.py”, line 392, in wait_for
return fut.result()
File “/usr/lib/python3.5/asyncio/futures.py”, line 274, in result
raise self._exception
File “/usr/lib/python3.5/asyncio/tasks.py”, line 239, in _step
result = coro.send(None)
File “/usr/lib/python3.5/asyncio/coroutines.py”, line 206, in coro
res = func(*args, **kw)
File “/home/homeassistant/.homeassistant/custom_components/camera/onvif.py”, line 50, in async_setup_platform
async_add_devices([ONVIFCameraHASS(hass, config)])
File “/home/homeassistant/.homeassistant/custom_components/camera/onvif.py”, line 76, in init
}, ‘ProfileToken’: profiles[0]._token}
File “/srv/homeassistant/lib/python3.5/site-packages/zeep/xsd/valueobjects.py”, line 138, in getattribute
self.class.name, key))
AttributeError: Profile instance has no attribute ‘_token’

i am on HA .60.0 in evironmvent
and using digoo m1z camera,

You could try this file, it’s the one I’ve got a pull request setup for it.
onvif.py with added error handling

Hi there,

I have been reading along for a few days. Got my Foscam C1 today, setup worked fine with the Foscam app so I am sure that the cam is working properly.

Now I am trying to set it up using onvif as described above. I used both the newest and the version before, both have trouble setting up.

As I am by no means a programmer I can’t figure out what is going on. The only line I understand is “onvif.exceptions.ONVIFError: Unknown error: (400, ‘Bad Request’)”, looks like something is pointing to the wrong URL but I am 100% sure I used the right IP, port and credentials.

2018-01-20 01:13:38 ERROR (MainThread) [custom_components.camera.onvif] Unable to communicate with ONVIF Camera: Unknown error: (400, ‘Bad Request’)
2018-01-20 01:13:38 ERROR (MainThread) [homeassistant.components.camera] Error while setting up platform onvif
Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/suds/transport/http.py”, line 78, in send
fp = self.u2open(u2request)
File “/usr/lib/python3.6/site-packages/suds/transport/http.py”, line 119, in u2open
return url.open(u2request, timeout=tm)
File “/usr/lib/python3.6/urllib/request.py”, line 532, in open
response = meth(req, response)
File “/usr/lib/python3.6/urllib/request.py”, line 642, in http_response
‘http’, request, response, code, msg, hdrs)
File “/usr/lib/python3.6/urllib/request.py”, line 570, in error
return self._call_chain(*args)
File “/usr/lib/python3.6/urllib/request.py”, line 504, in _call_chain
result = func(*args)
File “/usr/lib/python3.6/urllib/request.py”, line 650, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 400: Bad Request

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/suds/client.py”, line 652, in send
reply = transport.send(request)
File “/usr/lib/python3.6/site-packages/suds/transport/http.py”, line 178, in send
return HttpTransport.send(self, request)
File “/usr/lib/python3.6/site-packages/suds/transport/http.py”, line 86, in send
raise TransportError(e.msg, e.code, e.fp)
suds.transport.TransportError: Bad Request

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/onvif/client.py”, line 34, in wrapped
return func(*args, **kwargs)
File “/usr/lib/python3.6/site-packages/onvif/client.py”, line 201, in wrapped
return call(params, callback)
File “/usr/lib/python3.6/site-packages/onvif/client.py”, line 191, in call
ret = func(**params)
File “/usr/lib/python3.6/site-packages/suds/client.py”, line 559, in call
return client.invoke(args, kwargs)
File “/usr/lib/python3.6/site-packages/suds/client.py”, line 618, in invoke
result = self.send(soapenv)
File “/usr/lib/python3.6/site-packages/suds/client.py”, line 664, in send
result = self.failed(binding, e)
File “/usr/lib/python3.6/site-packages/suds/client.py”, line 726, in failed
raise Exception((status, reason))
Exception: (400, ‘Bad Request’)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/homeassistant/helpers/entity_component.py”, line 171, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=self.hass.loop)
File “/usr/lib/python3.6/asyncio/tasks.py”, line 358, in wait_for
return fut.result()
File “/usr/lib/python3.6/asyncio/futures.py”, line 245, in result
raise self._exception
File “/usr/lib/python3.6/asyncio/tasks.py”, line 180, in _step
result = coro.send(None)
File “/usr/lib/python3.6/asyncio/coroutines.py”, line 210, in coro
res = func(*args, **kw)
File “/config/custom_components/camera/onvif.py”, line 47, in async_setup_platform
async_add_devices([ONVIFCameraHASS(hass, config)])
File “/config/custom_components/camera/onvif.py”, line 66, in init
config.get(CONF_USERNAME), config.get(CONF_PASSWORD)
File “/usr/lib/python3.6/site-packages/onvif/client.py”, line 267, in init
self.update_xaddrs()
File “/usr/lib/python3.6/site-packages/onvif/client.py”, line 283, in update_xaddrs
capabilities = self.devicemgmt.GetCapabilities({‘Category’: ‘All’})
File “/usr/lib/python3.6/site-packages/onvif/client.py”, line 36, in wrapped
raise ONVIFError(err)
onvif.exceptions.ONVIFError: Unknown error: (400, ‘Bad Request’)

Any idea what I am doing wrong?

Kind regards,
Bram

Dear Matt:

thank you for writing the component.

I have a silly question: what do you mean by “onvif camera support?”

I briefly went through onvif specification, it contains many parts. The most important part is so-called “Profile S” which dictates the video streaming.

My question for you are:

  1. Since onvif CAN use rtsp for video streaming, what is the differences, in the home-assistant context, between your onvif component and ffmpeg component?

  2. exactly how to use onvif component in conjunction with ffmpeg component?

I just got this cheap German/Chinese camera claim to support onvif/rtsp with h.264 high. here is my current setup:

camera:
  # Security Camera: hikam S06
  - platform: ffmpeg
    input: -rtsp_transport tcp -i rtsp://192.168.34.134:554/stream=0
    name: cameraDinning

in your onvif component context, I am having problem where to input the /stream=0 part of the rtsp uri

thanks in advance

The idea of the component was to make it easier for users, you don’t need to worry about the stream when using the onvif platfrom.

the reason why I am “worrying” about it is because my suppose onvif camera is not working out of box.

On my synology, i set up this camera (hikam S6) as a “generic onvif” with port 8090, it worked fine.

but when i try to connect it to my home assistant using onvif, i got this strange error:

onvif.exceptions.ONVIFError: The requested profile token ProfileToken does not exist

I am not even sure the issue is on your side!

I got the still image working which refreshes now and than.
However clicking the image should open a live stream but nothing seems to happen.
It seems to do some camera_proxy calls which result in 200 response codes but nothing shows.

CONFIG
camera:

  • platform: onvif
    name: kitchen_camera
    host: 192.168.x.x
    username: admin
    password: verysecret
    port: 8080

ffmpeg:
ffmpeg_bin: /usr/local/bin/ffmpeg

Any ideas?

[UPDATE]
capturing rtsp stream via ffmpeg to avi works in command prompt.

[UPDATE]
tried the exact command from the logging for rstp and in a command prompt that works, however no stream in frontend.
ffmpeg -i rtsp://admin:[email protected]:554/11 -an -frames:v 1 -c:v mjpeg -q:v 2 -f image2pipe -

[UPDATE]
I get {“message”: “Entry not found”} on an attempt from the frontend to access the entity registry for my camera. It is just not in the entity registry.
https://x.x.x.x/api/config/entity_registry/camera.kitchen_camera 404 (Not Found)