Last Updated on : 2023-06-15 05:15:23
You can query the device details, including attributes and the latest status of a specified device.
GET /v1.0/devices/{device_id}
Parameter | Type | Parameter type | Required | Description |
---|---|---|---|---|
device_id | String | URI | Yes | The device ID. |
Parameter | Type | Description |
---|---|---|
Code | Integer | The response code. See Global 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 | Type | Description |
---|---|---|
id | String | The device number. |
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 | Determines whether it is a sub-device. Valid values:
true
: yesfalse
: nobiztype
of a specified application. |Description of status
Parameter | Type | Description |
---|---|---|
Code | String | The code of a specified data point. |
value | String | The value of a specified data point. |
type | String | The type of a 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 code | Description |
---|---|
500 | A system error has occurred while processing your request. |
1106 | Invalid permission. |
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback