Closed eumanecs closed 1 year ago
Hi, Hikconnect indeed doesnt use ISAPI, but build on SDK also (i believe)
I have added your device 861 as a valid device type in beta 20, will release it soon...
The beta addon has several methods to open door in case one method fails
beta 20 released, can you try?
just reinstaled beta 20 release got log 2023-06-17 11:49:30.771 | DEBUG | config:mqtt_config_from_supervisor:36 - Requesting MQTT service configuration to supervisor
2023-06-17 11:49:30.799 | INFO | sdk.utils:loadSDK:44 - Using OS: Linux with architecture: x86_64
loop[2] find 2 mac and 0 ip
2023-06-17 11:49:31.116 | INFO | doorbell:authenticate:70 - Connected to doorbell: Durvis
2023-06-17 11:49:31.117 | INFO | event:init:76 - Setting up event handler: Console stdout
2023-06-17 11:49:31.117 | INFO | mqtt:init:91 - Setting up event handler: MQTT
Traceback (most recent call last):
File "/app/main.py", line 91, in
Its using indeed ISAPI to get the relays, can you configure them manually as described here:
https://github.com/pergolafabio/Hikvision-Addons/blob/main/doorbell_beta/DOCS.md
With output_relays ...
Not shure what i am dooing wrong
my configuration look lik this
default_config:
frontend: themes: !include_dir_merge_named themes
tts:
automation: !include automations.yaml script: !include scripts.yaml scene: !include scenes.yaml
service: hassio.addon_stdin data: addon: aff2db71_hikvision_doorbell input: unlock front_door 1
and
Hi, the config looks correct, but check your mqtt integration, there should be a device be created, with all sensors and relays, you don't need to use that service
goto settings , integrations, mqtt, should look like this:
remove that service: part from your configuration, thats incorrect, is not needed
You don't need to touch any yaml file, if you use beta addon, all sensors and services will be created automatically as an mqtt device
my UI looks diferent i dont have integrations under settings i have removed service part from my configuration
offcourse you have :-) , there you will see the integrations, then click on mqtt
Supper, but it seams that Hikvisin door bell beta stops working
2023-06-17 13:02:36.230 | DEBUG | config:mqtt_config_from_supervisor:36 - Requesting MQTT service configuration to supervisor
2023-06-17 13:02:36.238 | INFO | sdk.utils:loadSDK:44 - Using OS: Linux with architecture: x86_64
loop[2] find 2 mac and 0 ip
2023-06-17 13:02:36.775 | INFO | doorbell:authenticate:70 - Connected to doorbell: Front door
2023-06-17 13:02:36.775 | INFO | event:init:76 - Setting up event handler: Console stdout
2023-06-17 13:02:36.775 | INFO | mqtt:init:91 - Setting up event handler: MQTT
2023-06-17 13:02:37.056 | ERROR | main:
By the way i was able to ssh to my Access Control terminal DS-K1T501SF with root login may be i can do some door unlock comand by som sip comand just for info
I need to have a look later for that error 9 ...
There is also an hikconnect integration, using cloud, maybe you can use that one instead of this addon if you only want to open door?
Hmm, seems error 9 , just means, fail to read data from device, can you try maybe rebooting it?
Yes, I want only open door, my ultimate gool is to have some curl command or http request to unlock the door and latter to put that request on home bridge to control the door with iPhone with Siri voice using https://github.com/TheRealSimon42/homebridge-http-lock-ultimate
I was using this source: https://github.com/judge/homebridge-hikconnect but seam it's its build from some revers engineering from your home assistant GitHub code, so it dos not exposes my lock. and unfortunately no support for ISAPI for my device DS-K1T501SF
You can use the hikconnect integration in HA, that should work for you, you will find it in HACS
I have been in contact with tomasbedrich
his replay was
Thanks for the logs. It seems your device does not expose the locks in the payload, the plugins looks for 'lockNum' property and it's not present in your case. I don't have a device like yours so it's pretty complicated to reverse engineer what happens when you click unlock in the application. If you could do that (listen for web traffic while press the button in the application) I could check if I could do something.
i started to play with the fiddler the problem is that cant repaly POST comand as the body part of the post all the time is diferent https://apiieu.hik-connect.com/api/device/transmit HTTP/1.1 Host: apiieu.hik-connect.com Content-Type: application/x-www-form-urlencoded; charset=utf-8 Connection: keep-alive Accept: application/json User-Agent: HikConnect/20230606 (iPhone; iOS 16.5; Scale/3.00) Accept-Language: en-LV;q=1, ru-LV;q=0.9, lv-LV;q=0.8 Accept-Encoding: gzip, deflate, br Content-Length: 569
Are you using android or iphone with fiddler?
when i started before with hikconnect, i have an indoor station, i need to send unlock to that device:
i saw in fiddler: (removed my serial number + token)
PUT /v3/devconfig/v1/call/QXXXXXXXX/1/remote/unlock?srcId=1&lockId=0&userType=0 HTTP/1.1
clientType: 55
osVersion: 5.1.1
clientVersion: 4.14.1.0407
netType: WIFI
clientNo: google_play
appChannel: hikvision
customno: 1000002
featureCode: b547bcdd76b2f2c93e0956114a6f8665
sessionId: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
areaId: 111
lang: en-US
appId: HikConnect
Content-Length: 0
Host: apiieu.hik-connect.com
Connection: Keep-Alive
Accept-Encoding: gzip
User-Agent: okhttp/3.12.1
yes, body part is indeed differen, you need to send the sessionID , its a token
you can create a sensor in HA, to grab the sessionID , here is an example, you can see it all in fiddler, make sure to change the payload, i have it in secret, its actuallt the login part, just copy/past it from fiddler
- platform: rest
name: hikconnect_login
scan_interval: 7200
resource: "https://apiieu.hik-connect.com/v3/users/login/v2"
headers:
customno: 1000002
appChannel: "hikvision"
Content-Type: "application/x-www-form-urlencoded"
featureCode: "b547bcdd76b2f2c93e0956114a6f8665"
lang: "en-US"
clientVersion: "4.14.1.0407"
appId: "HikConnect"
sessionId: ""
clientType: 55
clientNo: "google_play"
areaId: 111
netType: "WIFI"
osVersion: "5.1.1"
method: POST
payload: !secret hikvision_payload
value_template: "Hikconnect Login"
json_attributes:
- loginSession
you can see the payload in the "textview" below , its a long huge string
Iphone 13 mini ios 16.05 i was able to capture all trafick very well. I was not able to logi in to Hikconect app when proxy was activeted, but thet i log in on hikconect app with my credentials and afterwards enabled proxy on my phone and afterward i am able to cappuure all the trafick
yeah, once you have the sensor, you can build actions/scripts, based on the sessionID
for example;, here is a reject command, as you see i use the sessionID from the sensor:
hikconnect_callsignal_3_reject-: "curl -X PUT --header \"sessionId: {{ state_attr('sensor.hikconnect_login', 'loginSession').sessionId }}\" https://apiieu.hik-connect.com/v3/devconfig/v1/call/XXXXXXX/operation?cmdId=3&handler=e6ldym"
just copy paste the command from fiddler
i am able to get my faturecode but then i am stuck with what next, idealy if somone can make some plugin were i put my varialbes like customno and featurecode
see above, i copy pasted everything you need
first you need the sensor, thats the most important one, you need the sessionID token, that token is always needed to send your commands, like open door
yes, with that session id, you can send commands, but remember, the session is is only valid for some hours , its a temp token thats why i created a rest sensor with scan interval 7200 sec
My post looks like this
There I am stuck. What is sensor my serial device number? What is the header label name in fiddler for sensor? And wat is the payload is it session id value? Is the feature code header label name for the token?
What are the essential header label names from fiddler I should use?
You can all see it in fiddler, see my posts above
Ok i will investigate that. bay the way, i have rebooted device if you can take a look when you will have a time error 9 - fail to read data from device on home assitant. toady i will not boter you any more, hav a nice weekend.
Ok, will have a look , have a nice weekend!
Hello i have managed to create the python scrip to unlock my door the key values for me was: this info is aquered up on login: token voipToken session_id In order to unlock the door i need to login in to Hikconect app with the username and password go to the Access control device DS-K1T501SF in the app and there is door i need to provide extra 6 digit code to punch in order to unlock the door. if somone needs i can sher the Pyton script with masked privad data. pergolafabio let me know if you need somthing from Fiddler Everywhere i have still 5 days free trieal licence.
Hi, no need for it This addon is not based on Hikconnect, but uses the SDK, maybe you can provide the info thomas, who is the owner for the hikconnect integration? he can benefit from it?
Thnx anyway!! appreciated
btw, if you use fiddler classic, its a free version, no trial then
as for error 9 , not sure i can do anything about it :-( Is it an old device you have? maybe a firmware upgrade?
Yes its several years old, I have some custom firmware on it have installed Portugies version of it that had special functionality there were folks that helped to unpack the firmware and access audio files we have replaced and then package it back.
ah, maybe some issue on it to retrieve the events by sdk :-(
i dont wan to upgarde there were some scripts repackFirmwareH5.py and unpackFirmwareH5 and unpack.sh repack.sh i was using.
ok, maybe you can ask on community forum if someone added the device in the addon, that way we can rule out the issue wirth firmware maybe? gonna close for now, dont think i can do anything now :-(
What happened?
I have AccessControl Terminal DS-K1T501SF dos not support ISAPI, looks like it dos not exposes to plugin door lock expose the locks in the payload.
I have been using fiddler i has able to capter actual POST POST https://apiieu.hik-connect.com/api/device/transmit HTTP/1.1 Host: apiieu.hik-connect.com Content-Type: application/x-www-form-urlencoded; charset=utf-8 Connection: keep-alive Accept: application/json User-Agent: HikConnect/20230606 (iPhone; iOS 16.5; Scale/3.00) Accept-Language: en-LV;q=1, ru-LV;q=0.9, lv-LV;q=0.8 Accept-Encoding: gzip, deflate, br Content-Length: 569
When unlocked from Hik-connect cloud in the body of post message there is provided aditinal 6 digit password to operate the unlock action
Add-on
Hikvision Doorbell
What version of the add-on are you running?
2.1 & 3.0.0
Installation type
Home Assistant add-on
Relevant log output
Relevant configuration
Anything else?