A method, storage medium and device for directly connecting devices to the south based on MQTT of intelligent gateway
By adding southbound MQTT directly connected devices to the edge calculator and using scripts to parse MQTT messages, the complex and time-consuming problem of traditional MQTT devices upload data is solved, and the automated mapping and processing of devices and data is realized, the flexibility and compatibility of the system is improved, and the latency and configuration costs are reduced.
Patent Information
- Application Number
- CN202411670685.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-21
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2044-11-21
AI Technical Summary
The traditional MQTT device uploads data to require complex configuration and manual verification, which is time-consuming and labor-intensive, high cost, and cannot achieve data interaction.
By adding southbound MQTT direct connection devices to the edge calculator, using scripts to parse MQTT messages, and mapping device names and point names into specific data fields, realizing automated mapping and processing of devices and data.
Simplifies device management, improves flexibility and compatibility of data processing, reduces latency, reduces staffing requirements, and reduces gateway configuration costs.
Smart Images

Figure CN119172235B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of Internet of Things, and in particular to a method, storage medium and device for southbound direct connection of devices based on intelligent gateway MQTT. Background Art
[0002] MQTT (Message Queuing Telemetry Transport) is a message protocol based on the publish / subscribe paradigm under the ISO standard. MQTT broker is the core component of the MQTT protocol, responsible for receiving, forwarding and processing messages. Traditional MQTT devices need to obtain topics through brokers for message transmission when uploading data. The obtained messages need to be manually configured, filled in and checked manually to ensure that they are not repeated and the descriptions are correct, which requires a lot of manpower and time, and is prone to some errors, such as content errors and corresponding errors. Therefore, more professional personnel are needed to configure and check the message fields. In addition, the configured content cannot be synchronized to the platform to complete data binding, and data interaction cannot be achieved. Therefore, the traditional MQTT device data uploading method is time-consuming, labor-intensive, and costly, which reduces the convenience of data collection devices uploading data. Summary of the invention
[0003] In view of the deficiencies in the prior art, the present invention aims to provide a method, storage medium and device for directly connecting devices to the southbound MQTT based on an intelligent gateway.
[0004] In order to achieve the above object, the present invention adopts the following technical solution:
[0005] A method for directly connecting devices to the southbound network based on an intelligent gateway MQTT, characterized by comprising the following steps:
[0006] S1. Add a southbound MQTT direct connection device to the edge computer:
[0007] Create a channel and configure two topics to manage the channel, one for sending commands or control instructions, and the other for receiving status updates or feedback;
[0008] Create devices and points. The device name and point name represent the data storage object and data field respectively.
[0009] When a southbound MQTT direct-connected device uploads an MQTT message to an edge computer, the MQTT message includes the device name, data mode, parameters, and their values. The parameters include humidity, temperature, and other data that need to be collected or controlled.
[0010] S2. Script analysis:
[0011] After receiving the MQTT message uploaded by the southbound MQTT direct-connected device, the edge computer uses a script to parse the received MQTT message, parses the device name in the MQTT message into a unique ID, and parses the data mode in the message into the corresponding data field, parses the parameter into a point name and corresponds to the point name in the edge computer, and then structures the parsed data into an array, where each array element contains a point name and a corresponding value, thereby realizing the mapping of devices and data;
[0012] S3. The edge calculator displays the data parsed in step S2 through a web page.
[0013] Furthermore, the edge computer automatically caches the parsed data into an array in the memory according to the device name and the point name.
[0014] Furthermore, when the edge computer performs down-control on the southbound MQTT direct-connected device by transmitting a down-control message, the down-control message includes the device name, data mode, down-control parameters and down-control value, and a question mark is used instead of the down-control value.
[0015] The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program implements the above method when executed by a processor.
[0016] The present invention also provides an edge calculator, characterized in that it includes a southbound MQTT direct connection device, and a processor and a memory in the southbound MQTT direct connection device, wherein the memory is used to store a computer program; and when the processor is used to execute the computer program, the above method is implemented.
[0017] The beneficial effects of the present invention are:
[0018] 1. Simplify device management
[0019] Traditional MQTT device management relies on complex configuration files and manual settings, which increases the complexity of managing a large number of devices. In the present invention, the edge computer performs script parsing on the MQTT message, maps the device name and point name to a specific data field. This process is automated and does not require complex manual configuration, which simplifies device management. In particular, when dealing with a large number of devices, the device can be uniquely identified and data transmission can be efficiently managed through topics.
[0020] 2. Flexible data processing
[0021] Traditional MQTT systems are mostly used for one-way data flow, that is, devices publish data and servers process it, which has limited flexibility. However, the present invention uses scripts to parse messages, so that edge computers can dynamically parse and process data according to different device names and point names. This method allows the system to adapt to different devices and data formats, and can flexibly set data processing rules and response modes according to actual needs.
[0022] 3. High compatibility
[0023] When connecting different devices, the existing MQTT system often requires special adaptation of the devices, which increases the development and maintenance costs of the system. However, by introducing a universal script parsing mechanism, the edge computer can automatically identify and process different types of MQTT devices and data formats, avoiding special adaptation work for each device. This mechanism achieves seamless connection between devices and data by configuring different topics and data modes, thereby improving compatibility.
[0024] 4. Low latency
[0025] In traditional IoT systems, device data often needs to be uploaded to the cloud for processing before being fed back to the edge device, which increases latency. The present invention parses and processes MQTT messages locally on the edge computer, directly obtains data from the southbound MQTT direct-connected device and processes it locally, thus avoiding the delay in data transmission to the cloud. This direct connection method significantly reduces communication latency and improves the system's response speed.
[0026] To sum up, the method of the present invention is aimed at realizing the MQTT direct connection function of the edge computer for the southbound device. By configuring the topic to the channel, the MQTT message is parsed into data by using the script, and the data is intuitively displayed and controlled in the edge computer. It is simple and efficient, can reduce the personnel configuration process and ensure the correct data display, and can reduce the gateway configuration cost. At the same time, it can also facilitate the use of technical personnel to improve efficiency, simplify operation and ensure the accuracy, timeliness and convenient interactivity of the data. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] The drawings described herein are used to provide a further understanding of the present disclosure and constitute a part of the present disclosure. The illustrative embodiments of the present disclosure and their descriptions are used to explain the present disclosure and do not constitute an improper limitation on the present disclosure. In the drawings:
[0028] Figure 1 This is a schematic diagram of the process of adding a southbound MQTT direct connection device in Example 1 of the present invention;
[0029] Figure 2 This is a schematic diagram of the MQTT message format uploaded by the MQTT radar sensor to the edge computer in Example 2 of the present invention;
[0030] Figure 3 This is a schematic diagram of an MQTT message parsed by a script in Embodiment 2 of the present invention;
[0031] Figure 4 This is a schematic diagram of the MQTT message format transmitted when the edge computer controls the MQTT radar sensor in Example 2 of the present invention;
[0032] Figure 5 This is a schematic diagram of data obtained by parsing the MQTT radar sensor in Example 2 of the present invention;
[0033] Figure 6 This is a schematic diagram of the status of MQTT radar sensor device data display in Example 2 of the present invention. DETAILED DESCRIPTION
[0034] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments.
[0035] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0036] The present invention will be further described below in conjunction with the accompanying drawings. It should be noted that this embodiment is based on the technical solution and provides a detailed implementation method and specific operation process, but the protection scope of the present invention is not limited to this embodiment. Example
[0037] This embodiment provides a method for directly connecting devices to the south of the smart gateway MQTT, which realizes data collection and data interaction between edge computers through the south-bound direct connection MQTT device, and parses the message information through a script to ensure that device data is not repeated and that the function of uploading and sending data can be realized.
[0038] The method of this embodiment includes the following steps:
[0039] S1. Add a southbound MQTT direct connection device to the edge computer:
[0040] like Figure 1 As shown, create a channel and configure two topics to manage the channel, one for sending commands or control instructions, and the other for receiving status updates or feedback;
[0041] Create devices and points. The device name and point name represent the data storage object and data field respectively. In this way, the control and status feedback between the device and its points are clearly mapped.
[0042] When a southbound MQTT direct-connected device uploads an MQTT message to an edge computer, the MQTT message includes the device name, data mode, parameters, and their values. The parameters include humidity, temperature, and other data that need to be collected or controlled.
[0043] S2. Script analysis:
[0044] After receiving the MQTT message uploaded by the MQTT southbound direct connection device, the edge computer uses a script to parse the received MQTT message, parses the device name in the MQTT message into a unique ID, and parses the data mode in the message into the corresponding data field, parses the parameter into a point name and corresponds to the point name in the edge computer, and then structures the parsed data into an array form. Each array element contains a point name and a corresponding value, thereby achieving accurate mapping between devices and data, which is convenient for subsequent data processing and analysis. This structured method ensures clear and orderly data and can effectively support device management and monitoring.
[0045] S3. The edge calculator displays the data obtained by analyzing step S2 using a web page. The current technology for such devices is to analyze them independently through the platform, which puts a lot of pressure on the platform and causes insensitive device control and untimely display of device status. Now the data status and downstream control are concentrated on the edge, which can more efficiently process device data and control.
[0046] Furthermore, the edge computer can automatically cache the parsed data into an array in the memory according to the device name and point name, so that the edge computer can manage the southbound MQTT direct-connected devices and process the data in real time.
[0047] Furthermore, when the edge computer controls the transmission of the down-control message to the southbound MQTT direct-connected device, the down-control message includes the device name, data mode (such as set, etc.), down-control parameters params and down-control values, and the down-control values are replaced by question marks. By replacing the down-control values with question marks, the message structure can be kept consistent, flexibility can be enhanced, and control messages can be constructed dynamically. At the same time, the debugging process can be simplified and the risk of misoperation can be reduced. The use of question marks ensures the integrity of all necessary fields, helps avoid parsing errors, and ensures that the data of most MQTT devices can be parsed correctly. Example
[0048] This embodiment provides an application example of the method described in Embodiment 1, which is applied to a common MQTT radar sensor.
[0049] Figure 2 As shown, the MQTT message uploaded by the MQTT radar sensor to the edge computer includes the device name, protocol version (version), data mode (set), parameter params (movementsigns) and its parameter value (100).
[0050] like Figure 3 As shown in the figure, the edge calculator parses the device name of the MQTT message into the sole_ID field, the data mode into the sole_type field, the parameter params into the parm field and corresponds to the point name in the edge calculator, and then displays the structured array.
[0051] Figure 4 The figure shows the MQTT message format that the edge computer uses to control the southbound MQTT radar sensor. It supports self-setting, including device name, protocol version (1.0), data mode (set), control parameters params (fallSwitch), and control value (1).
[0052] like Figure 5 As shown in the figure, when transmitting to the southbound MQTT radar sensor for down control, a question mark is used to replace the data structure of the down control value.
[0053] Figure 6 A schematic diagram of the state of data display of the MQTT radar sensor device in Example 2 of the present invention is shown.
[0054] In addition, in another embodiment of the present disclosure, an edge calculator is proposed, which includes a southbound MQTT direct connection device, and a processor and a memory in the southbound MQTT direct connection device, wherein the memory is used to store a computer program; and when the processor is used to execute the computer program, the above method is implemented.
[0055] In another embodiment of the present disclosure, a computer-readable storage medium is proposed, including: a memory for storing computer instructions; a controller for calling and executing the computer instructions stored in the memory to implement any method in the above technical solutions.
[0056] For those skilled in the art, various corresponding changes and modifications can be made according to the above technical solutions and concepts, and all of these changes and modifications should be included in the protection scope of the claims of the present invention.
[0057] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
Claims
1. A method for directly connecting devices to the southbound network based on an intelligent gateway MQTT, characterized in that: The steps include: S1. Add a southbound MQTT direct connection device to the edge computer: Create a channel and configure two topics to manage the channel, one for sending commands or control instructions, and the other for receiving status updates or feedback; Create devices and points. The device name and point name represent the data storage object and data field respectively. When a southbound MQTT direct-connected device uploads an MQTT message to an edge computer, the MQTT message includes the device name, data mode, parameters, and their values, where the parameters include humidity and temperature. S2. Script analysis: After receiving the MQTT message uploaded by the southbound MQTT direct-connected device, the edge computer uses a script to parse the received MQTT message, parses the device name in the MQTT message into a unique ID, and parses the data mode in the message into the corresponding data field, parses the parameter into a point name and corresponds to the point name in the edge computer, and then structures the parsed data into an array form. Each array element contains a point name and a corresponding value, thereby realizing the mapping of devices and data; S3, the edge calculator displays the data obtained by parsing in step S2 through a web page; Among them, when the edge computer transmits a control message to the southbound MQTT direct-connected device for control, the control message includes the device name, data mode, control parameters and control value, and a question mark is used instead of the control value.
2. The method according to claim 1, characterized in that The edge computer automatically caches the parsed data into an array in memory based on the device name and point name.
3. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 2 is implemented.
4. An edge calculator, characterized in that: It includes a southbound MQTT direct connection device, and a processor and a memory in the southbound MQTT direct connection device, wherein the memory is used to store a computer program; when the processor is used to execute the computer program, the method described in any one of claims 1-2 is implemented.
Citation Information
Patent Citations
Internet-of-Things data processing method, device and equipment and storage medium
CN112688967A
Edge computing gateway service protocol conversion method and system
CN117319515A