Internet of Things equipment hybrid control method and device, electronic equipment and storage medium

By introducing multiple verification instructions and LAN backup connection channels in IoT device control, the stability problems of IoT device control when network connection is unstable and server resources are consumed are solved, and more efficient and reliable device control is achieved.

CN119728745APending Publication Date: 2025-03-28DONGGUAN DERUCCI BEDDING CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411791096.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-06
Publication Date
2025-03-28

AI Technical Summary

Technical Problem

The existing IoT device control schemes lead to a decrease in the stability and response efficiency of device control when the network connection is unstable or the server resources are consumed.

Method used

A hybrid control method for IoT devices is proposed, which comprehensively monitors network quality through multiple verification instructions (application verification instructions, gateway verification instructions and server verification instructions). The device control instructions are transmitted only when all network quality meets the preset requirements. At the same time, establish a backup connection channel based on the LAN to ensure that the equipment can be controlled stably when the network quality does not meet the requirements.

Benefits of technology

It effectively solves the problem of equipment control instability caused by network connection instability and server resource consumption, improves the stability and response efficiency of equipment control, and reduces the dependence on server resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119728745A_ABST
    Figure CN119728745A_ABST
Patent Text Reader

Abstract

The invention discloses an Internet of Things equipment hybrid control method and device, electronic equipment and a storage medium, and the method comprises the steps: obtaining equipment data of target equipment in response to an operation instruction of a target application; sending an equipment control instruction through the target application based on the equipment data; performing network quality verification on the target application, the Internet of Things gateway of the target device and the server; when the network quality meets the preset quality requirement, transmitting a device control instruction sent by the target application to the Internet of Things gateway through the server so as to perform operation control on the target device; when any network quality does not meet the quality requirement, establishing a connection channel between the target application and the Internet of Things gateway based on a preset local area network; and transmitting a device control instruction sent by the target application to the Internet of Things gateway through the connection channel so as to perform operation control on the target device. Multiple verification and standby connection channels are introduced, equipment control can be stably achieved, and the method can be widely applied to the technical field of data processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a hybrid control method, device, electronic device and storage medium for Internet of Things devices. Background Art

[0002] With the continuous advancement of Internet of Things (IoT) technology, smart IoT devices have been widely used in exhibitions, shopping malls, office buildings and other scenarios, providing users with unprecedented convenience and intelligent experience. However, in these complex and changing network environments, the instability of network connection quality has become a key factor restricting the stability of IoT device control. Most existing IoT device control solutions rely on cloud servers for remote control. This mode performs well when the network connection is stable, but once the network connection fluctuates or even interrupts, the stability and response efficiency of device control will be greatly reduced.

[0003] In addition, with the rapid increase in the number of IoT devices, the amount of message reporting has also increased, which has put tremendous pressure on server resources. When the server processes massive messages, it is not only prone to performance bottlenecks, but also may cause delays or loss of control instructions due to resource exhaustion, further exacerbating the complexity and instability of IoT device control. Summary of the invention

[0004] The main purpose of the embodiments of the present invention is to propose a hybrid control method, device, electronic device and storage medium for an Internet of Things device, in order to solve at least one problem of the prior art. The present invention can stably realize the control of the Internet of Things device.

[0005] To achieve the above object, an embodiment of the present invention provides a hybrid control method for an Internet of Things device, the method comprising:

[0006] Responding to an operation instruction of a target application, acquiring device data of a target device;

[0007] Based on the device data, a device control instruction of the target device is issued through the target application; the device control instruction carries a verification instruction; the verification instruction includes an application verification instruction, a gateway verification instruction and a server verification instruction;

[0008] In response to the application verification instruction, obtaining a first network quality of the target application;

[0009] In response to the gateway verification instruction, obtaining a second network quality of the Internet of Things gateway of the target device;

[0010] In response to the server verification instruction, obtaining a third network quality of the server;

[0011] When the network quality meets the preset quality requirements, the device control instruction issued by the target application is transmitted to the IoT gateway through the server to perform operation control on the target device; wherein the network quality includes the first network quality, the second network quality and the third network quality;

[0012] When the quality of any network does not meet the quality requirements, a connection channel between the target application and the IoT gateway is established based on the preset local area network; the device control instructions issued by the target application are transmitted to the IoT gateway through the connection channel to perform operational control on the target device.

[0013] In some embodiments, the operation instruction includes a start instruction; in response to the operation instruction of the target application, obtaining device data of the target device includes the following steps:

[0014] In response to the start instruction, start the target application, and determine whether the target application is started for the first time;

[0015] When the target application is not started for the first time, the local cache data of the target application is obtained to determine whether the local cache data is valid;

[0016] When the local cache data is valid, the local cache data is used as device data.

[0017] In some embodiments, the operation instruction further includes a data request instruction; and the method further includes the following steps:

[0018] When the local cache data is invalid, in response to the data request instruction, the cloud server interface is called to obtain the device data of the target device;

[0019] Store device data as local cache data for the target app.

[0020] In some embodiments, in response to the application verification instruction, obtaining the first network quality of the target application includes the following steps:

[0021] In response to the application verification instruction, executing a first number of Internet packet explorers to the server through the target application, and obtaining a first network quality of the target application according to all first execution results of the first number of Internet packet explorers;

[0022] Among them, the first network quality includes request status, maximum response time, average response time, minimum survival time and packet loss rate;

[0023] Among them, the quality requirements include that there is no request timeout in the request situation of the first network quality, the maximum response time is less than the first threshold, the average response time is less than or equal to the second threshold, the minimum survival time is greater than or equal to the third threshold, and the packet loss rate is 0.

[0024] In some embodiments, in response to the gateway verification instruction, obtaining the second network quality of the Internet of Things gateway of the target device includes the following steps:

[0025] In response to the gateway verification instruction, the operating status and state switching times of the Internet of Things gateway are obtained based on the heartbeat data packet sent by the Internet of Things gateway to the server;

[0026] In response to the gateway verification instruction, executing the second number of Internet packet explorers to the server through the server, and obtaining all second execution results of the second number of Internet packet explorers;

[0027] Obtaining a second network quality of the Internet of Things gateway according to the running state, the number of state switching times, and the second execution result;

[0028] The second network quality includes the running status, the number of state switching times, and the second execution result including the request status, the maximum response time, the average response time, the minimum survival time and the packet loss rate;

[0029] The quality requirements include that the operating status of the second network quality is online, the number of state switching times is greater than or equal to the fourth threshold, there is no request timeout in the request situation, the maximum response time is less than the fifth threshold, the average response time is less than or equal to the sixth threshold, the minimum survival time is greater than or equal to the seventh threshold, and the packet loss rate is 0.

[0030] In some embodiments, in response to the server verification instruction, obtaining a third network quality of the server includes the following steps:

[0031] In response to the server verification instruction, the CPU occupancy rate, memory occupancy rate and maintenance status of the server are obtained, and then the third network quality of the server is obtained;

[0032] The quality requirements include that the CPU usage is less than or equal to an eighth threshold, the memory usage is less than or equal to a ninth threshold, and the maintenance status is not in maintenance.

[0033] In some embodiments, the IoT gateway is pre-connected to a local area network; establishing a connection channel between the target application and the IoT gateway based on the preset local area network includes the following steps:

[0034] Scan all device information in the local area network through the target application; the device data includes the identification information and interface parameters of the IoT gateway of the target device; the interface parameters include the IP address, media access control address and port number;

[0035] Match and verify the interface parameters of the IoT gateway in all device information based on device data;

[0036] When the result of the matching check is a match, a connection channel of the transmission control protocol between the target application and the IoT gateway is established in the local area network based on the interface parameters; otherwise, an alarm is sent to the target application to prompt that a failure has occurred in the target device.

[0037] To achieve the above object, another aspect of an embodiment of the present invention provides a hybrid control device for an Internet of Things device, the device comprising:

[0038] The first module is used to obtain device data of a target device in response to an operation instruction of a target application;

[0039] The second module is used to issue a device control instruction of the target device through the target application based on the device data; the device control instruction carries a verification instruction; the verification instruction includes an application verification instruction, a gateway verification instruction and a server verification instruction;

[0040] A third module is used to obtain a first network quality of a target application in response to an application verification instruction;

[0041] A fourth module is used to obtain a second network quality of the Internet of Things gateway of the target device in response to the gateway verification instruction;

[0042] A fifth module is used to obtain a third network quality of the server in response to the server verification instruction;

[0043] The sixth module is used for transmitting the device control instruction issued by the target application to the IoT gateway through the server to operate and control the target device when the network quality meets the preset quality requirements; wherein the network quality includes the first network quality, the second network quality and the third network quality;

[0044] The seventh module is used to establish a connection channel between the target application and the IoT gateway based on a preset local area network when any network quality does not meet the quality requirements; the device control instructions issued by the target application are transmitted to the IoT gateway through the connection channel to operate and control the target device.

[0045] To achieve the above objective, another aspect of an embodiment of the present invention provides an electronic device, the electronic device comprising a memory and a processor, the memory storing a computer program, and the processor implementing the above method when executing the computer program.

[0046] To achieve the above objective, another aspect of an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the above method is implemented.

[0047] The present invention provides a hybrid control method, device, electronic device and storage medium for Internet of Things devices. The scheme obtains device data of a target device by responding to an operation instruction of a target application; based on the device data, a device control instruction of the target device is issued by the target application; the device control instruction carries a verification instruction; the verification instruction includes an application verification instruction, a gateway verification instruction and a server verification instruction; in response to the application verification instruction, a first network quality of the target application is obtained; in response to the gateway verification instruction, a second network quality of the Internet of Things gateway of the target device is obtained; in response to the server verification instruction, a third network quality of the server is obtained; when the network quality meets the preset quality requirements, the device control instruction issued by the target application is transmitted to the Internet of Things gateway through the server to perform operation control on the target device; wherein the network quality includes the first network quality, the second network quality and the third network quality; when any network quality does not meet the quality requirements, a connection channel between the target application and the Internet of Things gateway is established based on a preset local area network; the device control instruction issued by the target application is transmitted to the Internet of Things gateway through the connection channel to perform operation control on the target device. The embodiments of the present invention include at least the following beneficial effects:

[0048] The method of the present invention comprehensively monitors the network quality of the target application, the Internet of Things gateway and the server by introducing multiple verification instructions (including application verification instructions, gateway verification instructions and server verification instructions). Only when all network qualities meet the preset quality requirements, the device control instructions are transmitted to the Internet of Things gateway through the server to ensure the stability and efficiency of the control.

[0049] At the same time, the technical solution of the present invention also proposes a backup connection channel solution based on a preset local area network. When the quality of any network does not meet the quality requirements, a direct connection channel between the target application and the IoT gateway can be quickly established, and the device control instructions are transmitted through the channel, thereby effectively avoiding the impact of unstable network connection on device control. This backup connection channel solution not only improves the flexibility of device control, but also reduces dependence on server resources, further improving the stability and reliability of the entire IoT device control system.

[0050] To sum up, this technical solution effectively solves the problems of unstable network connection and large server resource consumption in the existing IoT device control solution by introducing multiple verification instructions and backup connection channel solutions, and provides a new solution for the stable control of IoT devices in complex network environments. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] Figure 1 It is a flow chart of a hybrid control method of an Internet of Things device provided by an embodiment of the present invention;

[0052] Figure 2is a schematic diagram of an example of data obtained by a PING command provided in an embodiment of the present invention;

[0053] Figure 3 An example diagram of the overall process of the hybrid control method for Internet of Things devices provided by an embodiment of the present invention;

[0054] Figure 4 A schematic diagram of the structure of a hybrid control device for an Internet of Things device provided by an embodiment of the present invention;

[0055] Figure 5 It is a schematic diagram of the hardware structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0056] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the embodiments of the present invention. They are only examples of devices and methods consistent with some aspects of the embodiments of the present invention as detailed in the attached claims.

[0057] It is understood that the terms "first", "second", etc. used in the present invention may be used herein to describe various concepts, but unless otherwise specified, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another. For example, without departing from the scope of the embodiments of the present invention, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the words "if" and "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0058] The terms "at least one", "multiple", "each", "any", etc. used in the present invention, at least one includes one, two or more, multiple includes two or more, each refers to each of the corresponding multiple, and any refers to any one of the multiple.

[0059] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which the present invention belongs. The terms used herein are only for the purpose of describing the embodiments of the present invention and are not intended to limit the present invention.

[0060] The hybrid control method of the Internet of Things device provided by the embodiment of the present invention relates to the field of data processing technology. The hybrid control method of the Internet of Things device provided by the embodiment of the present invention can be applied to a terminal, can also be applied to a server, and can also be software running in a terminal or a server. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, and a car terminal, etc., but is not limited to this; the server side can be configured as an independent physical server, or it can be configured as a server cluster or a distributed system composed of multiple physical servers, and can also be configured as a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The server can also be a node server in a blockchain network; the software can be an application that implements the hybrid control method of the Internet of Things device, etc., but is not limited to the above forms.

[0061] The present invention can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present invention can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present invention can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.

[0062] Figure 1 is an optional flow chart of the hybrid control method for Internet of Things devices provided by an embodiment of the present invention. Figure 1 The method may include but is not limited to steps S100 to S700.

[0063] S100, acquiring device data of a target device in response to an operation instruction of a target application;

[0064] It should be noted that the operating instructions include startup instructions; in some embodiments, obtaining device data of the target device in response to the operating instructions of the target application may include the following steps: in response to the startup instruction, starting the target application, and determining whether the target application is started for the first time; when the target application is not started for the first time, obtaining the local cache data of the target application, and determining whether the local cache data is valid; when the local cache data is valid, using the local cache data as device data.

[0065] Among them, in some embodiments, the operation instruction may also include a data request instruction; the method may also include the following steps: when the local cache data is invalid, in response to the data request instruction, calling the cloud server interface to obtain the device data of the target device; storing the device data as local cache data of the target application.

[0066] For example, in some specific implementations, device data can be obtained through a mobile APP, and the specific process steps can be implemented as follows:

[0067] 1.1 Is this your first time opening the app? If yes, proceed to step 1.3; if no, proceed to the next step;

[0068] 1.2 Is the APP local cache data valid? If yes, determine the device data through the local cache data; if no, proceed to step 1.3;

[0069] 1.3 Obtain device data (HTTP request cloud server interface) and store it in local cache.

[0070] It should be noted that in some specific application scenarios: examples of HTTP interface request parameters and returned data are as follows:

[0071] (1) Request example:

[0072] GET / api / getDeviceData? familyId=6736&userId=12345HTTP / 1.1;

[0073] (2) Example of successful response:

[0074]

[0075] (3) Failure response example:

[0076]

[0077]

[0078] (4) Request parameter examples are shown in Table 1:

[0079] Table 1

[0080] Parameter name type Is this field required? describe familyId number yes Family ID, used to distinguish different family device groups. userId number yes User ID, used to identify the user making the request

[0081] (5) Response parameters:

[0082] Response status code: 200 indicates success, other status codes indicate different error conditions.

[0083] Response content:

[0084] code: numeric type, indicating the response status code, 200 means success.

[0085] msg: string type, indicating the response message, such as "success" or "failure reason description".

[0086] data: array type, containing device data objects.

[0087] deviceId: string type, unique device identifier.

[0088] deviceName: string type, device name, such as "Living Room Gateway".

[0089] deviceModel: string type, device model, such as "derucci-geteway".

[0090] version: string type, device software version number, such as "0.0.8".

[0091] onlineState: digital type, device online status, 1 means online, 0 means offline.

[0092] network: digital type, network signal strength value (the specific meaning can be defined according to actual conditions).

[0093] S200, issuing a device control instruction of the target device through the target application based on the device data;

[0094] Among them, the device control instruction carries a verification instruction; the verification instruction includes an application verification instruction, a gateway verification instruction and a server verification instruction;

[0095] For example, in some specific implementations, in systems such as the Internet of Things (IoT) or smart homes, device data is critical. Such data generally includes device identification parameters, status, sensor readings, user settings, etc. After such data is collected and processed, the system may issue device control instructions based on such data to change the status or behavior of the device.

[0096] In order to ensure the accuracy and security of these control instructions, verification instructions are usually embedded in the instructions. Verification instructions are additional information used to verify the network quality of each intermediate component involved in the network communication link of the instruction during the instruction transmission and reception process.

[0097] S300, in response to an application verification instruction, obtaining a first network quality of a target application;

[0098] It should be noted that, in some embodiments, in response to an application verification instruction, obtaining the first network quality of the target application may include the following steps: in response to the application verification instruction, executing the first number of Internet packet explorers to the server through the target application, and obtaining the first network quality of the target application according to all first execution results of the first number of Internet packet explorers; wherein the first network quality includes request status, maximum response time, average response time, minimum survival time and packet loss rate; wherein the quality requirements include that there is no request timeout in the request status of the first network quality, the maximum response time is less than the first threshold, the average response time is less than or equal to the second threshold, the minimum survival time is greater than or equal to the third threshold, and the packet loss rate is 0.

[0099] For example, in some specific implementations, checking the quality of the mobile APP network connection can be implemented as follows:

[0100] 3.1 You can use the APP command to PING (Internet Packet Explorer) the server 10 times (that is, the first number, which can be adjusted according to actual needs. The various thresholds of subsequent applications are based on actual values ​​as an example. Similarly, they can also be adjusted according to actual needs. I will not go into details one by one).

[0101] It should be noted that PING (Packet Internet Groper), also known as Internet Packet Explorer in Chinese, is a computer network management application. This program is usually used to confirm whether a host on the Internet is reachable. PING is a service command that works at the application layer in the TCP / IP network architecture. Its principle is to send an ICMP (Internet Control Message Protocol) Echo Request message to a specific destination host, and based on the returned ICMP Echo Reply message, test whether the destination is reachable and obtain relevant status information such as the packet loss rate and average round-trip time of the connection. Figure 2 As shown in the figure, the key data obtained through the PING command are as follows:

[0102] (1) TTL: Time to Live, which specifies the maximum number of hops a data packet can go through in the network. The TTL value decreases by 1 every time it passes through a router. When the TTL decreases to 0, the data packet will be discarded.

[0103] (2) transmitted: number of packets sent;

[0104] (3) received: number of received packets;

[0105] (4)packet loss: packet loss rate (transmitted-received) / transmitted;

[0106] (5) time: round trip time of data packet (response time);

[0107] 3.2 Is there a request timeout? If yes, it is determined that the first network quality does not meet the quality requirements; if no, proceed to the next step;

[0108] Note: Request timeout, for example, appears in the process of echoing request and response: Request timeout for icmp_seq1;

[0109] 3.3 Is the maximum response time >= 200ms? If yes, the first network quality is determined to be not in compliance with the quality requirements; if no, proceed to the next step

[0110] Note: This is determined based on the maximum value of the time field returned by PING.

[0111] 3.4 Average response time > 150ms? If yes, the first network quality is judged not to meet the quality requirements; if no, proceed to the next step

[0112] Note: This is determined based on the average value of the time field returned by PING.

[0113] 3.5 Is the minimum TTL (default value 128) < 25? If yes, the first network quality is determined to be not in compliance with the quality requirements; if no, proceed to the next step

[0114] Note: This is determined based on the minimum value of the TTL field returned by PING.

[0115] 3.6 Calculate the packet loss rate between the APP and the server > 0? If yes, it is determined that the first network quality does not meet the quality requirements; if no, proceed to the subsequent steps.

[0116] Note: Packet loss: Packet loss rate = (transmitted-received) / transmitted.

[0117] S400, in response to the gateway verification instruction, obtaining a second network quality of the Internet of Things gateway of the target device;

[0118] It should be noted that, in some embodiments, in response to a gateway verification instruction, obtaining the second network quality of the Internet of Things gateway of the target device may include the following steps: in response to the gateway verification instruction, obtaining the operating status and number of state switching times of the Internet of Things gateway based on the heartbeat data packet sent by the Internet of Things gateway to the server; in response to the gateway verification instruction, executing a second number of Internet packet explorers to the server through the server, and obtaining all second execution results of the second number of Internet packet explorers; obtaining the second network quality of the Internet of Things gateway according to the operating status, the number of state switching times and the second execution result; wherein the second network quality includes the operating status, the number of state switching times and the request status, maximum response time, average response time, minimum survival time and packet loss rate included in the second execution result; the quality requirements include that the operating status of the second network quality is online, the number of state switching times is greater than or equal to the fourth threshold, there is no request timeout in the request status, the maximum response time is less than the fifth threshold, the average response time is less than or equal to the sixth threshold, the minimum survival time is greater than or equal to the seventh threshold and the packet loss rate is 0.

[0119] For example, in some specific implementations, the cloud server interface may be requested to assist in verifying the network connection quality of the IoT gateway (which may be a ZigBee gateway), which may be implemented as follows:

[0120] 4.1 Is the gateway device online? If yes, proceed to the next step; if no, the second network quality is judged not to meet the quality requirements;

[0121] It should be noted that: IoT gateway devices are in an offline mechanism;

[0122] (1) The IoT gateway device periodically (every 5 seconds) sends a heartbeat data packet to the cloud server (including: device MAC, command type, firmware version, current network signal strength, LAN IP address, etc.);

[0123] (2) After receiving the message, the cloud server marks the device as online in the redis middleware (and sets the expiration time to 5 seconds, which will be automatically cleared after the expiration), and records the heartbeat data packet to the time series database;

[0124] 4.2 Has the number of times the device has been offline and online (i.e., the number of state switching) in the last hour been less than 1? If yes, the second network quality is determined to not meet the quality requirements; if no, proceed to the next step;

[0125] 4.3 The cloud server uses the command PING IoT gateway device 10 times; it should be noted that the parameter information and judgment basis involved in the cloud server using the command PING IoT gateway device are the same as those of the aforementioned APP using the command PING server, and the logical details are not elaborated here.

[0126] 4.4 Is there a request timeout? If yes, it is determined that the second network quality does not meet the quality requirements; if no, proceed to the next step;

[0127] 4.5 Is the maximum response time >= 200ms? If yes, the second network quality is determined to be not in compliance with the quality requirements; if no, proceed to the next step;

[0128] 4.6 Average response time > 150ms? If yes, the second network quality is judged not to meet the quality requirements; if no, proceed to the next step;

[0129] 4.7 Is the minimum TTL (default value 128) < 25? If yes, the second network quality is determined to be not in compliance with the quality requirements; if no, proceed to the next step;

[0130] 4.8 Is the packet loss rate between the IoT device and the server calculated > 0? If yes, it is determined that the second network quality does not meet the quality requirements; if no, proceed to the subsequent steps.

[0131] S500, in response to the server verification instruction, obtaining a third network quality of the server;

[0132] It should be noted that, in some embodiments, in response to a server verification instruction, obtaining the third network quality of the server may include the following steps: in response to a server verification instruction, obtaining the CPU occupancy rate, memory occupancy rate and maintenance status of the server, and then arbitrarily obtaining the third network quality of the server; wherein, the quality requirements include the CPU occupancy rate being less than or equal to the eighth threshold, the memory occupancy rate being less than or equal to the ninth threshold, and the maintenance status being not under maintenance.

[0133] For example, in some specific implementations, the server real-time information may be requested to determine the third network quality of the server, which may be implemented as follows:

[0134] 5.1 Is the server CPU usage > 80%? If yes, the third network quality is judged not to meet the quality requirements; if no, proceed to the next step;

[0135] 5.2 Is the server memory usage > 85%? If yes, the third network quality is judged not to meet the quality requirements; if no, proceed to the next step;

[0136] 5.3 Is it the server maintenance time (configured by the operation and maintenance personnel in the backend)? If yes, it is determined that the third network quality does not meet the quality requirements; if no, proceed to the subsequent steps.

[0137] S600: When the network quality meets the preset quality requirements, the device control instruction issued by the target application is transmitted to the IoT gateway through the server to perform operation control on the target device;

[0138] The network quality includes the first network quality, the second network quality and the third network quality;

[0139] For example, in some specific implementations, if the network quality of each node involved in the communication connection from the target application to the target device meets the requirements, the device control instruction issued by the target application can be forwarded to the IoT gateway via the server to achieve the purpose of controlling the target device.

[0140] S700. When any network quality does not meet the quality requirements, a connection channel between the target application and the IoT gateway is established based on a preset local area network; a device control instruction issued by the target application is transmitted to the IoT gateway through the connection channel to perform operation control on the target device.

[0141] It should be noted that the Internet of Things gateway is pre-connected to the local area network; in some embodiments, establishing a connection channel between the target application and the Internet of Things gateway based on the preset local area network may include the following steps: scanning all device information in the local area network through the target application; the device data includes the identification information and interface parameters of the Internet of Things gateway of the target device; the interface parameters include the IP address, media access control address and port number; based on the device data, the interface parameters of the Internet of Things gateway in all device information are matched and checked; when the result of the matching check is a match, a connection channel of the transmission control protocol between the target application and the Internet of Things gateway is established in the local area network based on the interface parameters; otherwise, an alarm is sent to the target application to prompt that the target device has a fault.

[0142] For example, in some specific implementations, the offline control mode can be implemented by sending instructions through a local area network, which can be implemented as follows:

[0143] 6.1 Get all device information of the current LAN:

[0144] Note: Scan the IP address and MAC address of the device in the current LAN;

[0145] 6.2 Does it match the device LAN IP and MAC address information (included in the device data obtained in the previous step)?

[0146] If yes, go to step 6.4; if no, go to step 6.3;

[0147] 6.3 Tip: Device or network failure, please check; End;

[0148] 6.4 APP establishes a TCP connection channel with the device;

[0149] The establishment of a TCP connection channel can be achieved as follows:

[0150] (1) Initiate a connection request: The APP encapsulates the connection request into a TCP message based on the IP address and port number of the IoT gateway device (which is set to port 8000 at the factory) and sends it to the local area network. It then waits for a reply (if no reply is received within 500ms, it will retry, with a maximum of 10 retries).

[0151] (2) Processing the connection response: After receiving the connection request, the IoT gateway device returns a connection response message segment (including a status code); the APP checks the response status code and the connection is successfully established;

[0152] (3) Manage connection status: The APP sends a heartbeat packet to the IoT gateway every 2 seconds. If no heartbeat reply is received for more than 2 seconds, there is a connection problem. The APP closes the connection and then proceeds to step (1) to initiate a connection. When the user actively exits the APP or does not perform any operation in the APP for more than 5 minutes, the APP actively sends a connection closing request. After receiving the closing request, the IoT gateway device closes the connection.

[0153] 6.5APP uses TCP channel to send target instructions and ends.

[0154] In some practical application scenarios, taking the control of a smart mattress as an example, the overall data flow of the technical solution of the present invention can be implemented as follows:

[0155] Suppose there is a smart mattress system at home, which can be controlled by a mobile phone APP (such as "Smart Mattress APP"). Now, this APP, smart mattress device, and the communication process between them involve the technical content described above.

[0156] 1. Get device data:

[0157] When the "Smart Mattress APP" is opened, it will first try to obtain the device data of the smart mattress device (such as parameter configuration information of the mattress and its corresponding IoT gateway, etc.); in some preferred implementations, the device data may also include the current status of the smart mattress device, such as whether the light is on, what the brightness is, etc.

[0158] 2. Issue device control instructions:

[0159] If you want to control the hardness of the mattress through the APP, you can click a "hardness increase" or "hardness decrease" button on the APP. At this time, the APP will generate a device control instruction, which is to tell the smart mattress device to "increase the hardness" or "reduce the hardness". Moreover, in order to ensure the security and accuracy of the instruction, this instruction will also be accompanied by a verification instruction, including application verification instructions, gateway verification instructions and server verification instructions.

[0160] 3. The function of verification instruction:

[0161] Application verification command: Check whether the network connection of the "Smart Mattress APP" is stable, that is, the first network quality.

[0162] Gateway verification command: Check whether the network connection of the IoT gateway at home (this gateway is the bridge connecting smart devices and the Internet) is stable, that is, the second network quality.

[0163] Server verification instruction: Check whether the network connection of the "Smart Mattress APP" server (this server is responsible for handling the communication between the APP and the smart device) is stable, that is, the third network quality.

[0164] 4. Determination of network quality:

[0165] If the quality of these three networks meets the preset quality requirements, such as low latency and low packet loss rate, the server will transmit the device control command to the smart mattress device through the IoT gateway to turn off the lights.

[0166] However, if the quality of any of the networks does not meet the requirements, such as the APP's network connection is unstable, then in order to ensure that the instructions can be successfully transmitted, the system will establish a connection channel through a preset local area network (such as the home Wi-Fi network), allowing the APP and the IoT gateway to communicate directly, and then transmit the instructions to the smart mattress device.

[0167] In this way, even when the network is unstable, the smart mattress device at home can be successfully controlled through the "Smart Mattress APP".

[0168] In order to explain the principle of the technical solution of the present invention in detail, the overall process of the present invention is described below in combination with some specific embodiments. It is easy to understand that the following is an explanation of the technical principle of the present invention and cannot be regarded as a limitation of the present invention.

[0169] First of all, it should be noted that with the rapid development of Internet of Things technology, smart IoT (Internet of Things) devices are widely used in exhibitions, shopping malls, office buildings and other scenarios. However, in these complex network environments, the quality of network connection is often unstable, resulting in the lack of stability in IoT device control, which greatly affects the user experience and device response efficiency. At present, the existing IoT device control mainly relies on cloud servers for remote control, but once the network connection is unstable or even interrupted, device control will be difficult to achieve effectively. In addition, a large number of IoT devices will consume a lot of server resources due to their large number and large amount of message reporting, further exacerbating the complexity and instability of control.

[0170] In view of this, the present invention provides a hybrid control method for Internet of Things devices, such as Figure 3 As shown, in some specific application scenarios, the technical solution of the present invention can be implemented as follows:

[0171] 1. Mobile APP obtains device data:

[0172] 1.1 Is this your first time opening the app? If yes, proceed to step 1.3; if no, proceed to the next step;

[0173] 1.2 Is the APP local cache data valid? If yes, go to step 2; if no, go to step 1.3; 1.3 Get device data (HTTP request cloud server interface) and store it in the local cache;

[0174] Note: HTTP interface request parameters and return data:

[0175] (1) Request example:

[0176] GET / api / getDeviceData? familyId=6736&userId=12345HTTP / 1.1;

[0177] (2) Example of successful response:

[0178]

[0179] (3) Failure response example:

[0180]

[0181] (4) Request parameters refer to the above Table 1;

[0182] (5) Response parameters:

[0183] Response status code: 200 indicates success, other status codes indicate different error conditions.

[0184] Response content:

[0185] code: numeric type, indicating the response status code, 200 means success.

[0186] msg: string type, indicating the response message, such as "success" or "failure reason description".

[0187] data: array type, containing device data objects.

[0188] deviceId: string type, unique device identifier.

[0189] deviceName: string type, device name, such as "Living Room Gateway".

[0190] deviceModel: string type, device model, such as "derucci-geteway".

[0191] version: string type, device software version number, such as "0.0.8".

[0192] onlineState: digital type, device online status, 1 means online, 0 means offline.

[0193] network: digital type, network signal strength value (the specific meaning can be defined according to actual conditions).

[0194] 2. Send device control instructions;

[0195] 3. Verify the quality of the mobile APP network connection:

[0196] 3.1APP uses command PING server 10 times;

[0197] Note: The key data obtained through the ping command are as follows:

[0198] (1) TTL: Time to Live, which specifies the maximum number of hops a data packet can go through in the network. The TTL value decreases by 1 every time it passes through a router. When the TTL decreases to 0, the data packet will be discarded.

[0199] (2) transmitted: number of packets sent;

[0200] (3) received: number of received packets;

[0201] (4)packet loss: packet loss rate (transmitted-received) / transmitted;

[0202] (5) time: round trip time of data packet (response time);

[0203] 3.2 Is there a request timeout? If yes, go to step 6; if no, go to the next step;

[0204] Note: For example, Request timeout for icmp_seq 1 appears;

[0205] 3.3 Maximum response time >= 200ms? If yes, go to step 6; if no, go to the next step;

[0206] Note: Determine based on the time field returned by ping;

[0207] 3.4 Average response time > 150ms? If yes, go to step 6; if no, go to the next step;

[0208] Note: Determine based on the time field returned by ping;

[0209] 3.5 Is the minimum TTL (default value 128) < 25? If yes, go to step 6; if no, go to the next step;

[0210] Note: Determine based on the TTL field returned by ping;

[0211] 3.6 Calculate the packet loss rate between APP and server > 0? If yes, go to step 6; if no, go to the next step;

[0212] Note: (4) Packet loss: Packet loss rate = (transmitted-received) / transmitted;

[0213] 4. Verify the network connection quality of the IoT gateway; request the cloud server interface:

[0214] 4.1 Is the gateway device online? If yes, proceed to the next step; if no, proceed to step 6;

[0215] Note: IoT gateway device is in offline mechanism;

[0216] (1) The IoT gateway device periodically (every 5 seconds) sends a heartbeat data packet to the cloud server (including: device MAC, command type, firmware version, current network signal strength, LAN IP address, etc.);

[0217] (2) After receiving the message, the cloud server marks the device as online in the redis middleware (and sets the expiration time to 5 seconds, which will be automatically cleared after the expiration), and records the heartbeat data packet to the time series database;

[0218] 4.2 Has the number of gateway device offline and online times in the last hour been less than 1? If yes, proceed to step 6; if no, proceed to the next step;

[0219] 4.3 The cloud server uses the command PING IoT gateway device 10 times;

[0220] 4.4 Is there a request timeout? If yes, go to step 6; if no, go to the next step;

[0221] 4.5 Is the maximum response time >= 200ms? If yes, go to step 6; if no, go to the next step;

[0222] 4.6 Average response time > 150ms? If yes, go to step 6; if no, go to the next step;

[0223] 4.7 Is the minimum TTL (default value 128) < 25? If yes, go to step 6; if no, go to the next step;

[0224] 4.8 Calculate the packet loss rate between IoT devices and servers > 0? If yes, proceed to step 6; if no, proceed to the next step;

[0225] 5. Request server real-time information:

[0226] 5.1 Is the server CPU usage > 80%? If yes, proceed to step 6; if no, proceed to the next step;

[0227] 5.2 Is the server memory usage > 85%? If yes, proceed to step 6; if no, proceed to the next step;

[0228] 5.3 Is it the server maintenance time (configured by the operation and maintenance personnel in the backend)? If yes, go to step 6; if no, go to the next step

[0229] 5.4 Online control mode: send command through cloud network and end;

[0230] 6. Offline control method: send instructions through LAN:

[0231] 6.1 Get all device information of the current LAN;

[0232] Note: Scan the IP address and MAC address of the device in the current LAN;

[0233] 6.2 Does it match the device LAN IP and MAC address information (obtained in step 1)?

[0234] If yes, go to step 6.4; if no, go to step 6.3;

[0235] 6.3 Tip: Device or network failure, please check; End;

[0236] 6.4 APP establishes a TCP connection channel with the device;

[0237] Note: (1) Initiate a connection request: The APP encapsulates the connection request into a TCP message based on the IP address and port number of the IoT gateway device (which is set to port 8000 at the factory) and sends it to the LAN; then waits for a reply (if no reply is received within 500ms, the APP will retry, with a maximum of 10 retries);

[0238] (2) Processing the connection response: After receiving the connection request, the IoT gateway device returns a connection response message segment (including a status code); the APP checks the response status code and the connection is successfully established;

[0239] (3) Manage connection status: The APP sends a heartbeat packet to the IoT gateway every 2 seconds. If no heartbeat reply is received within 2 seconds, there is a connection problem. The APP closes the connection and then proceeds to step (1) to initiate a connection. When the user actively exits the APP or does not perform any operation in the APP for more than 5 minutes, the APP actively sends a connection closing request. After receiving the closing request, the IoT gateway device closes the connection.

[0240] 6.5APP uses TCP channel to send target instructions and ends.

[0241] In summary, the present invention aims to provide an online and offline hybrid control method and system for intelligent IoT devices based on ZigBee gateway. Its main purpose is to solve the problem of unstable control of IoT devices in complex network environments, thereby improving user experience and improving device response efficiency. At the same time, the method and system can save CPU and memory resources of the server, achieving the goal of reducing costs and increasing efficiency.

[0242] Compared with the prior art, the present invention has at least the following beneficial effects:

[0243] 1. Effectively overcome the dilemma of unstable control of IoT devices in complex network environments, significantly improve user experience, and ensure the reliability and stability of device control.

[0244] 2. With the automatic switching control method, the response speed of the equipment is greatly improved, and fast and accurate equipment control is achieved.

[0245] 3. It is widely used in exhibitions, shopping malls, office buildings and other scenarios. It has strong versatility and broad application prospects, and provides efficient solutions for the control of smart IoT devices in different fields.

[0246] 4. It can save IoT cloud server resources, reduce costs while improving efficiency, and achieve good results of reducing costs and increasing efficiency.

[0247] See also Figure 4The embodiment of the present invention further provides an IoT device hybrid control device 900, which can implement the above IoT device hybrid control method. The device includes:

[0248] The first module 901 is used to obtain device data of a target device in response to an operation instruction of a target application;

[0249] The second module 902 is used to issue a device control instruction of the target device through the target application based on the device data; the device control instruction carries a verification instruction; the verification instruction includes an application verification instruction, a gateway verification instruction and a server verification instruction;

[0250] The third module 903 is used to obtain a first network quality of a target application in response to an application verification instruction;

[0251] The fourth module 904 is used to obtain the second network quality of the Internet of Things gateway of the target device in response to the gateway verification instruction;

[0252] The fifth module 905 is used to obtain a third network quality of the server in response to the server verification instruction;

[0253] The sixth module 906 is used to transmit the device control instruction issued by the target application to the Internet of Things gateway through the server to operate and control the target device when the network quality meets the preset quality requirements; wherein the network quality includes the first network quality, the second network quality and the third network quality;

[0254] The seventh module 907 is used to establish a connection channel between the target application and the Internet of Things gateway based on a preset local area network when any network quality does not meet the quality requirements; transmit the device control instructions issued by the target application to the Internet of Things gateway through the connection channel to operate and control the target device.

[0255] It can be understood that the contents of the above method embodiments are all applicable to the present device embodiments, the functions specifically implemented by the present device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.

[0256] The embodiment of the present invention further provides an electronic device, the electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the above-mentioned Internet of Things device hybrid control method when executing the computer program. The electronic device can be any intelligent terminal including a tablet computer, a car computer, etc.

[0257] It can be understood that the contents of the above method embodiments are all applicable to the present device embodiments, the functions specifically implemented by the present device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.

[0258] See also Figure 5 , Figure 5 The hardware structure of an electronic device 1000 of another embodiment is illustrated. The electronic device includes:

[0259] The processor 1001 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present invention;

[0260] The memory 1002 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 1002 can store an operating system and other application programs. When the technical solution provided in the embodiment of this specification is implemented by software or firmware, the relevant program code is stored in the memory 1002, and the processor 1001 calls and executes the hybrid control method of the Internet of Things device of the embodiment of the present invention;

[0261] Input / output interface 1003, used to implement information input and output;

[0262] The communication interface 1004 is used to realize the communication interaction between the device and other devices. The communication can be realized through a wired manner (such as USB, network cable, etc.) or a wireless manner (such as mobile network, WIFI, Bluetooth, etc.);

[0263] A bus 1005 , which transmits information between various components of the device (e.g., the processor 1001 , the memory 1002 , the input / output interface 1003 , and the communication interface 1004 );

[0264] The processor 1001 , the memory 1002 , the input / output interface 1003 and the communication interface 1004 are connected to each other in communication within the device via the bus 1005 .

[0265] An embodiment of the present invention further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the above-mentioned hybrid control method of the Internet of Things device is implemented.

[0266] It can be understood that the contents of the above method embodiments are all applicable to the present storage medium embodiments, the functions specifically implemented by the present storage medium embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.

[0267] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0268] The embodiments of the present invention provide a hybrid control method for IoT devices, a hybrid control device for IoT devices, an electronic device, and a storage medium. The method obtains device data of a target device by responding to an operation instruction of a target application; based on the device data, a device control instruction of a target device is issued through a target application; the device control instruction carries a verification instruction; the verification instruction includes an application verification instruction, a gateway verification instruction, and a server verification instruction; in response to the application verification instruction, a first network quality of the target application is obtained; in response to the gateway verification instruction, a second network quality of the IoT gateway of the target device is obtained; in response to the server verification instruction, a third network quality of the server is obtained; when the network quality meets the preset quality requirements, the device control instruction issued by the target application is transmitted to the IoT gateway through the server to perform operation control on the target device; wherein the network quality includes the first network quality, the second network quality, and the third network quality; when any network quality does not meet the quality requirements, a connection channel between the target application and the IoT gateway is established based on a preset local area network; the device control instruction issued by the target application is transmitted to the IoT gateway through the connection channel to perform operation control on the target device. The embodiments of the present invention at least include the following

[0269] Beneficial effects:

[0270] The method of the present invention comprehensively monitors the network quality of the target application, the Internet of Things gateway and the server by introducing multiple verification instructions (including application verification instructions, gateway verification instructions and server verification instructions). Only when all network qualities meet the preset quality requirements, the device control instructions are transmitted to the Internet of Things gateway through the server to ensure the stability and efficiency of the control.

[0271] At the same time, the technical solution of the present invention also proposes a backup connection channel solution based on a preset local area network. When the quality of any network does not meet the quality requirements, a direct connection channel between the target application and the IoT gateway can be quickly established, and the device control instructions are transmitted through the channel, thereby effectively avoiding the impact of unstable network connection on device control. This backup connection channel solution not only improves the flexibility of device control, but also reduces dependence on server resources, further improving the stability and reliability of the entire IoT device control system.

[0272] To sum up, this technical solution effectively solves the problems of unstable network connection and large server resource consumption in the existing IoT device control solution by introducing multiple verification instructions and backup connection channel solutions, and provides a new solution for the stable control of IoT devices in complex network environments.

[0273] The embodiments described in the embodiments of the present invention are intended to more clearly illustrate the technical solutions of the embodiments of the present invention, and do not constitute a limitation on the technical solutions provided by the embodiments of the present invention. Those skilled in the art can appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of the present invention are also applicable to similar technical problems.

[0274] Those skilled in the art will appreciate that the technical solutions shown in the figures do not limit the embodiments of the present invention and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.

[0275] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0276] Those skilled in the art will appreciate that all or some of the steps, devices, and functional modules / units in the above disclosed methods may be implemented as software, firmware, hardware, or a suitable combination thereof.

[0277] The terms "first", "second", "third", "fourth", etc. (if any) in the description of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, device, product or equipment that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or equipment.

[0278] It should be understood that in the present invention, "at least one (item)" refers to one or more, and "plurality" refers to two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can represent: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.

[0279] In the several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the above units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0280] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0281] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0282] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including multiple instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods of various embodiments of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc., various media that can store programs.

[0283] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the rights of the embodiments of the present invention is not limited thereby. Any modification, equivalent substitution and improvement made by those skilled in the art without departing from the scope and essence of the embodiments of the present invention shall be within the scope of the rights of the embodiments of the present invention.

Claims

1. A hybrid control method for Internet of Things devices, characterized in that: The method comprises the following steps: Responding to an operation instruction of a target application, acquiring device data of a target device; Based on the device data, issuing a device control instruction of the target device through the target application; the device control instruction carries a verification instruction; the verification instruction includes an application verification instruction, a gateway verification instruction and a server verification instruction; In response to the application verification instruction, obtaining a first network quality of the target application; In response to the gateway verification instruction, obtaining a second network quality of the Internet of Things gateway of the target device; In response to the server verification instruction, obtaining a third network quality of the server; When the network quality meets the preset quality requirements, the device control instruction issued by the target application is transmitted to the IoT gateway through the server to perform operation control on the target device; wherein the network quality includes the first network quality, the second network quality and the third network quality; When the quality of any of the networks does not meet the quality requirements, a connection channel between the target application and the Internet of Things gateway is established based on a preset local area network; the device control instructions issued by the target application are transmitted to the Internet of Things gateway through the connection channel to perform operation control on the target device.

2. The hybrid control method of Internet of Things devices according to claim 1, characterized in that: The operation instruction includes a start instruction; the step of obtaining device data of the target device in response to the operation instruction of the target application includes the following steps: In response to the start instruction, start the target application, and determine whether the target application is started for the first time; When the target application is not started for the first time, obtaining local cache data of the target application, and determining whether the local cache data is valid; When the local cache data is valid, the local cache data is used as the device data.

3. The hybrid control method of Internet of Things devices according to claim 2, characterized in that: The operation instruction also includes a data request instruction; the method also includes the following steps: When the local cache data is invalid, in response to the data request instruction, calling a cloud server interface to obtain the device data of the target device; The device data is stored as the local cache data of the target application.

4. The hybrid control method of Internet of Things devices according to claim 1, characterized in that: The step of obtaining the first network quality of the target application in response to the application verification instruction comprises the following steps: In response to the application verification instruction, executing a first number of Internet packet explorers to the server through the target application, and obtaining a first network quality of the target application according to all first execution results of the first number of Internet packet explorers; The first network quality includes request status, maximum response time, average response time, minimum survival time and packet loss rate; Among them, the quality requirements include that there is no request timeout in the request situation of the first network quality, the maximum response time is less than a first threshold, the average response time is less than or equal to a second threshold, the minimum survival time is greater than or equal to a third threshold, and the packet loss rate is 0.

5. The hybrid control method of Internet of Things devices according to claim 1, characterized in that: The step of obtaining the second network quality of the Internet of Things gateway of the target device in response to the gateway verification instruction comprises the following steps: In response to the gateway verification instruction, obtaining the operating status and the number of state switching times of the Internet of Things gateway based on the heartbeat data packet sent by the Internet of Things gateway to the server; In response to the gateway verification instruction, executing the Internet packet explorer for a second time to the server through the server, and obtaining all second execution results of the Internet packet explorer for the second time; Obtaining the second network quality of the Internet of Things gateway according to the running state, the number of state switching times and the second execution result; The second network quality includes the running state, the number of state switching times, and the second execution result including the request status, maximum response time, average response time, minimum survival time and packet loss rate; The quality requirements include that the operating status of the second network quality is online, the number of state switching times is greater than or equal to a fourth threshold, there is no request timeout in the request situation, the maximum response time is less than a fifth threshold, the average response time is less than or equal to a sixth threshold, the minimum survival time is greater than or equal to a seventh threshold, and the packet loss rate is 0.

6. The hybrid control method of Internet of Things devices according to claim 1, characterized in that: The step of obtaining the third network quality of the server in response to the server verification instruction comprises the following steps: In response to the server verification instruction, obtaining the CPU occupancy rate, memory occupancy rate and maintenance status of the server, and then sorting out the third network quality of the server; The quality requirements include that the CPU occupancy rate is less than or equal to an eighth threshold, the memory occupancy rate is less than or equal to a ninth threshold, and the maintenance status is not in maintenance.

7. The hybrid control method of Internet of Things devices according to claim 1, characterized in that: The Internet of Things gateway is pre-connected to the local area network; the establishment of a connection channel between the target application and the Internet of Things gateway based on the preset local area network includes the following steps: Scan all device information in the local area network through the target application; the device data includes identification information and interface parameters of the IoT gateway of the target device; the interface parameters include IP address, media access control address and port number; Performing a match check on the interface parameters of the IoT gateway in all the device information based on the device data; When the result of the matching check is a match, a connection channel of the transmission control protocol between the target application and the Internet of Things gateway is established in the local area network based on the interface parameters; otherwise, an alarm is sent to the target application to prompt that the target device has a fault.

8. A hybrid control device for Internet of Things devices, characterized in that: The device comprises: The first module is used to obtain device data of a target device in response to an operation instruction of a target application; The second module is used to issue a device control instruction of the target device through the target application based on the device data; the device control instruction carries a verification instruction; the verification instruction includes an application verification instruction, a gateway verification instruction and a server verification instruction; A third module is used to obtain the first network quality of the target application in response to the application verification instruction; A fourth module is configured to obtain a second network quality of the Internet of Things gateway of the target device in response to the gateway verification instruction; A fifth module, configured to obtain a third network quality of the server in response to the server verification instruction; The sixth module is used for transmitting the device control instruction issued by the target application to the Internet of Things gateway through the server to perform operation control on the target device when the network quality meets the preset quality requirements; wherein the network quality includes the first network quality, the second network quality and the third network quality; The seventh module is used to establish a connection channel between the target application and the Internet of Things gateway based on a preset local area network when any of the network qualities does not meet the quality requirements; and transmit the device control instructions issued by the target application to the Internet of Things gateway through the connection channel to perform operation control on the target device.

9. An electronic device, characterized in that: The electronic device comprises a memory and a processor, the memory stores a computer program, and the processor implements the method according to any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.