Wi-Fi Lock API

Last Updated on : 2021-11-23 04:02:28download

For the interface request method, please call the TYSdk.apiRequest.

Gets the number of members

API name

tuya.m.device.member.count

API version

1.0

Request parameters

Name Type Description Optional?
devId String device ID No

Request example

{ "devId" : 1 }

Response example

{ "result":{ "familyUser":10, "panelUser":20 }, "t":1573024513335, "success":true, "status":"ok" }

Get a list of family members

API name

tuya.m.device.member.list

API version

2.0

Request parameters

Name Type Description Optional?
devId String device ID No

Returns the parameter

Name Type Description
userId String Member number
avatarUrl String Head address
userContact String contact
unlockList String[] List of unlock methods owned by members
userType String User type 10. Administrator 20. Regular member 30. Member without name
nickName String The user nickname

Request example

{ "devId" : "25230882b4e62d61b52a" }

Response example

{ "result":"1", "t":1573024513335, "success":{ "userId":"12", "avatarUrl":"", "userContact":"86-13757150532", "unlockList":[ "fingerprint1", "fingerprint2", "password1" ] }, "status":"ok" }

Gets the list of panel members

API name

tuya.m.device.member.panel.list

API version

2.0

Request parameters

Name Type Description Optional?
devId String device ID No
offset Integer Initial sequence number No
limit Integer The number of starts per request No

Returned parameter

Name Type Description
userId String Member number
avatarUrl String Head address
userContact String contact
unlockList String[] List of unlock methods owned by members
userType String User type 10. Administrator 20. Regular member 30. Member without name
nickName String The user nickname

Request example

{ "devId" : "25230882b4e62d61b52a", "offset" : 0, "linit": 50, }

Response example

{ "result":"1", "t":1573024513335, "success":{ "userId":"12", "avatarUrl":"", "userContact":"86-13757150532", "unlockList":[ "fingerprint1", "fingerprint2", "password1" ] }, "status":"ok" }

Users to add

API name

m.smart.scale.history.user.add

API version

1.0

Request parameters

Name Type Description Optional?
devId String device ID No
name String user name No
avatar String User avatar (no null) No
sex String Gender (null) No
birthday String Birthday (0) No
height Integer Height No

Request example

{ "devId" : "25230882b4e62d61b52a", "name" : 'tuya', "avatar": '', "sex": '', "birthday": '', "height": 0 }

Response example

{ "result" : { "userId" : "0000000aip" }, "t" : 1573612927418, "success" : true, "status" : "ok" }

Remove the user

API name

m.smart.scale.history.user.delete

API version

1.0

Request parameters

Name Type Description Optional?
devId String device ID No
userId String user id No

Request example

{ "devId" : "25230882b4e62d61b52a", "userId" : '9906', }

Response example

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

Add unlock mode

API name

tuya.m.device.member.opmode.add

API version

2.0

Request parameters

Name Type Description Optional?
devId String device ID No
userId String user id No
unlockId String unlock code No
unlockName String Unlock mode name No

Request example

{ "devId" : "25230882b4e62d61b52a", "userId" : '9906', "unlockId" : '1-2', "unlockName" : 'fingerprint02', }

Response example

{ "result" : { "opModeId" : 47958, "unlockName" : "password40" }, "t" : 1574503711145, "success" : true, "status" : "ok" }

Unlocking mode removed

API name

m.smart.scale.user.unlock.remove

API version

1.0

Request parameters

Name Type Description Optional?
devId String device ID No
unlockId String unlock code No

Request example

{ "devId" : "25230882b4e62d61b52a", "unlockId" : '1-2', }

Response example

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

Get the user details interface

API name

tuya.m.device.member.detail

API version

1.0

Request parameters

Name Type Description Optional?
devId String device ID No
userId String user id No

Returns the parameter

Name Type Description
userId String Member number
avatarUrl String Head address
userContact String contact
userType String User type 10. Administrator 20. Regular member 30. Member without name
nickName String The user nickname
unlockDetail UnLockDetail[] List of unlock methods owned by members

Request example

{ "devId" : "25230882b4e62d61b52a", "unlockId" : '1-2', }

Response example

{ "result":"1", "t":1573024513335, "success":{ "userId":"12", "avatarUrl":"", "userContact":"86-13757150532", "unlockDetail":[ { "dpId":12, "unlockList":[ { "devId":"vedoa12300", "unlockId":"12-2", "unlockName":"12-2", "unlockAttr":1, "opModeId":1, }, { "devId":"vedoa12300", "unlockId":"12-3", "unlockName":"12-3", "unlockAttr":0, "opModeId":2, } ] }, { "dpId":"13", "unlockList":[ { "devId":"vedoa12300", "unlockId":"13-3", "unlockName":"13-3", "unlockAttr":0, "opModeId":9, } ] } ] }, "status":"ok" }

Update unlock mode name

API name

tuya.m.device.member.opmode.update

API version

1.0

Request parameters

Name Type Description Optional?
devId String device ID No
opmodeId String Unlock mode serial number, opModeId returned when adding No
unlockName String The name of the way to open the door No

Request example

{ "devId" : "25230882b4e62d61b52a", "opmodeId" : '47958', "unlockName" : 'The tester', }

Response example

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

Anti-hijack setting

API name

tuya.m.scale.hijacking.add.config

API version

1.0

Request parameters

Name Type Description Optional?
devId String device ID No
dpId Integer The first half of unlockId No
dpValue Integer In the second part of unlockId No

Request example

{ "devId" : "25230882b4e62d61b52a", "dpValue":"1-1", "dpId":"1" }

Response example

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

Anti-hijack removal

API name

tuya.m.scale.hijacking.remove.config

API version

1.0

Request parameters

Name Type Description Optional?
devId String device ID No
dpId Integer The first half of unlockId No
dpValue Integer In the second part of unlockId No

Request example

{ "devId" : "25230882b4e62d61b52a", "dpValue":"1-1", "dpId":"1" }

Response example

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

Determine if there is a lock opening mode that needs to be assigned

API name

tuya.m.device.unlock.assignlist

API version

1.0

Request parameters

Name Type Description Optional?
devId String device ID No

Request example

{ "devId": "vedosoeerjfneweinqw" }

Response example

{ [ { "opmode":"1", "unlockInfo":[{ "unlockId":"1-01", "unlockName":"fingerprint 1" }] }, { "opmode":"2", "unlockInfo":[{ "unlockId":"2-01", "unlockName":"password 1" }] }, { "opmode":"3", "unlockInfo":[{ "unlockId":"3-01", "unlockName":"Door card 1" }] } ] }

Query the list of unlock modes to be assigned

API name

tuya.m.device.unlock.waitassign

API version

1.0

Request parameters

Name Type Description Optional?
devId String device ID No

Request example

{ "devId": "vedosoeerjfneweinqw" }

Response example

{ "result": true, // true: not to be allocated. false: not to be allocated "t": 1550562572623, "success": true, "status": "ok" }

Unlock mode distribution

API name

tuya.m.device.user.unlock.allocate

API version

1.0

Request parameters

Name Type Description Optional?
devId String device ID No
userId String user id No
unlockId String Number of unlock mode No

Request example

{ "devId" : "6cc1483v89yz1t8o", "userId" : "3765529", "unlockIds" : ["101-01","101-02"] }

Response example

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

Open door record allocation

API name

tuya.m.device.user.unlock.bind

API version

1.0

Request parameters

Name Type Description Optional?
devId String device ID No
userId String user id No
unlockId String unlock code No

Request example

{ "devId" : "6cc1483v89yz1t8o", "userId" : "3765529", "unlockIds" : ["1-1","2-2"] }

Response example

{ "result": true, // Only if true represents a successful allocation "t": 1550562572623, "success": true, "status": "ok" }

How many days are there to get the distribution network

API name

tuya.m.device.lock.active.period

API version

1.0

Request parameters

Name Type Description Optional?
devId String device ID No

Request example

{ "devId" : "6cc1483v89yz1t8o", }

Response example

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

Unread record number interface

API name

tuya.m.device.lock.alarm.unread

API version

1.0

Request parameters

Name Type Description Optional?
devId String device ID No

Request example

{ "devId" : "6cc1483v89yz1t8o" }

Response example

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

Open the door to record

API name

tuya.m.scale.history.list

API version

2.0

Request parameters

Name Type Description Optional?
devId String device ID No
dpIds Integer Data point No
offset Integer Start record number No
limit Integer Number of records per page No
startTime Integer start time No
endTime Integer end time No

Request example

{ "devId" : "6cc1483v89yz1t8o", "dpIds" : [1,2,3,4], "offset" : 0, "limit" : 50, "startTime" : '', "endTime" : '', }

Response example

{ "datas":[ { "devId":"7381641184f3eb715317", "dps":[ { "4":"0" } ], "avatar":"https://images.tuyacn.com/smart/user_res/avatar/scale/no_body_icon.png", "userName":"The tester", "unlockName":"Unlock mode name" "gmtCreate":1567079971000, "uuid":"156707000591403D659FAA1D8F951049B2001C9971000", "userId":"0", "tags":0, "status":1 } ], "hasNext":true, "totalCount":43 }

The alarm record

API name

tuya.m.device.lock.alarm.list

API version

1.0

Request parameters

Name Type Description Optional?
devId String device ID No
dpIds Integer DP code No
offset Integer Start record number No
limit Integer Number of records per pag No

Request example

{ "devId" : "6cc1483v89yz1t8o", "dpIds" : [1,2,3,4], "offset" : 0, "limit" : 50, }

Response example

{ "datas":[ { "devId":"7381641184f3eb715317", "dps":[ { "56":"1-2" } ], "avatar":"https://images.tuyacn.com/smart/user_res/avatar/scale/no_body_icon.png", "userName":"The tester", "gmtCreate":1567079971000, "uuid":"156707000591403D659FAA1D8F951049B2001C9971000", "userId":"0", "tags":0, "status":1 } ], "hasNext":true, "totalCount":43 }

Gets a list of online temporary passwords

API name

tuya.m.device.lock.temppwd.list

API version

2.0

Request parameters

Name Type Description Optional?
devId String device ID No

Request example

{ "devId" : "6cc1483v89yz1t8o", }

Returns the parameter

Name Type Description
name String Code name
effective Integer Password status 1. Pending 2. To be issued 3. In use 4. To be deleted 5
scheduleDetails String Timing data json format string password sequence number
phone String phone
effectiveTime Long effective time
invalidTime Long invalid time
availTime Integer Available times 0, permanent, 1, one-time
sn Integer Password number

Response example

{ "result": [{ "effective": 3, "effectiveTime": 111, "id": 11, "invalidTime": 333, "name": "name", "phone": "phone", "scheduleDetails": [{ // Returns the parameter new shcedule list "allDay": true, "effectiveTime": 720, "invalidTime": 1080, "workingDay": 8 // The week is represented by a byte, with bits 0 to 6 representing Sunday to Saturday }], "sn": 123 }], "t": 1550562572623, "success": true, "status": "ok" }

Add online temporary password list

API name

tuya.m.device.lock.temppwd.create

API version

4.0

Request parameters

Name Type Description Optional?
devId String device ID No
password String A temporary password No
schedule Integer Json format string for timing data Yes
phone String phone Yes
effectiveTime Long effective time No
invalidTime Long invalid time No
name String Code name No
availTime Integer Available times 0, permanent, 1, one-time No
countryCode Integer Password number Yes

Request example

{ "devId" : "vdevo158313195425051" "countryCode" : "86", "availTime" : 1, "invalidTime" : 1588133004, "name" : "Test 4.0", "effectiveTime" : 1588132904, "schedule":"", "phone" : "15158064461", "password" : "2E478FEBBDBE029F9B091FDC9E5CB8F9", }

schedule Parameter format instance
[{

"allDay": true, // Whether all day
"effectiveTime": 720, //effective time
"invalidTime": 1080, //invalid time
"workingDay":   // Week is expressed in a byte, bit0 ~ bit6 representing Sunday through Saturday

}, {

"allDay": true,
"effectiveTime": 720,
"invalidTime": 1080,
"workingDay": 3

}]
Response example

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

##Update the temporary code name
API name

tuya.m.device.lock.temppwd.name.update

API version

2.0

Request parameters

Name Type Description Optional?
devId String device ID No
pwdId Integer Unlock id Yes
name String name Yes

Request example

{ "devId" : "6cc1483v89yz1t8o", "pwdId" : 123123, "name" : 'tuya', }

Response example

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

Delete the online temporary password list

API name

tuya.m.device.lock.temppwd.del

API version

2.0

Request parameters

Name Type Description Optional?
devId String device ID No
id String Password serial number No

Request example

{ "devId" : "6cc1483v89yz1t8o", "id" : 2, }

Response example

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

Determines whether the password of the current type can continue to be retrieved

API name

tuya.m.device.lock.offlinepwd.available

API version

1.0

Request parameters

Name Type Description Optional?
devId String device ID No
pwdType String 0.Multiple password 1. Single password 8. Delete a single password 9. Clear the code No

Request example

{ "devId" : "002000015ccf7f0f3c7d" "pwdType" : "0" }

Response example

{ "result" : "false", "t" : 1565874044056, "success" : true, "status" : "ok" }

Add an offline temporary password

API name

tuya.m.device.lock.offlinepwd.get

API version

1.0

Request parameters

Name Type Description Optional?
devId String device ID No
pwdType String Password type 0. Multiple password 1. Single password 9. Clear code No
gmtStart Long Start time (not multiple password temporarily pass 0) No
gmtExpired Long End time (not multiple password temporarily pass 0) No
pwdName String Code name Yes
countryCode String country code Yes
mobile String mobile Yes

Request example

{ "devId" : "002000015ccf7f0f3c7d" "pwdType" : "1" "gmtStart" : "1568001081" "gmtExpired" : "1578001081" }

Response example

{ "result" : {pwd:"1234567890",pwdId: "3234"}, "t" : 1565874044056, "success" : true, "status" : "ok" }

Gets a list of offline temporary passwords

API name

tuya.m.device.lock.offlinepwd.list

API version

1.0

Request parameters

Name Type Description Optional?
devId String device ID No
pwdType String Password type 0. Multiple password 1. Single password 9. Clear code No
offset Integer Initial sequence number No
limit Integer The number of starts per request No

Request example

{ "devId" : "002000015ccf7f0f3c7d" "pwdType" : "1" }

Response example

{ "result" : [{ pwdId: 123123, pwdName: "Code name1", gmtStart:"1565874044", gmtExpired:"1575874044" status: 1, //Password status: 1. It has been issued and is in effect; 2. It has been issued successfully; 3 },{ pwdId: 23456, pwdName: "Code name2", gmtStart:"1565874044", gmtExpired:"1575874044" }], "t" : 1565874044056, "success" : true, "status" : "ok" }

Sets the name of an offline password

API name

tuya.m.device.lock.offlinepwd.bind

API version

1.0

Request parameters

Name Type Description Optional?
devId String device ID No
pwdId Integer Password number No
pwdName String Code name No
mobile String mobile No

Request example

{ "devId" : "6c67bdf59cc478a024yakz", "pwdId" : 15002, "pwdName" : "bind name", "mobile" : "13757150532" }

Response example

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

Get the delete password for an offline temporary password (multiple use only)

API name

tuya.m.device.lock.offlinepwd.revoke

API version

1.0

Request parameters

Name Type Description Optional?
devId String device ID No
pwdId Integer Password number No

Request example

{ "devId" : "002000015ccf7f0f3c7d" "pwdId" : "1" }

Response example

{ "result" : "1234567890", // Offline delete password "t" : 1565874044056, "success" : true, "status" : "ok" }

Offline delete password gets an allocatable password for an unlimited number of offline times

API name

tuya.m.device.lock.offlinepwd.revocable

API version

1.0

Request parameters

Name Type Description Optional?
devId String device ID No

Request example

{ "devId" : "002000015ccf7f0f3c7d" }

Response example

{ "result" : [{ pwdId: 012123123, pwdName: "Code name1", gmtStart:"1565874044", gmtExpired:"1575874044", },{ pwdId: 083232389, pwdName: "Code name2", gmtStart:"1565874044", gmtExpired:"1575874044" }], "t" : 1565874044056, "success" : true, "status" : "ok" }