Method, device, electronic device and storage medium for detecting activity of Internet of Things devices
By detecting the device status in the Internet of Things environment and reporting the results, the problem that the Internet of Things platform cannot sense the offline status of the device in real time is solved, and more efficient device activation is achieved.
Patent Information
- Application Number
- CN202510259310.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-06
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2045-03-06
AI Technical Summary
The network is unstable in the IoT environment, which makes it impossible for the IoT platform to sense the offline status of the device in real time.
The Internet of Things devices are detected through mutual exploration devices, and the status of the detection device and access detection results in the heartbeat packet are obtained, and the device status is determined based on the frequency difference between the detection frequency and the reported frequency of the heartbeat.
It improves the real-time and accuracy of IoT devices, so that the IoT platform can sense the online status of the device in a timely manner.
Smart Images

Figure CN119766702A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of Internet of Things, and in particular to an Internet of Things device activation method, device, electronic device and storage medium. Background Art
[0002] In the IoT environment, the network is not very stable and disconnections often occur.
[0003] The IoT platform needs to check the online and offline status of the device at all times. Currently, the IoT platform cannot perceive the online and offline status of such devices in real time. Summary of the invention
[0004] The present invention provides an Internet of Things device activity detection method, device, electronic device and storage medium, which can improve the real-time and accuracy of Internet of Things device activity detection.
[0005] According to one aspect of the present invention, a method for detecting activity of an Internet of Things device is provided, the method comprising:
[0006] Acquire heartbeat packets sent by multiple mutual detection devices; wherein the heartbeat packets carry access detection results of the status of the detection devices, and the Internet of Things devices include detection devices and mutual detection devices;
[0007] Acquire at least one detection device included in each of the heartbeat packets and an access detection result of each of the detection devices;
[0008] Obtaining the frequency difference between the detection frequency and the heartbeat reporting frequency of each of the mutual detection devices;
[0009] The status of each of the IoT devices is determined based on the detection devices included in each of the heartbeat packets, the access detection results of each of the detection devices, and the frequency difference of each of the mutual detection devices.
[0010] According to another aspect of the present invention, a device for detecting activity of an Internet of Things device is provided, the device comprising:
[0011] A heartbeat packet receiving module, used to obtain heartbeat packets sent by multiple mutual detection devices; wherein the heartbeat packet carries the access detection result of the state of the detection device, and the Internet of Things device includes a detection device and a mutual detection device;
[0012] A device status acquisition module, used to acquire at least one detection device included in each of the heartbeat packets and an access detection result of each of the detection devices;
[0013] A frequency difference acquisition module, used to obtain the frequency difference between the detection frequency and the heartbeat reporting frequency of each of the mutual detection devices;
[0014] The device status detection module is used to determine the status of each of the IoT devices based on the detection devices included in each of the heartbeat packets, the access detection results of each of the detection devices, and the frequency difference of each of the mutual detection devices.
[0015] According to another aspect of the present invention, there is provided an electronic device, the electronic device comprising:
[0016] At least one processor; and a memory in communication with the at least one processor; wherein the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the method for detecting activation of an Internet of Things device as described in any embodiment of the present invention.
[0017] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the method for detecting activation of an Internet of Things device described in any embodiment of the present invention when executed.
[0018] The technical solution of the embodiment of the present invention detects the Internet of Things devices through mutual detection devices and reports the detection results to the Internet of Things server. The detection frequency between the Internet of Things devices can be flexibly set, so that the Internet of Things platform can timely perceive the latest online status of the Internet of Things devices, thereby improving the real-time and accuracy of the detection of the Internet of Things devices.
[0019] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0021] Figure 1 This is a flow chart of a method for detecting activity of an Internet of Things device provided according to an embodiment of the present invention;
[0022] Figure 2 It is a flowchart of a method for detecting activity of an Internet of Things device in a scenario where the frequency difference of mutually detecting devices is the same frequency, provided according to an embodiment of the present invention;
[0023] Figure 3It is a flowchart of a method for detecting activity of an Internet of Things device in a scenario where the frequency difference of mutually detecting devices is different frequencies provided by an embodiment of the present invention;
[0024] Figure 4 This is a schematic diagram of the structure of an IoT device activity detection device provided according to an embodiment of the present invention;
[0025] Figure 5 It is a structural schematic diagram of an electronic device for implementing the method for detecting activation of an Internet of Things device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0026] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme 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. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0027] It should be noted that the terms "first", "second", etc. in the specification and claims 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 of the two are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0028] Figure 1 A flowchart of a method for detecting activity of an IoT device provided by an embodiment of the present invention. The embodiment of the present invention is applicable to the case of detecting activity of devices in the IoT. The method can be executed by an IoT device detection device, which can be implemented in the form of hardware and / or software. The IoT device detection device can be configured in an electronic device that carries the IoT device detection function, such as a server in an IoT platform.
[0029] See also Figure 1 The IoT device detection method shown includes:
[0030] S101. Acquire heartbeat packets sent by multiple mutual detection devices; wherein the heartbeat packets carry access detection results of the detection device status, and the Internet of Things devices include detection devices and mutual detection devices.
[0031] Among them, there are multiple IoT devices in the IoT, and some IoT devices cannot be directly communicated and connected with the IoT server of the IoT platform. The IoT devices are communicated and connected through some IoT devices that are directly communicated and connected with the IoT server to achieve access to the IoT. A mutual exploration device may refer to an IoT device that can detect whether an IoT device is online. A detection device may refer to an IoT device that is detected to be online. A heartbeat packet may be a data packet that a mutual exploration device periodically sends to an IoT server. The heartbeat packet is used to detect whether the mutual exploration device is online. At the same time, the heartbeat packet carries the status detection result of the mutual exploration device on the detection device, so that the heartbeat packet is also used to detect whether the detection device is online. The access detection result may refer to data on whether the detection device is online. In some embodiments, the IoT device includes an edge device or a telemetry device.
[0032] S102: Acquire at least one detection device included in each of the heartbeat packets and access detection results of each of the detection devices.
[0033] The mutual detection device may detect at least one detection device.
[0034] S103: Obtain a frequency difference between a detection frequency and a heartbeat reporting frequency of each of the mutual detection devices.
[0035] The detection frequency may refer to the frequency at which the mutual detection device detects whether the detection device is online. The heartbeat reporting frequency may refer to the frequency at which the mutual detection device reports the heartbeat packet. The frequency difference is used to determine whether the range of the detection device in the heartbeat packet reported by the mutual detection device each time is complete and comprehensive.
[0036] S104: Determine the status of each of the IoT devices according to each of the detection devices included in each of the heartbeat packets, the access detection results of each of the detection devices, and the frequency difference of each of the mutual detection devices.
[0037] Among them, different frequency differences correspond to different state determination methods. The state determination method is determined according to the frequency difference, and the state of each detection device is determined according to the state determination method and the access detection results of each detection device. Then, the states of multiple detection devices are integrated to determine the state of each IoT device in the IoT. If there is no mutual detection device that detects the state of a certain IoT device, it can be determined that the state of the IoT device is abnormal or unknown.
[0038] In some embodiments, when the number of heartbeat packets is one, the access detection result of the detection device included in the heartbeat packet is determined as the status of the Internet of Things device. For example, the heartbeat packet includes an access detection result of detection device A as online, and an access detection result of detection device B as offline, then the status of Internet of Things device A is online, and the status of Internet of Things device B is offline.
[0039] In some embodiments, when there are multiple heartbeat packets, the access detection results of the detection devices included in all heartbeat packets are integrated. For the same detection device, the existing access detection results are statistically processed in a manner corresponding to the frequency difference to determine the state of the IoT device. In one example, a threshold can be set, and the state with a number greater than the threshold is used as the state of the IoT device. In one example, the mean of the state is used as the state of the IoT device.
[0040] In addition, according to the business needs and application scenarios of the Internet of Things, statistical methods for access detection results corresponding to multiple frequency difference ranges can be set. According to the corresponding statistical methods, the access detection results belonging to the same detection device in each heartbeat packet are integrated to determine the status of the detection device, and the status of multiple detection devices are integrated to determine the status of the Internet of Things device.
[0041] In an optional embodiment, the heartbeat packet accesses each of the detection devices through the mutual detection device according to the detection frequency and the access address of each of the detection devices, and obtains the access detection result of the status of each detection device.
[0042] Among them, in the Internet of Things, there are Internet of Things servers and Internet of Things devices. Internet of Things devices may include edge devices or telemetry devices. Usually, Internet of Things devices upload heartbeat packets to the Internet of Things server according to the heartbeat reporting frequency. However, the heartbeat frequency of some Internet of Things devices is low and cannot be modified because the program is burned into the hardware device and it is not convenient to modify. Accordingly, these Internet of Things devices are fixed heartbeat devices. Some Internet of Things devices do not even have an active heartbeat function. In the above Internet of Things environment, select a device to which software services can be added and install a mutual exploration program in it. The Internet of Things device with the mutual exploration program installed is an Internet of Things device with mutual exploration capability. The mutual exploration program mainly completes the following functions: receiving and storing the access addresses of other Internet of Things devices in the Internet of Things; setting the detection frequency; when the detection frequency is triggered, accessing other Internet of Things devices one by one to obtain access detection results, and summarizing the access detection results into a heartbeat packet; sending the heartbeat packet to the Internet of Things server. After the Internet of Things server receives heartbeat packets from multiple Internet of Things devices with mutual exploration capability within a period of time, it deduplicates them according to the mutual exploration device, that is, only the latest heartbeat packet of the same mutual exploration device is retained during this period of time to obtain the latest live detection results.
[0043] It can be seen that by accessing the status of the detection device according to the detection frequency and access address, the access detection result is obtained, and the heartbeat packet is generated according to the access detection result, the mutual detection capability of the mutual detection devices is realized, the detection frequency of the status of the Internet of Things devices can be flexibly configured, and the accuracy and real-time performance of the status of the Internet of Things devices can be improved.
[0044] In an optional embodiment, the state of each of the IoT devices is determined based on each of the detection devices included in each of the heartbeat packets, the access detection results of each of the detection devices, and the frequency difference of each of the mutual detection devices, including: determining an online state condition based on the frequency difference of each of the mutual detection devices; when it is determined that the detection device meets the online state condition based on at least one detection device included in each of the heartbeat packets and the access detection results of each of the detection devices, determining that the state of the IoT device is online.
[0045] Among them, the online status condition may refer to the detection condition of the online status of the detection device. The online status condition corresponds to a status determination method, and different online status conditions correspond to different status determination methods. In some embodiments, the online status condition is used to determine the judgment inequality and threshold of the online status. The number of mutual exploration devices that detect the status of the detection device, when the frequency difference of each mutual exploration device is the same frequency, the number of mutual exploration devices that detect the status of the detection device as the target state is greater than or equal to the optimistic threshold, and the state of the detection device is determined to be the target state; the number of mutual exploration devices that detect the status of the detection device as the target state is less than the optimistic threshold, and the state of the detection device is determined not to be the target state. When there is a mutual exploration device with a frequency difference of different frequencies, the number of mutual exploration devices that detect the status of the detection device as the target state is greater than the pessimistic threshold, and the state of the detection device is determined to be the target state; the number of mutual exploration devices that detect the status of the detection device as the target state is less than or equal to the pessimistic threshold, and the state of the detection device is determined not to be the target state.
[0046] It can be seen that by configuring the corresponding online status conditions according to the frequency difference, different frequency scenarios can be adapted, the status of the detection device can be flexibly determined, and the accuracy of the status of the detection device can be improved.
[0047] The technical solution of the embodiment of the present invention detects the Internet of Things devices through mutual detection devices and reports the detection results to the Internet of Things server. The detection frequency between the Internet of Things devices can be flexibly set, so that the Internet of Things platform can timely perceive the latest online status of the Internet of Things devices, thereby improving the real-time and accuracy of the detection of the Internet of Things devices.
[0048] Figure 2A flowchart of an IoT device detection method in a scenario where the frequency difference of mutual detection devices is consistent with the frequency provided by an embodiment of the present invention. Based on the above-mentioned embodiment, the embodiment of the present invention concretizes "determining the status of each IoT device according to each detection device included in each heartbeat packet, the access detection result of each detection device, and the frequency difference of each mutual detection device" as follows: when the frequency difference of each mutual detection device is consistent with the frequency, the number of mutual detection devices is obtained; for each detection device, the online ratio between the number of online states of the IoT devices and the number of mutual detection devices is calculated; according to the online ratio and the frequency difference, the status of the detection device is determined; according to the status of each detection device, the status of each IoT device is determined. It should be noted that for the parts not described in detail in the embodiment of the present invention, reference can be made to the description of other embodiments.
[0049] See also Figure 2 The IoT device detection method shown includes:
[0050] S201. Acquire heartbeat packets sent by multiple mutual detection devices; wherein the heartbeat packets carry access detection results of the status of the detection devices, and the Internet of Things devices include detection devices and mutual detection devices.
[0051] S202: Acquire at least one detection device included in each of the heartbeat packets and access detection results of each of the detection devices.
[0052] S203: Obtain a frequency difference between a detection frequency and a heartbeat reporting frequency of each of the mutual detection devices.
[0053] S204: When the frequency differences of the mutual detection devices are all consistent, the number of mutual detection devices is obtained.
[0054] The frequency difference of the mutual detection devices is the same frequency, indicating that the detection frequency of the mutual detection devices is the same as the heartbeat reporting frequency. At this time, the detection devices included in the heartbeat packets sent by each mutual detection device are all IoT devices except the mutual detection device that sent the heartbeat packet. The number of mutual detection devices may refer to the number of valid mutual detection devices.
[0055] In an optional embodiment, obtaining the number of mutual exploration devices includes: obtaining the mutual exploration devices that send heartbeat packets; obtaining the status of each of the mutual exploration devices in each of the heartbeat packets; updating the mutual exploration devices according to each of the mutual exploration devices that send heartbeat packets and the status of each of the mutual exploration devices in each of the heartbeat packets; and counting the number of updated mutual exploration devices to obtain the number of mutual exploration devices.
[0056] Among them, the IoT device that sends the heartbeat packet is a mutual exploration device. According to the detection devices included in the heartbeat packet, the detected mutual exploration devices are screened out, and according to the status of the detected mutual exploration devices, the status of the detected mutual exploration devices is determined, and the online detected mutual exploration devices are used as updated mutual exploration devices. The number of updated mutual exploration devices is counted. In some embodiments, it is possible to determine whether the detected mutual exploration device is online based on the comparison result between the mean value or number of the online status of the detected mutual exploration devices and the threshold value corresponding to the frequency difference. For example, if the mean value of the online status or the number of online status is greater than or equal to the threshold value corresponding to the frequency difference, it is determined that the detected mutual exploration device is online; if the mean value of the online status or the number of online status is less than the threshold value corresponding to the frequency difference, it is determined that the detected mutual exploration device is offline.
[0057] In one example, the mutual detection devices include device A and device B, heartbeat packet 1: device A is online, device B is offline; heartbeat packet 2: device A is online, device B is offline. It is determined that the updated mutual detection device is device A.
[0058] It can be seen that by updating the mutual detection device and the number of mutual detection devices according to the status of the mutual detection device detected in the heartbeat packet, the number of mutual detection devices can be updated in real time according to the online status of the mutual detection device, thereby improving the accuracy of the number of mutual detection devices and thus improving the accuracy of the online status of the detection device.
[0059] S205: Calculate the number of online states of each detection device according to the access detection results of each detection device included in each heartbeat.
[0060] The online status of the same detection device in all heartbeat packets is obtained, and the number is counted to obtain the number of online statuses of the detection device.
[0061] S206: For each of the detection devices, calculate an online ratio between the number of online detection devices and the number of mutual detection devices.
[0062] The online ratio may refer to the ratio of the number of mutual detection devices that count the online status of a detection device to the number of mutual detection devices that count its status. The online ratio is used to describe the online statistical probability of the detection device. In scenarios with different frequencies, the number of mutual detection devices that detect the status of the detection device is the number of mutual detection devices.
[0063] S207: Determine the state of the detection device according to the online ratio and the frequency difference.
[0064] Among them, the frequency difference is used to determine the online status condition of the online ratio. According to the judgment condition corresponding to the frequency difference and the online ratio, the state of the detection device is determined. The online status condition may include an optimistic threshold and an online status judgment inequality. In some embodiments, the optimistic threshold corresponding to the frequency consistency is obtained, and when the online ratio is greater than or equal to the optimistic threshold corresponding to the frequency difference, the state of the detection device is determined to be an online state; when the online ratio is less than the optimistic threshold corresponding to the frequency difference, the state of the detection device is determined to be an offline state.
[0065] S208. Determine the status of each of the IoT devices according to the status of each of the detection devices.
[0066] In one example, an IoT environment includes: 1 IoT platform, i.e., IoT server, and 6 IoT devices: device U, device V, device W, device X, device Y, and device Z. Among these 6 devices, 2 (device Y and device Z) do not actively report heartbeats. The remaining 4 (device U, device V, device W, and device X) install mutual detection programs. The IoT server sends the addresses of the other 5 devices except the device itself to device U, device V, device W, and device X, and sets the mutual detection frequency.
[0067] Devices U, V, W, and X start to detect each other and generate heartbeat packets:
[0068] Device U: {"U":1,"V":1,"W":0,"X":1,"Y":1,"Z":0},
[0069] Device V: {"U":1,"V":1,"W":0,"X":1,"Y":1,"Z":0},
[0070] Device W: Not sent,
[0071] Device X: {"U":1,"V":1,"W":0,"X":1,"Y":1,"Z":1}.
[0072] Device Y and device Z do not have the ability to actively perform heartbeats, so they do not send heartbeat packets. 1 indicates online, and 0 indicates offline. Device W simulates offline.
[0073] Device U, device V, and device X send heartbeat packets to the IoT server (device W is offline, so no heartbeat packet is sent).
[0074] After receiving the message, the IoT server determines that device W should have sent a heartbeat packet, but the other three mutual detection devices all indicate that device W is not online, and device W itself has not sent a heartbeat packet. Therefore, the mutual detection quota of device W is excluded from the heartbeat statistics of this batch. Therefore, the number of mutual detection devices is 3.
[0075] The frequency difference of each mutual detection device is the same frequency, and accordingly, the threshold corresponding to the frequency difference is: 1 / 2. When the online ratio is ≥1 / 2, the detection device is online.
[0076] The IoT server receives the message and obtains the status of the IoT device as shown in Table 1 below:
[0077] Table 1
[0078] In another example, an IoT environment includes: 1 IoT platform, i.e., IoT server, and 10 IoT devices: device A, device B, device C, device D, device E, device F, device G, device H, device I, and device J. Among these 10 devices, 2 (device I and device J) do not actively report heartbeats. The remaining 8 (device A, device B, device C, device D, device E, device F, device G, and device H) install mutual exploration programs. The IoT server sends the addresses of the other 9 devices except the device itself to devices A, device B, device C, device D, device E, device F, device G, and device H, and sets the mutual exploration frequency.
[0079] Device A, device B, device C, device D, device E, device F, device G, and device H begin to detect each other and generate heartbeat packets:
[0080] Device A: {"A": 1, "B": 0, "C": 1, "D": 0, "E": 1, "F": 0, "G": 1, "H":0, "I": 0, "J": 0},
[0081] Device B: {"A": 1, "B": 1, "C": 0, "D": 1, "E": 0, "F": 1, "G": 0, "H":1, "I": 0, "J": 1},
[0082] Device C: {"A": 1, "B": 0, "C": 1, "D": 0, "E": 1, "F": 0, "G": 1, "H":0, "I": 1, "J": 0},
[0083] Device D: {"A": 1, "B": 0, "C": 1, "D": 1, "E": 0, "F": 1, "G": 0, "H":1, "I": 0, "J": 1},
[0084] Device E: {"A": 1, "B": 0, "C": 0, "D": 1, "E": 1, "F": 0, "G": 1, "H":0, "I": 0, "J": 1},
[0085] Device F: {"A": 1, "B": 0, "C": 1, "D": 1, "E": 1, "F": 1, "G": 0, "H":1, "I": 1, "J": 1},
[0086] Device G: {"A": 1, "B": 0, "C": 1, "D": 1, "E": 0, "F": 0, "G": 1, "H":0, "I": 0, "J": 0},
[0087] Device H: {"A": 1, "B": 0, "C": 1, "D": 0, "E": 1, "F": 0, "G": 1, "H":1, "I": 0, "J": 1}.
[0088] Device I and device J do not have the active heartbeat capability, so they do not send heartbeat packets. Among them, 1 means online, and 0 means offline.
[0089] Device A, device B, device C, device D, device E, device F, device G and device H send heartbeat packets to the IoT server. The number of mutually probing devices is 8. The frequency difference of each mutually probing device is consistent, and accordingly, the threshold corresponding to the frequency difference is: 1 / 2. When the online ratio is ≥1 / 2, the detection device is online. The IoT server receives the message and obtains the status of the IoT device as shown in Table 2 below:
[0090] Table 2
[0091] The technical solution of the embodiment of the present invention calculates the online ratio between the number of online detection devices and the number of mutual detection devices when the frequency difference of each mutual detection device is consistent with the frequency, and determines the online status of the detection device according to the online ratio. For the scenario where the detection frequency is consistent with the heartbeat reporting frequency, it can judge whether the detection device is online according to the access detection result of mutual detection between IoT devices, thereby improving the accuracy and flexibility of detection. The heartbeat frequency, detection frequency and heartbeat frequency detection interval can be customized, thereby realizing active, high-frequency, real-time and multi-dimensional judgment of whether the IoT device is online.
[0092] Figure 3A flowchart of a method for detecting activity of an Internet of Things device in a scenario where the frequency difference of mutual detection devices is different frequencies is provided for an embodiment of the present invention. Based on the above embodiments, the embodiment of the present invention concretizes "determining the status of each Internet of Things device according to each detection device included in each heartbeat packet, the access detection results of each detection device, and the frequency difference of each mutual detection device" as follows: when there is a frequency difference of mutual detection devices of different frequencies, according to each detection device included in each heartbeat packet, the number of participating devices corresponding to each detection device is counted; for each detection device, the online ratio between the number of online states of the detection device and the number of participating devices is calculated; according to the online ratio and the frequency difference, the status of the detection device is determined; according to the status of each detection device, the status of each Internet of Things device is determined. It should be noted that for the parts not described in detail in the embodiments of the present invention, reference can be made to the descriptions of other embodiments.
[0093] See also Figure 3 The IoT device detection method shown includes:
[0094] S301. Acquire heartbeat packets sent by multiple mutual detection devices; wherein the heartbeat packets carry access detection results of the status of the detection devices, and the Internet of Things devices include detection devices and mutual detection devices.
[0095] S302: Acquire at least one detection device included in each of the heartbeat packets and access detection results of each of the detection devices.
[0096] S303: Obtain a frequency difference between a detection frequency and a heartbeat reporting frequency of each of the mutual detection devices.
[0097] S304: When the frequency difference between the mutual detection devices is different in frequency, count the number of participating devices corresponding to each detection device included in each heartbeat packet.
[0098] Among them, the frequency difference of the mutual exploration devices is different frequencies, indicating that the detection frequency of the mutual exploration device to detect activity is different from the heartbeat reporting frequency. At this time, the detection devices included in the heartbeat packet are only some of the IoT devices in the IoT. There is at least one mutual exploration device with a frequency difference of different frequencies, indicating that the heartbeat packet sent by the at least one mutual exploration device only includes the access detection results of some IoT devices. The number of participating devices may refer to the number of mutual exploration devices that detect a certain detection device. In fact, the reporting frequency of the heartbeat packet is usually greater than the detection frequency, that is, within a heartbeat packet reporting cycle, the mutual exploration device cannot detect all IoT devices other than the mutual exploration device, and can only detect some of the IoT devices, which is equivalent to only some of the mutual exploration devices detecting the status of a detection device. If the detection frequency of the mutual exploration device to detect activity is different from the heartbeat reporting frequency, it may appear that different heartbeat packets in the same time period include different numbers of detection devices.
[0099] In an optional embodiment, according to each detection device included in each heartbeat packet, the number of participating devices corresponding to each detection device is counted, including: for each detection device, the number of heartbeat packets including the status of the detection device is counted, and determined as the number of participating devices corresponding to the detection device.
[0100] S305: For each of the detection devices, calculate an online ratio between the number of online detection devices and the number of participating devices.
[0101] The online ratio may refer to the ratio of the number of mutual probing devices that count the online status of a detection device to the number of mutual probing devices that count its status. The online ratio is used to describe the online statistical probability of the detection device. In scenarios with different frequencies, the number of mutual probing devices that detect the status of the detection device is the number of participating devices.
[0102] S306: Determine the state of the detection device according to the online ratio and the frequency difference.
[0103] The frequency difference is used to determine the online status condition of the online ratio. The state of the detection device is determined according to the judgment condition corresponding to the frequency difference and the online ratio. In some embodiments, a pessimistic threshold corresponding to the frequency difference is obtained, and when the online ratio is greater than the pessimistic threshold corresponding to the frequency difference, the state of the detection device is determined to be an online state; when the online ratio is less than or equal to the pessimistic threshold corresponding to the frequency difference, the state of the detection device is determined to be an offline state.
[0104] S307: Determine the status of each of the IoT devices according to the status of each of the detection devices.
[0105] As in the previous example, an IoT environment includes: 1 IoT platform, namely the IoT server, and 6 IoT devices: device U, device V, device W, device X, device Y, and device Z. Among these 6 devices, 2 (device Y and device Z) do not actively report heartbeats. The remaining 4 (device U, device V, device W, and device X) install mutual detection programs. The IoT server sends the addresses of the other 5 devices except the device itself to devices U, device V, device W, and device X, and sets the mutual detection frequency.
[0106] Devices U, V, W, and X begin to detect each other and generate heartbeat packets:
[0107] Device U: {"U":1,"V":1,"W":0,"X":1,"Y":1,"Z":0},
[0108] Device V: {"U":1,"V":1,"W":0,"X":1,"Y":0,"Z":0},
[0109] Device W: {"U":1,"W":0,"Z":1},
[0110] Device X: {"U":1,"V":1,"X":1,"Z":0}.
[0111] Device Y and device Z do not have the active heartbeat capability, so they do not send heartbeat packets. Among them, device W only detected devices U and device Z when reporting the heartbeat packet this time; device X only detected devices U, device V and device Z when reporting the heartbeat packet this time.
[0112] Device U, device V, device W and device X send heartbeat packets to the IoT server. There is at least one device with different frequencies. Correspondingly, the threshold corresponding to the frequency difference is 1 / 2. When the online ratio is > 1 / 2, the detection device is online. The IoT server receives the message and obtains the status of the IoT device as shown in Table 3 below:
[0113] Table 3
[0114] As in the previous example, an IoT environment includes: 1 IoT platform, i.e., IoT server, and 10 IoT devices: device A, device B, device C, device D, device E, device F, device G, device H, device I, and device J. Among these 10 devices, 2 (device I and device J) do not actively report heartbeats. The remaining 8 (devices A, B, C, D, E, F, G, and H) install mutual detection programs. The IoT server sends the addresses of the other 9 devices except the device itself to devices A, B, C, D, E, F, G, and H, and sets the mutual detection frequency.
[0115] Device A, device B, device C, device D, device E, device F, device G, and device H begin to detect each other and generate heartbeat packets respectively:
[0116] Device A: {"A": 1, "B": 0, "C": 1, "D": 0},
[0117] Device B: {"A": 1, "B": 1, "C": 0, "D": 1, "E": 0},
[0118] Device C: {"A": 1, "B": 0, "C": 0, "D": 0, "E": 1, "F": 0},
[0119] Device D: {"A": 1, "B": 0, "C": 0, "D": 1, "E": 0, "F": 0, "G": 0},
[0120] Device E: {"A": 1, "B": 0, "C": 0, "D": 1, "E": 1, "F": 0, "G": 1, "H":0},
[0121] Device F: {"A": 1, "B": 0, "C": 1, "D": 1, "E": 1, "F": 1, "G": 0, "H":0},
[0122] Device G: {"A": 1, "B": 0, "C": 1, "D": 1, "E": 0, "F": 0, "G": 1, "H":0, "I": 0},
[0123] Device H: {"A": 1, "B": 0, "C": 1, "D": 0, "E": 1, "F": 0, "G": 1, "H":1, "I": 0, "J": 1}.
[0124] Device I and device J do not have the ability to actively perform heartbeats, so they do not send heartbeat packets. Device A only detected devices B, C, and D when reporting the heartbeat packet this time; device B only detected devices A, C, D, and E when reporting the heartbeat packet this time; device C only detected devices A, B, D, E, and F when reporting the heartbeat packet this time; device D only detected devices A, B, C, E, F, and G when reporting the heartbeat packet this time; device E only detected devices A, B, C, E, F, and G when reporting the heartbeat packet this time. C, device D, device F, device G and device H; device F only detected devices A, device B, device C, device D, device E, device G and device H when reporting the heartbeat packet this time; device G only detected devices A, device B, device C, device D, device E, device F, device H and device I when reporting the heartbeat packet this time; device H only detected devices A, device B, device C, device D, device E, device F, device G, device I and device J when reporting the heartbeat packet this time.
[0125] Device A, device B, device C, device D, device E, device F, device G and device H send heartbeat packets to the IoT server. There is at least one device with different frequencies. Correspondingly, the threshold corresponding to the frequency difference is: 1 / 2. When the online ratio > 1 / 2, the detection device is online. The IoT server receives the message and obtains the status of the IoT device as shown in Table 4 below:
[0126] Table 4
[0127] The technical solution of the embodiment of the present invention calculates the online ratio between the number of online detection devices and the number of participating devices when the frequency difference of at least one mutual detection device is a frequency difference, and determines the online status of the detection device according to the online ratio. For scenarios where the detection frequency and the heartbeat reporting frequency are different, it can be determined whether the detection device is online according to the access detection results of mutual detection between IoT devices, thereby improving the accuracy and flexibility of detection. The heartbeat frequency, detection frequency and heartbeat frequency detection interval can be customized, thereby realizing active, high-frequency, real-time and multi-dimensional judgment of whether the IoT device is online.
[0128] Figure 4 The present invention is a schematic diagram of the structure of an IoT device activity detection device provided in an embodiment of the present invention. The present invention is applicable to the case of detecting activity of devices in the IoT. The device can execute the IoT device activity detection method. The device can be implemented in the form of hardware and / or software. The device can be configured in an electronic device that carries the IoT device activity detection function.
[0129] See also Figure 4 The IoT device detection device shown includes:
[0130] The heartbeat packet receiving module 401 is used to obtain the heartbeat packets sent by multiple mutual detection devices; wherein the heartbeat packets carry the access detection results of the status of the detection device, and the Internet of Things devices include detection devices and mutual detection devices;
[0131] The device status acquisition module 402 is used to obtain at least one detection device included in each of the heartbeat packets and the access detection results of each of the detection devices;
[0132] The frequency difference acquisition module 403 is used to obtain the frequency difference between the detection frequency and the heartbeat reporting frequency of each of the mutual detection devices;
[0133] The device status detection module 404 is used to determine the status of each IoT device according to each detection device included in each heartbeat packet, the access detection result of each detection device, and the frequency difference of each mutual detection device.
[0134] The technical solution of the embodiment of the present invention detects the Internet of Things devices through mutual detection devices and reports the detection results to the Internet of Things server. The detection frequency of the Internet of Things devices can be flexibly set, so that the Internet of Things platform can timely perceive the latest online status of the Internet of Things devices, thereby improving the real-time and accuracy of the detection of the Internet of Things devices.
[0135] Optionally, the device status detection module is specifically used to:
[0136] When the frequency differences of the mutual detection devices are all consistent, obtaining the number of mutual detection devices;
[0137] Calculate the number of online states of each detection device according to the access detection results of each detection device included in each heartbeat;
[0138] For each of the detection devices, calculating an online ratio between the number of online states of the detection device and the number of the mutual detection devices;
[0139] determining a state of the detection device according to the online ratio and the frequency difference;
[0140] The status of each of the IoT devices is determined based on the status of each of the detection devices.
[0141] Optionally, the device status detection module is specifically used to:
[0142] Get the mutual detection device that sends the heartbeat packet;
[0143] Obtaining the status of each of the mutual detection devices in each of the heartbeat packets;
[0144] Update the mutual exploration device according to each mutual exploration device that sends the heartbeat packet and the status of each mutual exploration device in each heartbeat packet;
[0145] The updated number of mutual detection devices is counted to obtain the number of mutual detection devices.
[0146] Optionally, the device status detection module is specifically used to:
[0147] When the frequency difference of the mutual detection devices is different, according to each detection device included in each heartbeat packet, the number of participating devices corresponding to each detection device is counted;
[0148] For each of the detection devices, calculating an online ratio between the number of online states of the detection device and the number of participating devices;
[0149] determining a state of the detection device according to the online ratio and the frequency difference;
[0150] The status of each of the IoT devices is determined based on the status of each of the detection devices.
[0151] Optionally, the device status detection module is specifically used to:
[0152] For each of the detection devices, the number of heartbeat packets including the status of the detection device is counted, and the number of participating devices corresponding to the detection device is determined.
[0153] Optionally, the device status detection module is specifically used to:
[0154] Determining an online status condition according to a frequency difference between the mutual detection devices;
[0155] When it is determined that the detection device meets the online status condition based on at least one detection device included in each of the heartbeat packets and the access detection results of each of the detection devices, the status of the Internet of Things device is determined to be an online status.
[0156] Optionally, the heartbeat packet accesses each detection device through the mutual detection device according to the detection frequency and the access address of each detection device to obtain the access detection result of the status of each detection device.
[0157] The IoT device activity detection device provided in the embodiment of the present invention can execute the IoT device activity detection method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0158] In the technical solutions of the embodiments of the present invention, the acquisition, storage and application of the data involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0159] Figure 5 A schematic diagram of the structure of an electronic device 500 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0160] like Figure 5 As shown, the electronic device 500 includes at least one processor 501, and a memory connected to the at least one processor 501 in communication, such as a read-only memory (ROM) 502, a random access memory (RAM) 503, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 501 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 502 or the computer program loaded from the storage unit 508 to the random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the electronic device 500 can also be stored. The processor 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0161] Multiple components in the electronic device 500 are connected to the I / O interface 505, including: an input unit 506, such as a keyboard, a mouse, etc.; an output unit 507, such as various types of displays, speakers, etc.; a storage unit 508, such as a disk, an optical disk, etc.; and a communication unit 509, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 509 allows the electronic device 500 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0162] The processor 501 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 501 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 501 executes the various methods and processes described above, such as the IoT device detection method.
[0163] In some embodiments, the IoT device detection method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 508. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 500 via the ROM 502 and / or the communication unit 509. When the computer program is loaded into the RAM 503 and executed by the processor 501, one or more steps of the IoT device detection method described above may be performed. Alternatively, in other embodiments, the processor 501 may be configured to execute the IoT device detection method in any other appropriate manner (e.g., by means of firmware).
[0164] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0165] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0166] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, device, or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0167] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0168] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0169] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS (Virtual Private Server) services.
[0170] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0171] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for detecting activity of an Internet of Things device, characterized in that: Applied to an Internet of Things server, the method comprises: Acquire heartbeat packets sent by multiple mutual detection devices; wherein the heartbeat packets carry access detection results of the status of the detection devices, and the Internet of Things devices include detection devices and mutual detection devices; Acquire at least one detection device included in each of the heartbeat packets and an access detection result of each of the detection devices; Obtaining the frequency difference between the detection frequency and the heartbeat reporting frequency of each of the mutual detection devices; The status of each of the IoT devices is determined based on the detection devices included in each of the heartbeat packets, the access detection results of each of the detection devices, and the frequency difference of each of the mutual detection devices.
2. The method according to claim 1, characterized in that Determining the status of each of the IoT devices according to each of the detection devices included in each of the heartbeat packets, the access detection results of each of the detection devices, and the frequency difference of each of the mutual detection devices includes: When the frequency differences of the mutual detection devices are all consistent, obtaining the number of mutual detection devices; Calculate the number of online states of each detection device according to the access detection results of each detection device included in each heartbeat; For each of the detection devices, calculating an online ratio between the number of online states of the detection device and the number of the mutual detection devices; determining a state of the detection device according to the online ratio and the frequency difference; The status of each of the IoT devices is determined based on the status of each of the detection devices.
3. The method according to claim 2, characterized in that The obtaining of the number of mutual detection devices includes: Get the mutual detection device that sends the heartbeat packet; Obtaining the status of each of the mutual detection devices in each of the heartbeat packets; Update the mutual exploration device according to each mutual exploration device that sends the heartbeat packet and the status of each mutual exploration device in each heartbeat packet; The updated number of mutual detection devices is counted to obtain the number of mutual detection devices.
4. The method according to claim 1, characterized in that Determining the status of each of the IoT devices according to each of the detection devices included in each of the heartbeat packets, the access detection results of each of the detection devices, and the frequency difference of each of the mutual detection devices includes: When the frequency difference of the mutual detection devices is different, according to each detection device included in each heartbeat packet, the number of participating devices corresponding to each detection device is counted; For each of the detection devices, calculating an online ratio between the number of online states of the detection device and the number of participating devices; determining a state of the detection device according to the online ratio and the frequency difference; The status of each of the IoT devices is determined based on the status of each of the detection devices.
5. The method according to claim 4, characterized in that The counting of the number of participating devices corresponding to each detection device included in each heartbeat packet includes: For each of the detection devices, the number of heartbeat packets including the status of the detection device is counted, and the number of participating devices corresponding to the detection device is determined.
6. The method according to claim 1, characterized in that Determining the status of each of the IoT devices according to each of the detection devices included in each of the heartbeat packets, the access detection results of each of the detection devices, and the frequency difference of each of the mutual detection devices includes: Determining an online status condition according to a frequency difference between the mutual detection devices; When it is determined that the detection device meets the online status condition based on at least one detection device included in each of the heartbeat packets and the access detection results of each of the detection devices, the status of the Internet of Things device is determined to be an online status.
7. The method according to claim 1, characterized in that The heartbeat packet is generated by the mutual detection device accessing each detection device according to the detection frequency and the access address of each detection device to obtain the access detection result of the status of each detection device.
8. An IoT device activity detection device, characterized in that: The device comprises: A heartbeat packet receiving module, used to obtain heartbeat packets sent by multiple mutual detection devices; wherein the heartbeat packet carries the access detection result of the state of the detection device, and the Internet of Things device includes a detection device and a mutual detection device; A device status acquisition module, used to acquire at least one detection device included in each of the heartbeat packets and an access detection result of each of the detection devices; A frequency difference acquisition module, used to obtain the frequency difference between the detection frequency and the heartbeat reporting frequency of each of the mutual detection devices; The device status detection module is used to determine the status of each of the IoT devices based on the detection devices included in each of the heartbeat packets, the access detection results of each of the detection devices, and the frequency difference of each of the mutual detection devices.
9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the Internet of Things device activation method described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the method for detecting activation of an Internet of Things device according to any one of claims 1 to 7 when executed.
Citation Information
Patent Citations
Offline AP detection method and device
CN107864486A
Device management method and device, server and memory medium
CN107995024A
Heartbeat packet sending method and to-be-tested system
CN111679931A
Redis cluster anomaly detection method and device, terminal and storage medium
CN114553747A
Method and device for improving stability of intelligent system based on cloud and multi-gateway detection
CN116208471A