Skip to main content
Version: 1.0

PresenceZone

The PresenceZone is a component stands for an individual physical sensor and has the following methods:

info

PresenceZone is a dynamic component

Methods

PresenceZone.SetConfig

PropertyTypeDescription

id

number

Id of the component instance

config

object

Configuration that the method takes

Find more about the config properties in config section

PresenceZone.GetConfig

Parameters:

PropertyTypeDescription

id

number

Id of the component instance

Find the PresenceZone.GetConfig response properties in config section

PresenceZone.GetStatus

Parameters:

PropertyTypeDescription

id

number

Id of the component instance

Find more about the status response properties in status section

Configuration

The configuration of the PresenceZone component contains information for name, area size, preview color and enable. To Get/Set the configuration of the PresenceZone component its id must be specified.

Parameters:

PropertyTypeDescription

id

number

Id of the component instance

name

string or null

Name of the component instance

enable

boolean

Activate or deactivate zone

color

array of type int

Preview color defined in format [R, G, B] where every color element is within limit of 0 to 255

presence_delay

number or null

Active period of presence before trigger (in seconds)

absence_delay

number or null

Active period of absence before trigger (in seconds)

area

array of type array

Zone area definition

Zone Area

Zone area defines the grid cells of the zone. Every cell in grid is 0.5 meters by 0.5 meters. Every square shaped cells are grouped in segment with coordinates of starting point x0 , y0 and ending point x1, y1. The area can contains multiple segment definitions.

Example zone area with 3 segments:

Zone array
  • Segment 1 [x0, y0, x1, y1] : [2,0,0,2]
  • Segment 2 [x0, y0, x1, y1] : [0,0,-2,3]
  • Segment 3 [x0, y0, x1, y1] : [2,3,1,4]
area : [
[2,0,0,2],
[0,0,-2,3],
[2,3,1,4]
]

Status

The status of the PresenceZone component contains information about its id, state and objects located in zone. To obtain the status of the PresenceZone component its id must be specified.

Properties:

PropertyTypeDescription

id

number

Id of the component instance

state

boolean

State of zone presence

num_objects

number

Number of objects located in zone

Webhook Events

Available events from PresenceZone component that can trigger webhooks:

  • presencezone.presence - produced when zone state is changed for presence_delay or absence_delay period.
    • presencezone.presence event supports one attribute, that can be used to determine the state of zone and support conditional webhooks:
      PropertyTypeDescription

      state

      boolean

      State of presence in zone

  • presencezone.counter - produced on object in zone change event.
    • presencezone.counter event supports one attribute, that can be used to determine the number of objects in zone and support conditional webhooks:
      PropertyTypeDescription

      num_objects

      number

      Number of objects in zone

      object

      array of type array

      Location of objects. Every object is presented as array with x and y coordinates.

  • presencezone.enter - produced when object enter into zone through zone border.
  • presencezone.leave - produced when object leave zone through zone border.

Notifications

This section describes notifications for events specific to the PresenceZone component. For general information please see this page.

Instances of the PresenceZone component can send notifications for the following events:

  • presence
  • counter
  • enter
  • leave

Example for notification for event:

{"component":"presencezone:200","id":200,"event":"presence","state":true,"ts":1731931521.19}

state contains state of presence in zone.

{"component":"presencezone:200","id":200,"event":"counter","num_objects":2,"object": [[0.1, 1.55], [-1.59, 0.93]],"ts":1731931521.19}

num_objects contains number of objects detected in zone.

object contains coordinates of every object.

Examples

PresenceZone.SetConfig example

http://192.168.33.1/rpc/PresenceZone.SetConfig?id=200&config={"name":"Zone 1","enable":true,"color":[0,255,0],"area":[[-8,16,8,0]]}

Response

{
"restart_required": false
}

PresenceZone.GetConfig example

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

Response

{
"id": 200,
"name": "Zone 1",
"enable": true,
"color": [
0,
255,
0
],
"area": [
[
-8,
16,
8,
0
]
]
}

PresenceZone.GetStatus example

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

Response

{
"id": 200,
"state": false,
"num_objects": 0
}

Events

presence example

{
"component": "presencezone:200",
"id": 200,
"event": "presence",
"state": true,
"ts": 1706593991.91
}

counter example

{
"component": "presencezone:200",
"id": 200,
"event": "counter",
"num_objects": 2,
"object": [
[0.1, 1.55],
[-1.59, 0.93]
],
"ts": 1706593991.91
}
info

In object propery first array [0.1, 1.55] means that first person is located on X: 0.1 meters and Y: 1.55 meters from presence sensor.

enter example

{
"component": "presencezone:200",
"id": 200,
"event": "enter",
"ts": 1706593991.91
}

leave example

{
"component": "presencezone:200",
"id": 200,
"event": "leave",
"ts": 1706593991.91
}