pergolafabio / Hikvision-Addons

Home Assistant: Hikvision Doorbell
179 stars 40 forks source link

DS-KH6320-WTDE1 doorbell state unavailable issue #227

Closed 6PATyCb closed 5 days ago

6PATyCb commented 1 week ago

What happened?

Hi again :) I continue to deal with the DS-KH6320-WTDE1 doorbell in HA. I saw on other screenshots that the device status should be available, but I don't see it on mine. I tried stopping the addon, deleting the device, turning on the addon. Instead of two devices, only one was added. The second was added after the command to reboot the first. The status still hasn't appeared. Please help, I am ready to attach any required logs.

Add-on

Hikvision Doorbell

What version of the add-on are you running?

3.0.16

Installation type

Home Assistant add-on

Relevant log output

2024-10-03 02:59:04.454 | DEBUG    | doorbell:isapi_door_capabilities:219 - No door relays found for the indoor device
2024-10-03 02:59:04.454 | DEBUG    | doorbell:get_num_outputs_indoor:238 - Unable to get the number of doors on the indoor station, please configure the relays manually with this option in the config: output_relays
2024-10-03 02:59:04.454 | DEBUG    | mqtt:__init__:163 - Configuring 0 door switches
2024-10-03 02:59:04.454 | DEBUG    | sdk.utils:call_ISAPI:125 - Call ISAPI request method url body: GET /ISAPI/System/deviceInfo  
[2024-10-03 02:59:04.450][INF] Private connect 192.168.133.170:8000 sock=139 this=0xda3cc4d4 cmd=0x117000 port=46294

[2024-10-03 02:59:04.453][DBG] SimpleSTDCommandToDvr with out cmd[GET /ISAPI/AccessControl/RemoteControl/door/capabilities], input size[0], max segment length[262144]

[2024-10-03 02:59:04.458][INF] Private connect 192.168.133.170:8000 sock=139 this=0xda3cc4d4 cmd=0x117000 port=46310

2024-10-03 02:59:04.461 | DEBUG    | sdk.utils:call_ISAPI:165 - Response output: <DeviceInfo version="2.0" xmlns="http://www.isapi.org/ver20/XMLSchema">
<deviceName>Kitchen</deviceName>
<deviceID>48513138-3437-3932-3533-e0baad898055</deviceID>
<model>DS-KH6320-WTDE1</model>
<serialNumber>DS-KH6320-WTDE10120230110WRQ18479253U</serialNumber>
<macAddress>e0:ba:ad:89:80:55</macAddress>
<firmwareVersion>V2.2.24</firmwareVersion>
<firmwareReleasedDate>build 240115</firmwareReleasedDate>
<encoderVersion>V1.0</encoderVersion>
<encoderReleasedDate>build 000000</encoderReleasedDate>
<deviceType>DVR</deviceType>
<RS485Num>1</RS485Num>
<telecontrolID>2</telecontrolID>
<alarmOutNum>2</alarmOutNum>
<alarmInNum>2</alarmInNum>
<customizedInfo></customizedInfo>
<OEMCode>1</OEMCode>
</DeviceInfo>

2024-10-03 02:59:04.462 | DEBUG    | doorbell:isapi_device_info:345 - We have found 2 com ports for the indoor device
2024-10-03 02:59:04.462 | DEBUG    | mqtt:__init__:183 - Configuring 2 door switches
2024-10-03 02:59:04.466 | DEBUG    | event:register_handler:234 - Adding event handler MQTT
2024-10-03 02:59:04.467 | DEBUG    | mqtt_input:__init__:21 - Setting up MQTTInput
2024-10-03 02:59:04.467 | DEBUG    | sdk.utils:call_ISAPI:125 - Call ISAPI request method url body: GET /ISAPI/System/deviceInfo  
[2024-10-03 02:59:04.461][DBG] SimpleSTDCommandToDvr with out cmd[GET /ISAPI/System/deviceInfo], input size[0], max segment length[262144]

[2024-10-03 02:59:04.476][INF] Private connect 192.168.133.169:8000 sock=145 this=0xda3cc4d4 cmd=0x117000 port=47070

2024-10-03 02:59:04.486 | DEBUG    | sdk.utils:call_ISAPI:165 - Response output: <DeviceInfo version="2.0" xmlns="http://www.isapi.org/ver20/XMLSchema">
<deviceName>Koridor</deviceName>
<deviceID>48513138-3437-3933-3338-e0baad8980aa</deviceID>
<model>DS-KH6320-WTDE1</model>
<serialNumber>DS-KH6320-WTDE10120230110WRQ18479338U</serialNumber>
<macAddress>e0:ba:ad:89:80:aa</macAddress>
<firmwareVersion>V2.2.24</firmwareVersion>
<firmwareReleasedDate>build 240115</firmwareReleasedDate>
<encoderVersion>V1.0</encoderVersion>
<encoderReleasedDate>build 000000</encoderReleasedDate>
<deviceType>DVR</deviceType>
<RS485Num>1</RS485Num>
<telecontrolID>1</telecontrolID>
<alarmOutNum>2</alarmOutNum>
<alarmInNum>2</alarmInNum>
<customizedInfo></customizedInfo>
<OEMCode>1</OEMCode>
</DeviceInfo>

[2024-10-03 02:59:04.486][DBG] SimpleSTDCommandToDvr with out cmd[GET /ISAPI/System/deviceInfo], input size[0], max segment length[262144]

2024-10-03 02:59:04.507 | DEBUG    | sdk.utils:call_ISAPI:125 - Call ISAPI request method url body: GET /ISAPI/System/deviceInfo  
[2024-10-03 02:59:04.510][INF] Private connect 192.168.133.170:8000 sock=172 this=0xda3cc4d4 cmd=0x117000 port=46322

2024-10-03 02:59:04.513 | DEBUG    | sdk.utils:call_ISAPI:165 - Response output: <DeviceInfo version="2.0" xmlns="http://www.isapi.org/ver20/XMLSchema">
<deviceName>Kitchen</deviceName>
<deviceID>48513138-3437-3932-3533-e0baad898055</deviceID>
<model>DS-KH6320-WTDE1</model>
<serialNumber>DS-KH6320-WTDE10120230110WRQ18479253U</serialNumber>
<macAddress>e0:ba:ad:89:80:55</macAddress>
<firmwareVersion>V2.2.24</firmwareVersion>
<firmwareReleasedDate>build 240115</firmwareReleasedDate>
<encoderVersion>V1.0</encoderVersion>
<encoderReleasedDate>build 000000</encoderReleasedDate>
<deviceType>DVR</deviceType>
<RS485Num>1</RS485Num>
<telecontrolID>2</telecontrolID>
<alarmOutNum>2</alarmOutNum>
<alarmInNum>2</alarmInNum>
<customizedInfo></customizedInfo>
<OEMCode>1</OEMCode>
</DeviceInfo>

[2024-10-03 02:59:04.513][DBG] SimpleSTDCommandToDvr with out cmd[GET /ISAPI/System/deviceInfo], input size[0], max segment length[262144]

2024-10-03 02:59:04.533 | DEBUG    | event:start:255 - Registering callback function using SDK
2024-10-03 02:59:04.534 | DEBUG    | doorbell:setup_alarm:91 - Arming the device via SDK
[2024-10-03 02:59:04.538][INF] Private connect 192.168.133.169:8000 sock=199 this=0xda3cc4d4 cmd=0x111020 port=47074

2024-10-03 02:59:04.541 | DEBUG    | doorbell:setup_alarm:91 - Arming the device via SDK
2024-10-03 02:59:04.546 | DEBUG    | input:loop_forever:29 - Waiting for input command
[2024-10-03 02:59:04.543][INF] Private connect 192.168.133.170:8000 sock=202 this=0xda3ccab8 cmd=0x111020 port=46324

2024-10-03 03:01:28.119 | INFO     | mqtt_input:_reboot_callback:300 - Received reboot command for doorbell: Indoor_korridor
2024-10-03 03:01:28.119 | DEBUG    | sdk.utils:call_ISAPI:125 - Call ISAPI request method url body: PUT /ISAPI/System/reboot  
[2024-10-03 03:01:28.128][INF] Private connect 192.168.133.169:8000 sock=203 this=0xda3cd09c cmd=0x117001 port=38930

2024-10-03 03:01:29.146 | DEBUG    | sdk.utils:call_ISAPI:165 - Response output: 
[2024-10-03 03:01:29.146][DBG] SimpleSTDCommandToDvr with out cmd[PUT /ISAPI/System/reboot], input size[0], max segment length[262144]

[2024-10-03 03:01:39.749][DBG] Alarm chan [0] recv timeout[2]!

[2024-10-03 03:01:44.757][DBG] Alarm chan [0] recv timeout[3]!

[2024-10-03 03:01:49.774][DBG] Alarm chan [0] recv timeout[4]!

[2024-10-03 03:01:54.772][DBG] Alarm chan [0] recv timeout[5]!

[2024-10-03 03:01:59.781][DBG] Alarm chan [0] recv timeout[6]!

[2024-10-03 03:02:04.785][INF] [0] CArmingSession::TimeoutCallBack Create ReConnectThread SUCC

[2024-10-03 03:02:04.785][DBG] Alarm chan [0] reconnect thread start!

[2024-10-03 03:02:04.786][DBG] Alarm chan [0] LinkToDVR!

[2024-10-03 03:02:04.789][INF] Private connect 192.168.133.169:8000 sock=199 this=0xda3cc4d4 cmd=0x111020 port=45610

[2024-10-03 03:02:04.797][INF] Private connect 192.168.133.169:8000 sock=199 this=0xda3cd09c cmd=0x10000 port=45618

[2024-10-03 03:02:04.798][INF] LogonDev1 in[192.168.133.169:8000]

[2024-10-03 03:02:04.833][INF] Private connect 192.168.133.169:8000 sock=199 this=0xda3cc4d4 cmd=0x111020 port=45626

[2024-10-03 03:02:04.833][INF] [SendCommandWithRecv relogin] newLinkId=da3cc4d4, cmd=0x111020

[2024-10-03 03:02:04.837][DBG] Alarm chan [0] ReConnect Success!

[2024-10-03 03:02:04.837][DBG] Alarm chan [0] reconnect thread Exit!

Relevant configuration

doorbells:
  - name: Indoor_korridor
    ip: 192.168.133.169
    username: admin
    password: 
  - name: Indoor_extention
    ip: 192.168.133.170
    username: admin
    password: 
system:
  log_level: DEBUG
  sdk_log_level: DEBUG
mqtt:
  host: 192.168.144.112
  port: 1883
  ssl: false

Anything else?

изображение

pergolafabio commented 1 week ago

Hi , to see ring events or to open door, you need to add your outdoor station... Adding an indoor station is limited in features...

6PATyCb commented 1 week ago

This is interesting. I use an analog four wire door station Hikvision DS-KB2411T-IM. изображение It does not have dedicated IP and can not be added to HA, The device is able to receive a call via HA and I can hear the relay triggering when I press the open button.

Apparently I need to get more familiar with your source code to try to debug my device for correct operation of hcnetsdk. I'll try to figure out what network ports are used there and check their availability. If everything is OK with them, I'll try to listen to the network traffic.

pergolafabio commented 1 week ago

ah, thats too bad on your indoor stations, there is a button "caller info" or " call state" , but you need to manually press/poll it to see if its in ringing state... it doesnt get an event from the outdoor station... but polling it is a bad idea

Maybe the Hikconnect CLoud integartion can help you? its on HACS

6PATyCb commented 1 week ago

I can't figure out the difference between an external and internal station yet. I just hope my station is a hybrid and supports the event protocol. I understand that the idea of ​​periodic polling is bad.

Maybe the Hikconnect CLoud integartion can help you? its on HACS

I will definitely check out this integration later, but I'm afraid it will have difficulties with local work (without the Internet), and this is the most important thing for me in HA.

6PATyCb commented 5 days ago

You were right. I spent a couple of days studying the ISAPI documentation and realized that it was either polling or nothing.