I have a Hikvision camera and I'm trying to get info from PIR sensor. It doesn't have a push notification and I've thought to read every minute from this URL "http://192.168.0.11/IO/outputs/1/status/"
I'm using this script to get all information but I don't know how I can get only one value.
Thank you in advance !!!
Code: Select all
function os.capture(cmd, rep) -- execute command to get site
-- rep is nr of repeats if result is empty
r = rep or 1
local s = ""
while ( s == "" and r > 0) do
r = r-1
local f = assert(io.popen(cmd, 'r'))
s = assert(f:read('*a'))
f:close()
end
if ( rep - r > 1 ) then
print("os.capture needed more than 1 call: " .. rep-r)
end
return s
end
commandArray = {}
local commando = "curl -s http://admin:[email protected]/IO/"
--print("commando: " .. commando)
local tmp = os.capture(commando, 3)
--print('Hikvision data:\n' .. tmp)
if ( tmp == "" ) then
print("Hikvision: Empty result from curl command")
end
return commandArray