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. You can also pass in a group name ton control multiple devices. Specify a group name on the devices under the General tab. There is an option in the server to setup Basic Authentication so your integration should support Basic Authentication if you are deploying it publicly.
- grab.jpg?oid=1&size=320x240 : return a still image of the camera resized to 320x240
- grab.jpg?oids=1,2,3,4&size=640x320&maintainAR=true&backColor=255,0,0 : return a grid of 4 cameras resized to 640x320, maintaining aspect ratio for the images with a red background (RGB)
- video.mjpg?oids=1,2,3&size=320x240 : return a grid of cameras in mjpeg form
- video.mjpg?oids=1,2,3&size=640x50&maintainAR=true&backColor=0,255,0 : return a grid of cameras in mjpeg form with a green background.
- 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/Off, snapshot, switchOn/Off, ftpPhotosOn/Off, ftpRecordingsOn/Off, cloudPhotosOn/Off, cloudRecordingsOn/Off, saveLocalOn/Off, applyScheduleToDevice, scheduleOn/Off
- 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=record&ot=2&oid=1&tag=someone%20at%20the%20door : start recording and tag the recording with "someone at the door"
- command.cgi?cmd=setProfile&ind=0 : apply the profile with an index of 0 (0=Home, 1=Away, 2=Night)
- 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?cmd=setobjectstate&ot=2&oid=1&state=Monitor : Set the working state of the device. Options are:
- None - disabled
- Monitor - enabled, no motion detection
- Modect - enabled, record on detect (applies a simple detector if detector is None)
- Redect - enabled, start recording, motion detection enabled (records until no motion is detected, applies a simple detector if detector is None)
- Record - enabled, start recording, no motion detection (records until stopped)