pergolafabio / Hikvision-Addons

Home Assistant: Hikvision Doorbell
182 stars 40 forks source link

Load Error #73

Closed niraviry closed 1 year ago

niraviry commented 1 year ago

Just installed the Beta 5 verion. Rest is latest verion. As mentioned I have removed the SDK add-on. I have left the home-assistant URL as is as there is no documentation for it. I an getting an error that looks like a fata one and add-on will not start:

2023-02-25 11:50:49.462 | DEBUG    | __main__:main:24 - Importing Hikvision SDK
2023-02-25 11:50:49.468 | INFO     | sdk.utils:loadSDK:44 - Using OS: Linux with architecture: aarch64
2023-02-25 11:50:49.468 | DEBUG    | sdk.utils:loadSDK:57 - Loading library from lib-aarch64/libhcnetsdk.so
hpr tls index{3}
2023-02-25 11:50:49.499 | DEBUG    | __main__:main:28 - Hikvision SDK loaded
2023-02-25 11:50:49.500 | DEBUG    | sdk.utils:setupSDK:83 - Initializing SDK
loop[2] find 2 mac and 0 ip
[2023-02-25 11:50:49.526][DBG] CCoreGlobalCtrlBase::LoadDSo, HPR_LoadDSo Succ, Path[/lib/aarch64-linux-gnu/libz.so.1.2.11], hHandleRet[2127374928]
2023-02-25 11:50:49.527 | DEBUG    | sdk.utils:setupSDK:97 - SDK initialized
[2023-02-25 11:50:49.526][INF] The COM:HCCoreBase ver is 6.1.4.15, 2020_03_05. Async:1.
[2023-02-25 11:50:49.526][INF] The COM:Core ver is 6.1.8.101, 2021_12_10. Async:1.
[2023-02-25 11:50:49.526][INF] This HCNetSDK ver is 6.1.8.101 Ver 2021_12_10.
2023-02-25 11:50:49.527 | DEBUG    | doorbell:__init__:38 - Setting up doorbell: front_gate
2023-02-25 11:50:49.528 | DEBUG    | doorbell:authenticate:45 - Logging into doorbell
[2023-02-25 11:50:49.529][INF] Login dev 10.0.0.11:8000.
[2023-02-25 11:50:49.529][INF] dwTotalNum[2048]
[2023-02-25 11:50:49.531][INF] Private connect 10.0.0.11:8000 sock=7 this=0x7f0488e4 cmd=0x10000 port=54962
[2023-02-25 11:50:49.531][INF] LogonDev1 in[10.0.0.11:8000]
[2023-02-25 11:50:49.533][DBG] CCoreGlobalCtrlBase::LoadDSo, HPR_LoadDSo Succ, Path[/app/lib-aarch64/libcrypto.so], hHandleRet[2130466608]
[2023-02-25 11:50:49.535][DBG] CCoreGlobalCtrlBase::LoadDSo, HPR_LoadDSo Succ, Path[/app/lib-aarch64/libssl.so], hHandleRet[2130467872]
[2023-02-25 11:50:49.535][INF] SSLTRANSAPI::LoadAPI, libeay, Load Real Path[/app/lib-aarch64/libcrypto.so]
[2023-02-25 11:50:49.535][INF] SSLTRANSAPI::IsAllAPILoaded, SSL_library_init Unload
[2023-02-25 11:50:49.535][INF] OpenSSL, Not All Function Loaded!
[2023-02-25 11:50:49.535][INF] SSLTRANSAPI::PrintVersion, OpenSSL version info [OpenSSL 1.1.1i  8 Dec 2020]
[2023-02-25 11:50:49.535][INF] CSSLTrans::SSLCtxInit, dwSSLVersion[6], m_fnTLSServerMethod
Traceback (most recent call last):
  File "/app/main.py", line 85, in <module>
    asyncio.run(main())
  File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
[2023-02-25 11:50:50.420][ERR] LogonDev1[10.0.0.11]
[2023-02-25 11:50:50.421][ERR] [10.0.0.11:8000]PRO_LoginHikDevice fail[err=1].[0x-0000001,0x-0000001]
[2023-02-25 11:50:50.421][ERR] CMemberMgrBase::AllocIndex2, MemberStart Failed, iIndex[0]
    return future.result()
  File "/app/main.py", line 40, in main
    doorbell.authenticate()
  File "/app/doorbell.py", line 56, in authenticate
    raise RuntimeError(f"SDK error code {self._sdk.NET_DVR_GetLastError()}")
RuntimeError: SDK error code 1
[2023-02-25 11:50:50.492][INF] COM_Logout[-1][1]

What seems to be the problem?

niraviry commented 1 year ago

Is it linked to the door status input at the outdoor station? I have hooked a magnetic switch in there so I can sense if someone opens the door without any connection to the door ringing or the door open switch.

pergolafabio commented 1 year ago

yes, the switch is indeed triggered to "on" when you open the door with key/badge/isapi , same behaviour as before with the binary_sensor.door

The switch just has now 2 functions, it opens a door, but its actually also a sensor

niraviry commented 1 year ago

OK.

mion00 commented 1 year ago

The switch acts essentially as a sensor for when the door open event is notified to us by the doorbell, and can also act toward the doorbell by opening the door when it is flipped to on inside HA.

niraviry commented 1 year ago

OK. Got it. Now I am struggling with go2rtc as from some reason it sopped working. I did not do anything. I see no video.

niraviry commented 1 year ago

Hi. Just returned to the issue. Got the latest Beta version. Call reject works. Call answer does not work. Both show some error in debug. See below log which is a button press, intercom answer which actually does nothing and after a second or two, a call reject.

`[2023-03-25 18:53:01.557][DBG] SimpleSTDCommandToDvr with out cmd[GET /ISAPI/System/deviceInfo], input size[0], max segment length[262144] [2023-03-25 18:53:01.557][ERR] StructureMime BOUNDARY DATA ERROR! 2023-03-25 18:53:01.591 | DEBUG | sdk.utils:call_ISAPI:125 - Request body: 2023-03-25 18:53:01.601 | DEBUG | sdk.utils:call_ISAPI:165 - Response output:

Embedded Net VIS 48513033-3131-3030-3033-c0517e003ddc DS-KH6320-TE1 DS-KH6320-TE10120200902WRQ03110003CLU c0:51:7e:00:3d:dc V2.1.34 build 220908 V1.0 build 000000 DVR 0 255 0 8

[2023-03-25 18:53:01.598][INF] Private connect 10.0.0.12:8000 sock=26 this=0x73b18aa4 cmd=0x117000 port=35348 [2023-03-25 18:53:01.601][DBG] SimpleSTDCommandToDvr with out cmd[GET /ISAPI/System/deviceInfo], input size[0], max segment length[262144] [2023-03-25 18:53:01.601][ERR] StructureMime BOUNDARY DATA ERROR! 2023-03-25 18:53:01.629 | DEBUG | event:start:227 - Registering callback function using SDK 2023-03-25 18:53:01.631 | DEBUG | doorbell:setup_alarm:79 - Arming the device via SDK [2023-03-25 18:53:01.634][INF] Private connect 10.0.0.11:8000 sock=38 this=0x73b18aa4 cmd=0x111020 port=53130 2023-03-25 18:53:01.648 | DEBUG | doorbell:setup_alarm:79 - Arming the device via SDK 2023-03-25 18:53:01.655 | DEBUG | input:loop_forever:29 - Waiting for input command [2023-03-25 18:53:01.651][INF] Private connect 10.0.0.12:8000 sock=41 this=0x73b18fc0 cmd=0x111020 port=35362 [2023-03-25 18:53:37.507][DBG] Alarm chan [0] recv timeout[2]! 2023-03-25 18:53:47.651 | DEBUG | event:_handle_callback:192 - Callback invoked from SDK 2023-03-25 18:53:47.654 | DEBUG | event:_invoke_handlers:166 - Invoking 2 handlers 2023-03-25 18:53:47.655 | INFO | event:video_intercom_alarm:109 - Video intercom alarm from front_gate 2023-03-25 18:53:47.656 | INFO | mqtt:video_intercom_alarm:236 - Doorbell ringing, updating sensor settings: mqtt=MQTT(host='core-mosquitto', username='addons', password='WohMitahLoolee0wiethohgh3aifeiziaveiNococeikoogiehietheph9eibaed', client_name=None, tls_key=None, tls_certfile=None, tls_ca_cert=None, discovery_prefix='homeassistant', state_prefix='hmd') entity=SensorInfo(component='sensor', device=DeviceInfo(name='front_gate', model='DS-KD8003-IME1/EU', manufacturer='Hikvision', sw_version='V2.2.56', hw_version='0x0', identifiers='6883457568564848514573776949476985484950485048485548578282695356495554505154', connections=None, configuration_url=None), device_class=None, enabled_by_default=None, entity_category=None, expire_after=None, force_update=None, icon='mdi:bell', name='Call state', object_id='front_gate_call_state', qos=None, unique_id='6883457568564848514573776949476985484950485048485548578282695356495554505154-call_state', unit_of_measurement=None) debug=False manual_availability=True topic_prefix: sensor/front_gate/Call-state config_topic: homeassistant/sensor/front_gate/Call-state/config state_topic: hmd/sensor/front_gate/Call-state/state wrote_configuration: True

[2023-03-25 18:53:47.651][INF] Alarm[0] IP[10.0.0.11] data_len[568] alarm_len[568] status[430] 2023-03-25 18:53:52.043 | INFO | mqtt_input:_answer_call_callback:113 - Received answer command for doorbell: front_gate 2023-03-25 18:53:52.044 | DEBUG | sdk.utils:call_ISAPI:125 - Request body: {"CallSignal": {"cmdType": "answer"}} [2023-03-25 18:53:52.052][INF] Private connect 10.0.0.11:8000 sock=42 this=0x73b194dc cmd=0x117001 port=47122 2023-03-25 18:53:52.062 | DEBUG | sdk.utils:call_ISAPI:162 - Response status: { "requestURL": "/ISAPI/VideoIntercom/callSignal", "statusCode": 6, "statusString": "Invalid Content", "subStatusCode": "badXmlContent", "errorCode": 1610612739, "errorMsg": "Wrong XMLcontent" } 2023-03-25 18:53:52.063 | ERROR | mqtt_input:_answer_call_callback:125 - Error while answering call: ('Error while calling ISAPI /ISAPI/VideoIntercom/callSignal?format=json', 11, 'The data sent to the device is illegal, or the data received from the device error. E.g. The input data is not supported by the device for remote configuration.') [2023-03-25 18:53:52.062][DBG] SimpleSTDCommandToDvr with out cmd[PUT /ISAPI/VideoIntercom/callSignal?format=json], input size[37], max segment length[262144] 2023-03-25 18:54:00.171 | INFO | mqtt_input:_reject_call_callback:98 - Received reject command for doorbell: front_gate 2023-03-25 18:54:00.172 | DEBUG | sdk.utils:call_ISAPI:125 - Request body: {"CallSignal": {"cmdType": "reject"}} [2023-03-25 18:54:00.181][INF] Private connect 10.0.0.11:8000 sock=42 this=0x73b194dc cmd=0x117001 port=57522 2023-03-25 18:54:00.187 | INFO | mqtt_input:_reject_call_callback:98 - Received reject command for doorbell: main_intercom_panel 2023-03-25 18:54:00.187 | DEBUG | sdk.utils:call_ISAPI:125 - Request body: {"CallSignal": {"cmdType": "reject"}} [2023-03-25 18:54:00.195][INF] Private connect 10.0.0.12:8000 sock=43 this=0x73b199f8 cmd=0x117001 port=46418 2023-03-25 18:54:00.209 | DEBUG | sdk.utils:call_ISAPI:162 - Response status: { "requestURL": "/ISAPI/VideoIntercom/callSignal", "statusCode": 6, "statusString": "Invalid Content", "subStatusCode": "badXmlContent", "errorCode": 1610612739, "errorMsg": "Wrong XMLcontent" } 2023-03-25 18:54:00.210 | ERROR | mqtt_input:_reject_call_callback:110 - Error while rejecting call: ('Error while calling ISAPI /ISAPI/VideoIntercom/callSignal?format=json', 11, 'The data sent to the device is illegal, or the data received from the device error. E.g. The input data is not supported by the device for remote configuration.') 2023-03-25 18:54:00.213 | DEBUG | sdk.utils:call_ISAPI:165 - Response output: { "statusCode": "1", [2023-03-25 18:54:00.209][DBG] SimpleSTDCommandToDvr with out cmd[PUT /ISAPI/VideoIntercom/callSignal?format=json], input size[37], max segment length[262144] "statusString": "OK", "errorMsg": "ok", "errorCode": 1 } [2023-03-25 18:54:00.213][DBG] SimpleSTDCommandToDvr with out cmd[PUT /ISAPI/VideoIntercom/callSignal?format=json], input size[37], max segment length[262144] 2023-03-25 18:54:01.259 | DEBUG | event:_handle_callback:192 - Callback invoked from SDK 2023-03-25 18:54:01.261 | DEBUG | event:_invoke_handlers:166 - Invoking 2 handlers 2023-03-25 18:54:01.262 | INFO | event:video_intercom_alarm:109 - Video intercom alarm from front_gate 2023-03-25 18:54:01.263 | INFO | mqtt:video_intercom_alarm:239 - Call dismissed, updating sensor settings: mqtt=MQTT(host='core-mosquitto', username='addons', password='WohMitahLoolee0wiethohgh3aifeiziaveiNococeikoogiehietheph9eibaed', client_name=None, tls_key=None, tls_certfile=None, tls_ca_cert=None, discovery_prefix='homeassistant', state_prefix='hmd') entity=SensorInfo(component='sensor', device=DeviceInfo(name='front_gate', model='DS-KD8003-IME1/EU', manufacturer='Hikvision', sw_version='V2.2.56', hw_version='0x0', identifiers='6883457568564848514573776949476985484950485048485548578282695356495554505154', connections=None, configuration_url=None), device_class=None, enabled_by_default=None, entity_category=None, expire_after=None, force_update=None, icon='mdi:bell', name='Call state', object_id='front_gate_call_state', qos=None, unique_id='6883457568564848514573776949476985484950485048485548578282695356495554505154-call_state', unit_of_measurement=None) debug=False manual_availability=True topic_prefix: sensor/front_gate/Call-state config_topic: homeassistant/sensor/front_gate/Call-state/config state_topic: hmd/sensor/front_gate/Call-state/state wrote_configuration: True

[2023-03-25 18:54:01.259][INF] Alarm[0] IP[10.0.0.11] data_len[568] alarm_len[568] status[430] [2023-03-25 18:54:08.261][DBG] Alarm chan [0] recv timeout[2]!`

BTW, the debug buffer is too small so you can;t see few actions in one shot.

niraviry commented 1 year ago

As for the video, I see video with voice coming from the outdoor unit but since the answer does not work, I can't say it is working. Anyway, there is voice coming in even if the speaker is muted. There are some more issues there but I first want to solve the answer issue to see what happens.

pergolafabio commented 1 year ago

Yeah, answer doesn't work here either, for the moment it has no purpose on this addon, only usefully to start manually two way audio

niraviry commented 1 year ago

I want to be sure I understand you correctly. Detection of door ringing supposed to trigger an automation which runs two way Audio and video using go2rtc. Am I correct?

pergolafabio commented 1 year ago

No, not at all, there is no relationship between this addon and go2rtc..

The go2rtc addon is just the first start to view a camera feed with 2 way audio in their own webframe, but imo not suitable yet for a doorbell replacement