petrleocompel / hikaxpro_hacs

HACS repository of Hikvision Ax Pro integration for home assistant
MIT License
40 stars 4 forks source link

Connect DS-PHA20-P device on v2.1.0-beta1 #57

Closed idealser closed 1 year ago

idealser commented 1 year ago

Got Unexpected error while connecting to the device. AX Hub checkbox was enabled.

2023-08-02 10:36:31.150 DEBUG (SyncWorker_4) [custom_components.hikvision_axpro.hikax.hikax] Session_Capabilities response
2023-08-02 10:36:31.150 DEBUG (SyncWorker_4) [custom_components.hikvision_axpro.hikax.hikax] Status: 200
2023-08-02 10:36:31.150 DEBUG (SyncWorker_4) [custom_components.hikvision_axpro.hikax.hikax] Content: b'<SessionLoginCap version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">\n<sessionID>f4a6bf2fe2f3f4605830319704e1c078c13e099e044c0dae86f566c2ce34676d</sessionID>\n<challenge>d2e0285141072119dac229ec036c386c</challenge>\n<iterations>100</iterations>\n<isIrreversible>true</isIrreversible>\n<sessionIDVersion>2</sessionIDVersion>\n<salt>bef6d541c1ac37f74d90b9d3dc642ab6ea54b17d653b10f24464867b6dbeacb5</salt>\n</SessionLoginCap>\n'
2023-08-02 10:36:31.150 DEBUG (SyncWorker_4) [custom_components.hikvision_axpro.hikax.hikax] Text: <SessionLoginCap version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<sessionID>f4a6bf2fe2f3f4605830319704e1c078c13e099e044c0dae86f566c2ce34676d</sessionID>
<challenge>d2e0285141072119dac229ec036c386c</challenge>
<iterations>100</iterations>
<isIrreversible>true</isIrreversible>
<sessionIDVersion>2</sessionIDVersion>
<salt>bef6d541c1ac37f74d90b9d3dc642ab6ea54b17d653b10f24464867b6dbeacb5</salt>
</SessionLoginCap>

2023-08-02 10:36:31.150 DEBUG (SyncWorker_4) [custom_components.hikvision_axpro.hikax.hikax] Headers: {'Date': 'Wed, 02 Aug 2023 12:36:29 GMT', 'Server': 'Webs', 'X-Frame-Options': 'SAMEORIGIN', 'Cache-Control': 'no-cache', 'Content-Length': '428', 'Content-Type': 'application/xml; charset="UTF-8"', 'Connection': 'keep-alive', 'Keep-Alive': 'timeout=60, max=99'}
2023-08-02 10:36:31.150 DEBUG (SyncWorker_4) [custom_components.hikvision_axpro.hikax.hikax] End Session_Capabilities response
2023-08-02 10:36:31.150 WARNING (SyncWorker_4) [custom_components.hikvision_axpro.hikax.hikax] Debug data <SessionLoginCap version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<sessionID>f4a6bf2fe2f3f4605830319704e1c078c13e099e044c0dae86f566c2ce34676d</sessionID>
<challenge>d2e0285141072119dac229ec036c386c</challenge>
<iterations>100</iterations>
<isIrreversible>true</isIrreversible>
<sessionIDVersion>2</sessionIDVersion>
<salt>bef6d541c1ac37f74d90b9d3dc642ab6ea54b17d653b10f24464867b6dbeacb5</salt>
</SessionLoginCap>

2023-08-02 10:36:31.153 ERROR (MainThread) [custom_components.hikvision_axpro.config_flow] 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.11/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.
idealser commented 1 year ago

Will add to the old issue #56