Remote Configuration

Last Updated on : 2022-10-17 07:53:38

Remote configuration allows you to update the configuration parameters such as system and network with no restart or interruption of service required.

This topic describes the MQTT topics and data structures used to enable the device to proactively request remote configuration information.

Feature description

Remote configuration supports:

  • Enable or disable remote configuration.
  • Edit the configuration file online and manage versions.
  • Push the configuration file to the target devices to update the configuration information in bulk.
  • The device proactively requests the configuration information.

For more information, see Remote Configuration.

Download configuration file

Device sends messages

A device requests the latest configuration file.

Topic: tylink/${deviceId}/ext/config/get

{
    "msgId":"45lkj3551234***",
    "time":1626197189638,
    "data":{
        "bizType":"PRODUCT_FILE"
    }
}

Description

Parameters Type Description Required Notes
${deviceId} string The device ID. Yes The device ID. If this is a sub-device, the deviceId should be the ID of the sub-device.
version string Protocol version No The protocol version defaults to 1.0, which is the only valid value currently.
msgId string Message ID Yes A string up to 32 bits in length. The request and response are associated with a message ID.
time number Message timestamp Yes The Unix timestamp when a message is sent, in seconds (10-digit value) or milliseconds (13-digit value).
data object Get the parameters of time service Yes Get the parameters of time service
data.bizType string Business type Yes Business type. Set remote configuration per product.
Valid value: PRODUCT_FILE.

Device receives messages

A device requests the latest configuration file from the cloud. The cloud returns the URL to the latest configuration file.

Topic: tylink/${deviceId}/ext/config/get_response

{
    "msgId":"45lkj3551234***",
    "time":1626197189638,
	"data":{
        "bizType":"PRODUCT_FILE",
        "pid":"5k8h97qska6pf***",
        "fileName": "n2atcfaa_000004d6n7_0.0.8.json",
        "url":"https://tuya-temp-fileupload-1254153901.cos.ap-shanghai.myqcloud.com/iot-platform-tmp/bay1617694933431vh5n/1631015173bbb14756aa2.png?sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKIDopcCYgw0qRoyV5qfKjvg2pPkqESnb5zI%26q-sign-time%3D1631015173%3B1631018773%26q-key-time%3D1631015173%3B1631018773%26q-header-list%3D%26q-url-param-list%3D%26q-signature%3D4670e7d3cf500f9210a0f2d5bc9e98d6e429****",
        "size": 5165,
        "sha256": "54081B1FD727F2F6533178B7FC18B144177A0E33201D1685BBF0B2E38AB9A***",
        "version": "0.0.8",
        "md5": "74ea6d75f6487049b61a2aa24da2f***"  
    }
}

Description

Parameters Type Description Required Notes
${deviceId} string Device ID Yes The device ID. If this is a sub-device, the deviceId should be the ID of the sub-device.
version string Protocol version No The protocol version defaults to 1.0, which is the only valid value currently.
msgId string Message ID Yes A string up to 32 bits in length. The request and response are associated with a message ID.
time number Message timestamp Yes The Unix timestamp when a message is sent, in seconds (10-digit value) or milliseconds (13-digit value).
data object Get the parameters of time service Yes Get the parameters of time service.
data.bizType string Business type Yes Business type. Set remote configuration per product.
Valid value: PRODUCT_FILE.
data.pid string Product ID (PID) Yes The PID of the product.
data.fileName string The name of the configuration file Yes The name of the configuration file.
data.url string The presigned URL to upload a file. Yes The presigned URL to upload a file to the cloud.
data.size integer The size of the configuration file Yes The unit is in bytes.
data.sha256 stirng SHA-256 hash value of the configuration file Yes SHA-256 hash value of the configuration file.
data.version stirng The version of the current configuration file Yes The version of the current configuration file.
data.md5 stirng The MD5 hash of the file Yes The MD5 hash of the file.