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

Username, Password, or Address is wrong. #145

Open
systxix opened this issue Jan 20, 2022 · 20 comments
Open

Username, Password, or Address is wrong. #145

systxix opened this issue Jan 20, 2022 · 20 comments

Comments

@systxix
Copy link

systxix commented Jan 20, 2022

Version of the custom_component

Configuration

Add your logs here.

Describe the bug

While adding camera to HA i'm getting this error: "Username, Password, or Address is wrong."
Using default username admin/admin

Are these cameras supported?

IPC-HFW1320S
IPC-HFW1300S
IPC-HFW2320R-ZS

Debug log


Add your logs here.

@AndreTzerra
Copy link

AndreTzerra commented Feb 6, 2022

I have the same problem.

When I try to add my XVR5108HS I have the same problem.
In the past I have managed to get a connection once.
Last week I had to change my complete network IP range.
(Migrated from 192.168.2.X to 10.11.1.X)

And now I can't get it to work again.
I'm sure that I use the right Name, password IP and port settings.
Below is the output from the Dahua log:

File "/config/custom_components/dahua/client.py", line 657, in get
response.raise_for_status()
File "/usr/local/lib/python3.9/site-packages/aiohttp/client_reqrep.py", line 1004, in raise_for_status
raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 500, message='Internal Server Error', url=URL('https://10.11.1.180:443/cgi-bin/magicBox.cgi?action=getMachineName')

When I go to https://10.11.1.180:443/cgi-bin/magicBox.cgi?action=getMachineName, I get "name=XVR".

@intelwolf
Copy link

For me it worked after changing the source code from client.py to below (in the custom_components folder). As it appeared my cam only provided that information after authentication and this fixed it:

_# self._base = "{0}://{1}:{2}".format(protocol, address, port)
self.base = "{0}://{1}:{2}@{3}:{4}".format(protocol, username, password, address, port)

@rroller
Copy link
Owner

rroller commented Feb 6, 2022

Thanks, this helps a lot. Can you try this (make sure to revert the code change)...
When adding the cam, for the address do this... but your username and password...
user:password@IP_ADDRESS
for example...

admin:pass@192.168.1.203

@AndreTzerra
Copy link

The option : _self.base = "{0}://{1}:{2}@{3}:{4}".format(protocol, username, password, address, port) did not work for me.

For me the solution looks very simple:
I used port 80 all the time. Let's give 443 one try. Thats it!

After deleting and reinstalling the component it works. 👍

@intelwolf
Copy link

That was my initial attempt (adding username:passwd to the address field). The result was that my camera got initialised without errors and all but I couldn't get the streams working. Makes sense I guess since the rtsp streams already have username password in it and using this method it would duplicate that.

@systxix
Copy link
Author

systxix commented Feb 16, 2022

Thanks, this helps a lot. Can you try this (make sure to revert the code change)... When adding the cam, for the address do this... but your username and password... user:password@IP_ADDRESS for example...

admin:pass@192.168.1.203

I can add camera like this but like intelwolf mentioned stream is not working.

@si458
Copy link
Contributor

si458 commented Feb 25, 2022

have you tried:

  1. delete device/integration
  2. updating to the latest version 0.9.39
  3. enable debug in configuration.yaml
  4. reboot HA
  5. try adding the device again and then checking logs
    (also check the user/pass works in your browser works directy from the camera ip first)

@systxix
Copy link
Author

systxix commented Feb 27, 2022

This error originated from a custom integration.

Logger: custom_components.dahua
Source: custom_components/dahua/client.py:670
Integration: Dahua (documentation, issues)
First occurred: 14:40:44 (1 occurrences)
Last logged: 14:40:44

Could not connect to Dahua device. For iMou devices see #6
Traceback (most recent call last):
File "/config/custom_components/dahua/config_flow.py", line 177, in _test_credentials
data = await client.get_machine_name()
File "/config/custom_components/dahua/client.py", line 101, in get_machine_name
return await self.get("/cgi-bin/magicBox.cgi?action=getMachineName")
File "/config/custom_components/dahua/client.py", line 687, in get
raise exception
File "/config/custom_components/dahua/client.py", line 670, in get
response.raise_for_status()
File "/usr/local/lib/python3.9/site-packages/aiohttp/client_reqrep.py", line 1004, in raise_for_status
raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 401, message='Unauthorized', url=URL('http://192.168.88.246:80/cgi-bin/magicBox.cgi?action=getMachineName')

@si458
Copy link
Contributor

si458 commented Feb 27, 2022

401, message='Unauthorized',

you need to verify the user/pass is correct by going to the URL it shows directly in your browser,
if the user/pass is correct you should get like a 404 error or 200 or something else, but not a 401 error

@systxix
Copy link
Author

systxix commented Feb 27, 2022

User and pass is correct. When opening http://192.168.88.246/cgi-bin/magicBox.cgi?action=getMachineName it asks for user/pass and then displays camera name=2A01ED7PAA00426

@nbmi
Copy link

nbmi commented Apr 2, 2022

As a critical initial step for those new to this, make sure your CGI service is enabled (System->Safety->SystemService->CGI Service).

I hadn't done this and could not connect to the camera at all after trying all suggestions in this thread. When I visited this location in browser (http://192.168.1.10/cgi-bin/magicBox.cgi?action=getMachineName) I got a 404. And after trying to add the integration, I would see a 404 error in the integration logs. But after enabling CGI, I was able to successfully add the camera to HA.

Tested on Dahua N43AM5Z

@giedriuskilcauskas
Copy link

After camera reset I was unable to setup camera in Integration, but while checking suggestion by @nbmi (which was Enabled, btw), I've noticed setting Private Protocol Authentication Mode (in the same location). Once I've changed to Compatibility Mode, it started working.

@alnsiuenrasd
Copy link

After exploring all of the suggestions provided here, I finally just reflashed home assistant and started all over. Once the Dahua integration was installed through HACS I was able to add all of my cameras with no issues. Perhaps this is an issue with Home Assistant?

@gnkarn
Copy link

gnkarn commented May 14, 2022

i have tried everything mentioned above , but still the same error , indicating error with name password or address ,
the url test works ok from browser . something else i could try ?, tks

this is the log info

Traceback (most recent call last):
File "/config/custom_components/dahua/config_flow.py", line 177, in _test_credentials
data = await client.get_machine_name()
File "/config/custom_components/dahua/client.py", line 101, in get_machine_name
return await self.get("/cgi-bin/magicBox.cgi?action=getMachineName")
File "/config/custom_components/dahua/client.py", line 687, in get
raise exception
File "/config/custom_components/dahua/client.py", line 670, in get
response.raise_for_status()
File "/usr/local/lib/python3.9/site-packages/aiohttp/client_reqrep.py", line 1004, in raise_for_status
raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 500, message='Internal Server Error', url=URL('https://192.168.0.199:443/cgi-bin/magicBox.cgi?action=getMachineName')

so , it seams the url fails, but if i test the URL , result is success .

@gnkarn
Copy link

gnkarn commented May 14, 2022

problem solved , it was port number 443 instead of 80

@NicusorFlorinBaluta
Copy link

hello, i have the same issue, but i can't find this CGI setting @nbmi is talking about
i tried the other solutions and they didn't work
my camera model is IPC-F42FE
Can someone help me please?
I managed to compose a working rtsp url, which i used in vlc without issue, so the ip/username/password are fine

@si458
Copy link
Contributor

si458 commented Aug 11, 2023

hello, i have the same issue, but i can't find this CGI setting @nbmi is talking about
i tried the other solutions and they didn't work
my camera model is IPC-F42FE
Can someone help me please?
I managed to compose a working rtsp url, which i used in vlc without issue, so the ip/username/password are fine

Are u using special characters in tbe password?
I found with one unit we have, it was fiddly with special characters so we changed it to a long number n letters one and it just worked then?

@NicusorFlorinBaluta
Copy link

no special characters, it's the default password. i also just noticed i cannot access the camera by entering the ip address into the browser

@si458
Copy link
Contributor

si458 commented Aug 11, 2023

Have u tried https://THEIP ?

@NicusorFlorinBaluta
Copy link

Did now, still no spark :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants