Closed pergolafabio closed 11 months ago
Ok, was creating add-on, but always segmentation fault seems when i use the 3.7 python image then it works
any idea?
#FROM python:3.8.12-slim
FROM python:3.7-slim
#FROM python:slim
I had this as well, i fixed it by removing the device_info parameter from NET_DVR_Login_V30.
(its not used anyway)
Also note that the intercom will return all the missed events as well in a slow matter, so that might be confusing at first. (just let it run and it will empty the queue slowly)
aha, thats interesting!! gonna update my addon and test, apreciate the info !!!
awesome..ill fork this project and make a version that just publishes all the events over MQTT
i created also an addon for this : https://github.com/pergolafabio/Hikvision-Addons
how did you found out the segmentation issue?
yes i ended up here via your addon. i dont use homeassist, but node-red instead.
its pretty amazing how @laszlojakab managed to create those python bindings to a closed source library!
i used gdb to debug a bit and found out it didnt segfault when you used the wrong login credentials. so i hoped/assumed the segfault was in the last part of the login procedure, when trying to write back the device_info. so it was a bit of luck :)
hmm, tested some python versions, and for some reason i was unable to reproduce the issue anymore maybe something changed in the lkatest build of pythons
i tested 7 , 8 , 9 and 10
updated now my addon also to 3.10
so you changed:
device_info = NET_DVR_DEVICEINFO_V30()
user_id = HCNetSDK.NET_DVR_Login_V30(config["ip"].encode('utf-8'), 8000, config["username"].encode('utf-8'), config["password"].encode('utf-8'), device_info)
to:
# device_info = NET_DVR_DEVICEINFO_V30()
user_id = HCNetSDK.NET_DVR_Login_V30(config["ip"].encode('utf-8'), 8000, config["username"].encode('utf-8'), config["password"].encode('utf-8'))
correct.
might also have to do which system libraries/linux distro you have.
its a bit sketchy to use .so libraries that were compiled for another system. so i wouldn't be surprised by some weirdness/instability.
ok, thnx for feedback !! :-)
thanks to the power of forking and python, i was done in 45 minutes :P
Cool :+)
Have you tried also the opensips stuff?
Btw, for opening , or sending stuff, loin at my GitHub, there is an example py file, so you can send commands to open a door for example
cool might try that in the future. my previous intercom had sip only support and was running through my asterisk server. :)
yeah, but i also wanted to have video in early media stage on my indoor panels, that never works in group calls , thats why i decided to register the PBX on the priiave SIP protocol, so indoor panels still have video
Hi I'm still getting a seg fault when trying to run. I've removed the device_info variable. Tried on python 3.7, 3.8. Ubuntu 18 and Ubuntu 20. Does anyone know what the issue could be ?
Have a look at my addon, it runs
https://github.com/pergolafabio/Hikvision-Addons/blob/main/hikvison-sdk/Dockerfile
Thank You. I've actually just managed to get it working with python 3.6 and Ubuntu 18. I see you're using python 10. Will try it with that since it's probably better. Thanks again
hey @psy0rz , my addon was updated from 3.10.8 to 3.10.9 , and seems segmentation fault was now occuring i also tried removing device_info, but issue still occurs
any idea what could be wrong?
nope, mine is still running, but with python 3.8.16
ah ok, yeah its a strange issue indeed :-( i reverted back the HA Addon to 3.10.8 , so working again now
but i have no idea where its coming from
btw, i see you created the mqtt version i created an addon based on this script, also included sending callsignal, maybe also interesting for your project? i have a zigbee openclose sensor at the door, so when i open the door manually, i reject the call, so all stations stop ringing
also, if interested , i have the RPI lib for aarch64 support
its not that strange: its using precompiled libraries. to have the best chance of success, the environment needs to be as close as possible to the environment that was originally used. So its a wonder it works at all :)
thats why i'm using docker, so i can control the environment. (e.g. python:3.8, debian buster)
how did you get it to function on an arm architecture?
all the files in the original lib-directory are x86_64?
yeah, i was in contact with Hikvision support and they supplied me an internal dev release, it wont be avaible to public release you can find files in below dir for aarch64, but iits even more difficult to run, it only works on Euler or Harmony os, i created my docker based on that, and it works, confirmed by lots of users
https://github.com/pergolafabio/Hikvision-Addons/tree/main/hikvision-sdk-aarch64
anyway, nothing we can do about the seg fault? maybe test a newer lib release, will that make improvements?
the "official" supported OS for aarch64 lib was:
quote by hikvision:
**The tested OS systems are Phytium ,Huawei**
hey @psy0rz , do you want to help with the HA Addon i created , we want to make it better, i have already some extras in it , like sending stdin messages for Open door or reject the callsignal or sending custom isapi commands
we habe more ideas to configure devices automaticly, based on mqtt , creating video stream But also not make it avaible only as addon, but an option to run it also as docker to make it suitable for everyone , not only HA but also openhab users
someone started yesterday already to make it a multiarch docker, so work is started, all help is verry welcome!!
sorry, i'm too busy with other projects, but good luck :)
No problem:+)
Thanks @psy0rz for your hikvision-intercom-mqtt project, it inspired me to join forces with @pergolafabio and improve on the existing addon to allow it to run also as a standalone container.
awesome! you're welcome :D
Hey @laszlojakab I'm creating an addon for HA with your script, but when i try to run your script using python 3.9 , when i fire it, i get immediately the error : segmentation fault - core dumped
why is that? if i run it with python 3.8 , then it works?
any idea?
thnx in advance