Get info CURL from Hikvision

Moderator: leecollings

Post Reply
juanjogarciac
Posts: 2
Joined: Saturday 12 November 2016 19:24
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Get info CURL from Hikvision

Post by juanjogarciac »

Hi,

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
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest