Equipment binding method, electronic equipment and storage medium

By obtaining the device code to acquire the device identifier and utilizing the permission verification mechanism of the cloud platform and gateway, the problems of cumbersome and inaccurate device binding operations in smart home systems are solved, enabling precise selection of devices for binding and simplifying operations, thereby improving the user experience.

CN121841884APending Publication Date: 2026-04-10GUANGZHOU HEMI TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
GUANGZHOU HEMI TECHNOLOGY CO LTD
Filing Date
2026-01-14
Publication Date
2026-04-10

AI Technical Summary

Technical Problem

In smart home systems, existing device binding methods are cumbersome, have low binding accuracy, and result in a poor user experience.

Method used

By obtaining the device code and device identifier of the target device, and utilizing the permission verification mechanism of the cloud platform and gateway, the binding process is simplified, ensuring the accuracy of device binding.

Benefits of technology

It enables precise selection of device binding, simplifies the operation process, improves user experience, and avoids long waiting times for binding results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121841884A_ABST
    Figure CN121841884A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides an equipment binding method, electronic equipment and a storage medium, and relates to the field of smart home. The method comprises the following steps: acquiring an equipment code of target equipment, and acquiring an equipment identifier of the target equipment according to the equipment code; sending a binding instruction to a cloud platform and starting a timing function, so that the cloud platform sends the binding instruction to a gateway when determining that the terminal has the indication permission according to the user identifier; the binding indication comprises a user identifier and a device identifier, and the binding indication is used for indicating the gateway to bind the target device; the gateway is a gateway bound with a user identifier corresponding to a user using the terminal; if first response information is received within a preset duration after the timing function is started, displaying information of successful binding; the first response information is used for representing binding success. According to the embodiment of the invention, accurate selection of the to-be-bound equipment and simplification of the binding process are realized.
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 device binding method, an electronic device, and a storage medium. Background Technology

[0002] Currently, in smart home systems, when users bind sub-devices to the gateway via a terminal, they typically use methods such as manual search, model selection, or batch binding.

[0003] However, the relevant binding methods still suffer from problems such as cumbersome operation, low binding accuracy, and poor user experience. Summary of the Invention

[0004] This application provides a device binding method, an electronic device, and a storage medium to solve the technical problems of cumbersome operation and low binding accuracy.

[0005] According to a first aspect of the embodiments of this application, a device binding method is provided, applied to a terminal, the method comprising: obtaining a device code of a target device, and obtaining a device identifier of the target device based on the device code; Send a binding instruction to the cloud platform and start the timing function so that when the cloud platform determines that the terminal has the instruction permission based on the user identifier, it sends a binding instruction to the gateway. The binding instruction includes a user identifier and a device identifier. The binding instruction is used to instruct the gateway to bind the target device. The gateway is the gateway bound to the user identifier corresponding to the user using the terminal. If the first response message is received within the preset time after the timer function is started, a message indicating successful binding will be displayed; the first response message is used to indicate successful binding.

[0006] According to a second aspect of the embodiments of this application, a device binding method is provided, applied to a gateway, the method comprising: In response to receiving the binding instruction, the device identifier in the binding instruction is obtained. The binding instruction is used to instruct the gateway to bind the target device corresponding to the device identifier. The binding instruction includes the user identifier and the device identifier. The binding instruction is sent to the gateway by the cloud platform after receiving the binding instruction sent by the terminal and determining that the terminal has the instruction permission based on the user identifier. The terminal is the terminal used by the user whose user identifier is already bound to the gateway. If the target device is determined to meet the binding conditions based on the device identifier, a first request is sent to the target device to request the establishment of a binding relationship with the target device; In response to the binding result returned by the device, if the binding result indicates that the binding is successful, the cloud platform sends a first response message indicating successful binding to the terminal.

[0007] According to a third aspect of the embodiments of this application, a terminal is provided, the device comprising: The acquisition module is used to obtain the device code of the target device and obtain the device identifier of the target device based on the device code. The startup module is used to send a binding instruction to the cloud platform and start the timing function, so that when the cloud platform determines that the terminal has the instruction permission based on the user identifier, it sends a binding instruction to the gateway. The binding instruction includes a user identifier and a device identifier, and the binding instruction is used to instruct the gateway to bind the target device. The gateway is the gateway bound to the user identifier corresponding to the user of the terminal. The display module is used to display a successful binding message if the first response message is received within a preset time after the timing function is started; the first response message is used to indicate that the binding is successful.

[0008] According to a fourth aspect of the embodiments of this application, a gateway is provided, the device comprising: The receiving module is used to respond to the receiving binding instruction and obtain the device identifier in the binding instruction. The binding instruction is used to instruct the gateway to bind the target device corresponding to the device identifier. The binding instruction includes the user identifier and the device identifier. The binding instruction is sent to the gateway by the cloud platform after receiving the binding instruction sent by the terminal and determining that the terminal has the instruction permission based on the user identifier. The terminal is the terminal used by the user whose user identifier is already bound to the gateway. The determination module is used to send a first request to the target device to request the establishment of a binding relationship with the target device if the target device is determined to meet the binding conditions based on the device identifier. The sending module is used to respond to the binding result returned by the device. If the binding result indicates that the binding is successful, it sends a first response message indicating successful binding to the terminal through the cloud platform.

[0009] According to a fifth aspect of the present application, an electronic device is provided, the electronic device including a memory, a processor and a computer program stored in the memory, wherein the processor executes the program to implement the steps of the method provided in the first aspect.

[0010] According to a sixth aspect of the embodiments of this application, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps of the method provided in the first aspect.

[0011] According to a seventh aspect of the present application, a computer program product is provided, the computer program product including computer instructions stored in a computer-readable storage medium, wherein when a processor of a computer device reads the computer instructions from the computer-readable storage medium, the processor executes the computer instructions, causing the computer device to perform steps implementing the method provided in the first aspect.

[0012] The beneficial effects of the technical solutions provided in this application are: The device binding method for terminals provided in this application obtains the device code of the target device and obtains the device identifier of the target device based on the device code. This enables accurate selection of the target device to be bound by obtaining the device code, avoiding the selection of the device to be bound from a large number of bindable devices and solving the problem of easily selecting the wrong target device to be bound.

[0013] After obtaining the device identifier, a binding instruction containing both the device identifier and the user identifier is sent via the cloud platform. This allows the cloud platform to directly forward the binding instruction to the gateway bound to the user identifier when it determines that the terminal has the necessary permissions based on the user identifier. This instructs the gateway to bind the target device. This simplifies the binding process for the target device, resolves the cumbersome procedures encountered when users perform binding operations via their terminals, and improves the user experience.

[0014] If the first response is received within the preset time after the timer function is started, a successful binding message will be displayed. By processing the first response received within the preset time after the timer function is started, the user experience is improved by avoiding long waiting times for the binding result when the binding process is slow. Attached Figure Description

[0015] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments of this application will be briefly introduced below.

[0016] Figure 1 This is a schematic diagram of the system architecture for implementing the device binding method provided in the embodiments of this application; Figure 2 A flowchart illustrating a device binding method applied to a terminal, provided in an embodiment of this application; Figure 3 A flowchart illustrating a method for determining binding failure in a device binding method provided in an embodiment of this application; Figure 4 This is a flowchart illustrating a device binding method applied to a gateway, as provided in an embodiment of this application. Figure 5 A flowchart illustrating the method for determining the binding conditions in a device binding method provided in an embodiment of this application; Figure 6 A flowchart illustrating a method for generating a target error code in a device binding method provided in this application embodiment; Figure 7 This is a schematic diagram of the interaction process in a device binding method provided in an embodiment of this application; Figure 8This is a schematic diagram of the structure of a terminal provided in an embodiment of this application; Figure 9 This is a schematic diagram of the structure of a gateway provided in an embodiment of this application; Figure 10 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0017] The embodiments of this application are described below with reference to the accompanying drawings. It should be understood that the embodiments described below with reference to the accompanying drawings are exemplary descriptions for explaining the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions of the embodiments of this application.

[0018] Those skilled in the art will understand that, unless otherwise stated, the singular forms “a,” “an,” “the,” and “the” used herein may also include the plural forms. It should be further understood that the terms “comprising” and “including” as used in embodiments of this application mean that the corresponding feature can be implemented as the presented feature, information, data, step, operation, element, and / or component, but do not exclude implementation as other features, information, data, step, operation, element, component, and / or combinations thereof supported by the art. It should be understood that when we say that an element is “connected” or “coupled” to another element, the one element can be directly connected or coupled to the other element, or it can mean that the one element and the other element establish a connection relationship through an intermediate element. Furthermore, “connected” or “coupled” as used herein can include wireless connection or wireless coupling. The term “and / or” as used herein indicates at least one of the items defined by the term; for example, “A and / or B” can be implemented as “A,” or as “B,” or as “A and B.”

[0019] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.

[0020] The relevant technologies are explained below: The relevant device binding methods have the following main drawbacks: 1. Manual search requires users to identify the target device from a list of numerous devices, which can easily lead to selecting the wrong device; 2. Binding by model requires users to accurately understand the device model information, which is not user-friendly for ordinary users; 3. While batch binding is more efficient, it cannot accurately specify a particular device, which can easily lead to incorrect binding. 4. Existing binding methods lack standardized communication protocols and robust error handling mechanisms.

[0021] In view of at least one of the above-mentioned technical problems or areas that need improvement in the related technologies, this application proposes a device binding method. This method obtains the device code of the target device and obtains the device identifier of the target device based on the device code. This achieves accurate selection of the target device to be bound by obtaining the device code, avoids selecting the device to be bound from a large number of bindable devices, and solves the problem that the target device to be bound is easy to be selected incorrectly.

[0022] After obtaining the device identifier, a binding instruction containing both the device identifier and the user identifier is sent via the cloud platform. This allows the cloud platform to directly forward the binding instruction to the gateway bound to the user identifier when it determines that the terminal has the necessary permissions based on the user identifier. This instructs the gateway to bind the target device. This simplifies the binding process for the target device, resolves the cumbersome procedures encountered when users perform binding operations via their terminals, and improves the user experience.

[0023] If the first response is received within the preset time after the timer function is started, a successful binding message will be displayed. By processing the first response received within the preset time after the timer function is started, the user experience is improved by avoiding long waiting times for the binding result when the binding process is slow.

[0024] The technical solutions of this application and their effects are described below through several exemplary embodiments. It should be noted that the following embodiments can be referenced, borrowed from, or combined with each other. Identical terms, similar features, and similar implementation steps in different embodiments will not be repeated.

[0025] Figure 1 This is a schematic diagram of the system architecture for implementing the device binding method provided in this application embodiment, wherein the system architecture includes: terminal 120, cloud platform 140 and gateway 160.

[0026] Terminal 120 installs and runs an application with a device binding method. Terminal 120 is used to obtain the device code of the target device and send a binding instruction to the cloud platform 140.

[0027] Terminal 120 is connected to cloud platform 140 via wireless network.

[0028] Cloud platform 140 includes at least one of a single server, multiple servers, a cloud computing platform, and a virtualization center. Illustratively, cloud platform 140 includes a processor 144 and a memory 142, the memory 142 including a display module 1421, a control module 1422, and a receiving module 1423. Cloud platform 140 is used to provide background services for applications in the device binding method. Optionally, cloud platform 140 undertakes the primary computing work, and terminal 120 undertakes secondary computing work; or cloud platform 140 undertakes secondary computing work, and terminal 120 undertakes primary computing work; or, cloud platform 140 and terminal 120 collaborate on computing using a distributed computing architecture.

[0029] Gateway 160 is used to bind devices according to the received binding instructions.

[0030] Optionally, the device type of the terminal includes at least one of the following: smartphone, tablet computer, e-book reader, Moving Picture Experts Group Audio Layer III (MP3) player, Moving Picture Experts Group Audio Layer IV (MP4) player, laptop computer, and desktop computer.

[0031] Those skilled in the art will understand that the number of terminals described above can be more or less. For example, there may be only one terminal, or there may be dozens or hundreds of terminals, or even more. This application does not limit the number of terminals or the type of device.

[0032] This application provides a device binding method for use on a terminal, such as... Figure 2 As shown, the method includes: S101, Obtain the device code of the target device, and obtain the device identifier of the target device based on the device code.

[0033] In this embodiment of the application, the device code is a code used to store device information. The device code can be a QR code, barcode, or other code. The device code of the target device is usually set on the device body of the target device. The device code of the target device can be obtained by scanning the device code on the device body of the target device with the camera of the terminal.

[0034] In this application embodiment, the target device is a smart device, such as a smart door lock, a smart clothes rack, a smart air conditioner, and other smart devices.

[0035] In this embodiment, the terminal, in response to obtaining the device code of the target device, parses the device code and obtains the device identifier stored in the device code.

[0036] In one example, the user triggers a control on the terminal that represents the function of adding a device. The terminal opens the camera and scans the device code attached to the target device through the camera. In response to the camera scanning the device code of the target device, the terminal parses the device code to obtain the device identifier of the target device, thereby determining that the user wants to bind the target device with the device identifier to the gateway.

[0037] S102 sends a binding instruction to the cloud platform and starts the timing function.

[0038] In this embodiment of the application, the binding instruction includes a user identifier and a device identifier. The binding instruction is used to instruct the gateway to bind the target device. The gateway is the gateway bound to the user identifier corresponding to the user of the terminal. In other words, the terminal sends the binding instruction to the cloud platform to instruct the gateway bound to the current user identifier to bind the target device.

[0039] In this embodiment, the terminal sends a binding instruction to the cloud platform, so that when the cloud platform determines that the terminal has the instruction permission based on the user identifier, it sends a binding instruction to the gateway. In other words, after the terminal sends a binding instruction to the cloud platform, the cloud platform does not directly forward the binding instruction sent by the terminal to the gateway. Instead, it first verifies whether the terminal has the instruction permission. If it determines that the terminal has the permission to instruct the gateway to bind the device, it forwards the binding instruction to the gateway.

[0040] In this embodiment of the application, if the gateway confirms whether the user identifier carried in the binding instruction is stored on the cloud platform, and the cloud platform stores the gateway corresponding to the current user identifier, that is, the gateway to which the user identifier is bound, then it indicates that the current terminal has the authority to instruct the gateway to bind the target device.

[0041] In this embodiment of the application, the binding instruction may also include a user token, and the cloud platform can verify whether the terminal has a binding instruction by verifying the user token.

[0042] In this embodiment of the application, after the terminal sends a binding instruction to the cloud platform, it starts the timing function to determine the duration of the current binding, so that the candidate can perform corresponding processing based on the time spent on binding.

[0043] In one example, the terminal sends a binding instruction to the gateway via the MQTT protocol. The specific communication process is as follows: Downlink Topic: $thing / down / action / {ProductID} (gateway) / {DeviceName} (gateway) Request message format: json { "method": "action", "clientToken":"v2530232175ejcqh::19af9591-cdff-44d3-b830-09450750c2bf", "actionId": "BindSubInfoToGateway", "timestamp": 1747900634, "params": { "GID": "Sub-device GID" } } Parameter description: method: Fixed to "action", indicating the invocation of device behavior; actionId: Action identifier, fixed as "BindSubInfoToGateway"; clientToken: Message ID, used for request-response matching; timestamp: The current time (milliseconds) at which the action was invoked; params.GID: Device identifier of the target device.

[0044] S103 If the first response is received within the preset time after the timing function is started, the binding success message will be displayed.

[0045] In this embodiment of the application, the first response information is used to indicate that the binding is successful. If the first response information is received within a preset time after the timing function is started, it means that the current gateway and the target device are successfully bound.

[0046] In this embodiment of the application, the current target device is confirmed to be successfully bound to the gateway only when the first response information is received within a preset time after the timing function is started. That is, the terminal only monitors the first response information received within a preset time after the timing function is started. When the preset time is exceeded, the binding process ends.

[0047] In one example, after the terminal sends a binding instruction to the gateway, it starts the timing function and displays "Binding in progress" on the visual interface. After the timing function reaches the preset time, it stops displaying "Binding in progress". If the first response information is received, the corresponding target device that has been successfully bound is displayed according to the first response information.

[0048] In this embodiment, the first response information is only accepted within a preset time period, which avoids the user having to wait a long time for the gateway to return the binding result when the gateway and the bound device are in the binding process for a long time, thus improving the user experience.

[0049] The device binding method for terminals provided in this application obtains the device code of the target device and obtains the device identifier of the target device based on the device code. This enables accurate selection of the target device to be bound by obtaining the device code, avoiding the selection of the device to be bound from a large number of bindable devices and solving the problem of easily selecting the wrong target device to be bound.

[0050] After obtaining the device identifier, a binding instruction containing both the device identifier and the user identifier is sent via the cloud platform. This allows the cloud platform to directly forward the binding instruction to the gateway bound to the user identifier when it determines that the terminal has the necessary permissions based on the user identifier. This instructs the gateway to bind the target device. This simplifies the binding process for the target device, resolves the cumbersome procedures encountered when users perform binding operations via their terminals, and improves the user experience.

[0051] If the first response is received within the preset time after the timer function is started, a successful binding message will be displayed. By processing the first response received within the preset time after the timer function is started, the user's long waiting time for the binding result is avoided when the gateway and the bound device are in the binding process for a long time, thus improving the user's binding experience.

[0052] Based on the above embodiments, as an optional embodiment, a method for determining binding failure is also provided, such as... Figure 3 As shown, the specific content is as follows: S201, If ​​the second response information is received, the target error code in the second response information is obtained; S202, based on the target error code and the preset first association relationship, determine the target first text and target second text corresponding to the target error code; S203, display the first target text and the second target text.

[0053] In S201 of this application embodiment, the second response information is sent when the gateway fails to bind to the target device. The target error code is used to characterize the reason for the binding failure. The target error code is generated by the gateway after receiving the binding instruction based on the reason for the current binding failure. That is, when the terminal receives the second response information, it indicates that the current gateway and the target device have failed to bind. Therefore, the terminal obtains the target error code in the second response information and can determine the reason for the binding failure based on the target error code.

[0054] In S202 of this application embodiment, the first association relationship includes the correspondence between each error code and the first text and the second text; the first text records the reason for the binding failure, and the second text records the solution to the binding failure. That is, the terminal pre-stores the first association relationship between the error code and the first text and the second text, that is, each error code has a corresponding reason for the binding failure and a solution to the binding failure. The reason for the binding failure and the solution to the binding failure can be obtained through the target error code carried in the second response information, that is, the target first text and the target second text.

[0055] In S203 of this application embodiment, after obtaining the target first text and the target second text, the terminal displays the target first text and the target second text on the visualization interface, that is, it displays the reason for the failure of this binding and the solution, thereby instructing the user to troubleshoot and solve according to the solution, so as to increase the probability of successful binding next time after solving the current problem.

[0056] In this application embodiment, the reasons for binding failure include at least one of the following: The target device is offline; The target device is incompatible with the gateway; The target device is already bound; The number of devices bound to the gateway exceeds the threshold. The gateway's load is not lower than the load threshold; The gateway receives a binding instruction for the target device within a preset time period. The gateway is undergoing firmware upgrade.

[0057] In this embodiment, when the target device is offline, the gateway cannot send the first request to it, therefore the binding fails; when the target device is incompatible with the gateway, the gateway and the target device cannot interact, and the gateway cannot send the first request to the target device, therefore the binding fails; when the target device is already bound, it means that the target device has already established a binding relationship with another gateway, and the gateway is binding it, therefore the binding fails; when the number of bound devices on the gateway exceeds the threshold, it means that the current gateway has reached its limit for the number of bound devices and cannot bind to any new devices, therefore the binding fails; when the gateway's load is not lower than the load threshold, it means that the gateway is currently under heavy load and cannot execute the binding process, therefore the binding fails; when the gateway has received a binding instruction for the target device within a preset time, it means that the binding process has already been executed or is being executed and will not be repeated, therefore the binding fails; when the gateway is in firmware upgrade mode, the gateway cannot perform binding business operations, therefore the binding fails.

[0058] In this application embodiment, the corresponding solutions for each binding failure reason are as follows: When the binding fails because the target device is offline, the corresponding solution is to check the power and network status of the target device. When the binding failure is due to incompatibility between the target device and the gateway, the corresponding solution is to update the gateway firmware or the terminal application version. If the binding fails because the target device is already bound, the solution is to contact the relevant personnel to unbind the original device. When the binding failure is due to the number of bound devices on the gateway exceeding the threshold, the corresponding solution is to unbind infrequently used devices and then rebind them. When the binding failure is due to the gateway's load not being lower than the load threshold, the corresponding solution is to restart the gateway or release resources. If the reason for the binding failure is that the gateway has received the binding instruction for the target device within the preset time, the corresponding solution is to prompt that there is no need to repeat the operation. If the binding fails because the gateway is undergoing a firmware upgrade, the solution is to wait for the gateway upgrade to complete before attempting to bind again.

[0059] In the above scheme, by pre-setting a first association, after receiving the second response information sent by the gateway through the cloud platform, i.e., after determining that the binding of the target device has failed, the cause and solution of the binding failure can be determined based on the received target error code and the first association. That is, the target first text and target second text are obtained. By displaying the target first text and target second text, the user is instructed to solve the cause of the binding failure according to the solution. This increases the probability of successful binding when rebinding the target device. Furthermore, by displaying the specific cause and solution of the binding failure, the user can better understand the current situation, avoid user confusion, and improve the user experience.

[0060] Based on the above embodiments, as an optional embodiment, after the timing function is started, if no first response information or second response information is received from the gateway within a preset time after the timing function is started, a prompt message is displayed; the prompt message is used to instruct the user to check the network settings.

[0061] In this embodiment of the application, if no first response information or second response information is received from the gateway within the preset time after the timing function is started, it means that the current user has been waiting for the binding result to be returned for a long time. A prompt message is displayed to prompt the user to check the network settings, so as to avoid the user waiting for a long time due to network settings and other reasons, which would reduce the user's experience.

[0062] In the above solution, the time spent on binding is timed using a timer function. If no response is received within the preset time period after the timer function is started, a prompt message is sent to the user to check the network settings in order to avoid the user waiting for a long time and to provide real-time feedback on the current binding status.

[0063] This application embodiment provides another device binding method, applied to a gateway, such as... Figure 4 As shown, the method includes: S301, in response to receiving the binding instruction, obtain the device identifier in the binding instruction.

[0064] In this embodiment, the binding instruction is used to instruct the gateway to bind the target device corresponding to the device identifier. The binding instruction includes a user identifier and a device identifier. The binding instruction is sent to the gateway after the cloud platform receives the binding instruction sent by the terminal and determines that the terminal has the instruction permission based on the user identifier. The terminal is the terminal used by the user whose user identifier is already bound to the gateway.

[0065] In this embodiment of the application, the binding instruction received by the gateway is sent from the terminal to the cloud platform. The cloud platform forwards the binding instruction to the gateway only before confirming that the terminal has the instruction authority to instruct the gateway to bind the target device based on the user identifier. After receiving the binding instruction, the gateway obtains the device identifier in the binding instruction.

[0066] In this application, since the terminal is the terminal used by the user whose user identifier is bound to the gateway, the gateway can receive the binding instruction and bind the target device based on the binding instruction.

[0067] S302, if the target device is determined to meet the binding conditions based on the device identifier, a first request is sent to the target device to request the establishment of a binding relationship with the target device.

[0068] In this embodiment of the application, after obtaining the device identifier, the gateway needs to first confirm whether the target device meets the binding conditions. Only if the target device meets the binding conditions will the gateway send a first request to the target device to request the establishment of a binding relationship with the target device.

[0069] In this embodiment, the binding conditions include the target device being online, meaning that the target device must be online to receive the first request sent by the gateway, thus avoiding sending the first request to the target device that is offline; the binding conditions also include the target device being unbound, thus avoiding sending the first request to a device that is already bound to another gateway, resulting in invalid transmission of the first request; the binding conditions also include communication compatibility between the gateway and the target device, thus avoiding invalid transmission to the target device that cannot receive the first request due to communication incompatibility.

[0070] In this embodiment, by first confirming whether the target device meets the binding conditions, and then deciding whether to initiate a first request to the target device, invalid interaction with the target device is avoided when the target device does not meet the binding conditions. This saves the gateway's operating resources and avoids executing too many processes when the gateway cannot bind with the target device, thus preventing the timely feedback of the real-time binding status to the user.

[0071] S303, in response to the binding result returned by the target device, if the binding result indicates successful binding, then a first response message indicating successful binding is sent to the terminal through the cloud platform.

[0072] In this embodiment of the application, when the target device returns a binding result indicating successful binding, a first response message representing successful binding is sent to the terminal through the cloud platform, thereby achieving timely feedback of the binding status.

[0073] In one example, the gateway returns the processing result via an uplink topic.

[0074] Uplink Topic: $thing / up / action / {ProductID} (gateway) / {DeviceName} (gateway) Response message format: json { "method": "action_reply", "clientToken": "20a4ccfd-d308-11e9-86c6-5254008a4f10", "code": 0, "status": "some message where error", "response": { "Code": 0 } } Where method: is fixed to "action", which indicates the response that invokes device behavior; clientToken: Message ID, used for request-response matching; code: This is the business execution result code, which indicates successful binding.

[0075] The device binding method for gateways provided in this application embodiment obtains the device identifier in the binding instruction sent by the receiving terminal. Since the binding instruction is sent by the cloud platform when it confirms that the terminal has the instruction permission, it avoids unauthorized devices instructing the gateway, thus improving the security of device binding. After obtaining the device identifier, it first confirms whether the target device meets the binding conditions. Only when the target device meets the binding conditions will a first request be sent to the target device. This avoids invalid interaction with the target device when it does not meet the binding conditions, saving gateway operating resources and avoiding the execution of many processes when the gateway cannot bind with the target device, thus preventing the inability to promptly provide real-time feedback on the binding status to the user. Upon receiving the binding result indicating successful binding from the target device, it returns a first response information indicating successful binding between the gateway and the target device to the terminal. This achieves timely return of the first response information upon successful binding, ensuring that the user can receive the binding result in a short time and improving the efficiency of device binding.

[0076] Based on the above embodiments, as an optional embodiment, each verification item in the preset verification set is verified; if it is determined that each verification item in the verification set passes the verification, the device identifier in the binding instruction is obtained.

[0077] In this application, the verification set includes at least one verification item, which is used to verify whether the gateway can currently bind to the target device. That is, after the gateway receives the binding instruction, it first verifies at least one verification item in the pre-set verification set to confirm whether the gateway can currently bind to the target device.

[0078] In this embodiment, before obtaining the device identifier in the binding instruction, each verification item in the preset verification set is verified first. When it is determined that each verification item in the preset verification set passes its corresponding verification, it indicates that the current gateway can bind the target device, thereby obtaining the device identifier in the binding instruction. In other words, the gateway will only obtain the device identifier to confirm whether the current target device can be bound when it confirms that it can bind the target device. This avoids continuing subsequent operations when it cannot bind the target device, thus saving the gateway's operating resources and the user's waiting time.

[0079] In this embodiment of the application, the verification set includes at least one of the following verification items: The number of devices bound to the gateway does not exceed the quantity threshold; The gateway's load is below the load threshold; The gateway did not receive a binding instruction for the target device within the preset time period; The gateway is not in a firmware upgrade state.

[0080] In this embodiment of the application, in order to ensure that the gateway can provide good service to the bound devices, the gateway usually limits the number of bound devices. When the number of bound devices exceeds the threshold, it means that no device can be bound at present. Therefore, when the number of bound devices of the gateway does not exceed the threshold, the above verification item passes.

[0081] In this embodiment of the application, the gateway binding operation involves computing and data storage, which consumes CPU and memory. The load can refer to CPU load, memory load, etc. When the CPU load is too high, it may cause the gateway to crash. If the memory in the gateway is insufficient to maintain the data cache during the binding process, it means that the gateway cannot bind the device at present. That is, when the load of the gateway is lower than the load threshold, the above verification item passes.

[0082] In this embodiment of the application, if the gateway does not receive a binding instruction from the target device within a preset time period, it indicates that the currently received binding instruction is not a duplicate binding instruction, that is, it is not a binding instruction that has already been received and is being executed. Therefore, the verification item passes.

[0083] In this embodiment of the application, the gateway needs to ensure that its current operating state is stable when binding devices, that is, it cannot be in a busy or abnormal state. Therefore, when the gateway is not in a firmware upgrade state or performing an operation that consumes a lot of computing resources, it means that the verification item passes.

[0084] In the above scheme, before obtaining the device identifier, each verification item in the pre-set verification set is verified. Only when all verification items pass is the device identifier of the target device obtained from the binding instruction to determine whether the target device meets the binding conditions. This ensures that the gateway will not continue to bind the device if there is any problem affecting the binding, avoiding continuing the subsequent binding process when it is destined to fail. This ensures that the gateway will only continue to bind when it can provide sufficient binding support, thus improving the user experience.

[0085] Based on the above embodiments, as an optional embodiment, if it is determined that at least one target verification item in the verification set fails the verification, a corresponding target error code is generated according to the preset second association relationship and at least one target verification item; the second association relationship includes the correspondence between each verification item and the error code, the target error code is used to characterize the reason for the current binding failure, and a second response information is returned to the terminal through the cloud platform, the second response information including the target error code; the second response is used to characterize the binding failure.

[0086] In this embodiment of the application, after verifying each verification item in the verification set, if it is determined that one target verification item fails the verification, it means that the current gateway cannot bind the target device. In order to help users clearly understand the reason for the failure to bind the target device, the gateway pre-establishes a second association relationship. The second association relationship includes the correspondence between each verification item and the error code. According to the first association relationship, the target error code corresponding to the target verification item can be obtained. The target error code is used to characterize the reason for the failure of this binding.

[0087] In this embodiment, after the gateway obtains the target verification code based on the target verification item, it sends the target verification code containing the second response information to the terminal. Since the terminal has a first association relationship stored in advance, the first association relationship includes the correspondence between the first text and the second text. The first text records the reason for the binding failure, and the second text records the solution to the binding failure. That is to say, after the gateway sends the second response information to the terminal, the terminal can determine the reason for the binding failure and the solution based on the target error code.

[0088] In the above scheme, when at least one target verification item in the verification set fails verification, a target error code is determined based on a preset second association relationship and at least one target verification. The cloud platform then returns a second response message containing the target error code to the terminal. This enables the gateway to promptly report the binding failure to the terminal when it determines that binding cannot be performed based on the current situation. Furthermore, by sending the target error code, the gateway helps the user understand the reason for the binding failure, thereby increasing the probability of successful binding when rebinding the target device. This allows the user to better understand the current situation, avoids user confusion, and improves the user experience.

[0089] Based on the above embodiments, as an optional embodiment, a method for determining whether binding conditions are met is provided, such as... Figure 5 As shown, the specific content is as follows: In this embodiment of the application, the binding conditions include at least the target device being online, the gateway being compatible with the target device, and the target device being in an unbound state.

[0090] In this embodiment, the binding conditions include the target device being online, meaning that the target device must be online to receive the first request sent by the gateway, thus avoiding sending the first request to the target device that is offline; the binding conditions also include the target device being unbound, thus avoiding sending the first request to a device that is already bound to another gateway, resulting in invalid transmission of the first request; the binding conditions also include communication compatibility between the gateway and the target device, thus avoiding invalid transmission to the target device that cannot receive the first request due to communication incompatibility.

[0091] S401, Obtain broadcast packets broadcast by at least one device within a preset range; S402, if it is determined that the received broadcast packet includes the target broadcast packet of the target device, then it is determined that the target device is online and compatible with the target device, and the target broadcast packet is parsed to obtain the parsing result; S403, if the parsing result determines that the target device is in an unbound state, then send the first request to the target device.

[0092] In S401 of this application embodiment, the broadcast packet includes the binding status of the device. The gateway obtains the broadcast packets broadcast by devices within a preset range. Therefore, by obtaining the broadcast packets broadcast by the devices, it can be determined whether the target device is in a bound state.

[0093] In S402 of this application embodiment, since the device only broadcasts broadcast packets continuously when it is online, and the gateway can only receive broadcast packets from devices that are compatible with its communication, if it is determined that the received broadcast packets include the target broadcast packets of the target device, it indicates that the target device is currently online and the gateway is compatible with the target device. Therefore, based on the above conditions, the target broadcast packets of the target device can be further parsed to obtain the parsing results, so as to determine whether the target device is in an unbound state.

[0094] In S403 of this application embodiment, if it is determined from the parsing result that the target device is in an unbound state, it means that the target device can be bound at present. Therefore, a first request is sent to the target device to request the establishment of a binding relationship with the target device.

[0095] In the above scheme, before sending the first request to the target device, the system determines whether the target device is online, whether the target device is compatible with the gateway, and whether the target device is in an unbound state by obtaining and parsing the broadcast packet of the target device. The first request is only sent to the target device if the target device is online, compatible with the gateway, and in an unbound state. This ensures that binding interaction with the target device only occurs when binding can be performed, thus avoiding waste of gateway resources and long waiting times for users.

[0096] In this embodiment of the application, if it is determined that any of the binding conditions are not met, a corresponding target error code is generated, and a second response information is returned to the terminal through the cloud platform; the second response information includes the target error code; the second response information is used to characterize the binding failure, and the target error code is used to characterize the reason for this binding failure; In this embodiment of the application, if it is determined that the target device does not meet any of the binding conditions, it means that the current gateway cannot establish a binding relationship with the target device. Based on the content that is not met, a corresponding target error code is generated. Then, a second response information representing the binding failure is sent to the terminal through the cloud platform, and the target error code is carried in the second response information so that the terminal can determine the reason for the binding failure based on the target error code.

[0097] In this embodiment of the application, if it is determined that the received broadcast packet does not include the target broadcast packet of the target device, the RSSI value of the current channel is obtained; if the RSSI value is lower than the first threshold or higher than the second threshold, it is determined that the binding condition is not met and a corresponding target error code is generated; if it is determined that the received broadcast packet includes the target broadcast packet of the target device, and the target device is determined to be in a bound state according to the parsing result, it is determined that the binding condition is not met and a target error code is generated.

[0098] Based on the above embodiments, as an optional embodiment, a method for generating a target error code is provided, such as... Figure 6 As shown, the specific content is as follows: S501-1, If ​​it is determined that the received broadcast packet does not include the target broadcast packet of the target device, then obtain the RSSI value of the current channel; S502-1, If ​​the RSSI value is lower than the first threshold, it is determined that the binding condition is not met, and a target error code is generated; S502-2, If the RSSI value is higher than the second threshold, it is determined that the binding condition is not met, and a target error code is generated; S501-2, if it is determined that the received broadcast packet includes the target broadcast packet of the target device, and the target device is determined to be in a bound state according to the parsing result, then it is determined that the binding condition is not met, and a target error code is generated.

[0099] In S501-1 of this application embodiment, after obtaining the broadcast of at least one device within a preset range in S401, if it is determined that the received broadcast packet does not include the target broadcast packet of the target device, it indicates that the current target device is offline or the target is incompatible. In order to further confirm why the target broadcast packet of the target device cannot be obtained, the RSSI value of the current channel is obtained.

[0100] In S502-1 of this application embodiment, if the RSSI value is lower than the first threshold, it indicates that there is no obvious electromagnetic wave energy, that is, no device is currently transmitting a signal. If the target device is online, it will inevitably broadcast broadcast packets continuously, which will result in obvious electromagnetic wave energy. Therefore, if the RSSI value is lower than the first threshold, it indicates that the device is offline. Thus, it is determined that the target device does not meet the binding conditions, and a target error code is generated. This target error code is used to characterize that the reason for the binding failure is that the target device is offline.

[0101] In S502-2 of this application embodiment, if the RSSI value is higher than the second threshold, it indicates that the target device is transmitting a signal, i.e., broadcasting a broadcast packet. However, the gateway cannot obtain the broadcast of the target device, which indicates that the gateway and the device are incompatible and the gateway cannot demodulate. Therefore, it is determined that the target device does not meet the binding conditions and a target error code is generated. The target error code is used to characterize that the reason for the binding failure is that the target device is incompatible.

[0102] In S501-2 of this application embodiment, after obtaining the broadcast of at least one device within a preset range in S401, if it is determined that the target broadcast packet has been received, it indicates that the target device is online and compatible. If it is determined that the target device is in a bound state according to the parsing result, it is determined that the target device does not currently meet the binding conditions. Therefore, a target error code is generated. The target error code is used to indicate that the reason for the binding failure is that the target device is in a bound state.

[0103] In the above scheme, when it is determined that the target device does not meet the binding conditions, a corresponding error code is generated, and a second response message carrying the target error code is returned to the terminal through the cloud platform. This allows the user to clearly understand the reason for the binding failure, improving the user experience. When it is determined that the broadcast packet does not contain the target broadcast packet, the RSSI value is obtained and compared with the first and second thresholds to clearly determine whether the target device is offline or incompatible. This facilitates the gateway in generating a target error code that represents the specific reason for the binding failure. When the broadcast packet contains the target broadcast packet, if it is determined that the target device is in a bound state, the binding conditions are determined not to be met, and a corresponding target error code is generated. This enables the acquisition of the specific reason for the binding failure, helping the user to understand the reason for the failure and improving the success rate of the terminal binding the target device again.

[0104] Based on the above embodiments, as an optional embodiment, a schematic diagram of the interaction flow of a device binding method is provided, such as... Figure 7 As shown, the specific content is as follows: S601. The terminal obtains the device code of the target device and obtains the device identifier of the target device based on the device code. S602, The terminal sends an instruction to the cloud platform to bind the user identifier and the device identifier and starts the timing function; S603, The cloud platform determines whether the terminal has instruction permissions based on the user identifier; S604. If the cloud platform determines that the terminal has the instruction permission, it sends a binding instruction to the gateway. S605. When the gateway determines that each verification item in the verification set passes the verification, it obtains the device identifier of the target device. S606. When the gateway determines that the target device meets the binding conditions based on the device identifier, it generates the first request. S607. The gateway sends the first request to the target device; S608. The target device establishes a binding relationship with the gateway based on the first request; S609. The target device returns a binding result indicating successful binding to the gateway; S610, the gateway sends the first response information to the terminal through the cloud platform; S611. Display the message indicating successful binding.

[0105] The device binding method provided in this application is applied to the field of IoT smart home, especially the sub-device binding scenario based on 5GCPE smart gateway, and can be extended to all IoT application fields that require device binding, such as industrial IoT and smart office.

[0106] The device binding method provided in this application embodiment allows users to complete the binding simply by scanning the device code of the device to be bound through their terminal, without the need for manual searching or input of device information. This greatly reduces the operational threshold while ensuring fast and accurate binding. The target error code provided by the gateway displays detailed reasons for binding failure and solutions, helping users quickly troubleshoot problems. It includes identification and handling solutions for various error scenarios. By setting a timeout mechanism with a preset duration, it avoids long waiting times for users and achieves real-time feedback on the binding status, ensuring that the binding process is controllable.

[0107] This application provides a terminal, such as... Figure 8 As shown, the terminal 80 may include: an acquisition module 801, a startup module 802, and a display module 803.

[0108] Specifically, the acquisition module 801 is used to acquire the device code of the target device and obtain the device identifier of the target device based on the device code; The startup module 802 is used to send a binding instruction to the cloud platform and start the timing function, so that when the cloud platform determines that the terminal has the instruction permission based on the user identifier, it sends a binding instruction to the gateway; the binding instruction includes a user identifier and a device identifier, and the binding instruction is used to instruct the gateway to bind the target device; the gateway is the gateway bound to the user identifier corresponding to the user using the terminal. The display module 803 is used to display a successful binding message if a first response message is received within a preset time after the timing function is started; the first response message is used to indicate that the binding is successful.

[0109] The terminal provided in this application embodiment obtains the device code of the target device and obtains the device identifier of the target device based on the device code. This enables accurate selection of the target device to be bound by obtaining the device code, avoiding the selection of the device to be bound from a large number of bindable devices and solving the problem of easily selecting the wrong target device to be bound.

[0110] After obtaining the device identifier, a binding instruction containing both the device identifier and the user identifier is sent via the cloud platform. This allows the cloud platform to directly forward the binding instruction to the gateway bound to the user identifier when it determines that the terminal has the necessary permissions based on the user identifier. This instructs the gateway to bind the target device. This simplifies the binding process for the target device, resolves the cumbersome procedures encountered when users perform binding operations via their terminals, and improves the user experience.

[0111] If the first response is received within the preset time after the timer function is started, a successful binding message will be displayed. By processing the first response received within the preset time after the timer function is started, the user experience is improved by avoiding long waiting times for the binding result when the binding process is slow.

[0112] This application provides a gateway, such as Figure 9 As shown, the gateway 90 may include a receiving module 901, a determining module 902, and a sending module 903.

[0113] Specifically, the receiving module 901 is used to receive the binding instruction and obtain the device identifier in the binding instruction. The binding instruction is used to instruct the gateway to bind the target device corresponding to the device identifier. The binding instruction includes a user identifier and a device identifier. The binding instruction is sent to the gateway by the cloud platform after receiving the binding instruction sent by the terminal and determining that the terminal has the instruction permission based on the user identifier. The terminal is the terminal used by the user whose user identifier is already bound to the gateway. The determination module 902 is used to send a first request to the target device to request the establishment of a binding relationship with the target device if it is determined from the device identifier that the target device meets the binding conditions. The sending module 903 is used to respond to the binding result returned by the device. If the binding result indicates that the binding is successful, it sends a first response message indicating successful binding to the terminal through the cloud platform.

[0114] The gateway provided in this application obtains the device identifier from the binding instruction sent by the receiving terminal. Since the binding instruction is sent by the cloud platform when it confirms that the terminal has the authorization to give instructions, it avoids unauthorized devices from giving instructions to the gateway, thus improving the security of device binding. After obtaining the device identifier, it first confirms whether the target device meets the binding conditions. Only when the target device meets the binding conditions will it send a first request to the target device. This avoids invalid interaction with the target device when it does not meet the binding conditions, saving the gateway's operating resources. It also avoids executing too many processes when the gateway cannot bind with the target device, thus preventing the inability to promptly provide real-time feedback on the binding status to the user. Upon receiving the binding result indicating successful binding from the target device, it returns a first response information indicating successful binding between the gateway and the target device to the terminal. This achieves timely return of the first response information upon successful binding, ensuring that the user receives the binding result in a short time and improving the efficiency of device binding.

[0115] The apparatus in this application embodiment can execute the method provided in this application embodiment, and the implementation principle is similar. The actions performed by each module in the apparatus of each embodiment of this application correspond to the steps in the method of each embodiment of this application. For detailed functional descriptions of each module of the apparatus, please refer to the descriptions in the corresponding methods shown above, which will not be repeated here.

[0116] This application provides an electronic device (computer device / equipment / system) including a memory, a processor, and a computer program stored in the memory. The processor executes the computer program to implement the steps of the device binding method. Compared with related technologies, this method can achieve the following: by obtaining the device code of the target device and obtaining the device identifier of the target device based on the device code, the accurate selection of the target device to be bound is realized by obtaining the device code, avoiding the selection of the device to be bound from a large number of bindable devices, and solving the problem that the target device to be bound is easily selected incorrectly.

[0117] After obtaining the device identifier, a binding instruction containing both the device identifier and the user identifier is sent via the cloud platform. This allows the cloud platform to directly forward the binding instruction to the gateway bound to the user identifier when it determines that the terminal has the necessary permissions based on the user identifier. This instructs the gateway to bind the target device. This simplifies the binding process for the target device, resolves the cumbersome procedures encountered when users perform binding operations via their terminals, and improves the user experience.

[0118] If the first response is received within the preset time after the timer function is started, a successful binding message will be displayed. By processing the first response received within the preset time after the timer function is started, the user experience is improved by avoiding long waiting times for the binding result when the binding process is slow.

[0119] In one alternative embodiment, an electronic device is provided, such as Figure 10 As shown, Figure 10 The illustrated electronic device 4000 includes a processor 4001 and a memory 4003. The processor 4001 and the memory 4003 are connected, for example, via a bus 4002. Optionally, the electronic device 4000 may further include a transceiver 4004, which can be used for data interaction between the electronic device and other electronic devices, such as sending and / or receiving data. It should be noted that in practical applications, the transceiver 4004 is not limited to one type, and the structure of the electronic device 4000 does not constitute a limitation on the embodiments of this application.

[0120] Processor 4001 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It can implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. Processor 4001 may also be a combination that implements computational functions, such as including one or more microprocessor combinations, a combination of a DSP and a microprocessor, etc.

[0121] Bus 4002 may include a pathway for transmitting information between the aforementioned components. Bus 4002 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. Bus 4002 can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 10 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.

[0122] The memory 4003 may be ROM (Read Only Memory) or other types of static storage devices capable of storing static information and instructions, RAM (Random Access Memory) or other types of dynamic storage devices capable of storing information and instructions, or EEPROM (Electrically Erasable Programmable Read Only Memory), CD-ROM (Compact Disc Read Only Memory) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media, other magnetic storage devices, or any other medium capable of carrying or storing computer programs and capable of being read by a computer, without limitation herein.

[0123] The memory 4003 is used to store computer programs that execute the embodiments of this application, and the execution is controlled by the processor 4001. The processor 4001 is used to execute the computer programs stored in the memory 4003 to implement the steps shown in the foregoing method embodiments.

[0124] The electronic device package may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital radio receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), and in-vehicle terminals (such as in-vehicle navigation terminals), as well as fixed terminals such as digital TVs and desktop computers. Figure 10 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of use of the embodiments disclosed herein.

[0125] This application provides a computer-readable storage medium storing a computer program. When executed by a processor, the computer program can implement the steps and corresponding content of the aforementioned method embodiments. Compared with the prior art, it achieves the following: by obtaining the device code of the target device and then obtaining the device identifier of the target device based on the device code, accurate selection of the target device to be bound is achieved by obtaining the device code, avoiding the need to select a device from among many bindable devices and solving the problem of easily selecting the wrong target device. After obtaining the device identifier, a binding instruction containing the device identifier and the user identifier is sent through the cloud platform. This allows the cloud platform to directly forward the binding instruction to the gateway bound to the user identifier when it determines that the terminal has the instruction permission based on the user identifier, thus instructing the gateway to bind the target device. This simplifies the binding process of the target device, solves the problem of cumbersome operation procedures when users perform binding operations through the terminal, and improves the user experience. If the first response information is received within a preset time after the timer function is started, a binding success message is displayed. By processing the first response information received within the preset time after the timer function is started, the user is prevented from waiting for a long time when the binding process is slow, thus improving the user binding experience.

[0126] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium, a computer-readable medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.

[0127] This application also provides a computer program product, including a computer program that, when executed by a processor, can implement the steps and corresponding content of the aforementioned method embodiments. Compared with the prior art, it achieves the following: by obtaining the device code of the target device and then obtaining the device identifier of the target device based on the device code, it enables precise selection of the target device to be bound by obtaining the device code, avoiding the need to select a device from a large number of bindable devices and solving the problem of easily selecting the wrong target device. After obtaining the device identifier, a binding instruction containing the device identifier and the user identifier is sent through the cloud platform. This allows the cloud platform to directly forward the binding instruction to the gateway bound to the user identifier when it determines that the terminal has the instruction permission based on the user identifier, thus instructing the gateway to bind the target device. This simplifies the target device binding process, solves the problem of cumbersome operation procedures when users perform binding operations through the terminal, and improves the user experience.

[0128] If the first response is received within the preset time after the timer function is started, a successful binding message will be displayed. By processing the first response received within the preset time after the timer function is started, the user experience is improved by avoiding long waiting times for the binding result when the binding process is slow.

[0129] The terms "first," "second," "third," "fourth," "1," "2," etc. (if present) 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 a sequence other than that shown in the illustrations or text descriptions.

[0130] It should be understood that although arrows indicate various operation steps in the flowcharts of this application's embodiments, the order in which these steps are implemented is not limited to the order indicated by the arrows. Unless explicitly stated herein, in some implementation scenarios of this application's embodiments, the implementation steps in each flowchart can be executed in other orders as required. Furthermore, some or all steps in each flowchart may include multiple sub-steps or multiple stages based on the actual implementation scenario. Some or all of these sub-steps or stages can be executed at the same time, and each sub-step or stage can also be executed at different times. In scenarios where execution times differ, the execution order of these sub-steps or stages can be flexibly configured according to requirements, and this application's embodiments do not limit this.

[0131] The above are only optional implementation methods for some implementation scenarios of this application. It should be noted that for those skilled in the art, other similar implementation methods based on the technical concept of this application, without departing from the technical concept of this application, also fall within the protection scope of the embodiments of this application.

Claims

1. A device binding method, characterized in that, Applied to terminals, including: Obtain the device code of the target device, and obtain the device identifier of the target device based on the device code; A binding instruction is sent to the cloud platform and a timer function is started, so that when the cloud platform determines that the terminal has the instruction permission based on the user identifier, it sends a binding instruction to the gateway; the binding instruction includes the user identifier and the device identifier, and the binding instruction is used to instruct the gateway to bind the target device; the gateway is the gateway bound to the user identifier corresponding to the user using the terminal; If the first response message is received within the preset time after the timer function is started, a message indicating successful binding will be displayed; the first response message is used to indicate successful binding.

2. The method according to claim 1, characterized in that, Following the start-up timing function, the following also includes: If a second response message is received, the target error code in the second response message is obtained; the second response message is sent when the gateway fails to bind to the target device, and the target error code is used to characterize the reason for this binding failure; Based on the target error code and a preset first association relationship, determine the target first text and target second text corresponding to the target error code; the first association relationship includes the correspondence between each error code and the first text and the second text; the first text records the reason for the binding failure, and the second text records the solution to the binding failure; Display the target first text and the target second text.

3. The method according to claim 2, characterized in that, Following the start-up timing function, the following also includes: If the first response information or the second response information sent by the gateway is not received within the preset time after the timing function is started, a prompt message will be displayed; the prompt message is used to instruct the user to check the network settings.

4. A device binding method, characterized in that, Applied to gateways, including: In response to receiving a binding instruction, the device identifier in the binding instruction is obtained; the binding instruction is used to instruct the gateway to bind the target device corresponding to the device identifier, the binding instruction includes a user identifier and the device identifier, the binding instruction is sent to the gateway after the cloud platform receives the binding instruction sent by the terminal, and the cloud platform determines that the terminal has the instruction permission based on the user identifier; the terminal is the terminal used by the user whose user identifier is already bound to the gateway. If the target device is determined to meet the binding conditions based on the device identifier, a first request is sent to the target device to request the establishment of a binding relationship with the target device; In response to the binding result returned by the target device, if the binding result indicates successful binding, a first response message indicating successful binding is sent to the terminal through the cloud platform.

5. The method according to claim 4, characterized in that, The step of obtaining the device identifier in the binding instruction includes: Each verification item in the preset verification set is verified; the verification set includes at least one verification item, which is used to verify whether the gateway can currently bind to the target device; If it is determined that each verification item in the verification set passes the verification, then the device identifier in the binding instruction is obtained; The verification set includes at least one of the following verification items: The number of devices bound to the gateway does not exceed the quantity threshold; The gateway's load is below the load threshold; The gateway did not receive a binding instruction for the target device within a preset time period; The gateway is not in a firmware upgrade state.

6. The method according to claim 5, characterized in that, The process of verifying each verification item in the preset verification set further includes: If it is determined that at least one target verification item in the verification set fails the verification, a corresponding target error code is generated according to the preset second association relationship and the at least one target verification item; the second association relationship includes the correspondence between each verification item and the error code, and the target error code is used to characterize the reason for the binding failure; The cloud platform returns a second response message to the terminal; the second response message includes the target error code, and the second response is used to indicate that the binding failed.

7. The method according to claim 4, characterized in that, The binding conditions include at least the target device being online, the gateway being compatible with the target device, and the target device being in an unbound state; The step of determining that the target device meets the binding conditions based on the device identifier, and then sending a first request to the target device, includes: Obtain broadcast packets from at least one device within a preset range; the broadcast packets include the binding status of the devices; If it is determined that the received broadcast packet includes the target broadcast packet of the target device, then it is determined that the target device is online and compatible with the target device. The target broadcast packet is then parsed to obtain the parsing result. If the parsing result determines that the target device is in an unbound state, then the first request is sent to the target device.

8. The method according to claim 7, characterized in that, The process of obtaining broadcast packets broadcast by at least one device within a preset range further includes: If it is determined that the binding conditions are not met, a corresponding target error code is generated, and a second response information is returned to the terminal through the cloud platform; the second response information includes the target error code; the second response information is used to indicate binding failure, and the target error code is used to indicate the reason for this binding failure; If it is determined that the binding conditions are not met, a corresponding target error code is generated, including: If it is determined that the received broadcast packets do not include the target broadcast packets of the target device, then the RSSI value of the current channel is obtained; If the RSSI value is lower than the first threshold or higher than the second threshold, it is determined that the binding condition is not met, and a corresponding target error code is generated. If it is determined that the received broadcast packet includes the target broadcast packet of the target device, and the target device is determined to be in a bound state based on the parsing result, then it is determined that the binding condition is not met, and the target error code is generated.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the method according to any one of claims 1-8.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method described in any one of claims 1-8.