CN111865754B - MQTT-based remote monitoring method and system - Google Patents

MQTT-based remote monitoring method and system Download PDF

Info

Publication number
CN111865754B
CN111865754B CN201910523338.8A CN201910523338A CN111865754B CN 111865754 B CN111865754 B CN 111865754B CN 201910523338 A CN201910523338 A CN 201910523338A CN 111865754 B CN111865754 B CN 111865754B
Authority
CN
China
Prior art keywords
mqtt
identifier
list
client
time
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910523338.8A
Other languages
Chinese (zh)
Other versions
CN111865754A (en
Inventor
王鑫
覃琴
陈亮
江旭华
石宁波
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guilin University of Electronic Technology
Original Assignee
Guilin University of Electronic Technology
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guilin University of Electronic Technology filed Critical Guilin University of Electronic Technology
Publication of CN111865754A publication Critical patent/CN111865754A/en
Application granted granted Critical
Publication of CN111865754B publication Critical patent/CN111865754B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/04Real-time or near real-time messaging, e.g. instant messaging [IM]
    • H04L51/046Interoperability with other network applications or services
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • H04L67/025Protocols based on web technology, e.g. hypertext transfer protocol [HTTP] for remote control or remote monitoring of applications
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/54Presence management, e.g. monitoring or registration for receipt of user log-on information, or the connection status of the users
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Abstract

The invention discloses a remote monitoring method and a system based on MQTT, wherein the method comprises the following steps: at least one equipment terminal establishes communication connection with an MQTT server through the MQTT and sends a detection signal to the MQTT server, wherein the detection signal comprises an identifier of the equipment terminal; the MQTT client acquires the identifier of at least one equipment terminal for the nth time through the MQTT server and generates a first identifier list; the MQTT client acquires the identifier of at least one equipment terminal for the (n + 1) th time and generates a second identifier list; the MQTT client compares the first identification list with the second identification list, and sends reminding information to a preset client when the second identification list is different from the first identification list. The invention realizes the remote monitoring of the equipment terminal through the MQTT protocol, and the invention can effectively reduce the complexity of the system architecture and improve the expandability of the system through the MQTT framework.

Description

MQTT-based remote monitoring method and system
Technical Field
The invention relates to the technical field of communication, in particular to a remote monitoring method and system based on MQTT.
Background
MQTT (Message Queuing Telemetry Transport) is a lightweight instant messaging protocol developed by IBM corporation. Unlike the HTTP protocol, the MQTT adopts a publish/subscribe mode instead of the traditional request/response mode, and this lighter mode makes MQTT more suitable for internet-of-things devices with low power consumption and limited network bandwidth. Meanwhile, the MQTT also has the characteristics of simplicity, support of continuous call back control, provision of different transmission service qualities, strong customizability and the like.
Today, the value of the MQTT is fully embodied when the internet of things is in good fire and hot, for example, for some remote areas, due to extremely poor network conditions, most of the devices operate in a single machine environment, the state of the devices needs to consume a large amount of manpower, material resources and financial resources for maintenance, and the application of the MQTT as asynchronous communication greatly solves the problem of management of the internet of things of the devices in the remote areas.
However, in the prior art, most remote monitoring systems applying MQTT perform disconnection processing on devices through a "wish mechanism", that is, when an unexpected connection of a device is interrupted, an MQTT server automatically sends a "last will" message to a certain theme. However, the wish information needs to be preset by the device side, the MQTT server actively issues the information when the call is disconnected, and if each device is not preset, the wish mechanism function cannot be realized.
Therefore, in order to solve the above problems, the inventors of the present application have studied and proposed a remote monitoring method and system based on MQTT.
Disclosure of Invention
In view of the above, the present invention provides a remote monitoring method and system based on MQTT, which can implement remote monitoring of a device terminal through MQTT protocol, monitor whether a device is disconnected without setting a wish message, and send a notification message in time.
In order to achieve the above technical effects, the present application provides a remote monitoring method based on MQTT, where as an implementation manner, the remote monitoring method based on MQTT includes the steps of: at least one equipment terminal establishes communication connection with an MQTT server through the MQTT and sends a detection signal to the MQTT server, wherein the detection signal comprises an identifier of the equipment terminal; the MQTT client acquires the identifier of the at least one equipment terminal for the nth time through the MQTT server and generates a first identifier list, wherein n is a positive integer; the MQTT client acquires the identifier of the at least one equipment terminal n +1 th time and generates a second identifier list; and the MQTT client compares the first identification list with the second identification list, and sends reminding information to a preset client when the second identification list is different from the first identification list.
As one implementation manner, the step of acquiring the identifier of the at least one device terminal and generating the second identifier list n +1 times by the MQTT client includes: the MQTT client sends instruction codes to the at least one equipment terminal at intervals of specific time values and starts a preset timer; after receiving the instruction code, the at least one equipment terminal sends the identifier of the at least one equipment terminal to the MQTT server; and when the preset timer is up, the MQTT client acquires the identifier of the at least one equipment terminal from the MQTT server.
As one implementation manner, the comparing, by the MQTT client, the first identifier list and the second identifier list, and sending a reminding message to a preset client when there is a difference between the second identifier list and the first identifier list includes: and when the second identifier list has the missing identifier of the at least one equipment terminal compared with the first identifier list, sending a call drop reminding message to a preset user side.
As an implementation manner, when the second identifier list has the missing identifier of the at least one device terminal compared to the first identifier list, after the step of sending the offline notification message to the preset user side, the method further includes: storing the missing identification of the at least one equipment terminal into a drop list; the MQTT client acquires the identifier of the at least one equipment terminal for the (n + 2) th time and generates a third identifier list; comparing the third ID list with the drop-line list; and when the third ID list has the identifier of the at least one equipment terminal in the drop-line list, sending a re-online notification, and deleting the identifier of the at least one equipment terminal corresponding to the drop-line list.
As an embodiment, the method further comprises: the HTTP server records at least one control instruction sent by the control terminal, and analyzes the field type of each control instruction to store each control instruction into a time task table of the MySQL database, wherein the field type comprises target equipment, a target switch state, execution time and a task type; the MQTT client performs full scanning on the time task table every other preset time and sends a control instruction with the execution time matched with the current time to the at least one equipment terminal;
as one implementation manner, after the steps of performing full scanning on the time task table every other predetermined time by the MQTT client, and sending the control instruction with the execution time matched with the current time to the at least one device terminal, the MQTT client further includes: the MQTT client checks the task type of the control instruction with the execution time matched with the current time, wherein the task type comprises a single task and a timing task; the MQTT client deletes the control instruction in the time task list when the task type of the control instruction is a single task; and when the task type of the control instruction is a timing task, the MQTT client updates the control instruction into the control instruction corresponding to the next execution in the time task list.
In order to solve the above technical problem, the present application further provides an MQTT-based remote monitoring system, as one implementation manner, the MQTT-based remote monitoring system includes: the system comprises at least one equipment terminal, an MQTT client, an MQTT server and a preset user side; the at least one equipment terminal establishes communication connection with the MQTT server through the MQTT and sends a detection signal to the MQTT server, wherein the detection signal comprises an identifier of the equipment terminal; the MQTT client acquires the identifier of the at least one equipment terminal for the nth time through the MQTT server and generates a first identifier list, acquires the identifier of the at least one equipment terminal for the (n + 1) th time and generates a second identifier list, compares the first identifier list with the second identifier list, and sends reminding information to a preset client when the second identifier list is different from the first identifier list.
As one implementation mode, the system also comprises an HTTP server, a MySQL database and a control terminal; the HTTP server records at least one control instruction sent by the control terminal, and analyzes the field type of each control instruction to store each control instruction into a time task table of the MySQL database, wherein the field type comprises target equipment, a target switch state, execution time and a task type; the MQTT client performs full scanning on the time task list every other preset time, and after sending a control instruction with execution time matched with the current time to the at least one equipment terminal, checks the task type of the control instruction, wherein the task type comprises a single task and a timing task, when the task type of the control instruction is the single task, the control instruction in the time task list is deleted, and when the task type of the control instruction is the timing task, the control instruction is updated to the control instruction corresponding to the next execution in the time task list.
As one implementation mode, the MQTT server, the MQTT client, the MySQL database and the HTTP server are built on a cloud server.
As described above, the MQTT-based remote monitoring method and system of the present invention have the following beneficial effects:
the device terminal establishes communication connection with the MQTT server through the MQTT, and sends a detection signal to the MQTT server, the detection signal comprises an identification of the device terminal, the MQTT client acquires the identification of at least one device terminal for the nth time through the MQTT server and generates a first identification list, then the MQTT client acquires the identification of at least one device terminal for the n +1 th time and generates a second identification list, the MQTT client compares the first identification list with the second identification list, and when the second identification list is different from the first identification list, the device terminal sends reminding information to a preset user side. In conclusion, the remote monitoring of the equipment terminal can be realized through the MQTT protocol, whether the equipment is disconnected or not is monitored under the condition that a wish message is not set, and a notification message is sent in time.
Drawings
Fig. 1 is a schematic flow chart of an embodiment of the MQTT-based remote monitoring method according to the present application.
Fig. 2 is a schematic flow chart of another embodiment of the MQTT-based remote monitoring method according to the present application.
Fig. 3 is a schematic structural diagram of an embodiment of the MQTT-based remote monitoring system according to the present application.
Fig. 4 is a schematic structural diagram of another embodiment of the MQTT-based remote monitoring system according to the present application.
Detailed Description
To further clarify the technical measures and effects adopted by the present application to achieve the intended purpose, the following detailed description of the embodiments, methods, steps, features and effects of the present application will be made with reference to the accompanying drawings and preferred embodiments.
The foregoing and other technical matters, features and effects of the present application will be apparent from the following detailed description of preferred embodiments, which is to be read in connection with the accompanying drawings. While the present application has been described in terms of specific embodiments and examples for achieving the desired objects and objectives, it is to be understood that the invention is not limited to the disclosed embodiments, but is to be accorded the widest scope consistent with the principles and novel features as defined by the appended claims.
Referring to fig. 1, fig. 1 is a schematic flow chart of an embodiment of the MQTT-based remote monitoring method according to the present application.
It should be noted that, the MQTT-based remote monitoring method of this embodiment may include, but is not limited to, the following steps:
step S1: at least one equipment terminal establishes communication connection with the MQTT server through the MQTT and sends a detection signal to the MQTT server, wherein the detection signal comprises the identification of the equipment terminal.
After carrying on the MQTT transmission module through appointed serial port IO, the equipment terminal has the function of being in communication connection with the MQTT server, the MQTT transmission module collects the equipment data of the equipment terminal in real time on the one hand, it is worth explaining that the equipment terminal comprises various data acquisition sensors, the MQTT transmission module collects various data of the equipment terminal through the sensors, on the other hand, the equipment terminal subscribes an appointed channel of the MQTT server through the MQTT transmission module, namely, the equipment terminal subscribes through setting an MQTT server IP and a port number, and the collected equipment data are transmitted to the MQTT server after subscribing the appointed channel of the MQTT server.
When the equipment terminal is carried with the MQTT transmission module to realize the establishment of communication connection with the MQTT server through the MQTT, a detection signal is sent to the MQTT server to carry out identity verification so as to realize the communication connection, wherein the detection signal comprises identity information of the corresponding equipment terminal, namely the identification of the equipment terminal.
Step S2: the MQTT client acquires the identifier of at least one equipment terminal for the nth time through the MQTT server and generates a first identifier list, wherein n is a positive integer.
The MQTT client is used for controlling and managing the equipment terminal connected to the MQTT server, establishes communication connection with the MQTT server through configuration parameters, and subscribes to a designated channel of the MQTT server which is the same as the equipment terminal. It is worth mentioning that the MQTT client may be understood as a client a and a client B, where the client a is used for information collection and the client B is used for information transmission, and of course, the information collection and the information transmission may be implemented by one client C.
After the equipment terminal is connected to the MQTT server, the same channel is subscribed, and the MQTT client acquires the identification of the equipment terminal for the nth time through the MQTT server and generates a first identification list.
Step S3: and the MQTT client acquires the identifier of at least one equipment terminal for the (n + 1) th time and generates a second identifier list.
The MQTT client-side sends a control command after a specific time interval, the MQTT server pushes the control command to each equipment terminal, and each equipment terminal sends the identification of the equipment terminal to the MQTT server again, so that the MQTT client-side obtains the identification of each equipment terminal again, establishes a second identification list and is used for comparing the second identification list with the first identification list, and corresponding judgment is carried out.
In one embodiment, step S3: the MQTT client acquires the identifier of at least one equipment terminal for the (n + 1) th time and generates a second identifier list, which comprises the following steps: the MQTT client sends instruction codes to at least one equipment terminal at intervals of specific time values and starts a preset timer; after receiving the instruction code, the at least one equipment terminal sends the identifier of the at least one equipment terminal to the MQTT server; and when the preset timer is up, the MQTT client acquires the identification of at least one equipment terminal from the MQTT server. For example, the MQTT client sends an instruction code isAlive to each device terminal every one minute, after the instruction code is sent out, a timer of 60 seconds is started, the device terminal sends its own identifier to a corresponding channel of the MQTT server after receiving the instruction code, and the client acquires the identifiers from the MQTT server and stores the identifiers in a new identifier list.
Step S4: the MQTT client compares the first identification list with the second identification list, and sends reminding information to a preset client when the second identification list is different from the first identification list.
Wherein the difference between the second list of identifications and the first list of identifications can be divided into the presence of increased identifications and the presence of decreased identifications in the second list of identifications relative to the first list of identifications. Therefore, in one embodiment, step S4: the MQTT client compares the first identification list with the second identification list, and when the second identification list is different from the first identification list, the MQTT client sends reminding information to a preset client, wherein the reminding information comprises the following steps:
s41: when the second identification list has the missing identification of at least one equipment terminal compared with the first identification list, sending the offline reminding information to a preset user side;
s42: when the second identification list has the newly added identification of the at least one equipment terminal compared with the first identification list, sending the reminding information to be authorized to a preset user side;
in one embodiment, at step S41: when the second identifier list has a missing identifier of at least one device terminal compared with the first identifier list, after sending the offline reminding information to a preset user side, the method further comprises the following steps: storing the lost identification of at least one equipment terminal into an offline list; the MQTT client acquires the identifier of at least one equipment terminal for the (n + 2) th time and generates a third identifier list; comparing the third ID list with the drop-line list; and when the third ID list has the identifier of at least one equipment terminal in the drop-line list, sending a re-online notification, and deleting the identifier of at least one corresponding equipment terminal in the drop-line list.
The identification of at least one equipment terminal which is missed by the second identification list compared with the first identification list is stored in the offline list, and when the missed equipment terminal is online again in subsequent detection, the offline notification is sent, so that not only the offline notification function can be realized, but also the subsequent online notification can be carried out, and the function can not be realized through a 'wish mechanism' of MQTT.
In one embodiment, at step S42: when the second identifier list has the identifier of the at least one newly added device terminal compared with the first identifier list, sending the reminding information to be authorized to the preset user side, and further comprising: and when the second list has the newly added identifier of the unauthorized equipment terminal compared with the first list, the MQTT client sends the reminding information to be authorized.
In the MQTT-based remote monitoring method provided by this embodiment, at least one device terminal is in communication connection with an MQTT server through MQTT, and a detection signal is sent to the MQTT server, where the detection signal includes an identifier of the device terminal, then an MQTT client acquires the identifier of the at least one device terminal through the MQTT server n-th time and generates a first identifier list, and after a certain time, the MQTT client acquires the identifier of the at least one device terminal n + 1-th time and generates a second identifier list, and the MQTT client compares the first identifier list and the second identifier list, and sends a reminding message to a preset client when the second identifier list is different from the first identifier list, so that a disconnection condition of the device terminal and an authorization request of a newly added device terminal can be monitored in the MQTT-based remote monitoring system.
Referring to fig. 2, fig. 2 is a schematic flow chart of another embodiment of the MQTT-based remote monitoring method according to the present application.
It should be noted that the MQTT-based remote monitoring method of the embodiment further includes the following steps:
step A: the HTTP server records at least one control instruction sent by the control terminal, analyzes the field type of each control instruction and stores the field type into a time task table of the MySQL database, wherein the field type comprises target equipment, a target switch state, execution time and a task type.
The control instruction is that a user sends a relevant control instruction to an HTTP server through a control terminal such as a PC terminal or an APP terminal, the HTTP server analyzes the relevant control instruction and then stores the relevant control instruction in a time task table of a MySQL database, and when the HTTP server analyzes the field type of the control instruction, the target equipment, the target switch state, the execution time and the task type of the control instruction are used as the field type.
And B: the MQTT client performs full scanning on the time task list at intervals of preset time and sends a control instruction with the execution time matched with the current time to at least one equipment terminal.
In order to ensure that control instructions are not missed, when the MQTT client performs full scanning on the time task table, the interval time should be as short as possible, for example, scanning is performed every 20 seconds, and for some devices with smaller control precision, the scanning time needs to be shorter. When the full scanning is carried out, the control instruction with the execution time matched with the current time is scanned by taking the current time as an index condition, and the control instruction is sent to the corresponding target equipment terminal once so as to execute the corresponding timing control task.
It should be noted that the timing control task can be generally divided into a single task and a circularly executed task, the former is a task executed once, and the latter is a task executed once at the same time interval, for example, executed once every 2 days, and sequentially circularly executed.
Thus, in one embodiment, step B: the MQTT client performs full scanning on the time task list at intervals of a preset time, and after sending the control instruction with the execution time matched with the current time to at least one equipment terminal, the method further comprises the following steps: the MQTT client checks the task type of the control instruction with the execution time matched with the current time, wherein the task type comprises a single task and a timing task; when the task type of the control instruction is a single task, the MQTT client deletes the control instruction in the time task list; and when the task type of the control instruction is a timing task, the MQTT client updates the control instruction into the control instruction corresponding to the next execution in the time task list.
The task types are divided into a single task and a timing task, of course, the single task can also be understood as a single timing task, the types 1, 2, 3, 4, 5, 6, and 7 are timing tasks (which can be understood as the number of days to be added in the next operation, but the number is not limited to represent the number of days with the same literal meaning, and can be freely set, such as 1 represents 5 days or 10 days), and the type 8 is a single task; if the control command is a timed task, the MQTT client adds the execution time of the command with the number of days of the corresponding type, and then updates the new control command in a time task list after updating the control command; if the type is single task, the control instruction is not stored in the time task table any more, and the control instruction is deleted after being successfully sent, so far, one scanning is completed.
According to the remote monitoring method based on the MQTT, the task control of multiple modes in the MQTT remote monitoring system can be realized by reading the control instruction sent by the user through the control terminal and distinguishing whether the task type of the control instruction is a single task or a timing task.
Referring to fig. 3, fig. 3 is a schematic structural diagram of an embodiment of the MQTT-based remote monitoring system according to the present invention, where the MQTT-based remote monitoring system includes: the system comprises at least one equipment terminal 2, an MQTT client 11, an MQTT server 12 and preset clients, wherein the MQTT client 11 and the MQTT client 12 are erected on a cloud server 1; at least one equipment terminal 2 establishes communication connection with the MQTT server 12 through the MQTT and sends a detection signal to the MQTT server 12, wherein the detection signal comprises an identifier of the equipment terminal 2; the MQTT client 11 acquires the identifier of at least one equipment terminal 2 for the nth time through the MQTT server 12 and generates a first identifier list; the MQTT client 11 acquires the identifier of at least one equipment terminal 2 for the (n + 1) th time and generates a second identifier list; the MQTT client 11 compares the first identifier list with the second identifier list, and sends a reminding message to a preset client when the second identifier list is different from the first identifier list. The preset user side is not shown in the figure, and is not limited to the intelligent terminal equipped with the MQTT program side.
Referring to fig. 4, fig. 4 is a schematic structural diagram of another embodiment of the MQTT-based remote monitoring system according to the present application. In this embodiment, the MQTT-based remote monitoring system further includes an HTTP server 13, a MySQL database 14, and a control terminal 3, where the HTTP server 13 and the MySQL database 14 are installed in the cloud server 1. The HTTP server 13 records at least one control instruction sent by the control terminal 3, and analyzes a field type of each control instruction to store each control instruction in a time task table of the MySQL database 14, where the field type includes a target device, a target switch state, an execution time, and a task type; the MQTT client 11 performs full scanning on the time task list at intervals of a preset time and sends a control instruction with the execution time matched with the current time to at least one equipment terminal 2; after sending a control instruction with execution time matched with the current time, the MQTT client 11 checks the task type of the control instruction, wherein the task type comprises a single task and a timing task; when the task type of the control instruction is a single task, the MQTT client 11 deletes the control instruction in the time task list; when the task type of the control instruction is a timing task, the MQTT client 11 updates the control instruction in the time task list to a control instruction corresponding to the next execution.
The MQTT-based remote monitoring system according to this embodiment establishes a communication connection between at least one device terminal 2 and the MQTT server 12 through MQTT, and transmits a detection signal to the MQTT server 12, where the detection signal includes an identifier of the device terminal, then the MQTT client 11 acquires the identifier of the at least one device terminal through the MQTT server 12 n times and generates a first identifier list, and after a specific time interval, the MQTT client 11 acquires the identifier of the at least one device terminal n +1 times and generates a second identifier list, and the MQTT client 11 compares the first identifier list and the second identifier list, and transmits a reminding message to a preset client when the second identifier list is different from the first identifier list, so as to monitor a disconnection status of the device terminal and an authorization request of a newly added device terminal in the MQTT-based remote monitoring system, and read a control command transmitted by a user through a control terminal, and the task type of the control instruction is distinguished to be a single task or a timing task, so that multi-mode task control in the MQTT remote monitoring system is realized.
The preferred embodiments of the present invention have been described in detail with reference to the accompanying drawings, but the present invention is not limited to the specific details of the above embodiments, and various simple modifications can be made to the technical solution of the present invention within the technical idea of the present invention, and these simple modifications all belong to the protection scope of the present invention. The various features described in the foregoing detailed description may be combined in any suitable manner without departing from the scope of the invention. The invention is not described in detail in order to avoid unnecessary repetition.

Claims (8)

1. A remote monitoring method based on MQTT is characterized by comprising the following steps:
at least one equipment terminal establishes communication connection with an MQTT server through the MQTT and sends a detection signal to the MQTT server, wherein the detection signal comprises an identifier of the equipment terminal;
the MQTT client acquires the identifier of the at least one equipment terminal for the nth time through the MQTT server and generates a first identifier list, wherein n is a positive integer;
the MQTT client acquires the identifier of the at least one equipment terminal for the (n + 1) th time and generates a second identifier list;
the MQTT client compares the first identification list with the second identification list, and sends reminding information to a preset client when the second identification list is different from the first identification list;
the step of acquiring the identifier of the at least one device terminal and generating a second identifier list at the nth +1 th time of the MQTT client comprises the following steps:
the MQTT client sends instruction codes to the at least one equipment terminal at intervals of specific time values and starts a preset timer;
and after the preset timer is up, the MQTT client acquires the identifier of the at least one equipment terminal from the MQTT server, wherein the identifier of the at least one equipment terminal is sent to the MQTT server by the at least one equipment terminal after receiving the instruction code.
2. The MQTT-based remote monitoring method according to claim 1, wherein the step of comparing the first identifier list with the second identifier list by the MQTT client, and sending a reminding message to a preset client when the second identifier list is different from the first identifier list comprises:
and when the second identifier list has the missing identifier of the at least one equipment terminal compared with the first identifier list, the MQTT client sends out a drop reminding message to the preset client.
3. The MQTT-based remote monitoring method according to claim 2, wherein when the second identifier list has the missing identifier of the at least one device terminal compared to the first identifier list, after the step of sending, by the MQTT client, a drop notification message to the preset user side, the method further comprises:
the MQTT client stores the lost identification of the at least one equipment terminal into a drop-line list;
the MQTT client acquires the identifier of the at least one equipment terminal for the (n + 2) th time and generates a third identifier list;
the MQTT client compares the third identification list with the drop-line list;
when the third identifier list has the identifier of the at least one device terminal in the drop-line list, the MQTT client sends a re-online notification to the preset client, and deletes the identifier of the at least one device terminal corresponding to the drop-line list.
4. The MQTT-based remote monitoring method according to claim 1, further comprising:
the HTTP server records at least one control instruction sent by the control terminal, and analyzes the field type of each control instruction to store each control instruction into a time task table of the MySQL database, wherein the field type comprises target equipment, a target switch state, execution time and a task type;
and the MQTT client performs full scanning on the time task list at intervals of a preset time and sends a control instruction with the execution time matched with the current time to the at least one equipment terminal.
5. The MQTT-based remote monitoring method according to claim 4, wherein after the steps of performing full scan on the schedule at intervals of a predetermined time by the MQTT client, and sending the control command with the execution time matched with the current time to the at least one device terminal, the MQTT client further comprises:
the MQTT client checks the task type of the control instruction with the execution time matched with the current time, wherein the task type comprises a single task and a timing task;
the MQTT client deletes the control instruction in the time task list when the task type of the control instruction is a single task;
and when the task type of the control instruction is a timing task, the MQTT client updates the control instruction into the control instruction corresponding to the next execution in the time task list.
6. A remote monitoring system based on MQTT is characterized by comprising: the system comprises at least one equipment terminal, an MQTT client, an MQTT server and a preset user side;
the at least one equipment terminal establishes communication connection with the MQTT server through the MQTT and sends a detection signal to the MQTT server, wherein the detection signal comprises an identifier of the equipment terminal;
the MQTT client acquires the identifier of the at least one equipment terminal through the MQTT server for the nth time and generates a first identifier list, acquires the identifier of the at least one equipment terminal for the (n + 1) th time and generates a second identifier list, compares the first identifier list with the second identifier list, and sends reminding information to a preset client when the second identifier list is different from the first identifier list;
the MQTT client is used for sending instruction codes to the at least one equipment terminal at intervals of specific time values, starting a preset timer, and acquiring the identifier of the at least one equipment terminal from the MQTT server after the preset timer expires, wherein the identifier of the at least one equipment terminal is sent to the MQTT server by the at least one equipment terminal after the instruction codes are received by the at least one equipment terminal.
7. The MQTT-based remote monitoring system according to claim 6, further comprising an HTTP server, a MySQL database and a control terminal;
the HTTP server records at least one control instruction sent by the control terminal, and analyzes the field type of each control instruction to store each control instruction into a time task table of the MySQL database, wherein the field type comprises target equipment, a target switch state, execution time and a task type;
the MQTT client performs full scanning on the time task list every other preset time, and after sending a control instruction with execution time matched with the current time to the at least one equipment terminal, checks the task type of the control instruction, wherein the task type comprises a single task and a timing task, when the task type of the control instruction is the single task, the control instruction in the time task list is deleted, and when the task type of the control instruction is the timing task, the control instruction is updated to the control instruction corresponding to the next execution in the time task list.
8. The MQTT-based remote monitoring system according to claim 7, wherein the MQTT server, the MQTT client, the MySQL database, and the HTTP server are built on a cloud server.
CN201910523338.8A 2019-04-30 2019-06-17 MQTT-based remote monitoring method and system Active CN111865754B (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910364550 2019-04-30
CN2019103645504 2019-04-30

Publications (2)

Publication Number Publication Date
CN111865754A CN111865754A (en) 2020-10-30
CN111865754B true CN111865754B (en) 2022-09-02

Family

ID=72966128

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910523338.8A Active CN111865754B (en) 2019-04-30 2019-06-17 MQTT-based remote monitoring method and system

Country Status (1)

Country Link
CN (1) CN111865754B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114979097B (en) * 2021-06-03 2023-07-21 中移互联网有限公司 Message pushing method and device based on MQTT and electronic equipment

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104639625A (en) * 2015-01-27 2015-05-20 华南理工大学 Data concentrator acquisition control method based on MQTT (Message Queuing Telemetry Transport), data concentrator acquisition control device based on MQTT and data concentrator acquisition control system based on MQTT
CN108259262A (en) * 2016-12-02 2018-07-06 远升科技股份有限公司 Method and system for monitoring connection status of device

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105515900B (en) * 2015-12-07 2019-04-19 北京奇虎科技有限公司 A kind of method and device obtaining terminal presence
CN106227132B (en) * 2016-08-30 2017-09-12 广州穗剑实验室科技有限公司 A kind of laboratory cloud monitor supervision platform and laboratory monitoring method
CN106385410A (en) * 2016-09-08 2017-02-08 四川长虹电器股份有限公司 Intelligent household appliance control system based on MQTT
CN109361771A (en) * 2018-12-11 2019-02-19 湖北科技学院 Registration, certification, the connection method of a kind of Internet of things system and its equipment

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104639625A (en) * 2015-01-27 2015-05-20 华南理工大学 Data concentrator acquisition control method based on MQTT (Message Queuing Telemetry Transport), data concentrator acquisition control device based on MQTT and data concentrator acquisition control system based on MQTT
CN108259262A (en) * 2016-12-02 2018-07-06 远升科技股份有限公司 Method and system for monitoring connection status of device

Also Published As

Publication number Publication date
CN111865754A (en) 2020-10-30

Similar Documents

Publication Publication Date Title
CN109412833A (en) A kind of management system and method for shared device
CN110460638A (en) Information push method and device
CN101283567A (en) System and method for providing presence age information in a unified communication system
CN112099968A (en) Equipment control method, device, system, storage medium and electronic device
CN106993043B (en) Data communication system and method based on agency
CN101610173B (en) Method and network management server for implementing data collocation on multi-network elements
CN111787031B (en) Method for sending control instruction of Internet of things equipment based on distributed technology
CN111865754B (en) MQTT-based remote monitoring method and system
CN103973718A (en) Operation and maintenance message pushing method based on android mobile platform
CN101742254A (en) Backup method for video monitoring system information and central platform server
CN112422684A (en) Target message processing method and device, storage medium and electronic device
CN102509180A (en) Server, activity program management method and activity program management system
CN110661631A (en) Method, device and computer readable storage medium for collecting network element logs
CN106789913B (en) User account management method and device
CN112039718A (en) Upgrade state detection method, server, device and storage medium
CN103034632A (en) Information transmitting method and a system
CN113572757A (en) Server access risk monitoring method and device
CN111008209B (en) Data reconciliation method, device and system, storage medium and electronic device
CN108600004B (en) Video server configuration management method and system
CN104065563A (en) Processing method, device and system for instant message
CN110224924A (en) State updating method and device, storage medium and electronic device
CN116319729A (en) Robot control method, device, server, system and storage medium
CN109116815A (en) One kind is based on MQTT injection molding machine management system, method and storage medium
CN113364838B (en) Equipment ad hoc network method and system based on MQTT
CN112437146A (en) Equipment state synchronization method, device and system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant