CN115801645A - Online state detection method and device for equipment - Google Patents

Online state detection method and device for equipment Download PDF

Info

Publication number
CN115801645A
CN115801645A CN202111064214.1A CN202111064214A CN115801645A CN 115801645 A CN115801645 A CN 115801645A CN 202111064214 A CN202111064214 A CN 202111064214A CN 115801645 A CN115801645 A CN 115801645A
Authority
CN
China
Prior art keywords
target
equipment
target equipment
heartbeat
state
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.)
Pending
Application number
CN202111064214.1A
Other languages
Chinese (zh)
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.)
Foshan Viomi Electrical Technology Co Ltd
Original Assignee
Foshan Viomi Electrical Technology Co Ltd
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 Foshan Viomi Electrical Technology Co Ltd filed Critical Foshan Viomi Electrical Technology Co Ltd
Priority to CN202111064214.1A priority Critical patent/CN115801645A/en
Publication of CN115801645A publication Critical patent/CN115801645A/en
Pending legal-status Critical Current

Links

Images

Abstract

The invention discloses a method and a device for detecting the online state of equipment, which automatically send a target heartbeat query instruction to the equipment when judging that the online state of the equipment needs to be determined and data reported by the equipment is not received within a time length matched with the equipment, automatically analyze the online state of the equipment according to the response condition fed back by the equipment and the type of the equipment, accurately and timely detect the real state (the online state or the offline state) of the equipment without increasing the heartbeat detection frequency of the equipment, are favorable for a user to know the real state of the equipment before preparing to control the equipment, so that the user can accurately control the equipment and the experience of the user is improved; by actively inquiring the online state of the equipment, the occurrence situations of network congestion and increased data instruction packet loss rate when the online state detection device carries a plurality of pieces of equipment and needs to communicate with the plurality of pieces of equipment can be reduced, and the cruising ability of the low-power-consumption equipment can be improved.

Description

Online state detection method and device for equipment
Technical Field
The invention relates to the technical field of intelligent equipment, in particular to an online state detection method and device of equipment.
Background
At present, zigBee wireless communication technology is widely used in smart home products, such as: the ZigBee gateway, the ZigBee switch, the ZigBee sensor and the like are applied to terminal products of ZigBee protocol communication. The ZigBee gateway needs to transfer and analyze a cloud data instruction, manages the equipment, monitors the change of the attribute value of the equipment and reports the change to the cloud, wherein the online state of the equipment depends on a heartbeat detection mechanism, namely, the online state of the equipment is determined by detecting whether the data reported by the equipment is received in a heartbeat period.
However, practice shows that due to limitations of current ZigBee products, after a device is offline (e.g., the device is powered off), a gateway cannot know in real time that the state of the device has changed, and often needs to wait for a heartbeat cycle before finding and reporting the offline state of the device, which easily causes an uncontrollable false image that the state of the device is still displayed on a user terminal as an online state. Therefore, it is important to provide a scheme for detecting the online status of the device in time so as to accurately control the device.
Disclosure of Invention
The technical problem to be solved by the present invention is to provide a method and a device for detecting an online status of a device, which can detect the online status of the device in time, so as to accurately control the device.
In order to solve the above technical problem, a first aspect of the present invention discloses an online status detection method for a device, where the method includes:
when the online state of the target equipment needs to be determined, judging whether data reported by the target equipment is received within a time period of data reporting waiting time matched with the target equipment, wherein the starting time of the data reporting waiting time is the time when the online state of the target equipment needs to be determined;
when judging that the data reported by the target equipment is not received, sending a target heartbeat query instruction to the target equipment;
acquiring a response condition fed back by the target equipment in a first preset time period, and analyzing the online state of the target equipment according to the response condition fed back by the target equipment and the type of the target equipment, wherein the type of the target equipment comprises a monitoring type or a query type.
As an optional implementation manner, in the first aspect of the present invention, after determining that data reported by the target device is not received, the method further includes:
when the type of the target equipment is the monitoring type, decrementing the value of the heartbeat counter of the target equipment to 0 preset value at intervals of second preset time;
and in the process that the value of the heartbeat counter of the target equipment is decreased to 0, judging whether the data reported by the target equipment is received, and when the data reported by the target equipment is judged not to be received, executing the operation of sending a target heartbeat query instruction to the target equipment.
As an optional implementation manner, in the first aspect of the present invention, the analyzing, according to the response status fed back by the target device and the type of the target device, the online status of the target device includes:
when the type of the target device is the query type and when the response condition fed back by the target device is used for indicating that response information of the target device is received within the first preset time period, marking the current state of the target device as an online state.
As an optional implementation manner, in the first aspect of the present invention, the method further comprises:
when the type of the target device is the query type and when the response condition fed back by the target device is used for indicating that the response information of the target device is not received in the first preset time period, determining the number of times of sending a target heartbeat query instruction to the target device at the current moment in the process of detecting the online state of the target device;
when judging whether the times are larger than or equal to the determined time threshold value, and if the judgment result is yes, determining that the current state of the target equipment is in an off-line state;
and, the method further comprises:
and when the times are judged to be smaller than the time threshold value, re-executing the operation of sending the target heartbeat query instruction to the target equipment.
As an optional implementation manner, in the first aspect of the present invention, when the type of the target device is the listening type, the analyzing the online status of the target device according to the response status fed back by the target device and the type of the target device includes:
when the response condition fed back by the target equipment is used for indicating that response information of the target equipment is received in the first preset time period, marking the current state of the target equipment as an online state;
and when the type of the target equipment is the monitoring type and when the response condition fed back by the target equipment is used for indicating that the response information of the target equipment is not received in the first preset time period, determining that the current state of the target equipment is in an offline state.
As an optional implementation manner, in the first aspect of the present invention, the method further comprises:
when the type of the target equipment is the monitoring type, determining that the heartbeat cycle of the target equipment is data reporting waiting time matched with the target equipment;
when the type of the target equipment is the query type, generating the heartbeat query duration of the target equipment according to the heartbeat period of the target equipment, and determining that the heartbeat query duration is the data reporting waiting duration matched with the target equipment, wherein the heartbeat query duration is more than or equal to a third preset duration and is less than a fourth preset duration, and the third preset duration and the fourth preset duration are both less than the heartbeat period of the target equipment.
As an optional implementation manner, in the first aspect of the present invention, the method further comprises:
when judging that the data reported by the target equipment is received, marking the current state of the target equipment as an online state;
judging whether the current state of the target equipment is turned over or not, and when the current state of the target equipment is judged to be turned over, executing the operation of sending the information that the target equipment is in the online state to the determined user terminal;
wherein the executing of the operation of sending the information that the target device is already in the online state to the determined user terminal includes:
sending the information that the target equipment is in an online state to the determined user terminal; and/or
Sending information that the target equipment is in an online state to a cloud server, and triggering the cloud server to send the information that the target equipment is in the online state to the determined user terminal;
before the operation of sending the information that the target device is in the online state to the determined user terminal is executed, the method further includes:
and judging whether the current state of the target equipment is turned over, and executing the operation of sending the information that the target equipment is in the online state to the determined user terminal when the current state of the target equipment is turned over.
As an alternative implementation, in the first aspect of the present invention, the method further includes:
broadcasting a heartbeat inquiry command to each device in all devices in a device information table, wherein the heartbeat inquiry command is used for inquiring heartbeat data of each device in the device information table;
determining the response condition of each device in the device information table to the heartbeat inquiry command, and judging whether the response condition exists in all the devices in the device information table or not according to the response condition of each device in the device information table to the heartbeat inquiry command, wherein the response condition is used for indicating that the device does not respond to the heartbeat inquiry command;
when judging that the current state of each device does not exist, marking the current state of each device as an online state in the device information table;
when judging that at least one response condition is used for indicating the equipment which does not respond to the heartbeat inquiry instruction, determining the response condition for indicating the inquiry frequency of each equipment which does not respond to the heartbeat inquiry instruction, judging whether the response condition is used for indicating whether the inquiry frequency of each equipment which does not respond to the heartbeat inquiry instruction is larger than or equal to the determined inquiry frequency threshold value, if so, marking the response condition for indicating that the current state of each equipment which does not respond to the heartbeat inquiry instruction is an off-line state, and if so, independently broadcasting the heartbeat inquiry instruction to each equipment which has the response condition for indicating that the equipment does not respond to the heartbeat inquiry instruction again.
As an alternative implementation, in the first aspect of the present invention, the method further includes:
when a query request aiming at the online state of a certain device sent by a user terminal is detected, determining the online state of a target device to be determined, wherein the certain device is the target device; alternatively, the first and second electrodes may be,
and judging whether the current time is in the inquiry time period of the online state of a certain device determined in the device list, and determining that the online state of the target device needs to be determined when the judgment result is yes, wherein the certain device is the target device.
The second aspect of the present invention discloses an online status detecting device for equipment, which comprises:
the judging module is used for judging whether the data reported by the target equipment is received within a time period of data reporting waiting time matched with the target equipment when the online state of the target equipment needs to be determined is judged, wherein the starting time of the data reporting waiting time is the time when the online state of the target equipment needs to be determined;
the sending module is used for sending a target heartbeat query instruction to the target equipment when the judging module judges that the data reported by the target equipment are not received;
the acquisition module is used for acquiring the response condition fed back by the target equipment in a first preset time period;
and the analysis module is used for analyzing the online state of the target equipment according to the response condition fed back by the target equipment and the type of the target equipment, wherein the type of the target equipment comprises a monitoring type or a query type.
As an alternative embodiment, in the second aspect of the present invention, the apparatus further comprises:
a decrementing module, configured to decrement a value of a heartbeat counter of the target device to a preset value of 0 every second preset time interval when the determining module determines that the data reported by the target device is not received and when the type of the target device is the monitoring type;
the judging module is further configured to judge whether the data reported by the target device is received or not in a process that the value of the heartbeat counter of the target device is decreased to 0, and when it is judged that the data reported by the target device is not received, trigger the sending module to execute the operation of sending the target heartbeat query instruction to the target device.
As an alternative embodiment, in the second aspect of the present invention, the analysis module includes:
and the marking sub-module is used for marking the current state of the target equipment as an online state when the type of the target equipment is the query type and when the response condition fed back by the target equipment is used for indicating that the response information of the target equipment is received in the first preset time period.
As an optional implementation manner, in the second aspect of the present invention, the analysis module further includes:
the marking sub-module is further configured to determine, when the type of the target device is the query type and when a response condition fed back by the target device is used to indicate that no response information of the target device is received within the first preset duration, a number of times that a target heartbeat query instruction is sent to the target device at a current time in a process of detecting an online state of the target device this time;
the judgment submodule is used for judging whether the times are more than or equal to the determined time threshold;
the marking sub-module is further used for determining that the current state of the target device is in an off-line state when the judgment result is yes;
the sending module is further configured to re-execute the operation of sending the target heartbeat query instruction to the target device when the judging submodule judges that the number of times is smaller than the number-of-times threshold.
As an optional implementation manner, in the second aspect of the present invention, when the type of the target device is the monitoring type, the manner that the analysis module analyzes the online status of the target device according to the response status fed back by the target device and the type of the target device specifically is:
when the response condition fed back by the target equipment is used for indicating that response information of the target equipment is received in the first preset time period, marking the current state of the target equipment as an online state;
and when the type of the target equipment is the monitoring type and when the response condition fed back by the target equipment is used for indicating that the response information of the target equipment is not received in the first preset time period, determining that the current state of the target equipment is in an offline state.
As an alternative embodiment, in the second aspect of the present invention, the apparatus further comprises:
a first determining module, configured to determine, when the type of the target device is the monitoring type, that a heartbeat cycle of the target device is a data reporting waiting duration matched with the target device;
the generating module is used for generating the heartbeat inquiry duration of the target equipment according to the heartbeat cycle of the target equipment when the type of the target equipment is the inquiry type;
the first determining module is further configured to determine that the heartbeat inquiry duration is a data reporting waiting duration matched with the target device, where the heartbeat inquiry duration is greater than or equal to a third preset duration and is less than a fourth preset duration, and both the third preset duration and the fourth preset duration are less than a heartbeat period of the target device.
As an alternative embodiment, in the second aspect of the present invention, the apparatus further comprises:
the first marking module is used for marking the current state of the target equipment as an online state when the judging module judges that the data reported by the target equipment are received;
the sending module is further configured to perform an operation of sending information that the target device is already in an online state to the determined user terminal;
the mode of the sending module executing the operation of sending the information that the target device is already in the online state to the determined user terminal is specifically as follows:
sending the information that the target equipment is in an online state to the determined user terminal; and/or
Sending information that the target equipment is in an online state to a cloud server, and triggering the cloud server to send the information that the target equipment is in the online state to the determined user terminal;
the judging module is further configured to judge whether the current state of the target device is turned over before the sending module performs an operation of sending the information that the target device is already in the online state to the determined user terminal; and when the current state of the target equipment is judged to be turned, triggering the sending module to execute the operation of sending the information that the target equipment is in the online state to the determined user terminal.
As an optional implementation manner, in the second aspect of the present invention, the sending module is further configured to broadcast a heartbeat query instruction to each of all devices in a device information table, where the heartbeat query instruction is used to query heartbeat data of each of the devices in the device information table;
and, the apparatus further comprises:
a second determining module, configured to determine a response condition of each device in the device information table for the heartbeat query instruction;
the judging module is further configured to judge, according to a response condition of each device in the device information table to the heartbeat inquiry command, whether a response condition exists in all the devices in the device information table, where the response condition is used to indicate that the device does not respond to the heartbeat inquiry command;
the second marking module is used for marking the current state of each piece of equipment as the online state in the equipment information table when judging that the equipment does not exist;
the second determining module is further configured to determine, when it is determined that at least one response condition exists for indicating a device that does not respond to the heartbeat query instruction, that the response condition is used for indicating the number of queries of each device that does not respond to the heartbeat query instruction;
the judging module is further configured to judge whether a response condition is used to indicate whether the query frequency of each device that does not respond to the heartbeat query instruction is greater than or equal to the determined query frequency threshold;
the second marking module is further configured to mark a response condition to indicate that the current state of each device which does not respond to the heartbeat inquiry instruction is an offline state when the judgment result is yes;
and the sending module is further configured to, when the determination result is yes, independently rebroadcast the heartbeat inquiry instruction to each device whose response condition is used to indicate that the heartbeat inquiry instruction is not responded.
As an optional implementation manner, in the second aspect of the present invention, the apparatus is further configured to determine that the presence status of the target device needs to be determined when a query request sent by the user terminal for the presence status of a certain device is detected, where the certain device is the target device; alternatively, the first and second liquid crystal display panels may be,
and judging whether the current time is in the inquiry time period of the online state of a certain device determined in the device list, and determining that the online state of the target device needs to be determined when the judgment result is yes, wherein the certain device is the target device.
The third aspect of the present invention discloses an online status detection device for another device, the device comprising:
a memory storing executable program code;
a processor coupled with the memory;
the processor calls the executable program code stored in the memory to execute part or all of the steps of the online status detection method of the device disclosed by the first aspect of the invention.
In a fourth aspect, the present invention discloses a computer storage medium storing computer instructions for performing some or all of the steps of the method for detecting an online status of a device disclosed in the first aspect of the present invention when the computer instructions are called.
Compared with the prior art, the embodiment of the invention has the following beneficial effects:
in the embodiment of the invention, when the online state of the target equipment needs to be determined is judged, whether the data reported by the target equipment is received in the time period of the data reporting waiting time length matched with the target equipment is judged, the type of the target equipment comprises a monitoring type or an inquiry type, and the initial time of the data reporting waiting time length is the time when the online state of the target equipment needs to be determined is judged; when judging that the data reported by the target equipment is not received, sending a target heartbeat query instruction to the target equipment, and acquiring a response condition fed back by the target equipment received in a first preset time period; and analyzing the online state of the target equipment according to the response condition fed back by the target equipment and the type of the target equipment. Therefore, when the online state of the target equipment needs to be determined and the data reported by the target equipment is not received within the time length matched with the target equipment, the target heartbeat query instruction is automatically sent to the target equipment, the online state of the target equipment is automatically analyzed according to the response condition fed back by the target equipment and the type of the target equipment, the real state (online state or offline state) of the target equipment can be accurately and timely detected without increasing the heartbeat detection frequency of the target equipment, a user can know the real state of the target equipment before preparing to control the target equipment, the user can accurately control the target equipment, and the experience of the user is improved; by actively inquiring the online state of the equipment, the occurrence situations of network congestion and increased data instruction packet loss rate when the online state detection device carries a plurality of pieces of equipment and needs to communicate with the plurality of pieces of equipment can be reduced, and the cruising ability of the low-power-consumption equipment can be improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a flow chart illustrating a method for detecting an online status of a device according to an embodiment of the present invention;
FIG. 2 is a flow chart illustrating an online status detecting method for another device according to an embodiment of the present invention;
FIG. 3 is a schematic structural diagram of an online status detecting device of an apparatus according to an embodiment of the present invention;
FIG. 4 is a schematic structural diagram of an online status detecting device of another apparatus disclosed in the embodiment of the present invention;
FIG. 5 is a schematic structural diagram of an online status detecting device of another apparatus according to an embodiment of the disclosure;
FIG. 6 is a schematic structural diagram of an online status detecting device and a device establishing a communication connection according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of a user terminal requesting switching between a plug-in homepage of an online status of an inquiry device and a plug-in page controlled by a sub-device according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of an apparatus information table according to an embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The terms "first," "second," and the like in the description and claims of the present invention and in the above-described drawings are used for distinguishing between different objects and not for describing a particular order. Furthermore, the terms "include" and "have," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, apparatus, article, or article that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or article.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the invention. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments.
The invention discloses a method and a device for detecting the online state of equipment, which can automatically send a target heartbeat inquiry instruction to target equipment when judging that the online state of the target equipment needs to be determined and when judging that data reported by the target equipment is not received within a time length matched with the target equipment, automatically analyze the online state of the target equipment according to the response condition fed back by the target equipment and the type of the target equipment, accurately and timely detect the real state (the online state or the offline state) of the target equipment without increasing the heartbeat detection frequency of the target equipment, are beneficial to a user to know the real state of the target equipment before preparing to control the target equipment, so that the user can accurately control the target equipment and the experience of the user is improved; by actively inquiring the online state of the equipment, the occurrence situations of network congestion and increased data instruction packet loss rate when the online state detection device carries a plurality of pieces of equipment and needs to communicate with the plurality of pieces of equipment can be reduced, and the cruising ability of the low-power-consumption equipment can be improved. The following are detailed below.
Example one
Referring to fig. 1, fig. 1 is a schematic flow chart illustrating an online status detection method for a device according to an embodiment of the present invention. The method described in fig. 1 may be applied to an online status detection device, such as an online status detection gateway, where the online status detection device, a user terminal, and a cloud server may be in communication connection with each other, where the user terminal includes at least one of a smart phone (Android phone, iOS phone, etc.), a smart phone number watch, a tablet computer, a palm computer, a vehicle-mounted computer, a desktop computer, a netbook, a Personal Digital Assistant (PDA), an intelligent navigator, and a Mobile Internet target device (MID), and the embodiment of the present invention is not limited. As shown in fig. 1, the online status detection method of the device may include the following operations:
101. and when the online state of the target equipment needs to be determined, judging whether the data reported by the target equipment is received within a time period of the data reporting waiting time length matched with the target equipment.
In the embodiment of the invention, the target equipment is any product using the ZigBee wireless technology, and the number of the target equipment is more than or equal to 1. The type of the target device includes a listening type or a query type. The monitoring type equipment is equipment capable of actively reporting data to the online state detection device, and comprises equipment (such as a socket, a panel, a lamp and the like) powered by a main power supply (such as mains supply) and/or low-power-consumption equipment (such as an intelligent door lock, a temperature and humidity sensor and the like) powered by a battery; the query type device is a device which can report data only when the online state detection device actively accesses. As shown in fig. 6, fig. 6 discloses a schematic diagram of an online status detection apparatus establishing communication connection with devices, as shown in fig. 6, the online status detection apparatus communicates with a listening-type device and a querying-type device respectively through a ZigBee coordinator, the number of the listening-type devices and the querying-type devices is not limited, and in the schematic diagram of fig. 6, six listening-type devices (device 1, device 2, device 3, device 4, device 5, and device 6) and six querying-type devices (device 7, device 8, device 9, device 10, device 11, and device 12) are illustrated.
In this embodiment of the present invention, optionally, the data reported by the target device includes, but is not limited to, at least one of a heartbeat packet, an attribute packet, and other data packets.
102. And when the data reported by the target equipment are judged not to be received, sending a target heartbeat query instruction to the target equipment, and acquiring a response condition fed back by the target equipment received within a first preset time period.
In this embodiment of the present invention, optionally, the starting time of the first preset time period is a time when the target heartbeat query instruction is sent to the target device, and the first preset time period is a longest response time period for waiting for data reported by the target device. Optionally, each target device has a corresponding first preset duration, and the first preset duration of each target device is a duration determined by the type of the target device and/or the heartbeat cycle of the target device and/or the timing accuracy of the target device, where the higher the timing accuracy of the target device is, the closer the determined first preset duration is to the heartbeat cycle of the corresponding device, for example: the heartbeat cycle of the target device is 3 minutes, and the customization precision of the target device is 98%, then the first preset time length corresponding to the target device is 3.5 minutes. Therefore, the longest response time length of the data to be reported by the target equipment is determined through the plurality of contents, the determination accuracy of the longest response time length can be improved, and the accuracy of receiving the response condition fed back by the target equipment is improved. Further optionally, different target devices may correspond to different heartbeat periods, for example, the heartbeat period of a device powered by the main power source is 1 minute or 5 minutes, and the heartbeat period of a device powered by the battery and with low power consumption is 20 minutes or 1 hour.
103. And analyzing the online state of the target equipment according to the response condition fed back by the target equipment and the type of the target equipment, wherein the type of the target equipment comprises a monitoring type or a query type.
It can be seen that, by implementing the method described in fig. 1, when it is determined that the online state of the target device needs to be determined and data reported by the target device is not received within a duration matched with the target device, a target heartbeat query instruction can be automatically sent to the target device, and the online state of the target device can be automatically analyzed according to a response condition fed back by the target device and the type of the target device, so that the real state (online state or offline state) of the target device can be accurately and timely detected without increasing the heartbeat detection frequency of the target device, and a user can know the real state of the target device before preparing to control the target device, so that the user can accurately control the target device, and the experience of the user is improved; by actively inquiring the online state of the equipment, the occurrence situations of network congestion and increased data instruction packet loss rate when the online state detection device carries a plurality of pieces of equipment and needs to communicate with the plurality of pieces of equipment can be reduced, and the cruising ability of the low-power-consumption equipment can be improved.
In an optional embodiment, the method may further comprise the operations of:
when detecting a query request aiming at the online state of a certain device sent by a user terminal, determining that the online state of a target device needs to be determined, wherein the certain device is the target device; alternatively, the first and second liquid crystal display panels may be,
and judging whether the current time is in the inquiry time period of the online state of a certain device determined in the device list, and determining that the online state of the target device is required to be determined when the judgment result is yes, wherein the certain device is the target device.
In this optional embodiment, as shown in fig. 7, fig. 7 discloses a schematic structural diagram of a user terminal requesting to query switching between a plug-in homepage of an online state of a device and a sub-device control plug-in page, as shown in fig. 7, when it is detected that a device control application (including APP or applet) of the user terminal is started, the user terminal enters the plug-in homepage, acquires a device list from a cloud server and/or an online state detection apparatus, and displays the device list on the plug-in homepage of the user terminal; detecting an operation triggered by a user aiming at a certain device (device 1) on a plug-in homepage, enabling a user terminal to enter a sub-device control plug-in page of the certain device, and when the current state of the certain device is displayed on the sub-device control plug-in page to be an offline state, disabling a control button (such as a switch channel 1 in fig. 7) of the certain device and prompting the user that the certain device is in the offline state and cannot be controlled; when the current state of a certain device is displayed as the online state on the control plug-in page of the sub-device, the user terminal sends a query request aiming at the online state of the certain device to the online state detection device. In the schematic diagram of fig. 7, the device list includes at least one device identifier and a state of each device, and the device list includes device 1, device 2, device 3, device 4, device 5, device 6, device 7, device 8, device 9, and device 10.
Therefore, in the optional embodiment, when it is determined that the user terminal sends the query request for the online state of the device or when the query time period in which the online state of the device is currently detected is detected, the online state of the device to be detected is determined, so that the online state of the device to be determined can be enriched, and the possibility of determining the online state of the device to be determined is improved.
In another optional embodiment, after determining that the data reported by the target device is not received, the method may further include the following operations:
when the type of the target equipment is a monitoring type, decrementing the value of the heartbeat counter of the target equipment to 0 preset value every second preset time;
and in the process that the value of the heartbeat counter of the target equipment is decreased to 0, judging whether the data reported by the target equipment is received, and when the data reported by the target equipment is judged not to be received, executing the operation of sending the target heartbeat query instruction to the target equipment.
In this optional embodiment, optionally, the second preset time period may be a time period such as 1s or 2s, and the preset value is 1, 2, for example: the value of the heartbeat counter of the target device is decremented to 1 every second interval.
In this optional embodiment, optionally, when it is determined that the data reported by the target device is received, the current state of the target device is marked as an online state.
As can be seen, after determining that the data reported by the target device is not received, if the target device is a monitoring type target device, the optional embodiment further determines whether the data reported by the target device is received in a process of decrementing a heartbeat counter of the target device, and if the data reported by the target device is not received, sends a target heartbeat query instruction to the target device, so that the occurrence accuracy of the target heartbeat query instruction can be improved; if the data reported by the target equipment is received, the current state of the target equipment is marked as the online state, so that the accuracy and the efficiency of determining the online state of the target equipment can be improved.
In yet another optional embodiment, optionally, analyzing the online status of the target device according to the response status fed back by the target device and the type of the target device, includes:
and when the type of the target equipment is the query type and the response condition fed back by the target equipment is used for indicating that the response information of the target equipment is received in a first preset time period, marking the current state of the target equipment as an online state.
In this optional embodiment, optionally, the response information of the target device includes, but is not limited to, at least one of an identifier of the target device, a response time, a type of the target device, a size of the target device, a color of the target device, an identifier of a receiving channel of the target heartbeat inquiry command, and an appearance shape of the target device, and it should be noted that the response information of the target device preferentially includes the identifier of the target device. Therefore, when the number of the devices needing to determine the online state is multiple, the devices can be clearly distinguished through the content included in the response condition of each device, and the more the content included in the response condition of the device is, the more the regional accuracy of the device is favorably improved, so that the accuracy and the reliability of determining the online state of each device are improved.
Therefore, the optional embodiment can determine that the current state of the target device is the online state when the response condition fed back by the target device with the type of query is judged to be used for indicating that the response information reported by the target device is received within the specified time, and can improve the accuracy and flexibility of determining the online state of the target device.
In yet another alternative embodiment, the method may further include the operations of:
when the type of the target equipment is an inquiry type and when the response condition fed back by the target equipment is used for indicating that the response information of the target equipment is not received in a first preset time period, determining the frequency of sending a target heartbeat inquiry instruction to the target equipment at the current moment in the process of detecting the online state of the target equipment;
judging whether the frequency is greater than or equal to the determined frequency threshold value, and determining that the current state of the target equipment is in an off-line state when the judgment result is yes;
and, the method may further comprise the steps of:
and when the frequency is judged to be less than the frequency threshold value, re-executing the operation of sending the target heartbeat inquiry command to the target equipment.
In this alternative embodiment, the number threshold may be 1 or 2, and this alternative embodiment is not limited.
As can be seen, in this optional embodiment, when it is determined that the response condition fed back by the target device of the type of query is used to indicate that the response information reported by the target device is not received within the specified time period, it is further automatically determined whether the number of times that the target device is queried exceeds a determined number threshold, if so, the current state of the target device is marked as an offline state, and if not, the target heartbeat query instruction is retransmitted to determine the current state of the target device, so that the accuracy and reliability of determining the current state of the target device can be improved.
In yet another optional embodiment, analyzing the online status of the target device according to the response status fed back by the target device and the type of the target device includes:
when the type of the target equipment is a monitoring type and when the response condition fed back by the target equipment is used for indicating that response information of the target equipment is received in a first preset time period, marking the current state of the target equipment as an online state;
and when the type of the target equipment is a monitoring type and the response condition fed back by the target equipment is used for indicating that the response information of the target equipment is not received in a first preset time period, determining that the current state of the target equipment is in an off-line state.
In this optional embodiment, optionally, the response information of the target device includes, but is not limited to, at least one of an identifier of the target device, a response time, a type of the target device, a size of the target device, a color of the target device, an identifier of a receiving channel of the target heartbeat inquiry command, and an appearance shape of the target device, and it should be noted that the response information of the target device preferentially includes the identifier of the target device. Therefore, when the number of the devices needing to determine the online state is multiple, the devices can be clearly distinguished through the content included in the response condition of each device, and the more the content included in the response condition of the device is, the more the regional accuracy of the device is favorably improved, so that the determination accuracy and the reliability of the online state of each device are improved.
In this optional embodiment, optionally, after the current state of the target device is determined, the heartbeat counter of the target device is reset, and the operation of decrementing the heartbeat counter of the target device to the preset value of 0 every second preset time interval is executed again, so as to know the real-time real state of the target device.
As can be seen, when the optional embodiment determines that the type of the target device is the monitoring type, the optional embodiment is directly used to indicate that the received or non-received response information reported by the target device is received within a specified time period according to the received response condition to determine the current state of the target device, so that the accuracy and efficiency of determining the current state of the target device can be improved.
In yet another optional embodiment, the method may further comprise the steps of:
when the type of the target equipment is a monitoring type, determining the heartbeat cycle of the target equipment as data reporting waiting time matched with the target equipment;
and when the type of the target equipment is the query type, generating heartbeat query time of the target equipment according to the heartbeat cycle of the target equipment, and determining the heartbeat query time as data reporting waiting time matched with the target equipment.
In this optional embodiment, optionally, the heartbeat inquiry time length is greater than or equal to a third preset time length and less than a fourth preset time length, where both the third preset time length and the fourth preset time length are less than the heartbeat period of the target device. For example, the heartbeat inquiry time length needs to be greater than or equal to half of the heartbeat period of the target device, and is less than or equal to three-fourths of the heartbeat period of the target device, so that the heartbeat inquiry time length of the target device is randomly generated, which is beneficial to separate inquiry when the online states of a plurality of target devices with the same heartbeat period need to be detected simultaneously (for example, 10 switch panels are arranged under an online state detection device, and the heartbeat periods of the switch panels are all 1 minute), and the occurrence situation that the online states of the target devices cannot be accurately determined and distinguished due to data packet loss easily caused by the end inquiry time of the heartbeat inquiry time length is reduced.
As can be seen, in the alternative embodiment, the waiting duration of the corresponding data report is determined according to the types of the different target devices, so that the accuracy of determining the waiting duration of the corresponding data report can be improved, and thus the accuracy of determining the online state of the corresponding target device is improved.
In yet another alternative embodiment, the method may further include the operations of:
when judging that the data reported by the target equipment is received, marking the current state of the target equipment as an online state;
executing an operation of sending information that the target equipment is in an online state to the determined user terminal;
in this optional embodiment, optionally, the operation of sending the information that the target device is already in the online state to the determined user terminal is performed, including:
sending information that the target equipment is in an online state to the determined user terminal; and/or
And sending the information that the target equipment is in the online state to the cloud server, and triggering the cloud server to send the information that the target equipment is in the online state to the determined user terminal.
It should be noted that this alternative embodiment may be applied to any of the above embodiments after the current state of the target device is marked as online. And after the online state of the target device is marked, the online information of the target device can be directly sent to the cloud server.
Therefore, when the current state of the target device is judged to be the online state, the optional embodiment directly sends the real information that the target device is in the online state to the user terminal indirectly and/or directly through the cloud server for the user to know, so that the user can control the target device accurately, the target device can be controlled intelligently and accurately, and the experience of the user is further improved.
In yet another optional embodiment, before performing the operation of sending the information that the target device is already in the online state to the determined user terminal, the method may further include the following operations:
and judging whether the current state of the target equipment is turned over, and executing the step of sending the information that the target equipment is in the online state to the determined user terminal when the current state of the target equipment is turned over.
In this alternative embodiment, when the current state of the target device changes from the online state to the offline state or from the offline state to the online state, it is determined that the target device has flipped.
Therefore, when the current state of the target device is judged to be the online state, the optional embodiment further judges whether the target device is turned over or not, and if yes, sends the real information of the online state of the target device to the user terminal, so that the influence on the performance of the device, the occupation of the storage space of the user terminal and the influence on the use of the user terminal by the user due to the heating of the online state detection device caused by the too frequent sending times of the real information of the online state of the device can be reduced.
In yet another alternative embodiment, the method may further include the operations of:
when the current state of the target equipment is judged not to be turned over, acquiring information corresponding to the target equipment, and analyzing the importance of the target equipment according to the acquired information corresponding to the target equipment;
and judging whether the importance of the target equipment is greater than or equal to the determined importance threshold, and executing the step of sending the information that the target equipment is in the online state to the determined user terminal when the importance of the target equipment is greater than or equal to the determined importance threshold.
In this optional embodiment, optionally, when it is determined that the value is smaller than the importance threshold, the process is ended.
In this optional embodiment, optionally, the information corresponding to the target device includes, but is not limited to, at least one of a usage frequency of the target device within a certain period of time (e.g., within 30 days of forward calculation of the current date), a usage duration of the target device within a certain period of time, a degree of dependence of the user on the target device, and current environment information. The current environment information includes one or more of current ambient light intensity, current ambient humidity, and current ambient temperature. The degree of dependence of the user on the target device may be predetermined or determined according to the current situation of the user, where the current situation of the user includes the physical situation of the user and/or the task arrangement of the user. Therefore, the more the information corresponding to the target device comprises, the better the analysis accuracy of the importance of the target device is improved, and the accuracy of sending the real information of the target device is improved.
Therefore, in the optional embodiment, when it is determined that the target device is not turned over, but when it is determined that the importance of the target device is high, the real information that the target device is in the online state is still sent to the user terminal, so that the user can know the situation of the concerned target device and enrich the intelligent function of the online state detection device, the user can further control the target device accurately, and the experience of the user is further improved.
Example two
Referring to fig. 2, fig. 2 is a schematic flowchart illustrating another method for detecting an online status of a device according to an embodiment of the present invention. The method described in fig. 2 may be applied to an online status detection device, such as an online status detection gateway, where the online status detection device, the user terminal, and the cloud server may be in communication connection with each other, where the user terminal includes at least one of a smart phone (Android phone, iOS phone, etc.), a smart phone number watch, a tablet computer, a palm computer, a vehicle-mounted computer, a desktop computer, a netbook, a Personal Digital Assistant (PDA), an intelligent navigator, and a Mobile Internet target device (MID), and the embodiment of the present invention is not limited. As shown in fig. 2, the online status detection method of the device may include the following operations:
201. and broadcasting a heartbeat inquiry command to each device in all devices in the device information table, wherein the heartbeat inquiry command is used for inquiring heartbeat data of each device in the device information table.
In the embodiment of the present invention, optionally, the device information table is configured to record attribute information and heartbeat information of each device, where the heartbeat information of each device includes a heartbeat cycle, a heartbeat counter, and a heartbeat inquiry time (a time change corresponding to a first preset duration) of the device, and the attribute information of each device includes an online state or an offline state of the device. Fig. 8 discloses a schematic structural diagram of an equipment information table, and as shown in fig. 8, the equipment information table lists equipment 1, equipment 2, equipment 3, equipment 4, equipment 5, …, and equipment n, each of the equipment includes a heartbeat cycle, a heartbeat counter, a heartbeat query time, and a state, where the state includes an online state or an offline state.
In this embodiment of the present invention, optionally, when the online status detecting device is just powered on, step 201 is triggered to be executed.
202. Determining the response condition of each device in the device information table for the heartbeat inquiry instruction, and judging whether the response condition exists in all the devices in the device information table for indicating the device which does not respond to the heartbeat inquiry instruction or not according to the response condition of each device in the device information table for the heartbeat inquiry instruction; when it is determined that the data does not exist, step 203 may be triggered to be executed; execution of step 204 may be triggered when it is determined that there is at least one answer case for a device that indicates no heartbeat inquiry command was answered.
203. The current status of each device is marked as online in the device information table and triggers execution of step 207.
204. Determining that the response condition is used for representing the query frequency of each device which does not respond to the heartbeat query instruction, and judging whether the response condition is used for representing that the query frequency of each device which does not respond to the heartbeat query instruction is greater than or equal to the determined query frequency threshold value, and if so, triggering to execute step 205; when the determination result is yes, execution of step 206 may be triggered.
In the embodiment of the invention, each device has a corresponding threshold value of the number of times of inquiry. Further, the threshold value of the number of queries corresponding to each device may be the same or different.
205. And marking the response condition to indicate that the current state of each device which does not respond to the heartbeat inquiry command is an offline state, marking the response condition to indicate that the current state of each device which responds to the heartbeat inquiry command is an online state, and triggering to execute the step 207.
206. The heartbeat inquiry command is rebroadcast individually to each device that is responding to the heartbeat inquiry command and is used for indicating that the heartbeat inquiry command is not answered.
207. And when the online state of the target equipment needs to be determined, generating a data reporting waiting time matched with the target equipment according to the type of the target equipment, and judging whether the data reported by the target equipment is received within the time period of the data reporting waiting time.
208. And when judging that the data reported by the target equipment is not received, sending a target heartbeat inquiry command to the target equipment, and acquiring the response condition fed back by the target equipment received in a first preset time period.
209. And analyzing the online state of the target equipment according to the response condition fed back by the target equipment and the type of the target equipment.
In the embodiment of the present invention, please refer to the detailed description of steps 101 to 103 in the first embodiment for the related description of steps 207 to 209, which is not described again in the embodiment of the present invention.
Therefore, the embodiment of the invention can also initialize all the devices in the device information table, which is beneficial to further improving the accuracy and reliability of the determination of the real state (on-line state or off-line state) of the subsequent devices, thereby further improving the control accuracy and reliability of the devices; and when judging that the frequency of partial equipment not answering the heartbeat inquiry command is less, the heartbeat inquiry command is sent to the equipment again, so that the accuracy of initialization of the equipment is improved.
It can be seen that, by implementing the method described in fig. 2, when it is determined that the online state of the target device needs to be determined and data reported by the target device is not received within a duration matched with the target device, a target heartbeat query instruction can be automatically sent to the target device, and the online state of the target device can be automatically analyzed according to a response condition fed back by the target device and the type of the target device, so that the real state (online state or offline state) of the target device can be accurately and timely detected without increasing the heartbeat detection frequency of the target device, and a user can know the real state of the target device before preparing to control the target device, so that the user can accurately control the target device, and the experience of the user is improved; by actively inquiring the online state of the equipment, the occurrence situations of network congestion and increased data instruction packet loss rate when the online state detection device carries a plurality of pieces of equipment and needs to communicate with the plurality of pieces of equipment can be reduced, and the cruising ability of the low-power-consumption equipment can be improved. In addition, all the devices in the device information table can be initialized, so that the accuracy and reliability of the determination of the real state (on-line state or off-line state) of the subsequent devices can be further improved, and the control accuracy and reliability of the devices can be further improved; and when judging that the frequency of partial equipment not answering the heartbeat inquiry command is less, the heartbeat inquiry command is sent to the equipment again, so that the accuracy of initialization of the equipment is improved.
In an alternative embodiment, the method may further comprise the steps of:
for each marked device, inquiring attribute information of the device, and reporting target information of the device to a cloud server, wherein the target information of the device comprises the attribute information and the online state of the device, and all the marked devices comprise devices of which the current states are marked as online states and devices of which the current states are marked as offline states. The online status of each device includes devices with different online statuses or offline statuses, and corresponds to different attribute information, such as: for a switch panel, an LED illumination lamp, its attribute information includes on/off attributes.
Therefore, after the state of the device is marked, the optional embodiment further reads the attribute information of the device, and reports the attribute information and the online state to the cloud server, so that a subsequent user can know the state of the device preliminarily, the user can conveniently operate the device accurately, and the user experience is further improved.
EXAMPLE III
Referring to fig. 3, fig. 3 is a schematic structural diagram of an online status detecting device of an apparatus according to an embodiment of the present invention. The online state detection device, the user terminal and the cloud server can be in communication connection with each other, where the user terminal includes at least one of a smart phone (Android phone, iOS phone, etc.), a smart phone number watch, a tablet computer, a palmtop computer, a vehicle-mounted computer, a desktop computer, a netbook, a Personal Digital Assistant (PDA), a smart navigator, a Mobile Internet Device (MID), and other terminal target Devices, and an embodiment of the present invention is not limited. As shown in fig. 3, the online status detecting device of the apparatus may include:
the determining module 301 is configured to determine whether to receive data reported by the target device within a time period of a data reporting waiting duration matched with the target device when it is determined that the online state of the target device needs to be determined.
A sending module 302, configured to send a target heartbeat query instruction to the target device when it is determined that the data reported by the target device is not received.
The obtaining module 303 is configured to obtain a response condition of the target device feedback received within a first preset time period.
And the analysis module 304 is configured to analyze the online state of the target device according to the response condition fed back by the target device and the type of the target device, where the type of the target device includes a listening type or a query type.
It can be seen that, when the online status detection apparatus described in fig. 3 is implemented, it can automatically send a target heartbeat query instruction to the target device when it is determined that the online status of the target device needs to be determined and data reported by the target device is not received within a duration matched with the target device, and automatically analyze the online status of the target device according to a response condition fed back by the target device and the type of the target device, and can accurately and timely detect the real status (online status or offline status) of the target device without increasing the heartbeat detection frequency of the target device, which is beneficial for a user to know the real status of the target device before preparing to control the target device, so that the user can accurately control the target device, and the experience of the user is improved; by actively inquiring the online state of the equipment, the occurrence situations of network congestion and increased data instruction packet loss rate when the online state detection device carries a plurality of pieces of equipment and needs to communicate with the plurality of pieces of equipment can be reduced, and the cruising ability of the low-power-consumption equipment can be improved.
In an alternative embodiment, as shown in fig. 4, the apparatus further comprises:
a decrementing module 305, configured to decrement the value of the heartbeat counter of the target device to a preset value of 0 every second preset time interval when the determining module 301 determines that the data reported by the target device is not received and the type of the target device is the monitoring type.
The determining module 301 is further configured to determine whether data reported by the target device is received in a process that the value of the heartbeat counter of the target device is decreased to 0, and when it is determined that the data reported by the target device is not received, trigger the sending module 302 to execute the operation of sending the target heartbeat query instruction to the target device.
It can be seen that, when the online status detection apparatus described in fig. 4 is implemented, after it is determined that data reported by the target device is not received, if the target device is a target device of a monitoring type, it is further determined whether the data reported by the target device is received in a process of decrementing a heartbeat counter of the target device, and if the data reported by the target device is not received, a target heartbeat query instruction is sent to the target device, so that occurrence accuracy of the target heartbeat query instruction can be improved; if the data reported by the target equipment is received, the current state of the target equipment is marked as the online state, so that the accuracy and the efficiency of determining the online state of the target equipment can be improved.
In another alternative embodiment, as shown in FIG. 4, the analysis module 304 includes:
the marking sub-module 3041 is configured to mark the current state of the target device as an online state when the type of the target device is a query type and when the response condition fed back by the target device indicates that response information of the target device is received within a first preset time period.
It can be seen that, by implementing the online status detection apparatus described in fig. 4, when it is determined that the response condition fed back by the target device of the type of query is used to indicate that the response information reported by the target device is received within the specified time, the current status of the target device is determined to be the online status, and accuracy and flexibility of determining the online status of the target device can be improved.
In yet another alternative embodiment, as shown in FIG. 4, the analysis module 304 further comprises;
the marking sub-module 3041 is configured to, when the type of the target device is a query type and when a response condition fed back by the target device is used to indicate that no response information of the target device is received within a first preset duration, determine a number of times that a target heartbeat query instruction is sent to the target device by a current time in a process of detecting an online state of the target device this time.
A determining submodule 3042, configured to determine whether the number of times is greater than or equal to the determined number of times threshold.
The marking sub-module 3041 is further configured to determine that the current state of the target device is in an offline state when the determination result is yes.
The sending module 302 is further configured to, when the determining sub-module 3043 determines that the number of times is smaller than the number threshold, re-execute the above operation of sending the target heartbeat query instruction to the target device.
It can be seen that, when it is determined that the response condition fed back by the target device of the type of query is used to indicate that the response information reported by the target device is not received within the specified time period, the online state detection apparatus described in fig. 4 can further automatically determine whether the number of times that the target device is queried exceeds a predetermined number threshold, if so, mark the current state of the target device as an offline state, and if not, resend the target heartbeat query instruction to determine the current state of the target device, so that the accuracy and reliability of determining the current state of the target device can be improved.
In yet another optional embodiment, as shown in fig. 4, when the type of the target device is a listening type, the analyzing module 304 specifically analyzes the online status of the target device according to the response status fed back by the target device and the type of the target device in a manner that:
when the response condition fed back by the target equipment is used for indicating that response information of the target equipment is received in a first preset time period, marking the current state of the target equipment as an online state;
and when the type of the target equipment is a monitoring type and when the response condition fed back by the target equipment is used for indicating that the response information of the target equipment is not received in a first preset time period, determining that the current state of the target equipment is in an offline state.
It can be seen that, when the online status detection apparatus described in fig. 4 is implemented to determine that the type of the target device is the monitoring type, the online status detection apparatus is directly used to indicate that the response information reported by the target device is received or not received within a specified time period according to the received response condition to determine the current status of the target device, so that the accuracy and efficiency of determining the current status of the target device can be improved.
In yet another alternative embodiment, as shown in fig. 4, the apparatus further comprises:
the first determining module 306 is configured to determine, when the type of the target device is a monitoring type, that a heartbeat cycle of the target device is a data reporting waiting duration matched with the target device.
The generating module 307 is configured to generate a heartbeat query duration of the target device according to a heartbeat cycle of the target device when the type of the target device is the query type.
The first determining module 306 is further configured to determine a heartbeat query duration as a data reporting waiting duration matched with the target device, where the heartbeat query duration is greater than or equal to a third preset duration and is less than a fourth preset duration, and both the third preset duration and the fourth preset duration are less than a heartbeat cycle of the target device.
In this optional embodiment, optionally, after the first determining module 306 performs the operation of determining that the heartbeat cycle of the target device is the data reporting waiting time length matched with the target device or performs the operation of determining that the heartbeat query time length is the data reporting waiting time length matched with the target device, the determining module 301 may be triggered to perform the operation of determining whether the data reported by the target device is received within the time period of the data reporting waiting time length matched with the target device when it is determined that the online state of the target device needs to be determined.
It can be seen that, by implementing the online status detection apparatus described in fig. 4, the corresponding waiting time for data reporting can be determined according to the types of different target devices, and the accuracy of determining the corresponding waiting time for data reporting can be improved, so that the accuracy of determining the online status of the corresponding target device is improved.
In yet another alternative embodiment, as shown in fig. 4, the apparatus further comprises:
the first marking module 308 is configured to mark the current state of the target device as an online state when the determining module 301 determines that the data reported by the target device is received.
The sending module 302 is further configured to perform an operation of sending information that the target device is already in an online state to the determined user terminal.
The manner of executing, by the sending module 302, the operation of sending the information that the target device is already in the online state to the determined user terminal is specifically:
sending information that the target equipment is in an online state to the determined user terminal; and/or
And sending the information that the target equipment is in the online state to the cloud server, and triggering the cloud server to send the information that the target equipment is in the online state to the determined user terminal.
Further, the determining module 301 is further configured to determine whether the current state of the target device is turned over before the sending module 302 executes an operation of sending the information that the target device is already in the online state to the determined user terminal; when the current state of the target device is determined to be turned over, the sending module 302 is triggered to execute an operation of sending information that the target device is already in an online state to the determined user terminal.
It can be seen that, when the online state detection device described in fig. 4 is implemented, the real information that the target device is in the online state can be directly and indirectly and/or directly sent to the user terminal through the cloud server to be known by the user, so that the user can accurately control the target device, the target device can be intelligently and accurately controlled, and the user experience is further improved. And when the current state of the target equipment is judged to be the online state, whether the target equipment is overturned or not can be further judged, if yes, the real information of the online state of the target equipment is sent to the user terminal, and the influence on the performance of the device, the invalid occupation of the storage space of the user terminal and the influence on the use of the user terminal by the user due to the heating of the online state detection device caused by the fact that the sending times of the real information of the online state of the equipment are too frequent can be reduced.
In yet another alternative embodiment, as shown in fig. 4, the apparatus further comprises:
the sending module 302 is further configured to broadcast a heartbeat query instruction to each device in all devices in the device information table, where the heartbeat query instruction is used to query heartbeat data of each device in the device information table.
A second determining module 309, configured to determine a response condition of each device in the device information table for the heartbeat query instruction.
The determining module 301 is further configured to determine, according to a response condition of each device in the device information table for the heartbeat query instruction, whether a response condition exists in all devices in the device information table, where the response condition is used to indicate a device that does not respond to the heartbeat query instruction.
A second marking module 310, configured to mark, when it is determined that there is no device, the current state of each device as an online state in the device information table.
The second determining module 309 is further configured to, when it is determined that at least one response condition exists for indicating a device that does not respond to the heartbeat query instruction, determine that the response condition is used for indicating the number of queries of each device that does not respond to the heartbeat query instruction.
The determining module 301 is further configured to determine whether the response condition is used to indicate that the query frequency of each device that does not respond to the heartbeat query instruction is greater than or equal to the determined query frequency threshold.
The second marking module 310 is further configured to mark a response condition to indicate that the current state of each device that does not respond to the heartbeat inquiry instruction is an offline state when the determination result is yes.
The sending module 302 is further configured to, when the determination result is yes, individually rebroadcast the heartbeat inquiry command to each device whose answer status is used to indicate that the heartbeat inquiry command is not answered.
Therefore, the implementation of the online state detection device described in fig. 4 can also perform initialization operation on all devices in the device information table, which is beneficial to further improving the accuracy and reliability of determination of the real state (online state or offline state) of subsequent devices, thereby further improving the accuracy and reliability of control of the devices; and when judging that the frequency of partial equipment not answering the heartbeat inquiry command is less, the heartbeat inquiry command is sent to the equipment again, so that the accuracy of initialization of the equipment is improved.
In yet another optional embodiment, the apparatus is further configured to determine that the presence status of the target device needs to be determined when a query request for the presence status of a device sent by the user terminal is detected, where the device is the target device; alternatively, the first and second electrodes may be,
and judging whether the current time is in the query time period of the online state of a certain device determined in the device list, and determining that the online state of the target device is required to be determined when the judgment result is yes, wherein the certain device is the target device.
It can be seen that, the optional online status detecting apparatus can also determine the online status of the device to be detected by determining that the user terminal sends the query request for the online status of the device or when detecting the query time period in which the device is online at the current time, so that the online status of the device to be detected can be enriched, and the possibility of determining the online status of the device to be detected can be improved.
Example four
Referring to fig. 5, fig. 5 is a schematic structural diagram of an online status detecting device of another apparatus according to an embodiment of the present disclosure. The online state detection device, the user terminal and the cloud server can be in communication connection with each other, wherein the user terminal includes at least one of terminal target Devices such as a smart phone (Android phone, iOS phone, etc.), a smart phone number watch, a tablet computer, a palm computer, a vehicle-mounted computer, a desktop computer, a netbook, a Personal Digital Assistant (PDA), an intelligent navigator, and a Mobile Internet target device (MID), and the embodiments of the present invention are not limited. As shown in fig. 5, the apparatus may include:
a memory 501 in which executable program code is stored;
a processor 502 coupled to a memory 501;
further, an input interface 503 and an output interface 504 coupled to the processor 502 may be included;
the processor 502 calls the executable program code stored in the memory 501 to execute some or all of the steps of the online status detection method for the device disclosed in the first embodiment or the second embodiment of the present invention.
EXAMPLE five
The embodiment of the invention discloses a computer storage medium, which stores computer instructions, and when the computer instructions are called, the computer storage medium is used for executing part or all of the steps of the online state detection method of the equipment disclosed in the first embodiment or the second embodiment of the invention.
The above-described embodiments of the apparatus are merely illustrative, and the modules described as separate components may or may not be physically separate, and the components shown as modules may or may not be physical modules, may be located in one place, or may be distributed on a plurality of network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above detailed description of the embodiments, those skilled in the art will clearly understand that the embodiments may be implemented by software plus a necessary general hardware platform, and may also be implemented by hardware. Based on such understanding, the above technical solutions may be embodied in the form of a software product, which may be stored in a computer-readable storage medium, wherein the storage medium includes a Read-Only Memory (ROM), a Random Access Memory (RAM), a Programmable Read-Only Memory (PROM), an Erasable Programmable Read-Only Memory (EPROM), a One-time Programmable Read-Only Memory (OTPROM), an Electrically Erasable Programmable Read-Only Memory (EEPROM), a Compact Disc-Read-Only Memory (CD-ROM) or other Memory capable of storing data, a magnetic tape, or any other computer-readable medium capable of storing data.
Finally, it should be noted that: the method and apparatus for detecting the online status of a device disclosed in the embodiments of the present invention are only disclosed as preferred embodiments of the present invention, and are only used for illustrating the technical solutions of the present invention, rather than limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art; the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (10)

1. A method for detecting an online status of a device, the method comprising:
when the online state of the target equipment needs to be determined, judging whether data reported by the target equipment is received within a time period of a data reporting waiting time length matched with the target equipment, wherein the starting time of the data reporting waiting time length is the time when the online state of the target equipment needs to be determined;
when judging that the data reported by the target equipment is not received, sending a target heartbeat query instruction to the target equipment;
acquiring a response condition fed back by the target equipment in a first preset time period, and analyzing the online state of the target equipment according to the response condition fed back by the target equipment and the type of the target equipment, wherein the type of the target equipment comprises a monitoring type or a query type.
2. The method of claim 1, wherein after determining that the data reported by the target device is not received, the method further comprises:
when the type of the target equipment is the monitoring type, decrementing the value of the heartbeat counter of the target equipment to 0 preset value at intervals of second preset time;
and in the process that the value of the heartbeat counter of the target equipment is decreased to 0, judging whether the data reported by the target equipment is received, and executing the operation of sending a target heartbeat inquiry command to the target equipment when judging that the data reported by the target equipment is not received.
3. The method for detecting the online status of the device according to claim 1, wherein the analyzing the online status of the target device according to the response fed back by the target device and the type of the target device comprises:
when the type of the target device is the query type and when the response condition fed back by the target device is used for indicating that response information of the target device is received within the first preset time period, marking the current state of the target device as an online state.
4. The method of online status detection of a device of claim 3, further comprising:
when the type of the target device is the query type and when the response condition fed back by the target device is used for indicating that the response information of the target device is not received in the first preset time period, determining the number of times of sending a target heartbeat query instruction to the target device at the current moment in the process of detecting the online state of the target device;
judging whether the frequency is greater than or equal to a determined frequency threshold value, and determining that the current state of the target equipment is in an off-line state when the judgment result is yes;
and, the method further comprises:
and when the frequency is judged to be smaller than the frequency threshold value, re-executing the operation of sending the target heartbeat inquiry instruction to the target equipment.
5. The method according to claim 1, wherein when the type of the target device is the listening type, the analyzing the online status of the target device according to the response fed back by the target device and the type of the target device includes:
when the response condition fed back by the target equipment is used for indicating that response information of the target equipment is received in the first preset time period, marking the current state of the target equipment as an online state;
and when the type of the target equipment is the monitoring type and when the response condition fed back by the target equipment is used for indicating that the response information of the target equipment is not received in the first preset time period, determining that the current state of the target equipment is in an offline state.
6. The method for detecting the online status of the device according to any one of claims 1 to 5, wherein the method further comprises:
when the type of the target equipment is the monitoring type, determining that the heartbeat cycle of the target equipment is data reporting waiting time matched with the target equipment;
when the type of the target equipment is the query type, generating the heartbeat query duration of the target equipment according to the heartbeat period of the target equipment, and determining that the heartbeat query duration is the data reporting waiting duration matched with the target equipment, wherein the heartbeat query duration is more than or equal to a third preset duration and is less than a fourth preset duration, and the third preset duration and the fourth preset duration are both less than the heartbeat period of the target equipment.
7. The method of online status detection of a device of claim 6, the method further comprising:
when judging that the data reported by the target equipment is received, marking the current state of the target equipment as an online state;
executing the operation of sending the information that the target equipment is in the online state to the determined user terminal;
wherein the executing of the operation of sending the information that the target device is already in the online state to the determined user terminal includes:
sending the information that the target equipment is in an online state to the determined user terminal; and/or
Sending information that the target equipment is in an online state to a cloud server, and triggering the cloud server to send the information that the target equipment is in the online state to the determined user terminal;
before the operation of sending the information that the target device is in the online state to the determined user terminal is executed, the method further includes:
and judging whether the current state of the target equipment is turned over, and executing the step of sending the information that the target equipment is in the online state to the determined user terminal when the current state of the target equipment is judged to be turned over.
8. The method for detecting the online status of the device according to any one of claims 1 to 5, wherein the method further comprises:
broadcasting a heartbeat inquiry command to each device in all devices in a device information table, wherein the heartbeat inquiry command is used for inquiring heartbeat data of each device in the device information table;
determining the response condition of each device in the device information table to the heartbeat inquiry command, and judging whether the response condition exists in all the devices in the device information table or not according to the response condition of each device in the device information table to the heartbeat inquiry command, wherein the response condition is used for indicating that the device does not respond to the heartbeat inquiry command;
when judging that the current state does not exist, marking the current state of each device as an online state in the device information table;
when at least one response condition is judged to exist and is used for indicating the equipment which does not respond to the heartbeat inquiry command, determining the response condition to be used for indicating the inquiry frequency of each equipment which does not respond to the heartbeat inquiry command, judging whether the response condition to be used for indicating whether the inquiry frequency of each equipment which does not respond to the heartbeat inquiry command is larger than or equal to the determined inquiry frequency threshold value, when the judgment result is yes, marking the response condition to be used for indicating that the current state of each equipment which does not respond to the heartbeat inquiry command is an off-line state, and when the judgment result is yes, independently broadcasting the heartbeat inquiry command to each equipment which is used for indicating that the heartbeat inquiry command is not responded.
9. The method of online status detection of a device of claim 7, the method further comprising:
when a query request aiming at the online state of a certain device sent by a user terminal is detected, determining the online state of a target device to be determined, wherein the certain device is the target device; alternatively, the first and second electrodes may be,
and judging whether the current time is in the inquiry time period of the online state of a certain device determined in the device list, and determining that the online state of the target device needs to be determined when the judgment result is yes, wherein the certain device is the target device.
10. An apparatus for detecting an online status of a device, the apparatus comprising:
the judging module is used for judging whether the data reported by the target equipment is received within a time period of data reporting waiting time matched with the target equipment when the online state of the target equipment needs to be determined is judged, wherein the starting time of the data reporting waiting time is the time when the online state of the target equipment needs to be determined;
the sending module is used for sending a target heartbeat query instruction to the target equipment when the judging module judges that the data reported by the target equipment are not received;
the acquisition module is used for acquiring the response condition fed back by the target equipment in a first preset time period;
and the analysis module is used for analyzing the online state of the target equipment according to the response condition fed back by the target equipment and the type of the target equipment, wherein the type of the target equipment comprises a monitoring type or a query type.
CN202111064214.1A 2021-09-10 2021-09-10 Online state detection method and device for equipment Pending CN115801645A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111064214.1A CN115801645A (en) 2021-09-10 2021-09-10 Online state detection method and device for equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111064214.1A CN115801645A (en) 2021-09-10 2021-09-10 Online state detection method and device for equipment

Publications (1)

Publication Number Publication Date
CN115801645A true CN115801645A (en) 2023-03-14

Family

ID=85417215

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111064214.1A Pending CN115801645A (en) 2021-09-10 2021-09-10 Online state detection method and device for equipment

Country Status (1)

Country Link
CN (1) CN115801645A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117424838A (en) * 2023-10-31 2024-01-19 北京中瑞浩航科技有限公司 Self-learning detection method for Internet of things equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106817428A (en) * 2017-02-13 2017-06-09 浙江风向标科技有限公司 A kind of method and apparatus of offline inspection
CN111031565A (en) * 2019-11-25 2020-04-17 青岛海信智慧家居系统股份有限公司 Method and device for identifying off-line state of ZigBee device
CN111884875A (en) * 2020-07-17 2020-11-03 青岛易来智能科技股份有限公司 Offline device determination method and device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106817428A (en) * 2017-02-13 2017-06-09 浙江风向标科技有限公司 A kind of method and apparatus of offline inspection
CN111031565A (en) * 2019-11-25 2020-04-17 青岛海信智慧家居系统股份有限公司 Method and device for identifying off-line state of ZigBee device
CN111884875A (en) * 2020-07-17 2020-11-03 青岛易来智能科技股份有限公司 Offline device determination method and device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117424838A (en) * 2023-10-31 2024-01-19 北京中瑞浩航科技有限公司 Self-learning detection method for Internet of things equipment

Similar Documents

Publication Publication Date Title
US10008092B2 (en) Method, apparatus, and storage medium for alerting cooking state of electric cooker
WO2019192305A1 (en) Method and apparatus for controlling smart device
CN106487928B (en) Message pushing method and device
CN110446273B (en) Networking method and device based on electronic price tags
CN109246604B (en) Intelligent device safety binding method, server, intelligent device and user side device
CN110826965B (en) Intelligent warehouse management method and device, handheld device and storage medium
CN105530307B (en) A kind of event-prompting method and system based on more associate devices
CN113395200B (en) Message pushing method and system, client, storage medium and processor
CN108833222B (en) Household appliance control method, household appliance control device, remote controller, terminal, server and medium
CN104469707A (en) Mobile terminal and communication method and device used for social account integration and applied to mobile terminal
CN109445292B (en) Automatic execution result collection method, device, system and storage medium
TW201717142A (en) A method for monitoring the state of the intelligent device on the same screen, a projection device and a user terminal
CN110618614A (en) Control method and device for smart home, storage medium and robot
CN110796419A (en) Intelligent warehouse management method and device, electronic equipment and storage medium
CN113064642B (en) Work flow starting method and system of electric control equipment, terminal and electric control equipment
CN115801645A (en) Online state detection method and device for equipment
CN113064683A (en) Electric control equipment control interface display method and system, terminal and electric control equipment
WO2020015462A1 (en) Timing transmission method, electronic device and storage medium
CN107579884A (en) Intelligent electric appliance state synchronization method, equipment, storage medium and intelligent refrigerator
CN109287511A (en) The method, apparatus of training pet control equipment and the wearable device of pet
CN111596559A (en) Equipment control method and device, intelligent display terminal and storage medium
CN105630498A (en) Application program display method and device and electronic equipment
CN107872372B (en) Reminding setting method and system for food in refrigerator
CN109669359B (en) Method and device for detecting passive equipment and electronic equipment
CN106682196A (en) Related software recommending method and device

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