home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.91k stars 30.14k forks source link

ONVIF integration won't authenticate with Hikvision digest authentication #119107

Open Alby247 opened 3 months ago

Alby247 commented 3 months ago

The problem

ONVIF integration wont authenticate with Hikvision digest authentication

Previously reported here

https://github.com/home-assistant/core/issues/99166

but this was closed without resolution.

Hikvision devices are detected by ONVIF integration but authorisation fails

Returns error:

Could not authenticate: Unknown fault occured: <?xml version='1.0' encoding='utf-8'?> <head> <title>Unauthorized</title> <link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon"> </link> <body> <h2>Access Error: 401 -- Unauthorized</h2> <pre/> </body> </head>

Users/passwords etc in Hikvision devices checked and triple checked.

Nothing in system logs.

What version of Home Assistant Core has the issue?

2024.6.0

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

ONVIF

Link to integration documentation on our website

https://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

### Tasks
rainepretorius commented 3 months ago

Same for me ONVIF for my cameras not workig

brian-kehoe commented 3 months ago

I have received the same error message

quieThu commented 3 months ago

Same issue here :(

Alby247 commented 3 months ago

@hunterjm is this an issue with the integration, or is it something we are all doing wrong re authorisation of the Hikvision cameras?

quieThu commented 3 months ago

I receive this error message when trying to setup the onvif integration:

Could not authenticate: The action requested requires authorization and the sender is not authorized (code:env:Sender) (subcodes:{http://www.onvif.org/ver10/error}NotAuthorized)

Model: Hikvision DS-2DE2A404IW-DE3 FW: V5.7.11 build 230612 ONVIF authentication mode: digest/WSSE

The onvif username is pretty simple and the password is only 9 characters long without specials. It works perfectly with alternative ONVIF monitoring app (onvier from play store for example)

Screenshot_20240612_203615_Chrome

Alby247 commented 3 months ago

I should also mention I can connect to the NVR fine using Onvif Device Manager.

Onvif HA integration detects the NVR (and a camera that I enabled Onvif on) but it won't accept the authentication.

kizza42 commented 3 months ago

Am also experiencing this issue recently with a Hikvision DS-2CD2347G2-LU running its latest firmware. I have played with the different Onvif access levels, sometimes It just works and then I leave it be until the next HA Update restarts HA and things break again

ficho81 commented 2 months ago

I have an Annke C800 camera, very similar to Hikvision ones, and HA ONVIF stopped working some months ago. After a lot of debugging, I arrived to the conclusion that HA onvif integration may be the problem.

RuiFG commented 2 months ago

everybody help??

rainepretorius commented 2 months ago

What fixed mine was turning off stream encryption on the devices local menu.

markbooth73 commented 2 months ago

Hello, I have ANNKE AC500, again HA ONVIF stopped working.

How I "fixed" mine was to install Hikvision firmware.

This gave me an option to turn off time verification

image

For some reason whatever attempts to correct the time failed.

Regards,

ficho81 commented 2 months ago

I have an Annke C800 camera, very similar to Hikvision ones, and HA ONVIF stopped working some months ago. After a lot of debugging, I arrived to the conclusion that HA onvif integration may be the problem.

solved toggling "daylight saving time" option!!

home-assistant[bot] commented 2 months ago

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. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


onvif documentation onvif source (message by IssueLinks)

vizion1988 commented 1 month ago

I have an Annke C800 camera, very similar to Hikvision ones, and HA ONVIF stopped working some months ago. After a lot of debugging, I arrived to the conclusion that HA onvif integration may be the problem.

solved toggling "daylight saving time" option!!

This fixed the issue for me as well. First configure your time settings, thereafter enable DST. I worked the other way around and that doesn't work. So work from top to bottom in the time settings screen of your camera :-)

alexswider commented 1 month ago

Same here, works on VLC for example, not sure how to fix it.

jsf3rd commented 1 month ago

Hello, I have ANNKE AC500, again HA ONVIF stopped working.

How I "fixed" mine was to install Hikvision firmware.

This gave me an option to turn off time verification

image

For some reason whatever attempts to correct the time failed.

Regards,

The fundamental problem is that Onvif requires you to put the time value in UTC when encrypting the password.

image

treppler commented 1 week ago

Hello,

i have the same problem. In my cam i don't have any posibiltiy turn off time verification. I think it has something to do with the camera model. I have to different cmaera modells (Bullett and Dome) Both cameras using the same ONVIF-version. The bullet has this issue. New firmware isn't available. grafik

Homeassistant: grafik

Nothing was changed on the camera. This is what the protocol of homeassistant tells: grafik

miklosbagi commented 4 days ago

*bump* Annke NC800. I have had to do 2 things to make this work:

  1. DST was set - that needs to be turned off
  2. ONVIF Authentication in configuration > Network > Advanced Settings > Onvif Management. By default this is set to digest. I had to change it to digest/WSSE