DS-KD8003 - DS-KV8113 - DS-KV8213 - DS-KV6113 - DS-KV8413 and .... integration Hikvision HikConnect Video intercom doorbell

Ow, I forgot, give me 10 min :slight_smile:

Edit: refresh, added :aarch64

:boom: :boom: :boom: !!! Ok guys, new add-on released !!! :boom: :boom: :boom:

I added some more sensors, but Iā€™m now able to send also the callsignal, to drop the callā€¦ This was not working before on DS-KD8003 (ISAPi) ownersā€¦ Verry usefull if you want to drop the call with a ZigBee door sensor for example, to stop ringing the Hikconnect/indoor devices

But most important, RPI support is included, I was able to retrieve the SDK for it :+)

For the people already using my addonā€¦ delete and uninstall it, I uploaded a new version, seems I had a type error in the folderā€¦ also simplified, no need anymore for a bearer token or setting up the states url ā€¦

Here is the addon:

Hi Fabio, as an RPI owner Iā€™m very excited to test this out! :star_struck: However - the sensors constantly stay ā€œoffā€ and in the protocol of Hikvision-SDK I get the following:

Using OS: Linux with architecture: aarch64
hpr tls index{2}
10/30/2022, 16:34:10 Hikvision SDK Add-on started! Listening for eventsā€¦
loop[2] find 6 mac and 14 ip
NET_DVR_Login_V30 failed, error code = 29

Hmm, what kind of devices do you have? I think maybe your device is not supported if I lookup error 29

Have you tried rebooting the Hikvision?

It this line also printed in the log? hpr tls index{2}. ??

I have two intercom sets

1st set:

DS-KD8003-IME1 with FW V2.0.8 build210426

DS-KH8350-WTE1 with FW V2.1.2 build210323

2nd set:

DS-KD8003-IME1 with FW V2.2.52 build211126

DS-KH8350-WTE1 with FW V2.1.60 build220815

Rebooted both Hikvision sets, tried both.

Home-assistant.log:

2022-10-30 17:38:42.977 ERROR (MainThread) [homeassistant.components.hassio] Failed to to call /addons/a53439b8_hikvision_sdk/stats - Canā€™t read stats from addon_a53439b8_hikvision_sdk: Expecting value: line 1 column 1 (char 0)

Hmm, not sure where that error is coming from? Why do have a complete different error log then before?

I always get this error in the log. The second intercom set is a spare, so I can play with it. I think later I will do a full restore with this set, and see if it changes anything. Is an indoor station mandatory, or can I test with a door station only, which was just restored to its default settings (i.e. not linked to any indoor station for calling)?

No , indoor is optional, strange, I uninstalled the addon, started clean, with version 1.5ā€¦ just entered correct IP and password, no errors here on start

Hmmā€¦ Just restored to default the DS-KD8003-IME1 with FW V2.2.52 build211126. Activated it again, then uninstalled the addon, started clean, with version 1.5ā€¦ just entered correct IP and password, and the same error here on start in the add-on Protocol: NET_DVR_Login_V30 failed, error code = 29

edit: and even upgraded the FW to the latest V2.2.56_220713

ps: what to enter in ip_indoor when testing with door station only?

Just leave it blanc, itā€™s not used, only when you send the callsignal serviceā€¦

Hmm, maybe the SDK isnā€™t compatible :frowning:

Hi @pergola.fabio,

I wonder if you could lead me in the right direction. Iā€™m trying to connect my FreePBX with the indoor unit (I have a multi-button KD8003 with - multiple - WTE2 indoor units). I have created a trunk after having first created an extension in the indoor unit, according to your example, but it doesnā€™t register. Actually, through sngrep, it looks as I receive a REGISTER request from the indoor unit after the REGISTER request is sent from my FreePBX.

Any ideas on what I might be doing wrong? What confuses me, is that in your hikvision_register.py script, you say that some custom headers (XML data) has to be sent to the indoor unit in order for the registration to be successful. How does asterisk trunk connect without these XML data? BTW, when I run the hikvision_register.py script from the FreePBX server it registers successfully, but I want to connect the indoor directly to a FreePBX trunk so that I can route the voice call wherever I need.

Iā€™ve been trying for hours, but is looks that Iā€™m missing something very fundamental.

Thank you very much in advance!

George

Well , the script sends indeed the XML part, but if you add the extension first manually with ivms with a random SNā€¦ Then you donā€™t need to send the regxml part, as long as the username matchesā€¦

Can you show me the output of the sngrep ?

Hi,

I have 2 outdoor units DS-KD8003 en 2 indoor stations. 1 set I use for my private home and the other for a fysio practice connected to my home.

I wonder if itā€™s possible to control both systems with the Hikvision-sdk addon. Or do I need 2 HA instances for that?

And Is it possible to read the door relay status from the outdoor unit so I can open the door with a relay located in the indoor (safe) area?

Hi , you can fork my repo and just add it as a second addon, should workā€¦ Opening doors should work yes

1 Like

Hi @pergola.fabio ,

So, 10.10.10.244/24 is my FreePBX and 10.10.70.6/24 is my indoor. The following screenshot is from sngrep:

The second REGISTER command has the following content:

2022/10/30 23:57:26.026212 10.10.70.6:5065 -> 10.10.10.244:5060
REGISTER sip:10.10.70.6:5065 SIP/2.0
Via: SIP/2.0/UDP 10.10.10.244:5060;rport=5060;branch=z9hG4bKPj535f48e8-6096-4b43-a498-068df6df7a42
From: <sip:[email protected]>;tag=33653787-b932-4f45-97c4-fd172ab8c5c3
To: <sip:[email protected]>
Call-ID: 29584947-bf63-4dde-bdd8-20d13a15c310
CSeq: 59113 REGISTER
Contact: <sip:[email protected]:5060>
Allow: OPTIONS
Allow: REGISTER
Allow: SUBSCRIBE
Allow: NOTIFY
Allow: PUBLISH
Allow: INVITE
Allow: ACK
Allow: BYE
Allow: CANCEL
Allow: UPDATE
Allow: PRACK
Allow: MESSAGE
Allow: REFER
Expires: 3600
Max-forwards: 70
User-agent: FPBX-15.0.24(16.28.0)
Content-Length: 0

Itā€™s like the indoor unit sending back a copy of the SIP REGISTER command.

Thanks for your assistance!

Yeah I have seen that 404:error too, what you can do , just use my script, run it on your freepbx server , so the regxml is sended and registeredā€¦ Then setup an trunk based on IP auth instead of register request, so the invite gets send to freepbx, because itā€™s the same IPā€¦

Are you running freepbx for a special reason? Otherwise you can make use of the asterisk addon, and use my script as a shell commandā€¦

Not sure why you have that 404 not found error, maybe the indoor doesnā€™t like different subnets? Seems the indoor isnā€™t able to find freepbxā€¦
Are you running freepbx on 5060 ,? I think 5060 must be hardcoded

Ok thnx I will try this next week.

1 Like

Well, I would expect that only FreePBX should send the REGISTER command to the indoor, not the other way round (this is how your script works from what I see from sngrep). Error 404 is probably expected, as the trunk is set to do outbound auth only.

About your suggestion, your hikvision_register.py script is set to port 5061. So, the INVITE from the indoor would go to port 5061, and not 5060 which is my FreePBX. I had FreePBX for many years, for the communication needs of the apartment block that I manage.

It doesnā€™t appear to be a network issue, as when I run the hikvision_register.py at the FreePBX server, it registers successfully.

Probably as a last resort I could use the asterisk addon+your_script and then build a trunk between asterisk add-on and FreePBX. But I would prefer to avoid this complexity.

Br,
George

Hi, no the reason I used 5061, is offcourse 5060 is already in use by freepbx or asterisk, but the invite is hardcoded on indoorā€¦ Even if my script uses 5061, the invite will be send to 5060ā€¦

So if you setup a trunk on freepbx, based on IP auth , you will receive it on freepbx ā€¦ That should solve itā€¦ But you need to run the script on your freepbx server, but that shouldnā€™t be an issueā€¦

Itā€™s indeed strangeā€¦ Maybe you indoor expects the regxml in the register headerā€¦ Mine does not (If I add it manually first with ivms) otherwise I get an 401

Hey @J2Kbr you had the same 404 error as @digeorgeous ā€¦ Did you figure out? Or are you also using the script? Or an customized version? Maybe you can share your latest info with us? Also interested in this oneā€¦

@digeorgeous see discussion here: