Skip to main content
Version: 1.0

CameraZone

The CameraZone component represents a user-defined area within the camera's field of view. Depending on its type, a zone is used either for motion detection or for blacking out the area in the video feed (privacy). It has the following methods:

info

CameraZone is a dynamic component. Instances are created via Camera.AddZone and removed via Camera.DeleteZone.

info

A default CameraZone covering the full frame is created automatically when the camera is initialized. The default zone cannot be deleted.

Coordinate System

The coordinates property uses a normalized grid rather than absolute pixels. Both the X (horizontal) and Y (vertical) axes range from 0 to 10000.

This abstraction ensures that zone definitions remain accurate and persistent even if the camera's stream resolution or aspect ratio changes (e.g., switching from High Definition to Standard Definition).

  • (0, 0): Top-Left corner of the frame.
  • (10000, 0): Top-Right corner.
  • (0, 10000): Bottom-Left corner.
  • (10000, 10000): Bottom-Right corner.
  • (5000, 5000): Exact center of the frame.
tip

To convert a pixel coordinate to this format, use the following formula: Val = (Pixel_Position / Total_Resolution_Dimension) * 10000

Methods

CameraZone.SetConfig

Update the configuration of a specific zone instance. Only the fields included in the request are modified; omitted fields are left unchanged.

Properties:

PropertyTypeDescription

id

number

Id of the component instance

config

object

Configuration to apply (see the configuration section)

CameraZone.GetConfig

Obtain the configuration of a specific zone instance.

Properties:

PropertyTypeDescription

id

number

Id of the component instance

See the configuration section for the response shape.

CameraZone.GetStatus

Obtain the status of a specific zone instance.

Properties:

PropertyTypeDescription

id

number

Id of the component instance

See the status section for the response shape.

Configuration

The configuration of the CameraZone component describes the zone's shape (coordinates), its purpose (type) and optional visual properties.

Properties:

PropertyTypeDescription

id

number

Id of the component instance

enable

boolean

Activate or deactivate zone processing.

type

string

Zone type. See accepted values.

coordinates

array of numbers

Polygon coordinates in the format [x0, y0, x1, y1, ...]. The coordinate values use the normalized grid described in the coordinate system section: each axis ranges from 0 to 10000. At least two points (4 values) must be supplied.

color

array of numbers

Optional. Preview color in the format [R, G, B], where each component is in the range 0..255.

name

string

Optional. Human-readable zone name.

null is not accepted for enable, type, coordinates, color or name. To remove an optional value, omit the field from the request.

Accepted values for `type`:
ValueDescription

"motion"

Motion-detection zone. Motion events inside the zone are reported via webhooks and notifications, and contribute to the camera's overall motion status.

"privacy"

Privacy zone. The area is blacked out in all video streams; the zone never reports motion.

Status

Properties:

PropertyTypeDescription

id

number

Id of the component instance.

motion

boolean

true if motion is currently detected in the zone, false otherwise. Present only for zones of type "motion"; privacy zones do not report a motion state.

Webhook Events

Available events from CameraZone component that can trigger webhooks (motion zones only):

  • camerazone.motion - produced when the motion status for this specific zone instance changes to true.
  • camerazone.motion_end - produced when the motion status for this specific zone instance changes to false.

Examples

CameraZone.SetConfig example

http://192.168.33.1/rpc/CameraZone.SetConfig?id=200&config={"name":"Entrance","enable":true,"type":"motion","coordinates":[1000,2000,5000,2000,5000,8000,1000,8000],"color":[255,0,0]}

Response

{
"restart_required": false
}

CameraZone.GetConfig example

http://192.168.33.1/rpc/CameraZone.GetConfig?id=200

Response

{
"id": 200,
"coordinates": [
1000,
2000,
5000,
2000,
5000,
8000,
1000,
8000
],
"enable": true,
"type": "motion",
"name": "Entrance",
"color": [
255,
0,
0
]
}

CameraZone.GetStatus example

http://192.168.33.1/rpc/CameraZone.GetStatus?id=200

Response

{
"id": 200,
"motion": true
}