Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ONVIF integration problem with Hikvision DS-2CD2432F-I camera - "Failed to set up" #91471

Closed
Nikolay-Ch opened this issue Apr 15, 2023 · 26 comments · Fixed by #91485
Closed

ONVIF integration problem with Hikvision DS-2CD2432F-I camera - "Failed to set up" #91471

Nikolay-Ch opened this issue Apr 15, 2023 · 26 comments · Fixed by #91485
Assignees

Comments

@Nikolay-Ch
Copy link

Nikolay-Ch commented Apr 15, 2023

The problem

When I update HA to last version my Hikvision camera DS-2CD2432F-I has stopped to work with ONVIF integration.
Camera integration has state "Failed to set up". No errors or warnings in logs. Other cameras HickView DS-I400 working normally, except this one. Moreover, the mac-address of the camera HA recognizes normally.
HA reboot doesn't help. Reloading the integration - too. HA waits a very long time and then writes "Failed to set up".

The camera itself is available both directly through its web interface and through the NVR-interface. The camera has not been updated or reconfigured.

What version of Home Assistant Core has the issue?

2023.4.4

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

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

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

@home-assistant
Copy link

Hey there @hunterjm, mind taking a look at this issue as it has been labeled with an integration (onvif) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of onvif can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign onvif Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


onvif documentation
onvif source
(message by IssueLinks)

@Nikolay-Ch Nikolay-Ch changed the title ONVIF integration problem with Hikvision camera - "Failed to setup" ONVIF integration problem with Hikvision camera - "Failed to set up" Apr 15, 2023
@bdraco
Copy link
Member

bdraco commented Apr 15, 2023

https://www.home-assistant.io/docs/configuration/troubleshooting/#debug-logs-and-diagnostics

Please provide diagnostics and logs as requested in the template

@Nikolay-Ch
Copy link
Author

Nikolay-Ch commented Apr 15, 2023

https://www.home-assistant.io/docs/configuration/troubleshooting/#debug-logs-and-diagnostics
I can't. As soon as I turn on logging, the logs are downloaded immediatly and logging is turned off by itself.
And there are no errors in the logs related to ONVIF

@Nikolay-Ch
Copy link
Author

So... I push Reload button, then enable debug logs. And wait for error. Logs below

2023-04-16 01:25:09.013 DEBUG (MainThread) [zeep.transports] HTTP Response from http://192.168.10.1/onvif/Media (status: 200): 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:tnshik="http://www.hikvision.com/2011/event/topics" xmlns:hikwsd="http://www.onvifext.com/onvif/ext/ver10/wsdl" xmlns:hikxsd="http://www.onvifext.com/onvif/ext/ver10/schema"><env:Header><wsa:Action>http://www.onvif.org/ver10/events/wsdl/PullPointSubscription/PullMessagesResponse</wsa:Action>\r\n</env:Header>\r\n<env:Body><tev:PullMessagesResponse><tev:CurrentTime>2023-04-15T22:24:57Z</tev:CurrentTime>\r\n<tev:TerminationTime>2023-04-16T22:24:08Z</tev:TerminationTime>\r\n</tev:PullMessagesResponse>\r\n</env:Body>\r\n</env:Envelope>\r\n' 2023-04-16 01:25:09.016 DEBUG (MainThread) [homeassistant.components.onvif] Camera Camera 1 profiles = []

@bdraco
Copy link
Member

bdraco commented Apr 15, 2023

It possible this is already going to be fixed by #91473 but we need to wait for 2023.4.5 to see if thats the case

@s-kostyuk
Copy link

ONVIF "fails to setup" HikVision DS-7104HQHI-K1 on Home Assistant 2023.4.1. The issue is not always reproducible. For example, the last time I tried to debug the issue, downgrading to 2023.3.6 and upgrading again to 2023.4.1, the cameras started working and I abandoned the investigation.

Now I rebooted the system, "fails to setup" returned and Home Assistant, docker or system reboots do not help anymore.

Do not see anything suspicions in the logs, attached:
home-assistant_2023-04-16T09-26-08.995Z.log

@s-kostyuk
Copy link

The server rebooted by itself (the bluetooth adapter is a little bit buggy and causes kernel crashes, probably it is the reason). Now the cameras are recognized again. Logs attached.
home-assistant_onvif_2023-04-16T11-23-06.330Z.log

@bdraco
Copy link
Member

bdraco commented Apr 16, 2023

There is currently a problem where we can run the camera out of subscription slots because the subscription is 24 hours and if hass is restarted without removing the subscription you have to power cycle the camera to get it working again

I'm working on a solution in #91485 but I may not have time to finish it before 2023.5.x

@s-kostyuk
Copy link

s-kostyuk commented Apr 16, 2023

In my use case both the recorder and hass were power cycled together. Unless hass makes many retries and exhausts the slots this way - I am doubtful that this would explain my problem.

@bdraco
Copy link
Member

bdraco commented Apr 16, 2023

In my use case both the recorder and hass were power cycled together. Unless hass makes many retries and exhausts the slots this way

  • I am doubtful that this would explain my problem.

If you have more information about what you think the source of the issue is, please share.

@s-kostyuk
Copy link

Except the logs above - sorry, I do not have additional information. Will watch the behaviour

@bdraco
Copy link
Member

bdraco commented Apr 18, 2023

Please try 2023.4.5

@s-kostyuk
Copy link

Works so far, thank you very much

@jondycz
Copy link

jondycz commented Apr 18, 2023

The latest update broke ONVIF for me too. It basically fails to initialize and just keeps on retrying. This is annoying since the initialization turns the torch light on the cameras. Had to remove the integration for the time being.

@bdraco
Copy link
Member

bdraco commented Apr 18, 2023

The latest update broke ONVIF for me too. It basically fails to initialize and just keeps on retrying. This is annoying since the initialization turns the torch light on the cameras. Had to remove the integration for the time being.

Please post the version you are using. Latest is not helpful.

@jondycz
Copy link

jondycz commented Apr 18, 2023

The latest update broke ONVIF for me too. It basically fails to initialize and just keeps on retrying. This is annoying since the initialization turns the torch light on the cameras. Had to remove the integration for the time being.

Please post the version you are using. Latest is not helpful.

2023.4.5

@bdraco
Copy link
Member

bdraco commented Apr 18, 2023

Thanks. Please post logs

@bdraco bdraco changed the title ONVIF integration problem with Hikvision camera - "Failed to set up" ONVIF integration problem with Hikvision DS-2CD2432F-I camera - "Failed to set up" Apr 19, 2023
@jondycz
Copy link

jondycz commented Apr 19, 2023

Thanks. Please post logs

Logger: homeassistant.config_entries
Source: config_entries.py:425
First occurred: 7:13:41 AM (1 occurrences)
Last logged: 7:13:41 AM

Config entry 'Garden camera - 00:12:42:4B:8A:8D' for onvif integration not ready yet: Could not connect to camera 192.168.0.42:8899: All connection attempts failed; Retrying in background

I had those cameras for a year connected. After update to 2023.4.5 they broke. Basically looped initialization. So i had to remove the entities. This is what I get when i add them back via the UI. Cameras have static local IPs and show the rtsp stream when viewed through camera entity. So nothing changed about my setup, which had been working for over a year.

@bdraco
Copy link
Member

bdraco commented Apr 19, 2023

https://www.home-assistant.io/docs/configuration/troubleshooting/

Please follow the steps to get the debug logs

@aik
Copy link

aik commented Apr 21, 2023

Here is the log:
home-assistant_onvif_2023-04-21T06-14-28.043Z.log
2023.4.3 does not this problem (but I cannot downgrade as a bunch of interface items dissappear here and there)

Interesting observation - it looks like the cameras which can update time from the network still do work, for some reason only 2 of my 6 cameras can update the time, others return "invalid tz" error and they also broke with 2023.4.5.

@bdraco
Copy link
Member

bdraco commented Apr 21, 2023 via email

@bdraco
Copy link
Member

bdraco commented Apr 21, 2023

mkdir -p /config/custom_components
cd /config/custom_components
git clone https://github.com/bdraco/onvif
cd /config/custom_components/onvif
git pull
git log -1

This version should work better with cameras with broken timezone handling.

@aik
Copy link

aik commented Apr 21, 2023

This version should work better with cameras with broken timezone handling.

It does work indeed, thanks! Should I keep onvif in custom components or a future upgrade will pick it up?

@bdraco
Copy link
Member

bdraco commented Apr 21, 2023

You should be able to delete that custom version in 2023.5.x assuming #91485 and #91567 get merged before next wed.

@aik
Copy link

aik commented Apr 21, 2023

while on the topic, is there any workaround to try with these cameras about the clock? for example the timezone on a server (my ntp is proxied by dnsmasq, the cameras are not allowed to the internet) or in the camera (the android app does not allow changing that and I do not have old windows) or something? It is Hikvision.

@bdraco
Copy link
Member

bdraco commented Apr 23, 2023

while on the topic, is there any workaround to try with these cameras about the clock? for example the timezone on a server (my ntp is proxied by dnsmasq, the cameras are not allowed to the internet) or in the camera (the android app does not allow changing that and I do not have old windows) or something? It is Hikvision.

#91882

changes pushed to the custom component as well

last commit is

commit 6ad923c3258c89ee027238e999f839800d9495f4 (HEAD -> main, origin/main)
Author: J. Nick Koston <nick@koston.org>
Date:   Sun Apr 23 01:02:48 2023 -0500

    english
cd /config/custom_components/onvif
git pull
git log -1

@github-actions github-actions bot locked and limited conversation to collaborators May 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants