-
Notifications
You must be signed in to change notification settings - Fork 19
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
Client error '403 Forbidden' for url 'http://xxx.xxx.xxx.xxx/ISAPI/Streaming/channels/y0y but browser with this url returns '200 OK' #176
Comments
A HTTP response with a status code of 403 can indeed include a JSON body. By initialization the integration relies on status code only to probe available channels. Many cameras have no 3rd and 4th channels. The level of log entry is WARNING so you shouldn't worry about that. |
Above I wrote that my camera returns “200 OK” to this URL and XML, which contains the status “Not supported”...
But I have another logs... Every minute for each camera... My log full of this messages (see below)
And when I run this URL in browser, NVR returns this XML (not 403 Error)
Can you check - with what credentials you create HTTP-request to NVR? |
Credentials are always the same but I can check specific request because some of my cameras by initialization respond 403 as well, especially for 3rd stream. |
So, in the browser I get 403 as well and XML response. Credentials are in Authorization header of any request. |
But I get no 403 error - I get 200. With the same credentials. |
It is not straightforward as it seems. Basically any request goes from here https://github.com/maciej-or/hikvision_next/blob/main/custom_components/hikvision_next/isapi.py#L760 deeper is hikvisionapi library where http request is generated. |
Look, I understand. HIk library returns code 403, but in http-body returns some usefull info in xml. And you can analyze it. And another thing... Your addon every minute request for unsupported inputs. and every minute I get in logs messages about it. Can you change log-level of you logging in this (and similar) case? |
I don't need to analyze payload of failed /Streaming/channels/y0y requests, if failed it does mean the stream entity wont be created. |
What rights I need to add to user? Below all logs from HA log-file. So you can see that warnings repeated every two minutes.
|
Is there any update on this? |
I have not yet had time to prepare the information requested by the author (diagnostic information). |
I've been dealing with a similar issue. What I've discovered for my setup is that I can't get still images directly from the NVR using the URL in the integration. I get see the same error as @Nikolay-Ch. I found another thread that led me to a different URL for still images: albeit lower image quality than going to the camera directly, it produces the desired image. This is the thread that led me to the URL above (It's towards the bottom): I'm not sure if this helps, but I wanted to share because I've been wrestling with this issue for a few months. |
@code-monkey-71 pls check authentication mode for RTSP and WEB, here is a sample setup #124 (comment) |
I have set both authentication modes to digest, but I don't have the algorithm configuration setting. Was there something else from the post that I was supposed to do? I have followed the directions for giving user the appropriate permissions, but I haven't been able to get a snapshot from any of the cameras even if I configure the integration to use the admin user. Here is the diagnostic data: debug logging: I have two cameras that are connected to the NVR from another switch and those 2 cameras get their IP addresses from my DHCP server and are therefore able to be connected directly from HA. If I connect the NVR and the cameras directly to HA via the integration, I can get a snapshot from the instance that's directly connected to HA, but I get the failure above if I try to go through the NVR. Video recording seems to work either way for what it's worth. Here is the image created by the integration if I call the Take Snapshot camera service: |
Thanks for details of your setup. You shouldn't worry about failed request for 'http://IP_NVR/ISAPI/Streaming/channels/103', 104. Any camera can provide several steams and these requests check what is available on specific device. So in your case the 1st camera supports main stream 101 - 2560x1440, 2nd stream 102 - 640x480, and does not support 103 and 104, it's fine. For still images the integration uses:
It is mystery indeed why |
Thanks for saving me time reading through the code. I was starting to dig through isapi.py, but hadn't quite found the right spot. This code change solved the snapshot issue and everything else appears to still be working correctly. I'll do a little more testing through the day and post back any findings. I'm also going to look into potential chipset anomalies, as I recall having to get a special firmware update from Hikvision that wasn't publicly available. I'll try to dig up that email and see if it helps explain the problem. |
Cool, I compared your diagnostic data with mine but haven't found particular differences regarding using another url for still images. Ideally would be find a condition when to use 2nd url and improve the integration. |
Just reporting back that I haven't seen any issues with this workaround in my environment. Everything is now working as expected. Thanks, |
Hi,
When I connect NVR, this addon try to check all channels of the all cameras, that were connected to the NVR.
And then in log file of the HA I see this messages:
But if I try to call HTTP-request with this URL and credentials that I enter into addon, in browser I get something else like this:
And addon logs 403 errors, when each camera returns something useful information about channell or status "Not Supported".
I have HiWatch DS-N308(C) NVR, and DS-I400(C) cameras...
The text was updated successfully, but these errors were encountered: