Skip to content

ONVIF Integration returning httpx.ConnectTimeout Error even though camera is returning capabilities (see debug logs) #146648

Open
@JetPil0t

Description

@JetPil0t

The problem

NOTE: 144728 appears to be a duplicate but my debug logs are more useful, so please do not close without reviewing them!

I am trying to set up a HiK Vision camera (actually, 4 cameras) using the ONVIF Integration. I cannot use automatic camera discovery, as my cameras are on a subnet of their recording device. The cameras are accessed using the IP of the recording device, with different ports used to access different cameras. This works perfectly with the Onvier app for Android, so I know the cameras support ONVIF. When I try to set up the ONVIF integration and put the host, port and credentials for the first camera in, the interface hangs for a while and then shows an error message:

Error setting up ONVIF device: Device sent empty error with type <class 'httpx.ConnectTimeout'>. Check logs for more information.

I enabled debug logging for ONVIF and retrieved further information, which makes it obvious that it is not a connection issue but something to do with the gathering of the camera's capabilities via SOAP that is causing the problem.

A quick web search suggests I am not the only one with this issue but the cause has not been identified (issues closed without resolution).

Unable to provide Diagnostics, as the setup of the Integration cannot complete.

Debug logs are attached.

What version of Home Assistant Core has the issue?

core-2025.5.3

What was the last working version of Home Assistant Core?

core-2025.5.3

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Onvif

Link to integration documentation on our website

https://www.home-assistant.io/integrations/onvif/

Diagnostics information

No response

Example YAML snippet

Anything in the logs that might be useful for us?

The XML SOAP responses from my Hik Vision camera are contained within the attached debug logs file. You will note there are multiple \r\n sequences in the response. This may be normal, or it may be an encoding issue, which is causing parsing errors and generating the error message in the debug logs:

Could not determine camera capabilities: Device sent empty error with type <class 'httpx.ConnectTimeout'>

I have removed the \r\n sequences from the XML responses and included the (formatted) responses in the camera responses file attached. The camera is clearly returning its capabilities when requested, but for some reason the code is not seeing them.

This camera works perfectly with the Onvier app on Android using ONVIF, which makes me think this is a Home Assistant issue rather than a camera issue.

Additional information

ONVIF debug logs.txt

ONVIF camera responses.xml.txt

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions