Get Area Occupancy for a Floor

The Get Area Occupancy for a Floor returns the occupancy status for all areas on a floor. An area is a grouping of sensors with an Area ID. The API response is a single data point for all sensors in the area.

The sensors in the area will start reporting occupancy data only after they are activated as zonal sensors. Refer to the article Enable Zonal Sensors to enable them as zonal sensors to get occupancy data.

The request will return occupied or unoccupied for all areas on the floor. For example, if Floor 1 in a building has two areas, the API will return occupied or unoccupied for all areas on Floor 1 identified with Area ID.  If you ever need to see the IDs of all areas, you can query those by using the Get All Areas request. 

For the sensors to report occupancy data, you will need the Sensor and API licenses based on the number of sensors in the system. Refer to the License Types and Product Codes.  

Request

GET https://{em_ip_address_or_hostname}/ems/api/org/facility/v1/getOccupancyStateOfFloorAreas/
{floor_id}

Parameters

Request 

em_ip_address or hostname Manage’s IP address or hostname
floor_id Floor identifier. Use the Floor ID returned in the Get All Floors API, or in Manage, select Facility > Floor > in the left panel, and click the Settings tab to obtain the Floor ID.
Response 
Id Area identifier
name Area name as described in Manage
description Area description as described in Manage. The field will be empty if there is no description entered in Manage.
zonesensorenable

The area has been activated as a zone sensor area. The area starts reporting consolidated occupancy status. Note that the zone sensor license must be purchased and available for the sensors to report occupancy information. Otherwise, occupancy data is not reported by the sensors.

true – Sensors in the area are enabled as zone sensors.
false – Sensors in the area are disabled as zone sensors.

occupancyState

0 – Area unoccupied
1 – Area occupied
-1 – Fault. Sensors are not reporting occupancy.

Note: For this API, the response will always include an additional area with ID field ALWAYS "0" and the name "Unassigned". The occupancyState will be "1 - Area occupied" if ANY sensor on that floor does not belong to an area and is "occupied". If all such sensors are "vacant", then the value will be "0 - Area unoccupied". 

Sample Code

Send a request to return the occupancy state for all areas on Floor 1. For example, if Floor 1 in the Main building has two areas: Hardware and Software, the details of the areas and their corresponding Area IDs and occupancy state for all areas on Floor 1 is returned in the response.

Get https://{192.80.3.2}/ems/api/org/facility/v1/getOccupancyStateOfFloorAreas/1

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: application/JSON
Content-Length: 7582
Date: Sat, 21 Jul 2015 17:06:51 GMT
{
  "id": "9",  ** Area ID**
  "name": "Hardware",
  "description": "hw eng",
  "zonesensorenable": "true"
  “occupancyState”: “1”,
},
{
  "id": "27", **Area ID**
  "name": "Software",
  "description": "sw eng",
  "zonesensorenable": "false",
  “occupancyState”: “1”,
},
{

"id": "0", **Area ID**
  "name": "Unassigned",
  "description": "Unassigned area",
  “occupancyState”: “1”,
}

Recommended articles:

Was this article helpful?
1 out of 2 found this helpful
Have more questions? Submit a request

Comments

Article is closed for comments.