Agent DVR API
You can control Agent using the local built-in server. Agent has a number of commands you can call to integrate with other systems and home automation. Some commands take an object ID ( oid displayed at the top of the edit control tab) and a type ID (ot) 1 = microphone, 2 = camera. To use these just call the local server with the URLs provided. There is no authentication on these addresses as the port should be blocked from the internet by the firewall.
- grab.jpg?oid=1&size=320x240 : return a still image of the camera resized to 320x240
- video.mjpg?oids=1,2,3&size=320x240 : return a grid of cameras in mjpeg form
- video.mp4?oids=1,2,3&size=320x240 : return a grid of cameras in mp4 form (the first camera with audio provides the audio stream). You can also use video.webm. See server settings/ streaming to set the framerate.
- audio.mp3?oid=1 (or .ogg or .wav) : return live audio from the specified microphone
- ptz.cgi?oid=1&dir=1 call PTZ on the camera. Specify dir = 0 for center, 1 = left, 2=up left, 3 = up, 4 = up right, 5 = right, 6 = down right, 7 = down, 8 = down left, 9 = zoom in, 10 = zoom out, 11 = stop
- ptz.cgi?oid=1&cmd=COMMAND : execute a command on the camera. COMMAND = the url encoded portion in the extended commands options from the PTZ2.xml file in Agent eg: ptz.cgi?oid=1&cmd=preset.cgi%3F-act%3Dgoto%26-number%3D0
- command.cgi?oid=1&ot=2&cmd=alert : Trigger alert on the device. You can use any command (cmd) from: alert, recordOnAlertOn, recordOnDetectOn, recordingOff, record, recordStop, alertOn, alertOff, snapshot, switchOn, switchOff
- command.cgi?group=upstairs&cmd=switchOff - apply the switch off command to all devices in the group upstairs. Specify the group on the device under "Groups" on the General tab.
- command.cgi?cmd=arm : Arm Agent (enable alerting). You can also use: disArm, allOn, allOff, applySchedule, stopCloudUploads, rtmpStop
- command.cgi?cmd=rtmpStart&oid=1 : start RTMP broadcasting for the device to the endpoint setup in Agent streaming settings.
- command.cgi?cmd=getObjects : return a JSON object describing the server and all devices
- command.cgi?cmd=getObject&ot=2&oid=1 : return a JSON object describing the specified device
- command.cgi?cmd=getStatus : return a JSON object with summary details for the server
- command.cgi?cmd=getProfiles : return a JSON object with available profiles for the server
- command.cgi?cmd=setProfile&ind=0 : apply the profile with an index of 0
- events.json?ot=1&oid=2&seconds=60 : return a JSON object with details of the device events over the last 60 seconds (seconds can be up to 600)
- command.cgi?oid=2&ot=0&state=Monitor : Set the working state of the device. Options are:
- None - disabled
- Monitor - enabled, no motion detection
- Modect - enabled, record on detect
- Redect - enabled, forced recording, motion etection
- Record - enabled, no motion detection, forced recording