Zone Occupancy

Zone occupancy refers to the number of people detected in a specific zone at a given time. It is calculated by consolidating data from multiple presence sensors within the zone.

Below are sample queries for retrieving zone-level occupancy data to analyze peak, and average within a selected time range.

Presence-based Zone Occupancy

Use the sample queries below to retrieve the total occupancy for areas covered by presence sensors in the zone. Keep in mind that the sensor coverage area influences the count and may not represent the zone's actual occupancy.

Query the peak hourly occupancy of a room with presence sensors installed:

Use measurement: zone_occupancy

Use function: max

Request
// POST https://api.butlr.io/api/v3/reporting
{
    "window": {
        "every": "1h",
        "function": "max",
        "timezone": "Europe/Amsterdam" 
    },
    "filter": {
        "start": "2024-01-01T04:00:00Z",
        "stop": "2024-01-02T04:00:00Z",
        "measurements": ["zone_occupancy"],
        "zones": {
            "eq": ["zone_2qfew7oRPTDPQ0f7X9ZotfoiI3w"]
        }
    },
    "group_by": {
      "order": ["time"]
    }
}

Response
// POST https://api.butlr.io/api/v3/reporting
{
   "data": {
	"2024-01-01T04:00:00Z": {
		"sum": 2,
		"min": 1,
		"max": 1,//peak
		"count": 2,
		"mean": 1,
		"median": 1,
		"stddev": 0,
		"first": 1,
		"last": 1
	 }
    }
}

Query the average hourly occupancy of a room with presence sensors installed:

Use measurement: zone_occupancy

Use function: mean

Request
// POST https://api.butlr.io/api/v3/reporting
{
    "window": {
        "every": "1h",
        "function": "mean",
        "timezone": "Europe/Amsterdam" 
    },
    "filter": {
        "start": "2024-01-01T04:00:00Z",
        "stop": "2024-01-01T04:00:00Z",
        "measurements": ["zone_occupancy"],
        "zones": {
            "eq": ["zone_2qfew7oRPTDPQ0f7X9ZotfoiI3w"]
        }
    },
    "group_by": {
      "order": ["time"]
    }
}

Response
// POST https://api.butlr.io/api/v3/reporting
{
    "data": {
	"2024-01-01T04:00:00Z": {
		"sum": 2,
		"min": 1,
		"max": 1,
		"count": 2,
		"mean": 1,//average
		"median": 1,
		"stddev": 0,
		"first": 1,
		"last": 1
	}
    }
}

Last updated