AI Adaptive Sensing

Last Updated on : 2023-04-25 02:37:41download

Based on AI algorithms in the cloud, AI adaptive sensing is an application that automatically adjusts the sensor-controlled lighting duration. Through the computation of the sensing historical data in the environment where a sensor is installed, the off delay time of the sensor is automatically adjusted at a specified time interval. In this way, the sensor better controls the lights based on the on-site scenarios, delivering an awesome user experience.

Request method API Description
POST /v1.0/illumination/aisensing/deivce/batch Bulk add devices
POST /v1.0/illumination/aisensing/deivce/remove Bulk delete devices
GET /v1.0/illumination/aisensing/deivce/page Query the list on pages
POST /v1.0/illumination/aisensing/deivce/removeHirshory Bulk delete historical data
GET /v1.0/illumination/aisensing/config Query the status of adaptive sensing algorithm
POST /v1.0/illumination/aisensing/config Change the status of adaptive sensing algorithm
GET /v1.0/illumination/aisensing/listPIRDeviceByRoomId Query available devices by room and project
GET /v1.0/illumination/aisensing/project/roomTree Get tree structure of spaces in a project (query sensors only)

Query the status of adaptive sensing algorithm

API description

Query the current status of the adaptive sensing algorithm under a specified project. Each project has only one algorithm switch configured.

API endpoint

GET /v1.0/illumination/aisensing/config

Request parameter

Parameter Type Parameter type Description Required
projectId String body The project ID. true

Response parameter

Parameter Type Description
code Integer The error code. For more information, see the error code section. It is empty when the request succeeded.
success Boolean Determine whether the request succeeded. Valid values:
  • true: success.
  • false: failure.
msg String The message that is returned if the request failed. The response is empty if the request succeeded.
t Long The returned 13-digit timestamp.
result Object The returned result.

Description of result

Parameter Type Description
algorithmSwitch Boolean The switch of the AI adaptive sensing algorithm.
projectId String The project ID.

Sample request

{
  "projectId": "sadad2313s****"
}

Sample response

{
  "algorithmSwitch": true,
  "projectId": "sadad2313s****"
}

Change the status of adaptive sensing algorithm

API description

Change the status of the adaptive sensing algorithm. You can enable or disable the algorithm. After the algorithm is disabled, delayed control commands will no longer be sent from the cloud to sensors.

API endpoint

POST /v1.0/illumination/aisensing/config

Request parameter

Parameter Type Parameter type Description Required
algorithmSwitch boolean body The algorithm switch. Valid values:
  • true: enable.
  • false: disable.
true
projectId String body The project ID. true

Response parameter

Parameter Type Description
code Integer The error code. For more information, see the error code section. It is empty when the request succeeded.
success Boolean Determine whether the request succeeded. Valid values:
  • true: success.
  • false: failure.
msg String The message that is returned if the request failed. The response is empty if the request succeeded.
t Long The returned 13-digit timestamp.
result Boolean The returned result.

Sample request

{
  "algorithmSwitch": "false",
  "projectId": "231312313"
}

Sample response

true

Query the list on pages

API description

Query the list of devices that are returned on pages. These devices belong to the AI algorithm pool for the current project. The project ID is required in the request. You can query the devices by space ID. The multilingual result can be returned.

API endpoint

GET /v1.0/illumination/aisensing/deivce/page

Request parameter

Parameter Type Parameter type Description Required
pageSize int body The number of items to be returned per page. false
pageNo int body The page number. false
projectId String body The project ID. true
roomId String body The ID of a specified space. false
lang String body Multilingual support. false

Response parameter

Parameter Type Description
code Integer The error code. For more information, see the error code section. It is empty when the request succeeded.
success Boolean Determine whether the request succeeded. Valid values:
  • true: success.
  • false: failure.
msg String The message that is returned if the request failed. The response is empty if the request succeeded.
t Long The returned 13-digit timestamp.
result Object The returned result.

Description of result

Parameter Type Description
total Integer The total number of returned entries.
list List The list.
deviceId String The device ID.
deviceType String The device type.
deviceName String The device name.
projectId String The project ID.
roomId String The ID of a room.
roomName String The name of a room.
validTime String The effective time.
bizCode String The business code.
gmtCreate String The creation time.
gmtModified String The modification time.

Sample request

{
  "lang": "zh",
  "projectId": "ssdk2131ks****",
  "roomId": "131321ad****"
}

Sample response

{
  "total": "3",
  "list": [
    {
      "deviceId":"sadadad****",
      "projectId":"adad2131****",
      "roomId":"sadadk231232****",
      "deviceName":"Control device",
      "bizCode":"asdadk231****"
    }
  ]
}

Bulk add devices

API description

After you query available devices by room ID and project ID, you can select multiple devices from the list of configured sensors and add them. The effective time in the input parameter is set to the current time by default.

API endpoint

POST /v1.0/illumination/aisensing/deivce/batch

Request parameter

Parameter Type Parameter type Description Required
requestList.deviceId String body The device ID. true
requestList.deviceName String body The device name. true
requestList.projectId String body The project ID. true
requestList.roomId String body The ID of a specified space. true
requestList.validTime date body The effective time. false
projectId String body The project ID. true

Response parameter

Parameter Type Description
code Integer The error code. For more information, see the error code section. It is empty when the request succeeded.
success Boolean Determine whether the request succeeded. Valid values:
  • true: success.
  • false: failure.
msg String The message that is returned if the request failed. The response is empty if the request succeeded.
t Long The returned 13-digit timestamp.
result Boolean The returned result.

Sample request

{
  "requestList.validTime": "2312332221",
  "requestList.roomId": "dad1k23213a****",
  "requestList.deviceName": "Device A",
  "requestList.projectId": "dasdaad*****",
  "requestList.deviceId": "adasd123213a****"
}

Sample response

true

Bulk delete devices

API description

Delete multiple devices from the algorithm pool. The deleted device will not participate in the algorithm, and there will be no more control commands sent by the cloud.

API endpoint

POST /v1.0/illumination/aisensing/deivce/remove

Request parameter

Parameter Type Parameter type Description Required
pirDiviceIds String[] body The list of device IDs. true
projectId String body The project ID. true

Response parameter

Parameter Type Description
code Integer The error code. For more information, see the error code section. It is empty when the request succeeded.
success Boolean Determine whether the request succeeded. Valid values:
  • true: success.
  • false: failure.
msg String The message that is returned if the request failed. The response is empty if the request succeeded.
t Long The returned 13-digit timestamp.
result Boolean The returned result.

Sample request

{
  "pirDiviceIds": "sadadad23123123,21312313****",
  "projectId": "sdakjk231****"
}

Sample response

true

Bulk delete historical data

API description

Bulk delete the historical data that includes the historical messages reported by data points of the selected devices. Then, the new data reporting, collection, and model calculation will be started.

API endpoint

POST /v1.0/illumination/aisensing/deivce/removeHirshory

Request parameter

Parameter Type Parameter type Description Required
pirDiviceIds String[] body The list of device IDs. true
projectId String body The project ID. true

Response parameter

Parameter Type Description
code Integer The error code. For more information, see the error code section. It is empty when the request succeeded.
success Boolean Determine whether the request succeeded. Valid values:
  • true: success.
  • false: failure.
msg String The message that is returned if the request failed. The response is empty if the request succeeded.
t Long The returned 13-digit timestamp.
result Boolean The returned result.

Sample request

{
  "pirDiviceIds": "sadad123****,213123ada****",
  "projectId": "dsada2313a****"
}

Sample response

true

Query available devices by room and project

API description

Query the available devices based on the room and project. The sensors that do not support AI adaptation and all non-sensors will be excluded. Only the list of devices that support AI adaptation will be returned.

API endpoint

GET /v1.0/illumination/aisensing/listPIRDeviceByRoomId

Request parameter

Parameter Type Parameter type Description Required
roomId String body The room ID. true
projectId String body The project ID. true

Response parameter

Parameter Type Description
code Integer The error code. For more information, see the error code section. It is empty when the request succeeded.
success Boolean Determine whether the request succeeded. Valid values:
  • true: success.
  • false: failure.
msg String The message that is returned if the request failed. The response is empty if the request succeeded.
t Long The returned 13-digit timestamp.
result Object The returned result.

Description of the result parameter

Parameter Type Description
deviceId String The device ID.
deviceName String The device name.
projectId String The project ID.
roomId String The name of a specified project.

Sample request

{
  "projectId": "adad23131****",
  "roomId": "2313ada****"
}

Sample response

[
  {
    "deviceId": "dad23****",
    "deviceName": Smart Device",
    "projectId": "adad23131****",
    "roomId": "2313ada****"
  }
]

Get tree structure of spaces in a project (query sensors only)

API description

Get the tree structure of spaces in a project (query sensors only).

API endpoint

GET /v1.0/illumination/aisensing/project/roomTree

Request parameter

Parameter Type Parameter type Description Required
projectId String body The project ID. true

Response parameter

Parameter Type Description
code Integer The error code. For more information, see the error code section. It is empty when the request succeeded.
success Boolean Determine whether the request succeeded. Valid values:
  • true: success.
  • false: failure.
msg String The message that is returned if the request failed. The response is empty if the request succeeded.
t Long The returned 13-digit timestamp.
result Object The returned result.

Description of result

Parameter Type Description
totalPointCount Integer The number of locations in the space.
totalRoomDeviceCount Integer The number of devices.
list List The list of rooms.
roomId String The ID of a room.
name String The name of a room.
roomLevel Integer The level of a room as an attribute of the space.

Sample request

{
  "projectId": "asdassdasdk2****"
}

Sample response

{
  "totalPointCount": 20,
  "totalRoomDeviceCount": 1,
  "list": [
    {
      "roomId": "sadad23****",
      "name": "Room name",
      "roomLevel": 2,
    }
  ]
}

Error code

The following table lists common error codes returned in the API calls. For more error codes, see Global Error Codes.

Error code Description
500 The error message is returned because a system error has occurred.