Are any changes required to allow the hikvision-sdk add on run in a Docker container and integrate with a container installation of HA?
yes, the addon makes uses of the config.json to read all valuesā¦ change the script to setup the manually
Has anyone got the doorbell model ds-kb6003 to work? here is an output of
This ISAPI stuff I do not really understand but I went through all the different things on https://www.docdroid.net/wlD2i8v/hikvision-isapi-26-ipmd-service-pdf
to try and find something that will give me a button push but no luck. Can someone push me in the right direction before I give up and move on to a different doorbell I got this one for free. If i could get this one to work that would be amazing.
curl -i --digest -u admin:xxxx http://0.0.0.0/ISAPI/VideoIntercom/capabilities
<isSupportDeviceId>true</isSupportDeviceId>
<isSupportOperationTime>true</isSupportOperationTime>
<isSupportRelatedDeviceAdress>true</isSupportRelatedDeviceAdress>
<isSupportKeyCfg>true</isSupportKeyCfg>
<isSupportAlarmUploadCfg>true</isSupportAlarmUploadCfg>
<isSupportWorkModeCfg>true</isSupportWorkModeCfg>
</VideoIntercomCap>
Try the addon, itās based on SDK instead of ISAPi
my outdoor station doesnāt report the call status (DS-KB8112-IM), it only reports when the doors are unlocked. Is it possible to use the SDK add-on with indoor station instead?
You can try, just change the IP, never tested if it worksā¦
I have Hassio running on Docker, how can I install you add-on? Thanks in advance !
You cant , the addon takes variables from the config, just modify the code/script/dockerfile so it doesnāt need to read the variables or hardcode them, its an easy python script
Hi, I was able to use the add-on and its working well. Thanks! But in my setup I have multiple indoor and outdoor stations. Is there already a way to use the addon or the script for multiple indoor/outdoor or will it require code level changes? Is anyone already doing this? Thank you!
hi, addon is limited to one outdoor indeed, feel fee to change the code and allow multiple doorstationsā¦
As for now, just install the addon twice if you have multiple outdoor stations
Oh, how does one install same addon multiple times? I didnt know that could be done I googled around and didnt find any solutionā¦
you need to fork my addon to your github, and then add a second repository
Or there is also a āaddonā folder on your HA instance , you can drop the folder there too, just rename the addon then in the config files
Awesome! I just happened to create a fork 5 minutes back trying to do the same. Thank you so much for your wonderful work. Thanks.
thnx for donation!
This was originally designed to be run as an add-on in Hassio and installed via Hassio so that it makes use of the Core API to internally set the sensors and states.
What Iāve done is run pergola.fabioās add-on manually via Docker. Example docker-compose file:
hikvision-sdk:
build:
context: ${USERDIR}/docker/hikvision-sdk
dockerfile: Dockerfile
image: result/latest
volumes:
- ${USERDIR}/docker/hikvision-sdk:/data
restart: always
tty: true
Iāve also modified the python script to read the configuration variables from an external JSON file as well as make use of MQTT to notify Hassio of the status changes rather than direct access via the core API and also to receive messages to perform actions like answer/hangup.
Example mqtt subscription:
with open("/data/options.json") as fd:
config = json.load(fd)
broker_address = config["mqtt_broker"]
broker_port = config["mqtt_port"]
broker_user = config["mqtt_username"]
broker_password = config["mqtt_password"]
client = mqtt.Client("hikvision-sdk")
client.username_pw_set(broker_user, password=broker_password)
client.on_connect= on_connect
client.on_message = on_message
client.connect(broker_address, port=broker_port)
client.subscribe(config["mqtt_topic"] + "/actions")
client.loop_start()
Example mqtt publish when a call is received:
client.publish(config["mqtt_topic"] + "/" + sensor_name_callstatus, "ON")
Example mqtt message receive:
action = message.payload.decode()
if "unlock1" in action:
print(dt + " Trying to unlock door 1... Stdin message: " + action)
unlock_door(0)
You do need to be somewhat proficient in python scripting. Iām a bit lazy at the moment but I might eventually upload my changes to my github.
Also, big thanks to pergola.fabio for his work on this.
To make it easier, I used indeed core API token, you can also just make a long lived bearer token and then do the same rest command to the HA IP , then is no mqtt neededā¦
Also make sure if running on RPI, aarch64, you need the other library and that openeuler OS
Yeah good point.
Only thing for me is that I wasnāt sure how to send the actions like reject/unlock/etc from HA to your python script because it reads from stdin.
I found using mqtt easier as I already had a few other integrations using it.
good point
i think stdin works also with docker exec
While integrating the sensors, i thought adding below might help:
- Add last_motion_ts/ last_ring_ts/ last_dismiss_ts / last_tamper_ts / last_unlock_ts as attributes to respective sensors. What are your thought? I wrote some minor changes to code to do it already. Also can we use your āset_attributeā function to retain any attributes set earlier when setting new state?
example:
Response: {entity_id:sensor.duplex_door_motion,state:on,attributes:{**last_motion_ts:2023-01-11T22:46:39.098099**},last_changed:2023-01-11T17:16:39.141393+00:00,last_updated:2023-01-11T17:16:39.141393+00:00,context:{id:01GPGXAXB5TM19M6DCT780PG4X,parent_id:null,user_id:bf5b43ce309c4e639b7e165c5af719be}}
- Is there anyway to get motion end and door closed (after a door not closed alert) in Alerts (non-polling) ways. Or is there a polling based method to get the latest door closed status/ motion status from SDK or ISAPI or Hikconnect? I tried to look around and didnāt find anything in SDK docs and for ISAPI it seemed ContentMgmt is not supported at least on my outdoor stations which could possibly be returning this valueof Input ID=1. Please note I do have a door contact sensor hardwired to the outdoor stations and its also configured to shoot Notification in Hikvision configs.
-
is indeed a good idea, allthough I dont see any benefit? I only do an automation when something live is happening? But feel free to submit a PR, I donāt have time right nowā¦
-
I donāt have any door open events in my system, I have an electric lock, so difficult to test for me
I want to step away from ISAPi, since not every device supports, SDK is more common, and I donāt like the polling