wickman 0 Share Posted February 15, 2019 it's possible to integrate HC2 with an ip-camera by specifying URL:s for the video stream and controlling it with left/right/up/down URL:s etc. This is one-way communication from HC2 to the camera. Now, some cameras can be armed/disarmed, which means that it will start to record when it detects motion. The idea is that this should trigger an alarm in HC2. My idea is to have a scene which can arm/disarm the camera and then, when the camera detects motions it should trigger a scene in HC2. Has anyone figured out how to trigger a scene in HC2 when the camera detects motion? Is there any kind of support for this? Also, is it possible to arm/disarm your camera through HC2? Quote Link to post Share on other sites
Thomasn 73 Share Posted February 15, 2019 It is not supported from Fibaro. However, you could possibly make a VD crontroling it through the cameras ip address. Have not seen it done yet. Quote Link to post Share on other sites
AvdL 3 Share Posted February 17, 2019 (edited) It is possible. I made a VD for my old Foscam camera, but with my new Hikvision camera (DS 2CD2135FWD-I 3MP) this works too. In the virtual device, I can see if the camera sees movement or not at the moment, and when the camera has seen movement for the last time. you can also start a scene of the camera der movement. I also saw VDs on the forums with which you can put the camera on arm / disarm. Edited February 17, 2019 by AvdL Quote Link to post Share on other sites
wickman 0 Author Share Posted February 18, 2019 15 hours ago, AvdL said: It is possible. I made a VD for my old Foscam camera, but with my new Hikvision camera (DS 2CD2135FWD-I 3MP) this works too. Thanks, that sound cool. I assume you need to call some rest-api on your camera to get alarm status information or how did you go about it? Quote Link to post Share on other sites
AvdL 3 Share Posted February 25, 2019 (edited) I based my virtual device on the LUA code of annhan91 in this topic: https://forum.fibaro.com/topic/24967-hikvision-alertstream/ Create a virtual device with 2 labels. One with the ID: stream, and one with the ID: LastTriggerTime. In the main loop you put the following LUA script. You must enter your IP address, password, username of your camera. local id = fibaro:getSelfId() function encode(data) local b='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; return ((data:gsub('.', function(x) local r,b='',x:byte() for i=8,1,-1 do r=r..(b%2^i-b%2^(i-1)>0 and '1' or '0') end return r; end)..'0000'):gsub('%d%d%d?%d?%d?%d?', function(x) if (#x < 6) then return '' end local c=0 for i=1,6 do c=c+(x:sub(i,i)=='1' and 2^(6-i) or 0) end return b:sub(c+1,c+1) end)..({ '', '==', '=' })[#data%3+1]) end enter = "\r\n"; USER="XXX" --(ADMIN account) PASSWORD="XXXX" --(ADMIN account) local ip="XXX.XXX.XXX.XXX" --(IP adres camera) local port="XXX" -- (Port camera) local tcpSocket = Net.FTcpSocket(ip,port) tcpSocket:setReadTimeout(500) tcpSocket:write("GET /ISAPI/Event/notification/alertStream HTTP/1.1" .. enter); tcpSocket:write("Authorization: Basic " .. encode(USER..":"..PASSWORD) .. enter .. enter); local nhan=tcpSocket:read() nhan=nhan .. tcpSocket:read() local tam= tcpSocket:read() tcpSocket:disconnect() local status=tostring(tam:match("<activePostCount>(.+)</activePostCount>")or " ") fibaro:debug(status) --bijwerken labels-- if status > "0" then --motion detected time = os.date("%H:%M:%S | %B %d"); fibaro:debug(time); fibaro:call(id, "setProperty", "ui.LastTriggerTime.value", time ); fibaro:call(id, "setProperty", "ui.stream.value", "Motion detected"); fibaro:call(id, "setProperty", "currentIcon", 1017) --WIJZIGEN 1017 = icon ID motion else --No motion fibaro:call(id, "setProperty", "ui.stream.value", "Safe"); fibaro:call(id, "setProperty", "currentIcon", 1018) --WIJZIGEN 1018 = icon ID no motion end fibaro:debug(status) Edited February 25, 2019 by AvdL 1 Quote Link to post Share on other sites
AvdL 3 Share Posted February 25, 2019 (edited) 15 minutes ago, AvdL said: . Edited February 25, 2019 by AvdL Quote Link to post Share on other sites
Sankotronic 1,333 Share Posted February 28, 2019 My Foscam camera has relay outputs for alarm so I believe it is also possible to connect UBS module to that output and have alarm trigger that way which is much better because then it reduces traffic between HC and camera Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.