HIKVision support - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: HIKVision support (/showthread.php?tid=1630) |
HIKVision support - buuuudzik - 05.10.2018 My client has on his house HIKVision cameras and I am so impressed about its quality and also modern webserver and API. But it is fresh software so I must update my scripts to support such cameras. I found that I cannot download an image in same way as before in BCS cameras. I have right path: http://username:password@ip_address:port/ISAPI/Streaming/channels/102/picture and it's work perfectly on webbrowser but unfortunately not in script. This is my script: Code: require('socket.http') And it logs that length of image1 is nil. I've found this specification: http://down.dipol.com.pl/Cctv/-Hikvision-/isapi/HIKVISION%20ISAPI_2.5-Image%20Service.pdf I've had similar differences when I've tried get image from old BCS camera and new HIK by Postman app and I've figured out that on HIK cameras autentification must be set to Digest Auth. How can I do it in Lua? RE: HIKVision support - buuuudzik - 05.10.2018 Also I see that there is possibility to download uptodate list or have connection with camera and get notified when new event occured but it is not so easy to me. In node js all would be easy but how use this function in Lua? http://www.ragingcomputer.com/2016/06/hikvision-motion-detection-in-openhab-using-node-js Perfect would if admin could give some short start guide how get the data(without parsing) like in nodejs: https://github.com/ragingcomputer/node-hikvision-api/blob/master/hikvision.js RE: HIKVision support - admin - 06.10.2018 Try code for digest auth in this post: https://forum.logicmachine.net/showthread.php?tid=1061&pid=9364#pid9364 RE: HIKVision support - buuuudzik - 06.10.2018 (06.10.2018, 05:01)admin Wrote: Try code for digest auth in this post: https://forum.logicmachine.net/showthread.php?tid=1061&pid=9364#pid9364 It works in local with http. I see that the library is not a 4 line code Thanks And what do you think admin about this alertStream? I think this could be a very good option to integrate e.g. linedetection or facedetection from so sharp camera. RE: HIKVision support - admin - 09.10.2018 Try this for alert stream: Code: socket = require('socket') RE: HIKVision support - buuuudzik - 09.10.2018 Today I will check for sure. Very thanks and this is really nice feature RE: HIKVision support - buuuudzik - 09.10.2018 I have the info that module socket.mime not found RE: HIKVision support - admin - 09.10.2018 Replace it with require('mime') RE: HIKVision support - buuuudzik - 09.10.2018 This script should be in resident 0s? Now I have it in resident 10s and updated version returns in Alerts "connection failed: nil" RE: HIKVision support - admin - 09.10.2018 I've updated the script, try again. Use a resident script with sleep time more than zero for testing, otherwise you might get too many alerts/logs. RE: HIKVision support - buuuudzik - 09.10.2018 Now is unauthorized message: Code: * arg: 1 I'm sure I have right credentials RE: HIKVision support - admin - 09.10.2018 Replace *l with *a and post the whole output. RE: HIKVision support - buuuudzik - 09.10.2018 Below whole result: Code: * arg: 1 RE: HIKVision support - admin - 10.10.2018 This means that you need to use digest auth here as well. Considering the code complexity, writing any examples without access to the real device is like shooting in the dark, sorry. RE: HIKVision support - buuuudzik - 10.10.2018 (10.10.2018, 10:22)admin Wrote: This means that you need to use digest auth here as well. Considering the code complexity, writing any examples without access to the real device is like shooting in the dark, sorry. Thanks for your efforts. I can give you an access to the real device via private message. RE: HIKVision support - admin - 10.10.2018 Try this, change IP, port, user and pass as needed. If this works correctly, you should get xml payloads in Logs tab, otherwise errors will go to Alerts tab. Code: require('socket') RE: HIKVision support - buuuudzik - 10.10.2018 It works I see such output: Code: * string: <EventNotificationAlert version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema"> I will find how to parse it. Thank you very much, you are very wise RE: HIKVision support - Alberto.ricof - 28.05.2020 Hello, I rescue this thread to see if anyone can help me, How can I find the values in the XML data that the string returns? specifically what I need are the ones marked in yellow in the attached screenshot. These records are only sent if: <statisticalMethods> realTime </statisticalMethods> Thank you very much in advance !! Best regards RE: HIKVision support - Erwin van der Zwart - 28.05.2020 Hi, You need to parse the XML data to get values from it, you can use the build in LuaExpat lib for that. See this post for a sample how to use the lpx parser: https://forum.logicmachine.net/showthread.php?tid=1836&pid=11472#pid11472 BR, Erwin RE: HIKVision support - Alberto.ricof - 29.05.2020 (28.05.2020, 21:16)Erwin van der Zwart Wrote: Hi, Thank you very much Erwin, it's just what i needed. BR, Alberto R. |