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

UNEXPECTED ERROR while register ax pro #105

Open
plbage opened this issue Mar 28, 2024 · 4 comments
Open

UNEXPECTED ERROR while register ax pro #105

plbage opened this issue Mar 28, 2024 · 4 comments
Assignees
Labels
invalid This doesn't seem right question Further information is requested

Comments

@plbage
Copy link

plbage commented Mar 28, 2024

Unexpected exception

Traceback (most recent call last):
  File "/config/custom_components/hikvision_axpro/hikax/hikax.py", line 38, in get_session_params
    session_cap = self.parse_session_response(response.text)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/hikvision_axpro/hikax/hikax.py", line 66, in parse_session_response
    session_cap = SessionLoginCap.SessionLoginCap(
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: SessionLoginCap.__init__() missing 1 required positional argument: 'session_id_version'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/config/custom_components/hikvision_axpro/config_flow.py", line 178, in async_step_user
    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 116, 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 "/config/custom_components/hikvision_axpro/hikax/hikax.py", line 93, in connect
    params = self.get_session_params()
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/hikvision_axpro/hikax/hikax.py", line 41, in get_session_params
    raise errors.IncorrectResponseContentError()
errors.errors.IncorrectResponseContentError: Response content is not in expected form.

@petrleocompel
Copy link
Owner

Hi, can you provide more info?

  1. version of your firmware
  2. model of your device
  3. during setting up of integration enable "debug output" (if you updating settings of existing config you have to restart HA)

@plbage
Copy link
Author

plbage commented Mar 29, 2024

Hello,

Tested with two AXPRO different address (wired & wireless)
Thx a lot for your help and time

1.AXPRO Firmware version => V1.2.9
2. DS-PWA96-M-WE
3. debug output enabled

> > Unexpected exception
> 
> Traceback (most recent call last):
>   File "/usr/local/lib/python3.12/site-packages/urllib3/connection.py", line 174, in _new_conn
>     conn = connection.create_connection(
>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   File "/usr/local/lib/python3.12/site-packages/urllib3/util/connection.py", line 95, in create_connection
>     raise err
>   File "/usr/local/lib/python3.12/site-packages/urllib3/util/connection.py", line 85, in create_connection
>     sock.connect(sa)
> TimeoutError: [Errno 110] Operation timed out
> 
> During handling of the above exception, another exception occurred:
> 
> Traceback (most recent call last):
>   File "/usr/local/lib/python3.12/site-packages/urllib3/connectionpool.py", line 715, in urlopen
>     httplib_response = self._make_request(
>                        ^^^^^^^^^^^^^^^^^^^
>   File "/usr/local/lib/python3.12/site-packages/urllib3/connectionpool.py", line 416, in _make_request
>     conn.request(method, url, **httplib_request_kw)
>   File "/usr/local/lib/python3.12/site-packages/urllib3/connection.py", line 244, in request
>     super(HTTPConnection, self).request(method, url, body=body, headers=headers)
>   File "/usr/local/lib/python3.12/http/client.py", line 1331, in request
>     self._send_request(method, url, body, headers, encode_chunked)
>   File "/usr/local/lib/python3.12/http/client.py", line 1377, in _send_request
>     self.endheaders(body, encode_chunked=encode_chunked)
>   File "/usr/local/lib/python3.12/http/client.py", line 1326, in endheaders
>     self._send_output(message_body, encode_chunked=encode_chunked)
>   File "/usr/local/lib/python3.12/http/client.py", line 1085, in _send_output
>     self.send(msg)
>   File "/usr/local/lib/python3.12/http/client.py", line 1029, in send
>     self.connect()
>   File "/usr/local/lib/python3.12/site-packages/urllib3/connection.py", line 205, in connect
>     conn = self._new_conn()
>            ^^^^^^^^^^^^^^^^
>   File "/usr/local/lib/python3.12/site-packages/urllib3/connection.py", line 179, in _new_conn
>     raise ConnectTimeoutError(
> urllib3.exceptions.ConnectTimeoutError: (<urllib3.connection.HTTPConnection object at 0x7f5d3489b0>, 'Connection to 192.169.0.3 timed out. (connect timeout=None)')
> 
> During handling of the above exception, another exception occurred:
> 
> Traceback (most recent call last):
>   File "/usr/local/lib/python3.12/site-packages/requests/adapters.py", line 486, in send
>     resp = conn.urlopen(
>            ^^^^^^^^^^^^^
>   File "/usr/local/lib/python3.12/site-packages/urllib3/connectionpool.py", line 799, in urlopen
>     retries = retries.increment(
>               ^^^^^^^^^^^^^^^^^^
>   File "/usr/local/lib/python3.12/site-packages/urllib3/util/retry.py", line 592, in increment
>     raise MaxRetryError(_pool, url, error or ResponseError(cause))
> urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='192.169.0.3', port=80): Max retries exceeded with url: /ISAPI/Security/sessionLogin/capabilities?username=vecjhd (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x7f5d3489b0>, 'Connection to 192.169.0.3 timed out. (connect timeout=None)'))
> 
> During handling of the above exception, another exception occurred:
> 
> Traceback (most recent call last):
>   File "/config/custom_components/hikvision_axpro/config_flow.py", line 178, in async_step_user
>     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 116, 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 "/config/custom_components/hikvision_axpro/hikax/hikax.py", line 93, in connect
>     params = self.get_session_params()
>              ^^^^^^^^^^^^^^^^^^^^^^^^^
>   File "/config/custom_components/hikvision_axpro/hikax/hikax.py", line 29, in get_session_params
>     response = requests.get(f"http:https://{q_user}:{q_password}@{self.host}{consts.Endpoints.Session_Capabilities}{q_user}")
>                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   File "/usr/local/lib/python3.12/site-packages/requests/api.py", line 73, in get
>     return request("get", url, params=params, **kwargs)
>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   File "/usr/local/lib/python3.12/site-packages/requests/api.py", line 59, in request
>     return session.request(method=method, url=url, **kwargs)
>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   File "/usr/local/lib/python3.12/site-packages/requests/sessions.py", line 589, in request
>     resp = self.send(prep, **send_kwargs)
>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   File "/usr/local/lib/python3.12/site-packages/requests/sessions.py", line 703, in send
>     r = adapter.send(request, **kwargs)
>         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   File "/usr/local/lib/python3.12/site-packages/requests/adapters.py", line 507, in send
>     raise ConnectTimeout(e, request=request)
> requests.exceptions.ConnectTimeout: HTTPConnectionPool(host='192.169.0.3', port=80): Max retries exceeded with url: /ISAPI/Security/sessionLogin/capabilities?username=vecjhd (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x7f5d3489b0>, 'Connection to 192.169.0.3 timed out. (connect timeout=None)'))
> 
> > 

@petrleocompel
Copy link
Owner

@plbage Can you screenshot the config before you press the "send" in configuration ?

Seems like invalid address is being put in IP field. Because I see Connection to 192.169.0.3 timed out
And are you sure that your AXPro IP is 192.169.0.3 -> I think that is public IP. I think you wanted to type 192.168.0.3...

@petrleocompel petrleocompel self-assigned this Apr 2, 2024
@petrleocompel petrleocompel added invalid This doesn't seem right question Further information is requested labels Apr 2, 2024
@petrleocompel
Copy link
Owner

@plbage Any update on this ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants