Device Status & Settings API

Last Updated on : 2023-06-15 05:15:23

Get device details

API description

You can query the device details, including attributes and the latest status of a specified device.

API endpoint

GET /v1.0/devices/{device_id}

Request parameter

Parameter Type Parameter type Required Description
device_id String URI Yes The device ID.

Response parameter

Parameter Type Description
Code Integer The response code. See Global Error Codes.
success Boolean Indicates whether the operation is successful. Valid values:
  • true: succeeded.
  • false: failed.
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: yes
  • false: no

| uuid | String | The universally unique identifier (UUID) of a specified device. |
| owner_id | String | The home ID. |
| online | Boolean | The online status of a specified device. |
| status | Object<status> | The status of a specified device feature. |
| active_time | Long | The time when a specified device is activated, which is accurate to seconds. |
| biz_type | Long | The biztype of a specified application. |
| icon | String | The device icon. |
| ip | String | The IP address of a specified device. |

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.

Sample request

GET /v1.0/devices/vdevo153490924188132

Sample SDK

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));

Sample response

{
    "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****"
    }
}

Error codes

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.