English
English
简体中文
Contact Us
Register
Log In
layoutIndex

Asset Management

Last Updated on : 2022-01-07 07:03:31download

TYAssetManager provides API methods that enable interactions to manage assets.

Currently, the SDK cannot be used to add, modify, or delete assets. These operations can only be implemented on the Tuya IoT Platform. For more information, see Manage Assets.

Query authorized assets for users

Parameters

Parameter Type Required Description
parentAssetId String false The ID of the parent asset.
pageNumber Integer false The number of the page to be returned. By default, the value is empty to return the first page.
pageSize Integer false The number of entries to be returned per page. Default value: 20. Maximum value: 20.

AssetsBean

Parameter Type Description
hasMore Boolean Indicates whether additional data is available.
assets List<AssetBean> The list of assets.
projectName String The name of the project.

AssetBean

Parameter Type Description
assetId String The ID of the asset.
assetName String The name of the asset.
parentAssetId String The ID of the parent asset.
permission String The permissions on the asset. Valid values: all: all permissions. read: read-only permission.

Example

TYAssetManager.getAssetBusiness().queryAssets(parentAssetId, pageNumber, pageSize, new ResultListener<AssetsBean>() {
            @Override
            public void onFailure(String errorCode, String errorMsg) {

            }

            @Override
            public void onSuccess(AssetsBean assetsBean) {

            }
        });

Query devices of a specific asset on pages

Parameters

Parameter Type Required Description
assetId String true The ID of the asset.
lastRowKey String false The row key of the last entry on each page.
pageSize Integer true The number of entries returned per page. Maximum value: 20.

AssetDeviceListBean

Type Description
list List<AssetDeviceBean> The list of device response objects in the asset.
lastRowKey String The row key of the last entry on each page.
pageSize Integer The number of entries to be returned per page.
hasNext Boolean Specifies whether to return the next page.

AssetDeviceBean

Parameter Type Description
deviceId String The ID of the device.
assetId String The ID of the asset.
assetName String The name of the asset.

Example

TYAssetManager.getAssetBusiness().queryDevicesByAssetId(assetId, lastRowKey, pageSize, new ResultListener<AssetDeviceListBean>() {
            @Override
            public void onFailure(String errorCode, String errorMsg) {

            }

            @Override
            public void onSuccess(AssetDeviceListBean assetDeviceListBean) {

            }
        });