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

Failed to Set up: Invalid_auth #132

Closed
davidwhi123 opened this issue Oct 12, 2024 · 10 comments
Closed

Failed to Set up: Invalid_auth #132

davidwhi123 opened this issue Oct 12, 2024 · 10 comments

Comments

@davidwhi123
Copy link

davidwhi123 commented Oct 12, 2024

Hi there

I hope you can help with an issue I've had since updating the software in HA.

I have been successfully using the integration for a while and recently updated to the latest version.

Since then, I'm getting an authorisation despite not changing any settings. The user name and password, IP address etc are unchanged and work when I log in to the Alarm panel directly. The user is an administrator role.

Appreciate any help / advice.

Thanks!

Capture1
Capture
Capture2

@petrleocompel
Copy link
Owner

Please read the readme. Having installer account can cause a lot of problems.

@petrleocompel
Copy link
Owner

petrleocompel commented Oct 13, 2024

@davidwhi123 there was no change regarding this API. There will be maybe "feature" coming up which could help you with this issue.

But in README I am advising not to have the installer. No clue why would It be needed. Having installer as the same user ... System is probable defaulting to "installer user" but that has no right to "use" the system just to configure.

If you want more help. I still need logs from the system.

@davidwhi123
Copy link
Author

The challenge I have it the AX pro UI doesn't let me delete the installer user, the delete button is greyed out (see image above)

If I give the installer full access I get the same error.

If anyone else has got around this issue I'd be very interested to know a solution!

@petrleocompel
Copy link
Owner

The solution will be later done in the API library hikaxpro send a special header to request "user" not "installer" account.

image

These days I was looking in to it. And I am currently in progress of implementing this.

@davidwhi123
Copy link
Author

davidwhi123 commented Oct 13, 2024

Ah good to know there's a potential fix.

These are the detailed error messages as logs if useful...

home-assistant_2024-10-13T17-32-34.586Z.log

Log Details (ERROR)

This error originated from a custom integration.

Logger: custom_components.hikvision_axpro.config_flow
Source: custom_components/hikvision_axpro/config_flow.py:218
integration: hikvision_axpro
First occurred: 12 October 2024 at 15:50:34 (3 occurrences)
Last logged: 12 October 2024 at 15:51:08

Unexpected exception
Traceback (most recent call last):
  File "/config/custom_components/hikvision_axpro/config_flow.py", line 218, in async_step_init
    info = await validate_input(self.hass, user_input)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/hikvision_axpro/config_flow.py", line 151, in validate_input
    if not await hub.authenticate():
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/hikvision_axpro/config_flow.py", line 98, in authenticate
    is_connect_success = await self.hass.async_add_executor_job(self.axpro.connect)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/hikaxpro.py", line 114, in connect
    encoded_password = self.encode_password(params)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/hikaxpro.py", line 90, in encode_password
    if session_cap.session_id_version == "2" and session_cap.is_irreversible:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'session_id_version'


Log Details (ERROR)
Logger: homeassistant.config_entries
Source: config_entries.py:594
First occurred: 12 October 2024 at 15:26:32 (2 occurrences)
Last logged: 12 October 2024 at 15:50:03

Error setting up entry Hikvision_axpro_192.168.0.18 for hikvision_axpro
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 594, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/hikvision_axpro/__init__.py", line 90, in async_setup_entry
    mac = await hass.async_add_executor_job(axpro.get_interface_mac_address, 1)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/hikaxpro.py", line 244, in get_interface_mac_address
    response = self.make_request(endpoint, consts.Method.GET)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/hikaxpro.py", line 298, in make_request
    self.connect()
  File "/usr/local/lib/python3.12/site-packages/hikaxpro.py", line 114, in connect
    encoded_password = self.encode_password(params)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/hikaxpro.py", line 90, in encode_password
    if session_cap.session_id_version == "2" and session_cap.is_irreversible:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'session_id_version'

@petrleocompel
Copy link
Owner

petrleocompel commented Oct 15, 2024

Released v2.3.0 to prevent usage of installer account.

If problem will appear again please reopen issue with new log from HA.

@davidwhi123
Copy link
Author

Hi there
Thanks for trying to resolve it. Unfortunately still getting the same error. Can I reopen this issue somehow or shall I raise a fresh one?

@davidwhi123
Copy link
Author

davidwhi123 commented Oct 15, 2024

Uploading home-assistant_2024-10-15T19-31-28.701Z.log…

Log Details (ERROR)
This error originated from a custom integration.
Logger: custom_components.hikvision_axpro.config_flow
Source: custom_components/hikvision_axpro/config_flow.py:218
integration: hikvision_axpro
First occurred: 20:20:24 (2 occurrences)
Last logged: 20:22:37

Unexpected exception
Traceback (most recent call last):
  File "/config/custom_components/hikvision_axpro/config_flow.py", line 218, in async_step_init
    info = await validate_input(self.hass, user_input)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/hikvision_axpro/config_flow.py", line 151, in validate_input
    if not await hub.authenticate():
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/hikvision_axpro/config_flow.py", line 98, in authenticate
    is_connect_success = await self.hass.async_add_executor_job(self.axpro.connect)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/hikaxpro.py", line 121, in connect
    encoded_password = self.encode_password(params)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/hikaxpro.py", line 97, in encode_password
    if session_cap.session_id_version == "2" and session_cap.is_irreversible:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'session_id_version'


Log Details (ERROR)
Logger: homeassistant.config_entries
Source: config_entries.py:594
First occurred: 20:19:50 (2 occurrences)
Last logged: 20:22:23

Error setting up entry Hikvision_axpro_192.168.0.18 for hikvision_axpro
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 594, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/hikvision_axpro/__init__.py", line 90, in async_setup_entry
    mac = await hass.async_add_executor_job(axpro.get_interface_mac_address, 1)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/hikaxpro.py", line 251, in get_interface_mac_address
    response = self.make_request(endpoint, consts.Method.GET)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/hikaxpro.py", line 307, in make_request
    self.connect()
  File "/usr/local/lib/python3.12/site-packages/hikaxpro.py", line 121, in connect
    encoded_password = self.encode_password(params)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/hikaxpro.py", line 97, in encode_password
    if session_cap.session_id_version == "2" and session_cap.is_irreversible:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'session_id_version'



Log Details (WARNING)
Logger: homeassistant.helpers.frame
Source: helpers/frame.py:188
First occurred: 20:19:19 (2 occurrences)
Last logged: 20:19:36

Detected that custom integration 'hikvision_axpro' accesses hass.helpers.service. This is deprecated and will stop working in Home Assistant 2024.11, it should be updated to import functions used from service directly at custom_components/hikvision_axpro/__init__.py, line 59: hass.helpers.service.async_register_admin_service(, please create a bug report at https://github.com/petrleocompel/hikaxpro_hacs/issues
Detected that custom integration 'nodered' registers an entity service with a non entity service schema which will stop working in HA Core 2025.9 at custom_components/nodered/switch.py, line 62: platform.async_register_entity_service(, please create a bug report at https://github.com/zachowj/hass-node-red/issues

@petrleocompel
Copy link
Owner

@davidwhi123 are you sure you have version 2.3.0 ?

Can you try swap your username for "admin"?
Or create new "local user" in the system on the "webpage" ?

@davidwhi123
Copy link
Author

Yes, its version 2.30.

I have just re-installed everything and it's now working! Thanks for your help.

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

2 participants