Get Detailed Fine-Grain Sensor Data

Returns sensor data for all sensors on a particular floor every five minutes for the specified time period. The data is returned every five minutes between the given time period. For example, for the interval from 10:00 (hh:mm) to 10:10 (hh:mm), the data is returned every five minutes, which will be 10:05 and 10:10. The time range can span a maximum of one hour for a given API call.

You will need the IoT sensor software license and Fine-grain Motion API License (API-MB-SU) to get fine-grain sensor data. Read Request License to purchase licenses if you have not, and make sure to enable sensors to provide motion-bit data via API. 

GET https://{em_ip_address_or_hostname}/ems/api/org/sensor/stats/floor/{floor_id}/{from date}/{to date}

Parameters

Request
em_ip_address or hostname Manage IP address or hostname
floor_id A unique identifier for the floor (returned in Get All Floors API)
from_date Display energy consumption data for the start time period  
Format: (yyyyMMddHHmm) year/month/day/hour/minutes
to_date Display energy consumption data for the end time period  
Format: (yyyyMMddHHmm) year/month/day/hour/minutes
Response
id A unique identifier for the fixture
power The average load of the fixture in watts during the last five-minute interval
occupancy

The value is in decimal format and needs to be converted to binary format. The binary is 64 bits integer value with each bit corresponding to 5 sec. in the last 5-minute interval. Out of 64 bits, the first four most significant bits are not used. The remaining subsequent 60 bits represent the recent 5 sec. periods.  
For example, the value in decimal 1152860189653680128 converted into a binary would be 00001111 1111111111001000 00111011 11111111 11111111 01000000 00000000. The first 4 bits (0000) are not used. The remaining string of subsequent 60 bits represents the occupied state for a five-minute interval, with each bit representing the recent five-second period.

If you prefer to verify a binary integer and if its value is less than 64 bits then add the required number of 0's to the start of the string.

For example, the binary quivalent of the decimal value 422212465065984 would be 11000000 00000000 00000000 00000000 00000000 00000000 0. To make the string to 64 bits, add the required number of zeros 00000000 00000001 10000000 00000000 00000000 00000000 00000000 00000000.
1: Occupied
0: Unoccupied

temperature Temperature in Fahrenheit
captureTime Five-minute time duration (YYYY-MM-dd hh:mm) year/month/day/hour/minutes

Sample Code

The example below shows getting data from Floor 2 from 10 hours 05 minutes to 10 hours 10 minutes. The API returns fine-grain data such as the Fixture ID, power in watts, occupancy status, temperature, time from all the sensors on Floor 2 for the specified duration, returning data at a 5-minute interval.

GET https://192.80.3.2/ems/api/org/sensor/stats/floor/2/202009281300/202009281400
HTTP/1.1 200 OK

Server: Apache-Coyote/1.1 Content-Type: application/xml Content-Length: 7582
Date: Sat, 25 Feb 2012 17:06:51 GMT
}{
  "sensor": [
    {
      "id": "1327",
      "power": "27.98",
     "occupancy": "1152860189653680128",
      "temperature": "78",
     "captureTime": "2021-09-28 13:00"
    },
    {
      "id": "1377",
      "power": "12.62",
     "occupancy": "422212465065984",
      "temperature": "74",
     "captureTime": "2021-09-28 13:00"
    },
    {
      "id": "367",
      "power": "70.81",
      "occupancy": "188658598246027468",
      "temperature": "70",
    "captureTime": "2021-09-28 13:00"
    },  
    {
      "id": "354",
      "power": "69.10",
      "occupancy": "1024568984031723712",
      "temperature": "74",
     "captureTime": "2021-09-28 13:00"
    },
    {
      "id": "483",
      "power": "68.12",
      "occupancy": "1148417902826749951",
      "temperature": "72",
     "captureTime": "2021-09-28 13:00"
    }
    …..
    …..
    …..
  ]
}
Was this article helpful?
2 out of 2 found this helpful
Have more questions? Submit a request

Comments

Article is closed for comments.