PCBA Lock API

Last Updated on : 2021-11-24 12:14:13download

Use TYSdk.apiRequest to make API requests.

Get a list of home members for a lock

Operation

tuya.m.device.member.detail.list

API version

1.0

Parameter

Name Type Description Optional
devId String The device ID. No
dpIds String One or more data point (DP) IDs that are separated with commas (,). Example: 12,13. No

Sample request

{
 "devId" : "25230882b4e62d61b52a",
 "dpIds" : "12,13"
}

Sample response

{
    "result":[
    {
        "userId":"2334", // The user ID.
        "lockUserId":2, // The lock user ID. The value cannot be `0` in the cloud.
        "userContact":"", // The contact.
        "nickName":"test", // The nickname.
        "avatarUrl":"", // The URL of avatar.
        "userType":10, // The type of member. Valid values:<ul><li>`10`: administrator</li><li>`20`: common member</li><li>`30`: unregistered member</li></ul>
	"backHomeNotifyAttr":0, // Specifies whether to set notifications of member arrival at home. Valid values:<ul><li>`0`: no</li><li>`1`: yes</li></ul>
        "unlockDetail":[ // The list of unlocking methods available to members.
            {
                "dpId":1, // dpId
                "open":true, // Specifies whether to unlock the door.
		"count":1, // The number of available unlocking methods. The value is the same as that of `unlockList.size()`.
                "unlockList":[ // The list of unlocking methods.
                    {
                        "unlockId":"1-2", // The ID of the unlocking method.
                        "devId":"vdev000a", // The lock ID.
                        "unlockName":"Fingerprint 1", // The contact.
                        "unlockAttr":1, // The unlocking attribute. Valid values:<ul><li>`1`: special</li><li>`0`: not special</li></ul>
                        "opModeId":2333 // The sequence number of the unlocking method.
                    }
                  ]
                }
            ]
        }
    ],
    "t":1573024513335,
    "success":true,
    "status":"ok"
}

Create a periodic temporary password

Operation

tuya.m.device.lock.temppwd.create

API version

5.0

Parameter

Name Type Description Optional
devId String The device ID. No
name String The name. Yes
password String The password. No
phone String The mobile phone number. Yes
password String The password. Yes
countryCode String The country code. Yes
sn Integer The ID of the temporary password. To create a password, the panel sets it on the device and receives this response parameter from the device. No
effectiveTime Long The 13-digit time when the password becomes effective. The value is accurate to the millisecond. No
availTime Integer The number of maximum times the password can be used. Valid values:
  • 0: permanent
  • 2: one time
No
invalidTime Long The 13-digit time when the password expires. The value is accurate to the millisecond. No
schedule String The schedule data in the JSON format. Yes

Sample request

{
    "devId":"vdev23322333",
    "name":"test",
    "password":"234567",
    "phone":"15158064445",
    "countryCode":"86",
    "sn":34,
    "effectiveTime":1581522427996,
    "availTime":1,
    "invalidTime":1581522429996,
    "schedule":[
        {
            "allDay":true, // Specifies whether the password is valid all day.
            "effectiveTime":720, // The time when the password becomes effective.
            "invalidTime":1080,// The time when the password expires.
            "workingDay":3// A week is represented with one byte. `Bit0` to `bit6` respectively represent Sunday to Saturday.
        }
    ]
}

Sample response

{
    "result":true,
    "t":1573024513335,
    "success":true,
    "status":"ok"
}

Update a periodic temporary password

Operation

tuya.m.device.lock.temppwd.update

API version

1.0

Parameter

Name Type Description Optional
id Long The temporary password ID. No
devId String The device ID. No
name String The name. Yes
password String The password. No
phone String The mobile phone number. Yes
password String The password. Yes
countryCode String The country code. Yes
sn Integer The temporary password ID generated by the device. No
effectiveTime Long The 13-digit time when the password becomes effective. The value is accurate to the millisecond. No
availTime Integer The number of maximum times the password can be used. Valid values:
  • 0: permanent
  • 2: one time
No
invalidTime Long The 13-digit time when the password expires. The value is accurate to the millisecond. No
schedule String The schedule data in the JSON format. Yes

Sample request

{
    "id":2333,
    "devId":"vdev23322333",
    "name":"test",
    "password":"234567",
    "phone":"15158064445",
    "countryCode":"86",
    "sn":34,
    "effectiveTime":1581522427996,
    "availTime":1,
    "invalidTime":1581522429996,
    "schedule":[
        {
            "allDay":true, // Specifies whether the password is valid all day.
            "effectiveTime":720, // The time when the password becomes effective.
            "invalidTime":1080,// The time when the password expires.
            "workingDay":3// A week is represented with one byte. `Bit0` to `bit6` respectively represent Sunday to Saturday.
        }
    ]
}

Sample response

{
    "result":true,
    "t":1573024513335,
    "success":true,
    "status":"ok"
}

Delete a temporary password

Operation

tuya.m.device.lock.temppwd.remove

API version

2.0

Parameter

Name Type Description Optional
devId String The device ID. No
targetStatus String The validity status of the target password. Valid values:
  • EFFECTIVE: effective
  • INEFFECTIVE: ineffective
No
pwdId Long The temporary password ID. Valid values:
  • 1: The value is required to delete an effective password.
  • 2: The value is ignored to delete an expired password. All expired data will be deleted.
Yes

Sample request

{
    "devId":"vdev23322333",
    "targetStatus":"EFFECTIVE",
    "pwdId":2333,
}

Sample response

{
    "result":true,
    "t":1573024513335,
    "success":true,
    "status":"ok"
}

Get the list of temporary passwords

Operation

tuya.m.device.lock.temppwd.list

API version

4.0

Parameter

Name Type Description Optional
devId String The device ID. No
targetStatus String The validity status of the target password. Valid values:
  • EFFECTIVE: effective
  • INEFFECTIVE: ineffective
No
offset Long The number of the entry starting from which entries are returned. It is a long type of value and the same as that of gmtCreate for the last entry on the current page. A value of null indicates the first page. Yes
lastPwdId Long The primary key ID for the last entry on the current page. A value of null indicates the first page. Yes
lastPwdType Integer The type of password for the last entry on the current page. When lastPwdId is null, this field can be empty. Valid values:
  • 0: periodic temporary password
  • 1: one-time password
Yes
limit Integer The number of entries per page. No

Sample request

{
    "devId":"vdev23322333",
    "targetStatus":"EFFECTIVE",
    "limit":20,
}

Sample response

{
    "data":[
        {
            "pwdId":"12345", // The password ID.
            "pwdType":0, // The type of password. Valid values:<ul><li>`0`: periodic temporary password</li><li>`1`: one-time password</li></ul>
            "name":"Periodic password",// The name of the password.
            "gmtCreate":3333,// The time when the password was created.
            "effectiveTime":5555, // The time when the password becomes effective.
            "expiredTime":5555, // The time when the password expires.
            "phone":"86-15158064456",// The mobile phone number with a country code.
            "scheduleDetails":[ // This field value is available only for a periodic password.
                {
                    "allDay":true, // Specifies whether the password is valid all day.
                    "effectiveTime":720, // The time when the password becomes effective.
                    "invalidTime":1080,// The time when the password expires.
                    "workingDay":3 // A week is represented with one byte. `bit0` to `bit6` respectively represent Sunday to Saturday.
                },
                {
                    "allDay":true,
                    "effectiveTime":720,
                    "invalidTime":1080,
                    "workingDay":3
                }
            ]
        },
        {
            "pwdId":"12457",
            "pwdType":1,
            "name":"One-time password",
            "gmtCreate":3333,
            "effectiveTime":5555,
            "expiredTime":5555,
            "phone":"86-15158064456",
            "scheduleDetails":[

            ]
        }
    ],
    "hasNext":true,
    "totalCount":0
}

Resend a password

Operation

tuya.m.device.lock.msg.resend

API version

2.0

Parameter

Name Type Description Optional
devId String The device ID. No
id String The password ID. No
pwdType Integer The type of password. Valid values:
  • 1: offline password
  • 0: periodic password
Yes

Sample request

{
    "devId":"vdev23322333",
    "id":"12",
    "pwdType": 1,
}

Sample response

{
    "result":true,
    "t":1573024513335,
    "success":true,
    "status":"ok"
}

Add an unlocking method (fingerprint+permanent password)

Operation

tuya.m.device.member.opmode.add

API version

4.0

Parameter

Name Type Description Optional
devId String The device ID. No
userId String The user ID. No
unlockId String The unlocking ID. Example: 1-2. No
unlockName String The name of the unlocking method, such as Fingerprint 02. If the value is not set, it is automatically generated in the cloud. Yes
unlockAttr Integer The attribute of the unlocking method. 1 indicates a special password. Yes
notifyInfo String The notification method to be returned in the JSON format. Yes

Sample request

{
    "devId":"vdev2332211",
    "userId":"33322",
    "unlockId":"1-2",
    "unlockName" : 'Fingerprint 02',
  "unlockAttr":1,
    "notifyInfo":{
        "appSend":0, // Specifies whether app notifications are enabled. Valid values:<ul><li>`0`: no</li><li>`1`: yes</li></ul>
        "msgPhone":"86-15156789943",// The mobile phone number that is used to receive SMS messages.
        "msgPhoneVerifyCode":"234567", // The SMS verification code sent to the mobile phone number. If the password is updated and the mobile phone number is unchanged, this parameter is empty.
        "notifyPhone":"86-15156789943", // The mobile phone number that is used to receive voice calls.
        "voicePhoneVerifyCode":"982356" // The voice call verification code sent to the mobile phone number. If the password is updated and the mobile phone number is unchanged, this parameter is empty.
    }
}

Sample response

{
    "result":true,
    "t":1573024513335,
    "success":true,
    "status":"ok"
}

Update a fingerprint unlocking method (fingerprint+permanent password)

Operation

tuya.m.device.member.opmode.update

API version

2.0

Parameter

Name Type Description Optional
devId String The device ID. No
opmodeId Long The primary key ID of the unlocking method. No
unlockName String The name of the unlocking method, such as Fingerprint 02. If the value is not set, it is automatically generated in the cloud. Yes
unlockAttr Integer The attribute of the unlocking method. 1 indicates a special password. Yes
notifyInfo String The notification method to be returned in the JSON format. Yes

Sample request

{
    "devId":"vdev2332211",
    "opmodeId":1333233,
    "unlockName" : 'Fingerprint 02',
    "unlockAttr":1,
    "notifyInfo":{
        "appSend":0, // Specifies whether app notifications are enabled. Valid values:<ul><li>`0`: no</li><li>`1`: yes</li></ul>
        "msgPhone":"86-15156789943",// The mobile phone number that is used to receive SMS messages.
        "msgPhoneVerifyCode":"234567", // The SMS verification code sent to the mobile phone number. If the password is updated and the mobile phone number is unchanged, this parameter is empty.
        "notifyPhone":"86-15156789943", // The mobile phone number that is used to receive voice calls.
        "voicePhoneVerifyCode":"982356" // The voice call verification code sent to the mobile phone number. If the password is updated and the mobile phone number is unchanged, this parameter is empty.
    }
}

Sample response

{
    "result":true,
    "t":1573024513335,
    "success":true,
    "status":"ok"
}

Delete an unlocking method

Operation

tuya.m.device.member.opmode.remove

API version

2.0

Parameter

Name Type Description Optional
devId String The device ID. No
opmodeId Long The primary key ID of the unlocking method. No

Sample request

{
    "devId":"vdev2332211",
    "opmodeId":1333233,
}

Sample response

{
    "result":true,
    "t":1573024513335,
    "success":true,
    "status":"ok"
}

Get a list of unlocking methods for a member

Operation

tuya.m.device.member.opmode.list

API version

2.0

Parameter

Name Type Description Optional
devId String The device ID. No
userId String The user ID. No
targetUnlockDpIds String One or more DP IDs of the target unlocking method, separated with commas (,). Example: 12,13. Yes
targetUnlockName String The name of the target unlocking method. Yes

Sample request

{
    "devId":"vdev2332211",
    "userId":1333233,
}

Sample response

{
    "result":[
    {
        "userName":"test", // The username.
        "userId":"xxx", // The user ID.
        "userType":10, // The type of member. Valid values:<ul><li>`0`: unknown type</li><li>`10`: administrator</li><li>`20`: common member</li><li>`30`: tagged member</li></ul>
        "lockUserId":0, // The lock user ID.
        "unlockName":"Fingerprint 1", // The name of the unlocking method.
        "opmodeId":"3444", // The primary key ID of the current unlocking method.
        "opmode":"12", // The DP ID of the current unlocking method.
        "opmodeValue":"3", // The DP value of the current unlocking method.
        "sourceAttribute":1,// The source of the unlocking method. Valid values:<ul><li>`1`: entered on the app</li><li>`2`: entered on the lock</li><li>`3`: entered by the lock administrator</li></ul>
        "phase":1, // The status. Valid values:<ul><li>`1`: confirmed and normal</li><li>`2`: to be confirmed and updated</li><li>`3`: frozen</li><li>`4`: to be frozen</li><li>`5`: to be unfrozen´</li><li>`6`: to be reset</li><li>`7`: failed to be created</li><li>`8`: deleted</li><li>`9`: to be deleted</li><li>`10`: to be created</li></ul>
        "unlockAttr":1, // The attribute of the unlocking method. `1` indicates the duress attribute.
        "notifyInfo":{
            "appSend":0,
            "msgPhone":"86-15156789943",
            "notifyPhone":"86-15156789943"
        }
    }
],
    "t":1573024513335,
    "success":true,
    "status":"ok"
}

Get a dynamic password

Operation

tuya.m.device.lock.offlinepwd.get

API version

1.0

Parameter

Name Type Description Optional
devId String The device ID. No
pwdType String The type of password. Valid values:
  • 0: a password that can be used as many times as needed before it expires
  • 1: a one-time password
  • 9: a clearing code
No
gmtStart Long The time when the password becomes effective. The value is 0 except for a password that can be used as many times as needed before it expires. No
gmtExpired Long The time when the password expires. The value is 0 except for a password that can be used as many times as needed before it expires. No
pwdName String The name of the password. Yes
countryCode String The country code, such as 86. Yes

Sample request

{
    "devId":"vdev2332211",
    "gmtExpired":"0",
    "pwdType":"1",
    "countryCode":"",
    "pwdName":"",
    "gmtStart":"0"
}

Sample response

{
    "result":{
        "gmtExpired":"1582131600",
        "pwdId":"402195",
        "pwd":"7339435096",
        "gmtStart":"1582110000"
    },
    "t":1573024513335,
    "success":true,
    "status":"ok"
}

Rename an offline password and send an SMS notification

tuya.m.device.lock.offlinepwd.update

API version

1.0

Parameter

Name Type Description Optional
devId String The device ID. No
pwdId String The password ID. No
pwdName String The name of the password. No
phoneWithCountryCode String The mobile phone number with a country code, used to receive messages. Yes

Sample request

{
    "devId":"vdev2332211",
    "pwdId" : "1",
    "pwdName": "Password name 1",
    "phoneWithCountryCode":"86-15158067886"
}

Sample response

{
    "result":true,
    "t":1573024513335,
    "success":true,
    "status":"ok"
}

Get dynamic lock data

tuya.m.scale.history.list

API version

2.0

Parameter

Name Type Description Optional
devId String The device ID. No
dpIds String One or more DP IDs that are separated with commas (,). No
offset Integer The number of the entry starting from which entries are returned. No
limit Integer The number of entries per page. No
startTime Long The time when the password becomes effective. No
endTime Long The time when the password expires. No

Sample request

{
    "devId":"vdev2332211",
    "dpIds":"[1,2]",
    "offset":0,
    "limit":10,
    "startTime": 1581434795,
    "endTime": 1581444795
}

Sample response

{
     "result":{
        "datas":[
            {
                "devId":"6cc81b7b8fd97fe00fguh2",
                "dps":[
                    {
                        "15":"97"
                    }
                ], // An array of key-value pairs. For each element, the key is `dpId` and the value is `dp`.
                "avatar":"https://airtake-public-data.oss-cn-hangzhou.aliyuncs.com/smart/user_res/avatar/scale/user_icon_default.png",
                "userName":"",
                "unlockName":"",
                "gmtCreate":1579339465000,
                "uuid":"15793300059C669FD0B31E173A6D1E2F5500109465000",
                "userId":"0",
                "status":1,
                "tags":0 // Valid values:<ul><li>`0`: other scenes</li><li>`1`: a duress alert</li></ul>
            }
        ],
        "hasNext":false,
        "totalCount":5
    },
    "t":1573024513335,
    "success":true,
    "status":"ok"
}

Get alert records of a device

tuya.m.device.lock.alarm.list

API version

2.0

Parameter

Name Type Description Optional
devId String The device ID. No
dpIds String One or more DP IDs that are separated with commas (,). No
offset Integer The number of the entry starting from which entries are returned. No
limit Integer The number of entries per page. No
includeHijack Boolean Indicates whether duress alarms are included. No

Sample request

{
    "devId":"vdev2332211",
    "dpIds":"[1,2]",
    "offset":0,
    "limit":10,
    "includeHijack": true,
}

Sample response

{
     "result":{
        "datas":[
            {
                "devId":"6cc81b7b8fd97fe00fguh2",
                "dps":[
                    {
                        "15":"97"
                    }
                ], // An array of key-value pairs. For each element, the key is `dpId` and the value is `dp`.
                "avatar":"https://airtake-public-data.oss-cn-hangzhou.aliyuncs.com/smart/user_res/avatar/scale/user_icon_default.png",
                "userName":"",
                "unlockName":"",
                "gmtCreate":1579339465000,
                "uuid":"15793300059C669FD0B31E173A6D1E2F5500109465000",
                "userId":"0",
                "status":1,
                "tags":0 // Valid values:<ul><li>`0`: other scenes</li><li>`1`: a duress alert</li></ul>
            }
        ],
        "hasNext":false,
        "totalCount":5
    },
    "t":1573024513335,
    "success":true,
    "status":"ok"
}

Get device activation time

tuya.m.device.lock.active.period

API version

1.0

Parameter

Name Type Description Optional
devId String The device ID. No

Sample request

{
    "devId":"vdev2332211",
    "dpIds":"[1,2]",
    "offset":0,
    "limit":10,
    "includeHijack": true,
}

Sample response

{
    "result":1574169765239,
    "t":1573024513335,
    "success":true,
    "status":"ok"
}

Query remaining quota of current user’s plan

tuya.m.mobile.voice.times.count

API version

1.0

Parameter

None

Sample request

null

Sample response

{
    "result": {
		"remainingTimes": 0, // The remaining quota.
		"expireDate": 0, // The time when the plan expires.
		"packageStatus": 0 // The status of the plan . Valid values:<ul><li>`0`: No plan is purchased.</li><li>`1`: A plan is available.</li><li>`2`: No plan is available due to expiration.</li><li>`3`: No plan is available because the quota is used up.</li></ul>
	}
    "t":1573024513335,
    "success":true,
    "status":"ok"
}

Send a verification code via SMS

tuya.m.msg.verifycode.send

API version

1.0

Parameter

Name Type Description Optional
phone String The mobile phone number with a country code. Format: xx-yyyyyyyyyyy. Example: 86-xxxxx. No

Sample request

{
   "phone":"86-151xxxxxxxx"
}

Sample response

{
    "result":true,
    "t":1573024513335,
    "success":true,
    "status":"ok"
}

Get the lock user ID

tuya.m.device.user.lockid

API version

1.0

Parameter

Name Type Description Optional
devId String The device ID. No

Sample request

{
    "devId":"vdev2332211",
}

Sample response

{
    "result":"12",
    "t":1573024513335,
    "success":true,
    "status":"ok"
}

Set notifications of member arrival at home

tuya.m.scale.hijacking.add.config

API version

1.0

Parameter

Name Type Description Optional
devId String The device ID. No
dpId Integer The DP ID of the member arrival notification feature. No
dpValue String The DP value. It is the same as that of userId to which member arrival notifications are sent. No
typeDpId Integer Yes
typeDpValue String Yes

Sample request

{
    "devId":"vdev2332211",
    "dpId":69,
    "dpValue":"7858797",
    "typeDpValue":"",
    "typeDpId":0
}

Sample response

{
    "result":null,
    "t":1573024513335,
    "success":true,
    "status":"ok"
}

Remove member arrival notifications

tuya.m.scale.hijacking.remove.config

API version

1.0

Parameter

Name Type Description Optional
devId String The device ID. No
dpId Integer The DP ID of the member arrival notification feature. No
dpValue String The DP value. It is the same as that of userId to which member arrival notifications are sent. No
typeDpId Integer Yes
typeDpValue String Yes

Sample request

{
    "devId":"vdev2332211",
    "dpId":69,
    "dpValue":"7858797",
    "typeDpValue":"",
    "typeDpId":0
}

Sample response

{
    "result":null,
    "t":1573024513335,
    "success":true,
    "status":"ok"
}

Get member information

tuya.m.device.member.panel.get

API version

1.0

Parameter

Name Type Description Optional
devId String The device ID. No
userId String The panel user ID. If the value is not set, the value of the current user information of the panel is returned. Yes

Sample request

{
    "devId":"vdev2332211",
    "userId":"0000000001" // It can be empty.
}

Sample response

{
    "result":{
      "userId":"0000000001",
      "lockUserId":2, // The lock user ID.
      "nickName":"123",
       "avatarUrl":"smart/user_res/ay1519797357494tgSIE/scale/avatar_1524487255195.jpg",
      "userType":"10" // The type of member. Valid values:<ul><li>`10`: administrator</li><li>`20`: common member</li><li>`30`: unregistered member</li></ul>
      "unlockList":[
        "Fingerprint 1",
        "Fingerprint 2",
        "Password-1"
      ]
},
    "t":1573024513335,
    "success":true,
    "status":"ok"
}

Set whether to continuously get an offline password

tuya.m.device.lock.offlinepwd.available

API version

1.0

Parameter

Name Type Description Optional
devId String The device ID. No
pwdType Integer The type of password. Valid values:
  • 0: a password that can be used as many times as needed
  • 1: one-time password
No

Sample request

{
    "devId":"vdev2332211",
    "pwdType":"1"
}

Sample response

{
    "result":{
        "nextAvailableTime":"1582776000", // The time when the next password can be obtained. The value is accurate to the second. If `available=false`, the value is `0`.
        "available":false // Specifies whether a password can be obtained. Valid values:<ul><li>`false`: no</li><li>`true`: yes</li></ul>
    },
    "t":1573024513335,
    "success":true,
    "status":"ok"
}

Save DP data by dpCode

tuya.m.device.props.save

API version

1.0

Parameter

Name Type Description Optional
devId String The device ID. No
propKvs String The JSON key-value pair in the format of dpCode:dpValue. No

Sample request

{
    "devId":"vdev2332211",
    "propKvs":"{\"unlock_key_warn\":\"true\"}"
}

Sample response

{
    "result": null,
    "t":1573024513335,
    "success":true,
    "status":"ok"
}

Get DP data by dpCode

tuya.m.device.props.fetch

API version

1.0

Parameter

Name Type Description Optional
devId String The device ID. No
props String One or more dpCode properties that are separated with commas (,). No

Sample request

{
    "devId":"vdev2332211",
    "props":"\"unlock_key_warn\",\"family_return_warn\""
}

Sample response

{
    "result": {
        "unlock_key_warn":"true",
        "family_return_warn":"false"
    },
    "t":1573024513335,
    "success":true,
    "status":"ok"
}

Get the offline password T0 time

tuya.m.device.offlinepwd.ble.time

API version

1.0

Parameter

Name Type Description Optional
devId String The device ID. No

Sample request

{
    "devId":"vdev2332211",
}

Sample response

{
    "result": "5e6362a6",
    "t":1573024513335,
    "success":true,
    "status":"ok"
}

Query members removed from home (data sync between Bluetooth lock and cloud)

tuya.m.device.absent.member.list

API version

1.0

Parameter

Name Type Description Optional
devId String The device ID. No

Sample request

{
    "devId":"vdev2332211",
}

Sample response

{
    "result": [
        {
            "userId":12410208,
            "userType":10,
            "lockUserId":2
        },
        {
            "userId":12410209,
            "userType":20,
            "lockUserId":3
        }
    ],
    "t":1573024513335,
    "success":true,
    "status":"ok"
}

Confirm members removed from home on the device

tuya.m.device.absent.member.del.confirm

API version

1.0

Parameter

Name Type Description Optional
devId String The device ID. No
lockUserId Integer The lock user ID. The value is included in the DP data reported by the device. No

Sample request

{
    "devId":"vdev2332211",
    "lockUserId":2
}

Sample response

{
    "result": null,
    "t":1573024513335,
    "success":true,
    "status":"ok"
}

Get and send home member information

Scenario: After a user role is updated, data must be synchronized between the device and the cloud. This is similar to the process to synchronize the members removed from a home.

tuya.m.device.member.list

API version

2.0

Parameter

Name Type Description Optional
devId String The device ID. No

Sample request

{
    "devId":"vdev2332211",
    "lockUserId":2
}

Sample response

{
    "result": {
        "userId":"12",
		"userType": 10,
		"lockUserId":1,
        "avatarUrl":"",
        "userContact":"86-13757150532",
        "unlockList":[
            "Fingerprint 1",
            "Fingerprint 2",
            "Password-1"
        ]
    },
    "t":1573024513335,
    "success":true,
    "status":"ok"
}

Initiate data synchronization

Scenario: Data is synchronized each time the device goes online and the user list is refreshed. In the case of frequent refreshes, data is also frequently synchronized. Therefore, a new synchronization task might be started when the last one is still in progress. This will cause a waste of local and cloud resources. The current operation is used for the following purposes:

  • Control the synchronization frequency. A synchronization command is sent to the device only when the panel calls this operation with distributed=true returned.
  • The cloud controls the frequency. Data is synchronized at an interval of at least five seconds.

tuya.m.device.opmode.sync.rise

API version

2.0

Parameter

Name Type Description Optional
devId String The device ID. No
dpIds String The list of dpId to be synchronized. For example, to synchronize the password, fingerprint, card, and biometric data, the value is set to [11,12,13,15,33.] No

Sample request

{
    "devId":"vdev2332211",
    "dpIds":"[11,12,13,15,33]"
}

Sample response

{
    "result": {
        "ins":"01020304",
        "distributed":true, // Indicates whether a synchronization command can be sent to the device. Valid values:<ul><li>`true`: It can be sent.</li><li>`false`: It cannot be sent.</li></ul>
        "dpId":4
    },
    "t":1573024513335,
    "success":true,
    "status":"ok"
}