Methods, devices, storage media, and electronic devices for switching door lock states

By generating and verifying a local unlocking password using the device number and local key when the smart lock is not connected to the cloud platform, the problem of low security during offline lock state switching is solved, achieving higher security and dynamic password usage.

CN116580483BActive Publication Date: 2026-05-26QINGDAO HAIER TECH +2
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
QINGDAO HAIER TECH
Filing Date
2023-03-31
Publication Date
2026-05-26

Smart Images

  • Figure CN116580483B_ABST
    Figure CN116580483B_ABST
Patent Text Reader

Abstract

This application discloses a method, apparatus, storage medium, and electronic device for switching door lock states, relating to the field of smart home technology. The method for switching door lock states includes: when it is determined that there is no network connection between the smart lock and the cloud platform, responding to an unlocking operation of the smart lock by a target object, and obtaining a temporary unlocking password corresponding to the unlocking operation; generating a local unlocking password based on the unlocking time of the unlocking operation, the device number of the smart lock, and the device local key of the smart lock; verifying the temporary unlocking password using the local unlocking password, and determining whether to switch the door lock state of the smart lock based on the verification result. This technical solution solves the technical problem of how to switch the door lock state of an offline door lock to improve door lock security.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of smart home technology, and more specifically, to a method, apparatus, storage medium, and electronic device for switching door lock states. Background Technology

[0002] Currently, in the field of IoT home appliances, solutions for determining whether to switch door lock states based on temporary unlocking passwords can typically be implemented in the following ways:

[0003] 1. When a user unlocks the door using a temporary unlocking password, the user requests a password from the cloud using their mobile phone (the cloud can generate a new password for this door lock device). After the user enters the password obtained from the cloud into the door lock device, the door lock device connects to the cloud for password verification. If the device verifies that the password matches the password generated by the cloud, the door can be unlocked, and the door lock status is switched to open. 2. A batch of passwords are pre-set in the door lock device and also stored in the cloud. When the user unlocks the door using the temporary unlocking password function on their mobile phone, a password is randomly obtained from the cloud and sent to the user. After the user enters the password into the door lock device, if the device verifies that the password matches the pre-set password, the door can be unlocked, and the door lock status is switched to open.

[0004] However, all of the above solutions have technical flaws in practical applications: For Solution 1, since the lock device needs to be connected to the network for verification, the actual unlocking time depends on the device's network communication time, and frequent activation of network communication increases the probability of data leakage, resulting in lower security. Solution 2 allows the lock device to unlock without a network connection. Although this improves the security of the unlocking password compared to Solution 1, the password is pre-set and generally reused, making it impossible to destroy it after a single use, thus the security is still not high enough.

[0005] Therefore, in related technologies, there is a technical problem of how to switch the lock status of offline locks to improve lock security.

[0006] Regarding the technical problem of how to switch the lock status of offline locks to improve lock security, no effective solution has yet been proposed. Summary of the Invention

[0007] This application provides a method, apparatus, storage medium, and electronic device for switching door lock states, to at least solve the technical problem in the related art of how to switch the door lock state of an offline door lock to improve door lock security.

[0008] According to one embodiment of this application, a method for switching the state of a door lock is provided, comprising: when it is determined that there is no network connection between the smart door lock and the cloud platform, responding to an unlocking operation of the smart door lock by a target object, and obtaining a temporary unlocking password corresponding to the unlocking operation; generating a local unlocking password based on the unlocking time of the unlocking operation, the device number of the smart door lock and the device local key of the smart door lock; verifying the temporary unlocking password using the local unlocking password, and determining whether to switch the door lock state of the smart door lock based on the verification result.

[0009] In an exemplary embodiment, generating a local unlocking password based on the unlocking time of the unlocking operation, using the device number of the smart lock and the device local key of the smart lock, includes: obtaining a second-level timestamp corresponding to the unlocking time, and converting the second-level timestamp into an unlocking time field with a preset time interval; performing hash encryption on the unlocking time field, the device local key, and the device number of the smart lock using a hash algorithm to obtain a hash encryption result; and determining the hash encryption result as the local unlocking password.

[0010] In an exemplary embodiment, after generating a local unlocking password based on the device number of the smart lock and the device local key of the smart lock according to the unlocking time of the unlocking operation, the method further includes: grouping the password byte sequence corresponding to the local unlocking password according to a preset byte length to obtain multiple passwords, wherein the byte length of each of the multiple passwords is equal to the preset byte length; the step of responding to the unlocking operation of the target object on the smart lock and obtaining the temporary unlocking password corresponding to the unlocking operation includes: if it is determined that the target object performs at least two unlocking operations on the smart lock, obtaining the number of unlocking operations; if it is determined that the number of unlocking operations is not greater than the number of passwords in the multiple passwords, obtaining the temporary unlocking password corresponding to the unlocking operation.

[0011] In one exemplary embodiment, verifying the temporary unlocking password using the local unlocking password includes: obtaining the previous unlocking time field corresponding to the second-level timestamp; verifying the temporary unlocking password based on a first set of passwords corresponding to the unlocking time field and a second set of passwords corresponding to the previous unlocking time field, wherein the number of passwords contained in the first set of passwords is equal to the number of passwords contained in the second set of passwords.

[0012] In an exemplary embodiment, before verifying the temporary unlocking password based on the first set of passwords corresponding to the unlocking time field and the second set of passwords corresponding to the previous unlocking time field, the method further includes: determining a synchronization record of the smart lock synchronizing data with the cloud platform according to a preset period; obtaining the first device local key of the most recent synchronization and the first validity period of the first device local key from the synchronization record; and, if it is determined that the unlocking time indicated by the second-level timestamp belongs to the first validity period, generating the first set of passwords based on the unlocking time field, the first device local key, and the device number of the smart lock.

[0013] In an exemplary embodiment, before verifying the temporary unlocking password based on the first set of passwords corresponding to the unlocking time field and the second set of passwords corresponding to the previous unlocking time field, the method further includes: if it is determined that the unlocking time indicated by the second-level timestamp does not belong to the first validity period, obtaining a second device local key and a second validity period of the second device local key from the synchronization record, wherein the synchronization time of the second device local key is earlier than that of the first device local key; generating the second set of passwords based on the previous unlocking time field, the second device local key, and the device number of the smart lock.

[0014] In one exemplary embodiment, verifying the temporary unlocking password using the local unlocking password includes: verifying the temporary unlocking password using the first set of passwords to obtain a first verification result; and verifying the temporary unlocking password using the second set of passwords if the first verification result indicates a verification failure.

[0015] In an exemplary embodiment, determining whether to switch the lock state of the smart lock based on the verification result includes: if a second verification result indicating a verification failure is obtained by verifying the temporary unlocking password using the first set of passwords and the second set of passwords, then if the current lock state of the smart lock is determined to be open, then the lock state of the smart lock is determined to be switched to closed; if the current lock state of the smart lock is determined to be closed, then the lock state of the smart lock is determined not to be switched.

[0016] In an exemplary embodiment, determining whether to switch the lock state of the smart lock based on the verification result includes: if a second verification result indicating successful verification of the temporary unlocking password using the first set of passwords and the second set of passwords indicates successful verification, obtaining the target local unlocking password corresponding to the second verification result; obtaining a global unlocking time field preset for the second-level timestamp; and determining whether to switch the lock state of the smart lock based on the usage status of the target local unlocking password and the global unlocking time field.

[0017] In an exemplary embodiment, determining whether to switch the door lock state of the smart lock based on the usage status of the target local unlocking password and the global unlocking time field includes: if the unlocking time field corresponding to the second-level timestamp is consistent with the global unlocking time field, determining that the target local unlocking password belongs to the first group of passwords; obtaining the usage identifier corresponding to the target local unlocking password; if the usage identifier corresponding to the target local unlocking password indicates that the target local unlocking password has been used, determining that the verification result is a verification failure, and not switching the door lock state of the smart lock.

[0018] In an exemplary embodiment, determining whether to switch the door lock state of the smart lock based on the usage status of the target local unlocking password and the global unlocking time field includes: if it is determined that the unlocking time field corresponding to the second-level timestamp is inconsistent with the global unlocking time field, determining the next unlocking time field corresponding to the second-level timestamp; obtaining a first global unlocking variable corresponding to the unlocking time field and a second global unlocking variable corresponding to the next unlocking time field; updating the first global unlocking variable according to the second global unlocking variable; and after determining that the first global unlocking variable has been updated, determining that the verification result is successful, and switching the door lock state of the smart lock.

[0019] In an exemplary embodiment, updating the first global unlocking variable according to the second global unlocking variable includes: obtaining a first type of global unlocking variable and a second type of global unlocking variable included in the first global unlocking variable, wherein the first type of global unlocking variable includes a usage identifier of the first group of passwords, and the second type of global unlocking variable includes a usage identifier of the second group of passwords; obtaining a first type of global unlocking variable and a second type of global unlocking variable included in the second global variable, wherein the second type of global unlocking variable included in the second global variable includes a usage identifier of a third group of passwords corresponding to the next unlocking time field, wherein the number of passwords included in the third group of passwords is equal to the number of passwords included in the first group of passwords and the second group of passwords; updating the first type of global unlocking variable included in the first global unlocking variable to an intermediate global variable value, wherein the intermediate global variable value is equal to the variable value of the second type of global unlocking variable included in the second global variable, and the variable value represents the usage identifier of the local unlocking password; and resetting the first type of global unlocking variable included in the second global unlocking variable to an initial global variable value.

[0020] According to another embodiment of this application, a door lock state switching device is also provided, including: a cloud platform and a smart door lock, wherein the smart door lock is used to respond to an unlocking operation of a target object and obtain a temporary unlocking password corresponding to the unlocking operation when there is no network connection with the cloud platform; generate a local unlocking password based on the unlocking time of the unlocking operation, using the device number of the smart door lock and the device local key of the smart door lock; verify the temporary unlocking password using the local unlocking password, and determine whether to switch the door lock state of the smart door lock based on the verification result.

[0021] According to another aspect of the embodiments of this application, a computer-readable storage medium is also provided, wherein a computer program is stored in the computer-readable storage medium, and the computer program is configured to execute the above-described door lock state switching method when running.

[0022] According to another aspect of the embodiments of this application, an electronic device is also provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the above-described door lock state switching method through the computer program.

[0023] In this embodiment, when it is determined that there is no network connection between the smart lock and the cloud platform, in response to the target object's unlocking operation on the smart lock, a temporary unlocking password corresponding to the unlocking operation is obtained; based on the unlocking time of the unlocking operation, a local unlocking password is generated using the smart lock's device number and the smart lock's local device key; the temporary unlocking password is verified using the local unlocking password, and based on the verification result, it is determined whether to switch the smart lock's lock state; by adopting the above technical solution, the technical problem of how to switch the lock state of an offline lock to improve lock security is solved, thereby improving lock security. Attached Figure Description

[0024] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0025] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0026] Figure 1 This is a schematic diagram of the hardware environment for a door lock state switching method according to an embodiment of this application;

[0027] Figure 2 This is a flowchart of a door lock state switching method according to an embodiment of this application;

[0028] Figure 3 This is a flowchart (I) illustrating a door lock state switching method according to an embodiment of this application;

[0029] Figure 4 This is a flowchart (II) illustrating the door lock state switching method according to an embodiment of this application;

[0030] Figure 5 This is a schematic diagram illustrating the validity period of a temporary unlocking password according to an embodiment of this application;

[0031] Figure 6 This is a structural block diagram of a door lock state switching system according to an embodiment of this application. Detailed Implementation

[0032] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0033] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0034] According to one aspect of the embodiments of this application, a method for switching door lock states is provided. This door lock state switching method is widely applicable to whole-house intelligent digital control application scenarios such as smart homes, smart home ecosystems, and intelligence house ecosystems. Optionally, in this embodiment, the above-mentioned door lock state switching method can be applied to, for example... Figure 1 The hardware environment shown consists of terminal device 102 and server 104. For example... Figure 1 As shown, server 104 is connected to terminal device 102 via a network and can be used to provide services (such as application services) to the terminal or clients installed on the terminal. A database can be set up on the server or independently of the server to provide data storage services for server 104. Cloud computing and / or edge computing services can be configured on the server or independently of the server to provide data processing services for server 104.

[0035] The aforementioned network may include, but is not limited to, at least one of the following: wired network, wireless network. The aforementioned wired network may include, but is not limited to, at least one of the following: wide area network, metropolitan area network, local area network. The aforementioned wireless network may include, but is not limited to, at least one of the following: Wi-Fi (Wireless Fidelity), Bluetooth. The terminal device 102 may not be limited to PC, mobile phone, tablet computer, smart air conditioner, smart range hood, smart refrigerator, smart oven, smart stove, smart washing machine, smart water heater, smart washing equipment, smart dishwasher, smart projector, smart TV, smart clothes rack, smart curtains, smart audio-visual equipment, smart socket, smart speaker, smart speaker box, smart fresh air equipment, smart kitchen and bathroom equipment, smart bathroom equipment, smart robot vacuum cleaner, smart window cleaning robot, smart mopping robot, smart air purifier, smart steam oven, smart microwave oven, smart water heater, smart air purifier, smart water dispenser, smart door lock, etc.

[0036] This embodiment provides a method for switching door lock states, applied to the aforementioned terminal device. Figure 2 This is a flowchart of a door lock state switching method according to an embodiment of this application, which includes the following steps:

[0037] Step S202: If it is determined that there is no network connection between the smart lock and the cloud platform, respond to the unlocking operation of the target object on the smart lock and obtain the temporary unlocking password corresponding to the unlocking operation;

[0038] Step S204: Based on the unlocking time of the unlocking operation, a local unlocking password is generated using the device number of the smart lock and the device local key of the smart lock.

[0039] Step S206: Verify the temporary unlocking password using the local unlocking password, and determine whether to switch the door lock state of the smart door lock based on the verification result.

[0040] Through the above steps, when it is determined that there is no network connection between the smart lock and the cloud platform, the system responds to the unlocking operation of the target object on the smart lock and obtains the temporary unlocking password corresponding to the unlocking operation; based on the unlocking time of the unlocking operation, the device number of the smart lock and the device local key of the smart lock are used to generate a local unlocking password; the temporary unlocking password is verified using the local unlocking password, and the verification result is used to determine whether to switch the door lock state of the smart lock. This solves the technical problem in related technologies of how to switch the door lock state of an offline door lock to improve door lock security, thereby improving the security of the door lock.

[0041] In an exemplary embodiment, the technical solution for generating a local unlocking password based on the unlocking time of the unlocking operation, the device number of the smart lock, and the device local key of the smart lock in step S204 specifically includes: step S11, obtaining a second-level timestamp corresponding to the unlocking time, and converting the second-level timestamp into an unlocking time field with a preset time interval; step S12, using a hash algorithm to perform hash encryption on the unlocking time field, the device local key, and the device number of the smart lock to obtain a hash encryption result; and step S13, determining the hash encryption result as the local unlocking password.

[0042] Optionally, the device local key can also be periodically synchronized between the smart lock and the cloud platform. For example, the smart lock periodically synchronizes the generated device local key to the cloud platform, or the cloud platform periodically synchronizes the generated device local key to the smart lock. This application does not impose any restrictions on this.

[0043] Furthermore, in this embodiment, a random string with a preset number of characters can be concatenated with the hash encryption result to obtain a concatenated string; the string is then encrypted using the MD5 message digest algorithm; and the unlocking password generated for the target object is determined based on the encrypted result. In this embodiment, the aforementioned random string with a preset number of characters can be, for example, a "salt." This embodiment increases the complexity of the unlocking password by "adding salt" to the hash encryption result, making it more difficult to crack and thus improving the security of the unlocking password.

[0044] In an exemplary embodiment, further, after generating a local unlocking password based on the device number of the smart lock and the device local key of the smart lock according to the unlocking time of the unlocking operation, the following technical solution can be proposed: grouping the password byte sequence corresponding to the local unlocking password according to a preset byte length to obtain multiple passwords, wherein the byte length of each of the multiple passwords is equal to the preset byte length; the step of responding to the unlocking operation of the target object on the smart lock and obtaining the temporary unlocking password corresponding to the unlocking operation includes: if it is determined that the target object performs at least two unlocking operations on the smart lock, obtaining the number of unlocking operations; if it is determined that the number of unlocking operations is not greater than the number of passwords in the multiple passwords, obtaining the temporary unlocking password corresponding to the unlocking operation.

[0045] Optionally, if it is determined that the number of unlocking operations exceeds the number of multiple passwords, the acquisition of the temporary unlocking password corresponding to the unlocking operation is stopped, and a prompt message is sent to the target object. The prompt message is used to indicate that the number of unlocking operations exceeds the number of multiple passwords.

[0046] In an exemplary embodiment, the process of converting the second-level timestamp into an unlocking time field with a preset time interval is described by the following steps: obtaining the value when converting the preset time interval into a second-level unit; determining the quotient between the second-level timestamp and the value, wherein the time unit of the quotient is a second-level unit; and converting the time unit of the quotient into the preset time interval to obtain the unlocking time field.

[0047] The unlocking time field mentioned above is a positive integer.

[0048] It should be noted that, for example, if the preset time range is 10 minutes, then the formula for converting the second-level timestamp ts into an unlocking time field with a time interval of the preset time range can be: T10 = (ts / 600) * 600. Here, ts / 600 represents the quotient between the second-level timestamp and the value, (ts / 600) * 600 represents converting the time unit of the quotient into the time unit of the preset time range, and T10 is the aforementioned unlocking time field, with the preset time range being on the order of 10 minutes.

[0049] In one exemplary embodiment, a further technical solution is proposed to verify the temporary unlocking password using the local unlocking password, including: step S21, obtaining the previous unlocking time field corresponding to the second-level timestamp; step S22, verifying the temporary unlocking password based on the first set of passwords corresponding to the unlocking time field and the second set of passwords corresponding to the previous unlocking time field, wherein the number of passwords contained in the first set of passwords is equal to the number of passwords contained in the second set of passwords.

[0050] Based on the above embodiments, the formula for converting the second-level timestamp ts into an unlocking time field with a preset time interval can be, for example, as: T10' = (ts / 600-1)*600. Here, (ts / 600-1) represents the quotient between the second-level timestamp and the value, (ts / 600)*600 represents converting the time unit of the quotient into the time unit of the preset time interval, and T10' is the previous unlocking time field, with the preset time interval being on the order of 10 minutes.

[0051] During the verification of the temporary unlocking password using the first set of passwords corresponding to the unlocking time field and the second set of passwords corresponding to the previous unlocking time field, the verification is confirmed to be successful as long as any local unlocking password that successfully verifies the temporary unlocking password exists.

[0052] In an exemplary embodiment, before verifying the temporary unlocking password based on the first set of passwords corresponding to the unlocking time field and the second set of passwords corresponding to the previous unlocking time field, a synchronization record of the smart lock synchronizing data with the cloud platform according to a preset period can be determined; the first device local key of the most recent synchronization and the first validity period of the first device local key are obtained from the synchronization record; if it is determined that the unlocking time indicated by the second-level timestamp belongs to the first validity period, the first set of passwords is generated based on the unlocking time field, the first device local key, and the device number of the smart lock.

[0053] In an exemplary embodiment, before verifying the temporary unlocking password based on the first set of passwords corresponding to the unlocking time field and the second set of passwords corresponding to the previous unlocking time field, an execution scheme is further proposed. The specific steps are as follows: if it is determined that the unlocking time indicated by the second-level timestamp does not belong to the first validity period, the second device local key and the second validity period of the second device local key are obtained from the synchronization record, wherein the synchronization time of the second device local key is earlier than that of the first device local key; the second set of passwords is generated based on the previous unlocking time field, the second device local key, and the device number of the smart door lock.

[0054] In an exemplary embodiment, the technical solution of verifying the temporary unlocking password using the local unlocking password can be described by the following steps, specifically including: verifying the temporary unlocking password using the first set of passwords to obtain a first verification result; and verifying the temporary unlocking password using the second set of passwords when it is determined that the first verification result indicates a verification failure.

[0055] If the first verification result indicates that the verification was successful, then it is determined whether to switch the door lock status based on the first verification result.

[0056] In an exemplary embodiment, the method for determining whether to switch the lock state of the smart lock based on the verification result can be further described. Specific steps include: if a second verification result indicating a verification failure occurs when the first set of passwords and the second set of passwords are used to verify the temporary unlocking password, and if the current lock state of the smart lock is determined to be open, then the lock state of the smart lock is switched to closed; if the current lock state of the smart lock is determined to be closed, then the lock state of the smart lock is not switched.

[0057] In one exemplary embodiment, an alternative implementation scheme is proposed for determining whether to switch the lock state of the smart lock based on the verification result. Specifically, it includes: if a second verification result indicating successful verification is obtained when the verification of the temporary unlocking password using the first set of passwords and the second set of passwords is determined, obtaining the target local unlocking password corresponding to the second verification result; obtaining a global unlocking time field preset for the second-level timestamp; and determining whether to switch the lock state of the smart lock based on the usage status of the target local unlocking password and the global unlocking time field.

[0058] If the second verification result of verifying the temporary unlocking password using the first set of passwords and the second set of passwords indicates that the verification failed, it is determined not to switch the door lock state of the smart door lock.

[0059] In an exemplary embodiment, the process of determining whether to switch the door lock state of the smart lock based on the usage status of the target local unlocking password and the global unlocking time field can be described by the following scheme: Scheme 1 includes: Step S31, if it is determined that the unlocking time field corresponding to the second-level timestamp is consistent with the global unlocking time field, determine that the target local unlocking password belongs to the first group of passwords; Step S32, obtain the usage identifier corresponding to the target local unlocking password; Step S33, if it is determined that the usage identifier corresponding to the target local unlocking password indicates that the target local unlocking password has been used, determine that the verification result is a verification failure, and do not switch the door lock state of the smart lock.

[0060] In an exemplary embodiment, Scheme 2 includes: Step S41, determining the next unlocking time field corresponding to the second-level timestamp when the unlocking time field corresponding to the second-level timestamp is inconsistent with the global unlocking time field; Step S42, obtaining the first global unlocking variable corresponding to the unlocking time field and the second global unlocking variable corresponding to the next unlocking time field; Step S43, updating the first global unlocking variable according to the second global unlocking variable; Step S44, after determining that the first global unlocking variable has been updated, determining that the verification result is successful, and switching the door lock state of the smart door lock.

[0061] It should be noted that the two globally maintained bit variables contain the usage identifier corresponding to the local unlocking password. Each bit of bit variable 1 is the usage identifier corresponding to the local unlocking password, indicating whether the first set of passwords in the unlocking time field has been used; each bit of bit variable 2 indicates whether the second set of passwords in the previous unlocking time field has been used.

[0062] Optionally, in step S44 above, if it is determined that the first global unlocking variable has been updated and the verification result is successful, during the process of switching the door lock state of the smart door lock, if it is determined that the current door lock state of the smart door lock is open, then it is determined to switch the door lock state of the smart door lock to closed; if it is determined that the current door lock state of the smart door lock is closed, then it is determined not to switch the door lock state of the smart door lock.

[0063] In an exemplary embodiment, the process of updating the first global unlocking variable according to the second global unlocking variable is further described, and the specific steps include: obtaining a first type of global unlocking variable and a second type of global unlocking variable contained in the first global unlocking variable, wherein the first type of global unlocking variable includes a usage identifier of the first group of passwords, and the second type of global unlocking variable includes a usage identifier of the second group of passwords; obtaining a first type of global unlocking variable and a second type of global unlocking variable contained in the second global variable, wherein the second type of global unlocking variable contained in the second global variable includes a usage identifier of a third group of passwords corresponding to the next unlocking time field, wherein the number of passwords contained in the third group of passwords is equal to the number of passwords contained in the first group of passwords and the second group of passwords; updating the first type of global unlocking variable contained in the first global unlocking variable to an intermediate global variable value, wherein the intermediate global variable value is equal to the variable value of the second type of global unlocking variable contained in the second global variable, and the variable value represents the usage identifier of the local unlocking password; and resetting the first type of global unlocking variable contained in the second global unlocking variable to an initial global variable value.

[0064] In one exemplary embodiment, after resetting the first type of global unlocking variables included in the second global unlocking variable to the initial global variable value, a target unlocking variable value can also be obtained from the initial global variable value, wherein the target unlocking variable value is used to represent the target usage identifier of the target local unlocking password; if it is determined that the target usage identifier of the target local unlocking password is used to indicate that the target local unlocking password is not used, the target unlocking variable value is modified so that the target usage identifier represented by the modified target variable value indicates that the target local unlocking password has been used.

[0065] In one exemplary embodiment, after updating the first global unlock variable according to the second global unlock variable, the field value of the unlock time field can be further updated to the field value of the next unlock time field.

[0066] To better understand the process of the above-mentioned door lock state switching method, the implementation flow of the above-mentioned door lock state switching method will be described below in conjunction with optional embodiments, but it is not intended to limit the technical solution of the embodiments of this application.

[0067] The meanings of the various entities involved in the technical solution of this application are as follows:

[0068] [Owner]: The owner of the door lock can obtain a one-time temporary password (i.e., the temporary unlocking password mentioned above) through a mobile phone communication software;

[0069] [Visitor]: Visitors to the host's home need to unlock the door using a one-time temporary password provided by the host (e.g., nanny, relatives, etc.);

[0070] [Door Lock Details Page]: This is the door lock function page on the mobile app, where the owner also obtains a one-time temporary password.

[0071] [Password Service Center]: This is a cloud platform used to provide services for applying for and managing one-time temporary passwords.

[0072]

WIFI Module

[0073] [Door Lock Body]: This refers to the device program used by smart door locks to perform the lock's own functions (such as unlocking).

[0074] The WIFI module (i.e., wireless module) and the door lock body work together to realize the function of smart door lock.

[0075] This embodiment provides a method for determining the unlocking result. Figure 3 This is a flowchart (I) illustrating the method for determining the unlocking result according to an embodiment of this application, as follows: Figure 3 As shown, the specific steps are as follows:

[0076] Step 1: The user obtains a one-time temporary password;

[0077] Step 2: The visitor enters the one-time temporary password sent by the user into the smart lock and unlocks it.

[0078] Specifically, step 1 includes the following steps:

[0079] Step S301: The user obtains a one-time temporary password using their mobile phone;

[0080] Step S302: Obtain a one-time temporary password from the cloud platform;

[0081] Step S303: The cloud platform generates a one-time temporary password and saves the retrieval record (the saved record is only used to query the password retrieval record and the password itself is not saved);

[0082] Step S304: The cloud platform returns a one-time temporary password to the user;

[0083] Step S305: Upon successful return, display the one-time temporary password and its expiration date to the user on the mobile phone;

[0084] Step S306: If the return fails, prompt the user to try again within the next 10 minutes;

[0085] Step S307: The user informs the visitor of a one-time temporary password via SMS or telephone;

[0086] Specifically, step 2 includes the following steps:

[0087] Step S308: The visitor enters a one-time temporary password into the door lock body;

[0088] Step S309: The door lock body wakes up the WIFI module;

[0089] Step S3010: Verify the one-time temporary password by the door lock body;

[0090] Step S3011: The door lock body calculates and verifies the one-time temporary password locally;

[0091] Step S3012: If verification fails, return an error directly; if verification succeeds, check if the password has been used. If this is the first time the password has been verified, return success and mark the password as used; if the password has been used, return failure.

[0092] Step S3013: Return the verification result;

[0093] Step S3014: If the verification is successful, unlock the door and alert the visitor.

[0094] Through the above steps, a one-time temporary password can be dynamically generated, and the user can use the obtained one-time temporary password to unlock the door even when the device is offline. Furthermore, since the one-time temporary password is different for each application and expires after one use, the security of the door lock unlocking result is improved.

[0095] In one embodiment, the generation algorithm and verification algorithm of the one-time temporary password (i.e., temporary unlocking password) mentioned in the above flowchart are further described.

[0096] In this embodiment, the one-time temporary password is described, specifically including:

[0097] Step S51: The one-time temporary password is valid from the current time to the next full 10 minutes. For example, if the current time is 16:43, the obtained password is valid from 16:43 to 17:00.

[0098] Step S52: Each time a request to obtain a one-time temporary password is received, the newly generated password is returned. For example, only 8 passwords are allowed to be obtained within each full 10-minute period; for example, at any time between 16:40 and 16:50 (excluding 16:50), a maximum of 8 passwords can be obtained.

[0099] Step S53: A one-time temporary password is generated based on the current time (valid for 10-20 minutes). It is invalidated after each successful verification, meaning each password can only be used successfully once.

[0100] Step S54: The verification time range of the one-time temporary password does not include the minute of the expiration date. For example, if the validity period of a password is 11:43 to 12:00 (excluding 12:00), then the password cannot be used to open the door after 12:00. Please refer to Table 1 for details.

[0101] Table 1. Schedule for One-Time Temporary Password Verification

[0102]

[0103]

[0104] For example, in Table 1, for a password generation time of 12:23, the password verification time is from 12:23 to 12:39 (i.e., the above validity period).

[0105] In step S55, both the smart lock and the cloud platform require a time parameter for password generation. If the smart lock and the cloud platform are not synchronized, the unlocking password saved by the smart lock may differ from the temporary unlocking password generated by the cloud platform. Therefore, the smart lock and the cloud platform need to synchronize their time to ensure that they generate the same password.

[0106] Next, the key parameters for generating a one-time temporary password will be explained in conjunction with step S56.

[0107] Step S56, key parameters for generating a one-time temporary password:

[0108] Parameter 1 (Identification Factor): Device ID (i.e., the device number of the smart lock), a publicly disclosed unique identifier for the device, which is different for each device and is embedded in the device program;

[0109] Parameter 2 (Key Factor): Device localkey (i.e., device local key), a confidential and periodically updated device key. The process for obtaining and updating the device localkey will be introduced later.

[0110] Parameter 3 (Dynamic Factor): Time (10-minute level), which is the dynamic value of the unlocking time field mentioned above, which changes continuously as time progresses;

[0111] Other parameters: salt, which represents a specific string. Inserting a specific string at any fixed position in the generated password can make the hash result different from the hash result using the original password, making the password more random and harder to crack.

[0112] In this embodiment, the process of generating a one-time temporary password is described, and the specific steps include:

[0113] Step S61: The owner obtains a one-time temporary password from the cloud platform - password service center (i.e., the cloud platform) via mobile phone;

[0114] Step S62: The cloud platform-password service center calculates the corresponding 10-minute time based on the current second-level timestamp ts (timespan, i.e., the unlocking time mentioned above). The calculation formula is: 10-minute time T10 = (ts / 600) * 600; where T10 is the unlocking time field mentioned above.

[0115] The cloud platform-cryptography service center uses (device ID, device localkey, time (10-minute time T10), salt) to perform SHA256 to generate a 32-byte password sequence (i.e., the password byte sequence mentioned above);

[0116] In step S63, the cloud platform-password service center splits the 32-byte password sequence into 8 groups of 4 bytes each (i.e., the preset byte length mentioned above) and generates 8 returnable one-time temporary password strings; see steps S63.1 to S63.3 for specific splitting rules.

[0117] Step S63.1: If a 6-digit password is to be generated, convert each password group (4 bytes) into an unsigned integer, and extract the last (lowest) 6 digits as a one-time temporary password (padded with 0s on the left, for example, 1000002, the final password is 000002);

[0118] Step S63.2: If you want to generate an 8-bit numeric password, convert each password (4 bytes) into an unsigned integer, and extract the last (lowest) 8 digits as a one-time temporary password (padded with 0s on the left, for example, 1000002, the final password is 01000002);

[0119] Step S63.3: Whether to use a 6-digit or 8-digit password can be agreed upon by the door lock and the door lock details page.

[0120] In step S64, the cloud platform-password service center selects the corresponding password from these 8 one-time temporary passwords and returns it to the mobile phone within 10 minutes, according to the order in which they were obtained.

[0121] The specific return steps include:

[0122] The first time you retrieve the password, it returns the first password.

[0123] The second retrieval returns the second password;

[0124] Repeat the process until the eighth password is obtained, then return the eighth password.

[0125] For the Jth attempt, where J > 8 and j is a positive integer, a message indicating that the current attempt has exceeded the limit will be returned, prompting the user that "the limit for one-time temporary passwords obtained within the current 10 minutes has been exceeded. Please try again in the next 10 minutes (16:40-16:50)".

[0126] Step S65: After successfully obtaining the one-time temporary password, the obtained password and its validity period are displayed to the owner.

[0127] In this embodiment, the verification process of a one-time temporary password is described, and the specific process includes:

[0128] Step S71: The visitor enters a password through the door lock, and the door lock body verifies the password through the WIFI module.

[0129] Step S72: The WIFI module calculates the current 10-minute time based on the current second-level timestamp ts. The calculation formula is: 10-minute time T10 = (ts / 600) * 600;

[0130] Step S73: The WIFI module uses (device ID, device localkey, time (10-minute time T10), salt) to perform SHA256 (i.e., use a hash algorithm for encryption) to generate a 32-byte password sequence (the same as the generation algorithm).

[0131] In step S74, the WIFI module splits the 32-byte password sequence into 8 groups of 4 bytes each, generating 8 one-time temporary password strings for verification (i.e., the first group of passwords); the splitting rules are shown in steps S74.1 to S74.2.

[0132] Step S74.1, if the door lock is implemented according to a 6-digit numeric password: convert each password (4 bytes) into an unsigned integer, and extract the last (lowest) 6 digits as a one-time temporary password (padded with 0s on the left, for example, 1000002, the final password is 000002);

[0133] Step S74.2, if the door lock is implemented according to an 8-bit numeric password: convert each password (4 bytes) into an unsigned integer, and extract the last (lowest) 8 digits as a one-time temporary password (padded with 0s on the left, for example, 1000002, the final password is 01000002).

[0134] Furthermore, this embodiment also includes the process of saving T10 and resetting the bit variable corresponding to T10, the implementation process of which is as follows:

[0135] Step S81: The WIFI module calculates the previous 10-minute time (i.e., the previous unlock time field) based on the current second-level timestamp ts. The calculation formula is: 10-minute time T10' = ((ts / 600) - 1) * 600. Then, the 8 passwords (i.e. the second set of passwords) corresponding to the previous 10-minute time T10' are calculated according to steps 3 and 4.

[0136] In step S82, the WIFI module compares the password entered by the user with the 16 passwords generated above (8 calculated by T10 and 8 calculated by T10').

[0137] Step S82.1: If none of the 16 passwords match, the verification is deemed to have failed.

[0138] In step S82.2, if any password is successfully matched, then determine and mark whether the password has been used.

[0139] Specifically, in step S82.2.1, the WIFI module globally maintains two 8-bit bit variables (both with an initial value of 00000000). Each bit of bit variable 1 (i.e., the first type of global unlocking variable included in the first global unlocking variable mentioned above) indicates whether the 8 passwords have been used within the current 10 minutes T10, with 0 indicating unused and 1 indicating used; for example, the current value of bit variable 1 is 01000101, which means that among the 8 passwords in the current 10 minutes, the 2nd / 6th / 8th passwords have been used, and the 1st / 3rd / 4th / 5th / 7th passwords have not been used;

[0140] In this context, each bit of bit variable 2 (i.e., the second type of global unlocking variable included in the first global unlocking variable mentioned above) indicates whether the 8 passwords have been used within the previous 10 minutes T10'. Similarly, 0 indicates that they have not been used, and 1 indicates that they have been used. For an example of bit variable 2, please refer to bit variable 1.

[0141] Step S82.2.2: The WIFI module maintains a global 10-minute time gT10 (i.e., the global unlock time field, with an initial value of 0);

[0142] Step S82.2.3: The WIFI module determines whether the currently calculated time has entered the next 10 minutes (i.e., the next unlock time field).

[0143] 1) If the calculated current 10-minute time T10 differs from the globally maintained 10-minute time gT10, then it is determined to enter the next 10-minute period, and the variable update process for the next 10-minute period is executed:

[0144] Update the value of bit variable 2 (the second type of global unlocking variable included in the second global unlocking variable mentioned above) corresponding to the next 10 minutes to bit variable 1 of the current 10 minutes; reset bit variable 1 (the first type of global unlocking variable included in the second global unlocking variable mentioned above) corresponding to the next 10 minutes to 00000000 (indicating that it is not used, i.e., the first type of global unlocking variable included in the second global unlocking variable mentioned above), set the value of gT10 to T10; set the position corresponding to the currently successfully matched password in bit variable 1 to 1, and determine that the verification is successful.

[0145] 2) If the calculated current 10-minute time T10 is the same as the globally maintained gT10, then it is still within the current 10 minutes and will not enter the next 10 minutes. Then it will determine whether the position of the password corresponding to the successfully matched password is 0: if it is 0, then the bit variable of the password corresponding to the successfully matched password will be set to 1, and it will be determined as a successful verification; if it is 1, then it will be determined as a failed verification.

[0146] Step S83: Send the verification result of the WIFI module to the door lock body.

[0147] Specifically, at least two device localkeys corresponding to the current 10-minute time T10 need to be determined, and after the one-time temporary passwords generated based on the two device localkeys are verified, the verification result is returned to the door lock body.

[0148] In step S84, if the door lock body receives a successful verification response from the WIFI module, it will unlock. If the verification fails, the user will be prompted with "Incorrect password, please re-enter".

[0149] In other embodiments of this invention, combined with Figure 4 Further implementation schemes for obtaining and updating device localkeys are provided, such as... Figure 4 As shown, Figure 4 This is a flowchart (II) illustrating the method for determining the unlocking result according to an embodiment of this application. The specific steps are as follows:

[0150] Step S401: Confirm that the WIFI module has previously connected to the cloud platform;

[0151] Step S402: Obtain the localkey (get LK1);

[0152] Step S403: Save LK1 (Flash save);

[0153] Step S404: Power off the WIFI module;

[0154] Step S405: Confirm that the door lock body has entered sleep mode;

[0155] Step S406: The user obtains a temporary one-time password TmpPwd1 (generated based on LK1);

[0156] Step S407: Confirm that the user has activated the door lock by pressing a button;

[0157] Step S408: Power on the WIFI module;

[0158] Step S409: Connect to the cloud platform;

[0159] Step S4010: Obtain the localkey (if more than 8 hours have passed since LK1 was obtained, obtain LK2);

[0160] Step S4011: Change the currently effective localkey to LK2 (save in Flash);

[0161] Step S4012: Continue to save the historical localkey separately using LK1 (Flash save);

[0162] Step S4013: Enter TmpPwd1;

[0163] Step S4014: One-time temporary password verification;

[0164] Step S4015: Verify using LK2 (the currently active localkey);

[0165] Step S4016: Upon confirming successful verification using LK2, return a verification success message;

[0166] Step S4017: When it is determined that the verification using LK2 has failed, determine whether LK1 was obtained within 20 minutes;

[0167] Step S4018: If the time of obtaining LK1 is not within 20 minutes after obtaining LK2, then return verification failure;

[0168] Step S4019: If LK1 is acquired within 20 minutes of LK2 being acquired, then LK1 is used for verification.

[0169] Step S4020: If LK1 verification is successful, return a verification success message;

[0170] Step S4021: If verification using LK1 fails, return a verification failure message.

[0171] Based on the above steps, for example, the Wi-Fi module periodically (perhaps every 2 hours) obtains the device localkey from the cloud platform, or obtains the device localkey from the cloud platform each time it randomly connects. The cloud platform determines the time since the device last obtained a new value. If it is within 8 hours, it directly returns the previously obtained localkey; if it is more than 8 hours, the cloud platform generates and returns a new localkey. To avoid the Wi-Fi module's localkey update (every 8 hours) rendering previously obtained one-time temporary passwords unusable, the Wi-Fi module needs to save the most recent localkey for a period of time for one-time temporary password verification.

[0172] Furthermore, in one embodiment, the latest localkey (e.g., LK2 in the above figure) can be used for verification; if the verification of the latest localkey fails, the most recent localkey (e.g., LK1 in the above figure) can be used for verification.

[0173] Additionally, two global bit variables need to be maintained for the most recent localkey to indicate whether the 16 passwords calculated based on the localkey are already in use. If the global 10-minute time interval gT10 is used to determine that the next 10 minutes have passed, the processing logic for the two global bit variables is the same as for the latest localkey, as detailed in steps S81 to S84.

[0174] After entering the next 10 minutes, the variable update process for the next 10 minutes is then executed: the value of bit variable 2 corresponding to the next 10 minutes is updated to bit variable 1 of the current 10 minutes; bit variable 1 corresponding to the next 10 minutes is reset to 00000000 (indicating that it is not used), the value of gT10 is set to T10; and the position corresponding to the currently successfully matched password in bit variable 1 is set to 1.

[0175] Furthermore, in one embodiment, it can also be combined with Figure 5 The validity period of the temporary unlocking password in the above embodiments is explained as follows: Figure 5 As shown, for a generation cycle corresponding to the 10-minute time period "12:40-12:50", its validity period (i.e. Figure 5 The effective time is "12:40-13:00", excluding the time "13:00".

[0176] Based on the above embodiments, for example, in scenarios where the homeowner is not home but visitors are present, the following solution can be implemented:

[0177] 1. A visitor arrived at 12:43 on March 28, 2023. The homeowner was not home. The visitor called the homeowner, who obtained a one-time temporary password via mobile phone (valid from 12:43 to 13:00) and sent it to the visitor via WeChat. The visitor entered the one-time temporary password into the door lock within the password's validity period (12:43 to 13:00). If the verification was successful, the door lock opened, and the visitor entered.

[0178] 2. Subsequently, if a visitor accidentally leaks the one-time temporary password (including leaking the password within its validity period), and it is obtained by someone else, the door lock will not be able to be opened even if the other person enters the password, since the one-time temporary password can only be used once.

[0179] 3. Since the one-time temporary password verification of the door lock is performed entirely on the local machine and there is no network interaction with external parties such as the cloud, visitors can unlock the door in seconds after entering the one-time temporary password.

[0180] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods of the various embodiments of this application.

[0181] Figure 6 This is a structural block diagram of a door lock state switching system according to an embodiment of this application; as shown... Figure 6 As shown, it includes: a cloud platform 62 and a smart lock 64, wherein the smart lock 64 is used to respond to the unlocking operation of a target object when there is no network connection with the cloud platform, and obtain a temporary unlocking password corresponding to the unlocking operation; generate a local unlocking password based on the unlocking time of the unlocking operation, the device number of the smart lock and the device local key of the smart lock; verify the temporary unlocking password using the local unlocking password, and determine whether to switch the lock state of the smart lock based on the verification result.

[0182] The system described above, when it is determined that there is no network connection between the smart lock and the cloud platform, responds to the unlocking operation of the target object on the smart lock and obtains the temporary unlocking password corresponding to the unlocking operation; based on the unlocking time of the unlocking operation, a local unlocking password is generated using the device number and local key of the smart lock; the temporary unlocking password is verified using the local unlocking password, and the verification result is used to determine whether to switch the lock state of the smart lock. This solves the technical problem in related technologies of how to switch the lock state of an offline lock to improve lock security, thereby improving the security of the lock.

[0183] In an exemplary embodiment, the smart lock 64 is further configured to perform the following steps: Step S11, obtaining a second-level timestamp corresponding to the unlocking time, and converting the second-level timestamp into an unlocking time field with a preset time interval; Step S12, using a hash algorithm to perform hash encryption on the unlocking time field, the device local key, and the device number of the smart lock to obtain a hash encryption result; Step S13, determining the hash encryption result as the local unlocking password.

[0184] In an exemplary embodiment, the smart lock 64 is further configured to: group the password byte sequence corresponding to the local unlocking password according to a preset byte length to obtain multiple passwords, wherein the byte length of each of the multiple passwords is equal to the preset byte length; and to obtain a temporary unlocking password corresponding to the unlocking operation in response to the unlocking operation of the target object, including: obtaining the number of unlocking operations when it is determined that the target object performs at least two unlocking operations on the smart lock; and obtaining a temporary unlocking password corresponding to the unlocking operation when it is determined that the number of unlocking operations is not greater than the number of passwords in the multiple passwords.

[0185] In an exemplary embodiment, the smart door lock 64 is further configured to: obtain a value when the preset time unit is converted into a second unit, determine the quotient between the second-level timestamp and the value, wherein the time unit of the quotient is a second unit; convert the time unit of the quotient into the preset time unit to obtain the unlocking time field.

[0186] In an exemplary embodiment, the smart lock 64 is further configured to perform the following steps: step S21, obtaining the previous unlocking time field corresponding to the second-level timestamp; step S22, verifying the temporary unlocking password based on the first set of passwords corresponding to the unlocking time field and the second set of passwords corresponding to the previous unlocking time field, wherein the number of passwords contained in the first set of passwords is equal to the number of passwords contained in the second set of passwords.

[0187] In an exemplary embodiment, before verifying the temporary unlocking password based on the first set of passwords corresponding to the unlocking time field and the second set of passwords corresponding to the previous unlocking time field, the smart lock 64 is further configured to: determine the synchronization record of the smart lock synchronizing data with the cloud platform according to a preset period; obtain the first device local key of the most recent synchronization and the first validity period of the first device local key from the synchronization record; and, if it is determined that the unlocking time indicated by the second-level timestamp belongs to the first validity period, generate the first set of passwords based on the unlocking time field, the first device local key, and the device number of the smart lock.

[0188] In an exemplary embodiment, before verifying the temporary unlocking password based on the first set of passwords corresponding to the unlocking time field and the second set of passwords corresponding to the previous unlocking time field, the smart lock 64 is further configured to: if it is determined that the unlocking time indicated by the second-level timestamp does not belong to the first validity period, obtain the second device local key and the second validity period of the second device local key from the synchronization record, wherein the synchronization time of the second device local key is earlier than that of the first device local key; generate the second set of passwords based on the previous unlocking time field, the second device local key, and the device number of the smart lock.

[0189] In an exemplary embodiment, the smart lock 64 is further configured to: verify the temporary unlocking password using the first set of passwords to obtain a first verification result; and, if it is determined that the first verification result indicates a verification failure, verify the temporary unlocking password using the second set of passwords.

[0190] In an exemplary embodiment, the smart lock 64 is further configured to: if a second verification result indicating that the verification of the temporary unlocking password using the first set of passwords and the second set of passwords has failed is determined, if the current lock state of the smart lock is determined to be open, then determine to switch the lock state of the smart lock to closed; if the current lock state of the smart lock is determined to be closed, then determine not to switch the lock state of the smart lock.

[0191] In an exemplary embodiment, the smart lock 64 is further configured to, when determining that a second verification result indicating successful verification of the temporary unlocking password using the first set of passwords and the second set of passwords indicates successful verification, obtain the target local unlocking password corresponding to the second verification result; obtain a global unlocking time field preset for the second-level timestamp; and determine whether to switch the lock state of the smart lock based on the usage status of the target local unlocking password and the global unlocking time field.

[0192] In an exemplary embodiment, the smart door lock 64 is further configured to execute the following scheme: Scheme 1, including: step S31, determining that the target local unlocking password belongs to the first group of passwords when the unlocking time field corresponding to the second-level timestamp is consistent with the global unlocking time field; step S32, obtaining the usage identifier corresponding to the target local unlocking password; step S33, determining that the verification result of the verification is a verification failure when the usage identifier corresponding to the target local unlocking password indicates that the target local unlocking password has been used, and not switching the door lock state of the smart door lock.

[0193] Solution 2 includes: Step S41, if the unlocking time field corresponding to the second-level timestamp is inconsistent with the global unlocking time field, determine the next unlocking time field corresponding to the second-level timestamp; Step S42, obtain the first global unlocking variable corresponding to the unlocking time field and the second global unlocking variable corresponding to the next unlocking time field; Step S43, update the first global unlocking variable according to the second global unlocking variable; Step S44, after the first global unlocking variable is updated, determine that the verification result is successful, and switch the door lock state of the smart door lock.

[0194] In an exemplary embodiment, the smart lock 64 is further configured to: obtain a first type of global unlocking variable and a second type of global unlocking variable included in the first global unlocking variable, wherein the first type of global unlocking variable includes a usage identifier of the first set of passwords, and the second type of global unlocking variable includes a usage identifier of the second set of passwords; obtain a first type of global unlocking variable and a second type of global unlocking variable included in the second global variable, wherein the second type of global unlocking variable included in the second global variable includes a usage identifier of a third set of passwords corresponding to the next unlocking time field, wherein the number of passwords included in the third set of passwords is equal to the number of passwords included in the first set of passwords and the second set of passwords; update the first type of global unlocking variable included in the first global unlocking variable to an intermediate global variable value, wherein the intermediate global variable value is equal to the variable value of the second type of global unlocking variable included in the second global variable, and the variable value represents the usage identifier of the local unlocking password; and reset the first type of global unlocking variable included in the second global unlocking variable to an initial global variable value.

[0195] In an exemplary embodiment, after resetting the first type of global unlocking variables included in the second global unlocking variable to the initial global variable value, the smart lock 64 is further configured to obtain a target unlocking variable value from the initial global variable value, wherein the target unlocking variable value is used to represent the target usage identifier of the target local unlocking password; if it is determined that the target usage identifier of the target local unlocking password is used to indicate that the target local unlocking password is not used, the target unlocking variable value is modified so that the target usage identifier represented by the modified target variable value indicates that the target local unlocking password has been used.

[0196] In an exemplary embodiment, the smart lock 64 is further configured to update the field value of the unlocking time field to the field value of the next unlocking time field after updating the first global unlocking variable according to the second global unlocking variable.

[0197] Embodiments of this application also provide a storage medium including a stored program, wherein the program executes any of the methods described above when it is run.

[0198] Optionally, in this embodiment, the storage medium may be configured to store program code for performing the following steps:

[0199] S1, if it is determined that there is no network connection between the smart lock and the cloud platform, respond to the unlocking operation of the target object on the smart lock and obtain the temporary unlocking password corresponding to the unlocking operation;

[0200] S2, Based on the unlocking time of the unlocking operation, the device number of the smart door lock and the device local key of the smart door lock are used to generate a local unlocking password;

[0201] S3, use the local unlocking password to verify the temporary unlocking password, and determine whether to switch the door lock state of the smart door lock based on the verification result.

[0202] Embodiments of this application also provide an electronic device including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.

[0203] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.

[0204] Optionally, in this embodiment, the processor can be configured to perform the following steps via a computer program:

[0205] S1, if it is determined that there is no network connection between the smart lock and the cloud platform, respond to the unlocking operation of the target object on the smart lock and obtain the temporary unlocking password corresponding to the unlocking operation;

[0206] S2, Based on the unlocking time of the unlocking operation, the device number of the smart door lock and the device local key of the smart door lock are used to generate a local unlocking password;

[0207] S3, use the local unlocking password to verify the temporary unlocking password, and determine whether to switch the door lock state of the smart door lock based on the verification result.

[0208] Optionally, in this embodiment, the storage medium may include, but is not limited to, various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.

[0209] Optionally, specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementations, and will not be repeated here.

[0210] Obviously, those skilled in the art should understand that the modules or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, thereby storing them in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those presented here, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.

[0211] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A method of switching a door lock state, characterized by, include: If it is determined that there is no network connection between the smart lock and the cloud platform, respond to the unlocking operation of the target object on the smart lock and obtain the temporary unlocking password corresponding to the unlocking operation; Based on the unlocking time of the unlocking operation, the device number of the smart lock and the device local key of the smart lock are used to generate a local unlocking password; The temporary unlocking password is verified using the local unlocking password, and the door lock status of the smart door lock is determined based on the verification result. Verify the temporary unlocking password using the local unlocking password, including: Retrieve the previous unlock time field corresponding to the second-level timestamp; The temporary unlocking password is verified based on the first set of passwords corresponding to the unlocking time field and the second set of passwords corresponding to the previous unlocking time field, wherein the number of passwords contained in the first set of passwords is equal to the number of passwords contained in the second set of passwords. Determining whether to switch the smart lock state based on the verification result includes: If the second verification result indicates that the verification of the temporary unlocking password using the first set of passwords and the second set of passwords is successful, the target local unlocking password corresponding to the second verification result is obtained. Obtain the global unlock time field preset for the second-level timestamp; Based on the usage status of the target local unlocking password and the global unlocking time field, determine whether to switch the door lock status of the smart door lock; Determining whether to switch the smart lock's lock state based on the usage status of the target local unlocking password and the global unlocking time field includes: If it is determined that the unlock time field corresponding to the second-level timestamp is inconsistent with the global unlock time field, the next unlock time field corresponding to the second-level timestamp is determined. Obtain the first global unlock variable corresponding to the unlock time field and the second global unlock variable corresponding to the next unlock time field; Update the first global unlock variable according to the second global unlock variable; After confirming that the first global unlock variable has been updated, and confirming that the verification result is successful, the door lock state of the smart door lock is switched.

2. The door lock state switching method according to claim 1, wherein Based on the unlocking time of the unlocking operation, the smart lock's device number and the smart lock's local key generate a local unlocking password, including: Obtain the second-level timestamp corresponding to the unlocking time, and convert the second-level timestamp into an unlocking time field with a preset time interval; The unlocking time field, the device local key, and the device number of the smart lock are hashed and encrypted using a hash algorithm to obtain the hash encryption result. The hash encryption result is determined as the local unlocking password.

3. The door lock state switching method according to claim 1 or 2, characterized in that, After generating a local unlocking password based on the device number of the smart lock and the device local key of the smart lock according to the unlocking time of the unlocking operation, the method further includes: The password byte sequence corresponding to the local unlocking password is grouped according to a preset byte length to obtain multiple passwords, wherein the byte length of each of the multiple passwords is equal to the preset byte length; The process of responding to the target object's unlocking operation on the smart lock and obtaining the temporary unlocking password corresponding to the unlocking operation includes: If it is determined that the target object has performed at least two unlocking operations on the smart door lock, the number of unlocking operations is obtained; If it is determined that the number of unlocking operations is not greater than the number of passwords in the plurality of passwords, the temporary unlocking password corresponding to the unlocking operation is obtained.

4. The door lock state switching method according to claim 2, characterized in that, Converting the second-level timestamp into an unlocking time field with a preset time interval includes: Obtain the value when the preset time unit is converted to a second unit, and determine the quotient between the second-level timestamp and the value, wherein the time unit of the quotient is a second unit; The time unit of the quotient is converted into the time unit of the preset time level to obtain the unlocking time field.

5. The door lock state switching method according to claim 1, characterized in that, Before verifying the temporary unlocking password based on the first set of passwords corresponding to the unlocking time field and the second set of passwords corresponding to the previous unlocking time field, the method further includes: The system determines the synchronization record of the smart door lock synchronizing data with the cloud platform according to a preset period; and retrieves the first device local key and the first validity period of the first device local key from the most recent synchronization record. If it is determined that the unlocking time indicated by the second-level timestamp belongs to the first validity period, the first set of passwords is generated based on the unlocking time field, the first device local key, and the device number of the smart door lock.

6. The door lock state switching method according to claim 5, characterized in that, Before verifying the temporary unlocking password based on the first set of passwords corresponding to the unlocking time field and the second set of passwords corresponding to the previous unlocking time field, the method further includes: If it is determined that the unlocking time indicated by the second-level timestamp does not belong to the first validity period, the second device local key and the second validity period of the second device local key are obtained from the synchronization record, wherein the synchronization time of the second device local key is earlier than that of the first device local key; The second set of passwords is generated based on the previous unlocking time field, the second device local key, and the device number of the smart door lock.

7. The door lock state switching method according to claim 1, characterized in that, Verify the temporary unlocking password using the local unlocking password, including: The temporary unlocking password is verified using the first set of passwords to obtain a first verification result; If the first verification result indicates a verification failure, the second set of passwords is used to verify the temporary unlocking password.

8. The door lock state switching method according to claim 1, characterized in that, Determining whether to switch the smart lock state based on the verification result includes: If the second verification result of verifying the temporary unlocking password using the first set of passwords and the second set of passwords indicates that the verification failed, and if it is determined that the current lock state of the smart lock is open, then it is determined to switch the lock state of the smart lock to closed. If it is determined that the current lock state of the smart lock is closed, then it is determined not to switch the lock state of the smart lock.

9. The door lock state switching method according to claim 1, characterized in that, Determining whether to switch the smart lock's lock state based on the usage status of the target local unlocking password and the global unlocking time field further includes: If the unlocking time field corresponding to the second-level timestamp is found to be consistent with the global unlocking time field, it is determined that the target local unlocking password belongs to the first group of passwords; Obtain the usage identifier corresponding to the target local unlock password; If it is determined that the usage identifier corresponding to the target local unlocking password indicates that the target local unlocking password has been used, the verification result is determined to be a verification failure, and the door lock state of the smart door lock is not switched.

10. The door lock state switching method according to claim 1, characterized in that, Updating the first global unlock variable based on the second global unlock variable includes: Obtain the first type of global unlocking variable and the second type of global unlocking variable contained in the first global unlocking variable, wherein the first type of global unlocking variable includes the usage identifier of the first group of passwords, and the second type of global unlocking variable includes the usage identifier of the second group of passwords; Obtain the first type of global unlocking variable and the second type of global unlocking variable contained in the second global unlocking variable, wherein the second type of global unlocking variable contained in the second global unlocking variable includes a third group of password usage identifiers corresponding to the next unlocking time field, wherein the number of passwords contained in the third group of passwords is equal to the number of passwords contained in the first group of passwords and the second group of passwords; The first type of global unlocking variable included in the first global unlocking variable is updated to an intermediate global variable value, wherein the intermediate global variable value is equal to the variable value of the second type of global unlocking variable included in the second global unlocking variable, and the variable value represents the usage identifier of the local unlocking password; Reset the first type of global unlocking variable contained in the second global unlocking variable to the initial global variable value.

11. The door lock state switching method according to claim 10, characterized in that, After resetting the first type of global unlocking variable contained in the second global unlocking variable to its initial global variable value, the method further includes: Obtain the target unlock variable value from the initial global variable value, wherein the target unlock variable value is used to represent the target usage identifier of the target local unlock password; If the target usage identifier of the target local unlocking password is determined to indicate that the target local unlocking password is not used, the target unlocking variable value is modified so that the target usage identifier represented by the modified target variable value indicates that the target local unlocking password has been used.

12. The method for switching the state of a door lock according to any one of claims 1 to 11, characterized in that, After updating the first global unlock variable according to the second global unlock variable, the method further includes: Update the field value of the unlock time field to the field value of the next unlock time field.

13. A door lock state switching system, characterized in that, include: A cloud platform and a smart lock, wherein the smart lock is used to respond to an unlocking operation of a target object when there is no network connection with the cloud platform, and obtain a temporary unlocking password corresponding to the unlocking operation; generate a local unlocking password based on the unlocking time of the unlocking operation, the device number of the smart lock and the device local key of the smart lock; verify the temporary unlocking password using the local unlocking password, and determine whether to switch the lock state of the smart lock based on the verification result; The smart lock is also used to obtain the previous unlocking time field corresponding to the second-level timestamp; and to verify the temporary unlocking password based on the first set of passwords corresponding to the unlocking time field and the second set of passwords corresponding to the previous unlocking time field, wherein the number of passwords contained in the first set of passwords is equal to the number of passwords contained in the second set of passwords. The smart lock is further configured to: when a second verification result indicating successful verification of the temporary unlocking password using the first set of passwords and the second set of passwords indicates successful verification, obtain the target local unlocking password corresponding to the second verification result; obtain a global unlocking time field preset for the second-level timestamp; and determine whether to switch the lock state of the smart lock based on the usage status of the target local unlocking password and the global unlocking time field. The smart lock is further configured to: determine the next unlocking time field corresponding to the second-level timestamp when the unlocking time field corresponding to the second-level timestamp is inconsistent with the global unlocking time field; obtain a first global unlocking variable corresponding to the unlocking time field and a second global unlocking variable corresponding to the next unlocking time field; update the first global unlocking variable according to the second global unlocking variable; and after the first global unlocking variable is updated, determine that the verification result is successful and switch the lock state of the smart lock.

14. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein the program, when executed, performs the method according to any one of claims 1 to 12.

15. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to execute the method described in any one of claims 1 to 12 through the computer program.