Add human presence sensor
https://cnapi.ttlock.com/v3/humanPresenceSensor/add
The human presence sensor can detect whether there is a person in the room and transmit the sensing data to the power-taking switch, so as to realize automatic power taking by sensing.
Call this API after adding the human presence sensor to the power-taking switch through the APP SDK, to bind the human presence sensor to the power-taking switch in the cloud. Currently, a human presence sensor can only be added to one power-taking switch; if added to another, the new binding will overwrite the previous one.
1 HTTP request method and example
POST, ContentType:application/x-www-form-urlencoded
javascript
curl --location -g --request POST 'https://cnapi.ttlock.com/v3/humanPresenceSensor/add' \
--data-urlencode 'clientId=4773aa036f7f49c68d876bb4be85c80c' \
--data-urlencode 'accessToken=dfd5489d0cee31f0bdfaf59d0d42d71f' \
--data-urlencode 'lockId=76324' \
--data-urlencode 'name=301roomsensor' \
--data-urlencode 'mac=AA:BB:CC:DD:EE:FF' \
--data-urlencode 'number=HPS-234234' \
--data-urlencode 'sensitivity=1' \
--data-urlencode 'modelNum=xxxxxxxxxxxxx' \
--data-urlencode 'hardwareRevision=xxxxxxxxxxxxx' \
--data-urlencode 'firmwareRevision=xxxxxxxxxxxxx' \
--data-urlencode 'date=1625025703000'2 Request parameters
| Name | Type | Required | Description |
|---|---|---|---|
| clientId | String | Y | client_id from Create application |
| accessToken | String | Y | Access token,refer to: Get access token |
| lockId | String | Y | Power switch ID |
| name | String | Y | Name |
| mac | String | Y | Human presence sensor MAC |
| number | String | Y | Human presence sensor number |
| sensitivity | String | N | Sensitivity: 0-off, 1-low, 2-lower, 3-medium, 4-higher, 5-high |
| modelNum | String | N | Product model |
| hardwareRevision | String | N | Hardware version number |
| firmwareRevision | String | N | Firmware version number |
| date | Long | Y | Current time (timestamp in millisecond) |
3 Response and example
| Parameter | Type | Description |
|---|---|---|
| id | Int | Human presence sensor ID |
{
"id": 2233
}