Last Updated on : 2023-07-19 09:12:44download
For smart door locks, except raw type data points (DPs), you need to subscribe to the standard instruction set and status set DPs. This way, you can get the DP content and parameter values, such as DPs for device status reporting, unlocking history, and alert history.
Standard instructions are used to control the general capabilities of smart locks. For more information, see the standard instruction set and status set of smart locks and the API Get device details in the subsequent sections.
For more information, see Enroll in unlocking methods.
Applicable lock types
Parameters
Parameter name | Type | Description |
---|---|---|
bizCode | String | The code of the specified event type. |
devId | String | The device ID. |
uuid | String | The universally unique identifier (UUID) of the specified device. |
bizData | Object | The status of the specified unlocking method. |
ts | Long | The timestamp. |
bizCode
bizCode | Description |
---|---|
doorUnlockMethodStatus | The status of the specified unlocking method. |
bizData
code | Data type | Description |
---|---|---|
finish | Boolean | Indicates whether the unlocking method is enrolled. |
operate | Integer | The operation type. Valid values:
|
raised | Boolean | Indicates whether an unlocking method enrollment is initiated. |
totalPeriod | Integer | The total number of enrollments. The value is pushed separately and only once. |
period | Integer | The number of remaining enrollments allowed for users. |
event | String | The event. Valid values:
|
Data format
{
"bizCode":"doorUnlockMethodStatus",
"bizData":{
"finish":false,
"operate":1,
"raised":true,
"totalPeriod":2,
"period":2,
"event":"unlockMethodEntry"
},
"uuid":"xxxx",
"devId":"xxxx"
}
For more information, see the Device Control API.
Query the device details, including the instruction set and the latest status of the specified device.
GET /v1.0/devices/{device_id}
Parameter name | Type | Parameter type | Required | Description |
---|---|---|---|---|
device_id | String | URI | Yes | The device ID. |
Parameter name | Type | Description |
---|---|---|
code | Integer | The response code. See Error codes. |
success | Boolean | Indicates whether the operation is successful. Valid values:
|
msg | String | The error message returned if the API call fails. This parameter value is empty if the API call succeeds. |
result | Object<result> | The returned result. |
Description of result
Parameter name | Type | Description |
---|---|---|
id | String | The device ID. |
name | String | The device name. |
uid | String | The user ID. |
local_key | String | The secret key. |
category | String | The product category. |
product_id | String | The product ID. |
product_name | String | The product name. |
sub | Boolean | Specifies whether it is a sub-device. Valid values:
|
uuid | String | The UUID of the specified device. |
owner_id | String | The home ID. |
online | Boolean | Indicates whether the device is online. |
status | Object<status> | The status of the specified device feature. |
active_time | Long | The time when the specified device is activated, which is accurate to seconds. |
biz_type | Long | The biztype of the specified application. |
icon | String | The icon of the specified device. |
ip | String | The IP address of the specified device. |
Description of status
Parameter name | Type | Description |
---|---|---|
code | String | The code of the specified data point. |
value | String | The value of the specified data point. |
type | String | The type of the specified data point. |
GET /v1.0/devices/vdevo153490924188132
TuyaClient client = new TuyaClient(clientId, secret, RegionEnum.CN);
DeviceVo deviceVo = client.getDeviceInfo(DEV_ID);
System.out.println("Get device details: ");
System.out.println(JSONObject.toJSONString(deviceVo));
{
"success": true,
"result": {
"active_time": 1589505938,
"biz_type": 299009,
"category": "qt",
"create_time": 1560827137,
"icon": "smart/icon/15402589135gknz23xajb_0.png",
"id": "60613135b121cddc294****",
"ip": "120.198.****.****",
"local_key": "3a9b50126fe473****",
"name": "Body fat scale",
"online": true,
"owner_id": "1070****",
"product_id": "g0er6hSKgMqr****",
"product_name": "Wifi scales_OEM",
"status": [
{
"code": "weight",
"value": "48900"
},
{
"code": "left_hand_r",
"value": "0"
},
{
"code": "right_hand_r",
"value": "0"
},
{
"code": "left_leg_r",
"value": "0"
},
{
"code": "right_leg_r",
"value": "0"
},
{
"code": "body_r",
"value": "653"
},
{
"code": "battery_low",
"value": "false"
}
],
"sub": false,
"time_zone": "+08:00",
"uid": "ay157896239864843g****",
"update_time": 1589764585,
"uuid": "60613135b23cddc294****"
}
}
The following table lists common error codes returned in the API calls. For more error codes, see Global Error Codes.
Error codes | Description |
---|---|
500 | A system error has occurred while processing your request. |
1106 | Invalid permission. |
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback