Lock Password Service

Last Updated on : 2024-06-04 08:14:02download

This topic describes the commands for the door lock password service.

There are two protocols for requesting temporary passwords from the cloud, depending on whether password positional notation applies. Ensure you use the correct protocol to make a request.

Offline dynamic password (0x16)

A type of dynamic password that can be used even if a device is disconnected from the internet for long periods of time.

The MCU sends the following data.

Field Bytes Description
Header 2 0x55aa
Version 1 0x03
Command 1 0x16
Data length 2 7 + N
Data 7 + N Year(1) + mon(1) + day(1) + hour(1) + min(1) + sec(1) + code_len(1) + code(n), indicating the GMT, password length, and password content.
Checksum 1 Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder.

Example

  • An offline password: 1849455172
  • GMT: 08:18:42 on January 11, 2021
  • Example: 55 AA 00 16 00 11 15 01 0B 08 12 2A 0A 01 08 04 09 04 05 05 01 07 02 C3

The module returns the following data.

Field Bytes Description
Header 2 0x55aa
Version 1 0x00
Command 1 0x16
Data length 2 3 + N
Data 3 + N Result(1) + type(1) + decode_len(1) + decode(N)
  • Result: 0: correct password. Other values: error, no data returned.
  • type: 0: timed password. 1: one-time password. 2: clear password.
  • decode_len: data length after decoding.
  • decode: decoded data.
Checksum 1 Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder.

Request temporary password from the cloud (0x14)

  • To maximize power saving, when detecting multiple temporary passwords, the MCU then calls this interface to get password data for updating locally stored data.

    The module sends the MCU time data in GMT, so the MCU should sync its clock with the module through Getting GMT.

  • The server sends full temporary passwords to the device. The MCU updates locally stored data accordingly.

  • Users can set a weekly schedule based on the current validity period of a temporary password. Up to three schedules can be added.

The MCU sends the following data.

Field Bytes Description
Header 2 0x55aa
Version 1 0x03
Command 1 0x14
Data length 2 0x0000
Data 0 None
Checksum 1 Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder.

The door lock gets the currently valid temporary password:

55 aa 00 14 00 00 13

The module returns the following data.

Field Bytes Description
Header 2 0x55aa
Version 1 0x00
Command 1 0x14
Data length 2 0x0001+N (temporary password)
Data 1 + N
  • Data[0] indicates whether the password is obtained successfully.
    • 0 indicates a failure with a data length of one byte, and the data of password and valid time will not be transmitted in serial communication.
    • 1: success.
  • Data[1]: indicates the number of passwords, ranging from 0 to 10. 0 indicates no password is created on the app. The data of password and valid time will not be transmitted in serial communication. The number of passwords indicates the password data contained in the current packet.
  • Data[2]: indicates password length. The length of each password is consistent.
  • Data[3]: Bit 7 indicates whether there is a subsequent packet. Bit 6 to bit 0: indicates the sequence number of the current packet, starting from 0. The following is the data of the first password.
  • Data[4]: indicates the password ID, ranging from 1 to 50. To obtain the actual ID, add 900 to the password ID.
  • Data[5]: indicates the number of times a password can be used within the validity period. 0: Unlimited times. 1: One-time.
  • Data[6]: indicates the current status of a password. 0: The password is valid. 1: The password is invalid because it has been deleted from the app.
  • The start date in GMT of the validity period:
    • Data[7]: indicates the year. 0x00 indicates the year 2000.
    • Data[8]: indicates the month, ranging from 1 to 12.
    • Data[9]: indicates the day, ranging from 1 to 31.
    • Data[10]: indicates the hour, ranging from 0 to 23.
    • Data[11]: indicates the minute, ranging from 0 to 59.
    • Data[12]: indicates the second, ranging from 0 to 59.
  • The end date in GMT of the validity period:
    • Data[13]: indicates the year. 0x00 indicates the year 2000.
    • Data[14]: indicates the month, ranging from 1 to 12.
    • Data[15]: indicates the day, ranging from 1 to 31.
    • Data[16]: indicates the hour, ranging from 0 to 23.
    • Data[17]: indicates the minute, ranging from 0 to 59.
    • Data[18]: indicates the second, ranging from 0 to 59.
  • The temporary password (data length N = Data[2]), which is transferred in ASCII mode.
    • Data[19+N]: indicates the number of schedules. The following is the data of the first schedule.
    • Data[20+N]: 0 indicates the password is valid within the specified period of a day. 1 indicates the password is valid all day long. The data of start and end time is invalid.
    • Data[21+N]: the hour of the start time.
    • Data[22+N]: the minute of the start time.
    • Data[23+N]: the hour of the end time.
    • Data[24+N]: the minute of the end time.
    • Data[25+N]: weekly schedule.
      • Bit 0: Sunday
      • Bit 1: Monday
      • Bit 2: Tuesday
      • Bit 3: Wednesday
      • Bit 4: Thursday
      • Bit 5: Friday
      • Bit 6: Saturday
      If the schedule is set to run on every Sunday and Wednesday, the data is 0x09. Next is the data of the second schedule … The data of the second password … and so on.
Checksum 1 Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder.

Password positional notation (0x17)

The positional notation uses a set of consecutive digits to represent any real number. The positional notation adopted by the password is determined by two factors:

  • The base: indicates the number of unique digits that a positional notation system uses to represent numbers. Base-4 through base-10 are supported.

  • The starting value: indicates the number starts with zero or one.

    Number
    of digits
    Password starts
    with 0 or 1
    Dynamic
    password
    Offline
    password
    The min length
    of online password
    Security level Multilingual
    online password
    4 Optional Not supported Not supported 8 1/29W Password of 8 to 12 digits
    5 Optional Supported Not supported 8 1/39W Password of 8 to 12 digits
    6 Optional Supported Not supported 8 1/100W Password of 8 to 12 digits
    7 Optional Supported Supported 8 1/100W Password of 8 to 11 digits
    8 Optional Supported Supported 7 1/100W Password of 7 to 11 digits
    9 Optional Supported Supported 7 1/100W Password of 7 to 10 digits
    10 Not configurable Supported Supported 7 1/100W Password of 7 digits

The MCU sends the following data.

Field Bytes Description
Header 2 0x55aa
Version 1 0x03
Command 1 0x17
Data length 2 0x0002
Data 2 Data[0]: indicates the base number.
Data[1]: indicates the starting value.
Checksum 1 Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder.

Example

  • To adopt a set of consecutive digits 1 through 5, the base number is set to 5 and the starting value is set to 1.

  • To adopt a set of consecutive digits 0 through 5, the base number is set to 6 and the starting value is set to 0.

You must set the positional notation after the product information query (0x01) and before any password-related operation.

The module returns the following data.

Field Bytes Description
Header 2 0x55aa
Version 1 0x00
Command 1 0x17
Data length 2 0x0001
Data 1
  • 0: Success.
  • Other values: Failure.
Checksum 1 Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder.

Request temporary password from the cloud (0x14 with positional notation)

  • To maximize power saving, when detecting multiple temporary passwords, the MCU then calls this interface to get password data for updating locally stored data.

    The module sends the MCU time data in GMT, so the MCU should sync its clock with the module through Getting GMT.

  • The server sends full temporary passwords to the device. The MCU updates locally stored data accordingly.

  • Users can set a weekly schedule based on the current validity period of a temporary password. Up to three schedules can be added.

The MCU sends the following data.

Field Bytes Description
Header 2 0x55aa
Version 1 0x03
Command 1 0x14
Data length 2 0x0000
Data 0 None
Checksum 1 Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder.

The door lock gets the currently valid temporary password:

55 aa 00 14 00 00 13

The module returns the following data.

Field Bytes Description
Header 2 0x55aa
Version 1 0x00
Command 1 0x14
Data length 2 0x0001+N (temporary password)
Data 1 + N
  • Data[0] indicates whether the password is obtained successfully.
    • 0 indicates a failure with a data length of one byte, and the data of password and valid time will not be transmitted in serial communication.
    • 1: success.
  • Data[1]: indicates the number of passwords, ranging from 0 to 10. 0 indicates no password is created on the app. The data of password and valid time will not be transmitted in serial communication. The number of passwords indicates the password data contained in the current packet.
  • Data[2]: Bit 7 indicates whether there is a subsequent packet. Bit 6 to bit 0: indicates the sequence number of the current packet, starting from 0. The data of the first password, including length, ID, times of use, current status, start date, end date, number of schedules, and schedule data.
  • Data[3]: indicates password length. The length of each password is consistent.
  • Data[4]: indicates the password ID, ranging from 1 to 50. To obtain the actual ID, add 900 to the password ID.
  • Data[5]: indicates the number of times a password can be used within the validity period. 0: Unlimited times. 1: One-time.
  • Data[6]: indicates the current status of a password. 0: The password is valid. 1: The password is invalid because it has been deleted from the app.
  • The start date in GMT of the validity period:
    • Data[7]: indicates the year. 0x00 indicates the year 2000.
    • Data[8]: indicates the month, ranging from 1 to 12.
    • Data[9]: indicates the day, ranging from 1 to 31.
    • Data[10]: indicates the hour, ranging from 0 to 23.
    • Data[11]: indicates the minute, ranging from 0 to 59.
    • Data[12]: indicates the second, ranging from 0 to 59.
  • The end date in GMT of the validity period:
    • Data[13]: indicates the year. 0x00 indicates the year 2000.
    • Data[14]: indicates the month, ranging from 1 to 12.
    • Data[15]: indicates the day, ranging from 1 to 31.
    • Data[16]: indicates the hour, ranging from 0 to 23.
    • Data[17]: indicates the minute, ranging from 0 to 59.
    • Data[18]: indicates the second, ranging from 0 to 59.
  • The temporary password (data length N = Data[2]), which is transferred in ASCII mode.
    • Data[19+N]: indicates the number of schedules. The following is the data of the first schedule.
    • Data[20+N]: 0 indicates the password is valid within the specified period of a day. 1 indicates the password is valid all day long. The data of start and end time is invalid.
    • Data[21+N]: the hour of the start time.
    • Data[22+N]: the minute of the start time.
    • Data[23+N]: the hour of the end time.
    • Data[24+N]: the minute of the end time.
    • Data[25+N]: weekly schedule.
      • Bit 0: Sunday
      • Bit 1: Monday
      • Bit 2: Tuesday
      • Bit 3: Wednesday
      • Bit 4: Thursday
      • Bit 5: Friday
      • Bit 6: Saturday
      If the schedule is set to run on every Sunday and Wednesday, the data is 0x09. Next is the data of the second schedule … The data of the second password … and so on.
Checksum 1 Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder.