Device state updating method and apparatus, storage medium, and electronic device
By managing device status through a cloud server and transmitting control commands and feedback messages through a gateway, the problem of untimely device status updates in Bluetooth mesh networks is solved, enabling timely updates of device status.
Patent Information
- Application Number
- CN202211419376.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-14
- Publication Date
- 2026-02-03
- Estimated Expiration
- 2042-11-14
AI Technical Summary
In Bluetooth mesh networks, the limited storage space of devices managed by a single gateway leads to a large number of devices reporting their status with delays, resulting in untimely updates to device status.
By using the topic relationships stored on the cloud server, the gateway sends control commands to the target IoT device and receives feedback messages, updating the device status on the cloud server based on these messages.
It enables timely updates of device status, solves the problem of delayed reporting of device status under single gateway management, and improves the speed of device status updates.
Smart Images

Figure CN115766436B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of communications, and more specifically, to a method, apparatus, storage medium, and electronic device for updating device status. Background Technology
[0002] In Bluetooth mesh network gateway communication, related technologies typically employ a single gateway to manage devices. However, the storage space of a single gateway is fixed, thus limiting the number of devices it can manage. Furthermore, when a large number of device statuses need to be reported simultaneously, the single gateway management method usually delays the reporting of these statuses, which can easily lead to untimely device status updates.
[0003] There is currently no effective solution to the above problems. Summary of the Invention
[0004] This invention provides a device status update method, apparatus, storage medium, and electronic device to at least solve the technical problem in the related art where the delayed reporting of a large number of device statuses when a single gateway manages devices leads to untimely device status updates.
[0005] According to one embodiment of the present invention, a device status update method is provided, comprising: sending a control command to a target IoT device via a gateway based on topic relationships stored on a cloud server, wherein the topic relationships are used to find the identity identifier of each IoT device among multiple IoT devices within the coverage area of a mesh network, the gateway is used to transmit the control command, and the control command is used to adjust the device status of each IoT device among the multiple IoT devices; receiving a feedback message reported by the target IoT device via the gateway, wherein the feedback message carries information including the current device status of the target IoT device; and updating the historical device status of the target IoT device to the current device status on the cloud server based on the topic relationships and the feedback message.
[0006] Optionally, sending control commands to the target IoT device via the gateway based on the topic relationships stored on the cloud server includes: finding the target identity of the target IoT device from the topic relationships; encapsulating the control commands into a MeshNet protocol message based on the target identity; and sending the MeshNet protocol message to the target IoT device via the gateway.
[0007] Optionally, on the cloud server, updating the historical device status of the target IoT device to the current device status based on topic relationships and feedback messages includes: finding the target identity of the target IoT device from the topic relationships; finding the historical device status of the target IoT device on the cloud server based on the target identity; and updating the historical device status to the current device status according to the feedback messages.
[0008] Optionally, the device status update method further includes: in response to updating the historical device status to the current device status on the cloud server, sending a first notification message to at least one terminal device, wherein the first notification message is used to notify at least one terminal device to update the locally stored historical device status to the current device status.
[0009] Optionally, the device status update method further includes: in response to successfully sending a control command to the target IoT device via the gateway, updating the historical device status to the target device status based on the topic relationship, and sending a second notification message to at least one terminal device, wherein the second notification message is used to notify at least one terminal device to update the locally stored historical device status to the target device status.
[0010] Optionally, the feedback message is that the target IoT device waits for a preset time before reporting to the cloud server via the gateway, where the preset time is used to confirm whether the cloud server will send the control command again.
[0011] Optionally, updating the historical device status to the current device status according to the feedback message includes: determining whether the current device status is consistent with the target device status based on the feedback message; and updating the target device status to the current device status in response to the inconsistency between the current device status and the target device status.
[0012] Optionally, the device status update method further includes: in response to updating the target device status to the current device status on the cloud server, sending a third notification message to at least one terminal device, wherein the third notification message is used to notify at least one terminal device to update the locally stored target device status to the current device status.
[0013] According to one embodiment of the present invention, a device status update apparatus is also provided, comprising: a sending module, configured to send a control command to a target IoT device via a gateway based on topic relationships stored on a cloud server, wherein the topic relationships are used to find the identity identifier of each IoT device among multiple IoT devices within the coverage area of a mesh network, the gateway is used to transmit the control command transparently, and the control command is used to adjust the device status of each IoT device among the multiple IoT devices; a receiving module, configured to receive a feedback message reported by the target IoT device via the gateway, wherein the feedback message carries information including the current device status of the target IoT device; and an updating module, configured to update the historical device status of the target IoT device to the current device status on a cloud server based on the topic relationships and the feedback message.
[0014] Optionally, the sending module is also used to: find the target identity of the target IoT device from the topic relationship; encapsulate the control command into a MeshNet protocol message based on the target identity; and send the MeshNet protocol message to the target IoT device via the gateway.
[0015] Optionally, the update module is also used to: find the target identity of the target IoT device from the topic relationship; find the historical device status of the target IoT device on the cloud server based on the target identity; and update the historical device status to the current device status according to the feedback message.
[0016] Optionally, the sending module is further configured to: in response to updating the historical device status to the current device status on the cloud server, send a first notification message to at least one terminal device, wherein the first notification message is used to notify at least one terminal device to update the locally stored historical device status to the current device status.
[0017] Optionally, the device status update method further includes: a processing module, configured to, in response to successfully sending a control command to the target IoT device via a gateway, update the historical device status to the target device status based on topic relationships, and send a second notification message to at least one terminal device, wherein the second notification message is used to notify at least one terminal device to update the locally stored historical device status to the target device status.
[0018] Optionally, the update module is also used to: determine whether the current device state is consistent with the target device state based on the feedback message; and update the target device state to the current device state in response to the inconsistency between the current device state and the target device state.
[0019] Optionally, the sending module is further configured to: in response to updating the target device state to the current device state on the cloud server, send a third notification message to at least one terminal device, wherein the third notification message is used to notify at least one terminal device to update the locally stored target device state to the current device state.
[0020] According to one embodiment of the present invention, a computer-readable storage medium is also provided, wherein a computer program is stored in the computer-readable storage medium, and the computer program is configured to execute the device state update method described in any of the above-mentioned methods when run by a processor.
[0021] According to one embodiment of the present invention, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the device state update method described in any of the preceding claims.
[0022] In at least some embodiments of the present invention, control commands are sent to the target IoT device via a gateway based on topic relationships stored on a cloud server, and feedback messages reported by the target IoT device are received via the gateway. Finally, on the cloud server, the historical device status of the target IoT device is updated to the current device status based on the topic relationships and feedback messages. This achieves the goal of improving the update speed of device status, thereby realizing the technical effect of timely updating of device status. This solves the technical problem in related technologies where the delayed reporting of a large number of device statuses when a single gateway manages devices leads to untimely updates of device status. Attached Figure Description
[0023] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings:
[0024] Figure 1 This is a flowchart of a device status update method according to one embodiment of the present invention;
[0025] Figure 2 This is a schematic diagram of a device status update system according to one embodiment of the present invention;
[0026] Figure 3 This is a schematic diagram of a device status update method according to one embodiment of the present invention;
[0027] Figure 4 This is a schematic diagram of another device status update method according to one embodiment of the present invention;
[0028] Figure 5 This is a structural block diagram of a device status update apparatus according to one embodiment of the present invention. Detailed Implementation
[0029] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0030] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0031] According to an embodiment of the present invention, a method embodiment for updating device state is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0032] This method embodiment can be executed in a device status update system. The device status update system includes: terminal devices, IoT devices, gateways, and cloud servers.
[0033] Specifically, the aforementioned terminal devices can be smartphones (e.g., Android phones, iOS phones, etc.), tablets, PCs, and mobile internet devices (MIDs). These IoT devices can be smart home devices, such as smart humidifiers, smart washing machines, and smart robot vacuums; they can also be smart industrial equipment, such as smart robots and smart scanners.
[0034] The internal structures of the aforementioned terminal devices, IoT devices, gateways, and cloud servers are basically similar. The following explanation will use the internal structure of the terminal device as an example; the internal structures of the IoT devices, gateways, and cloud servers will not be described in detail.
[0035] The terminal device may include one or more processors (processors may include, but are not limited to, central processing units (CPUs), graphics processing units (GPUs), digital signal processing (DSP) chips, microcontroller units (MCUs), field-programmable gate arrays (FPGAs), neural network processors (NPUs), tensor processors (TPUs), artificial intelligence (AI) type processors, etc.) and memory for storing data. Optionally, the terminal device may also include transmission devices, input / output devices, and display devices for communication functions. Those skilled in the art will understand that the above structural description is merely illustrative and does not limit the structure of the terminal device. For example, the terminal device may include more or fewer components than described above, or have a different configuration than described above.
[0036] The memory can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the device state update method in this embodiment of the invention. The processor executes various functional applications and data processing by running the computer program stored in the memory, thereby implementing the aforementioned device state update method. The memory may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include memory remotely located relative to the processor, and these remote memories can be connected to the terminal device via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0037] Transmission devices are used to receive or send data over a network. Specific examples of such networks may include wireless networks provided by the communication provider of the terminal devices. In one example, the transmission device includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device may be a Radio Frequency (RF) module, used for wireless communication with the Internet.
[0038] Display devices can be, for example, touchscreen liquid crystal displays (LCDs) and touch displays (also referred to as "touchscreens" or "touch displays"). The LCD allows users to interact with the user interface of the terminal device. In some embodiments, the terminal device has a graphical user interface (GUI), which allows users to interact with the GUI through finger contact and / or gestures on a touch-sensitive surface. Optional human-computer interaction functions include: creating web pages, drawing, word processing, creating electronic documents, playing games, video conferencing, instant messaging, sending and receiving emails, call interfaces, playing digital video, playing digital music, and / or web browsing, etc. Executable instructions for performing the aforementioned device state update methods are configured / stored in one or more processor-executable computer program products or readable storage media.
[0039] This embodiment provides a device status update method running on the aforementioned cloud server. Figure 1 This is a flowchart of a device status update method according to one embodiment of the present invention, such as... Figure 1 As shown, the process includes the following steps:
[0040] Step S12: Based on the topic relationships stored on the cloud server, a control command is sent to the target IoT device via the gateway. The topic relationships are used to find the identity of each IoT device among multiple IoT devices within the coverage area of the mesh network. The gateway is used to transmit the control command, and the control command is used to adjust the device status of each IoT device among multiple IoT devices.
[0041] Step S14: Receive feedback messages reported by the target IoT device via the gateway. The feedback messages carry information including the current device status of the target IoT device.
[0042] Step S16: On the cloud server, update the historical device status of the target IoT device to the current device status based on topic relationships and feedback messages.
[0043] Figure 2 This is a schematic diagram of a device status update system according to one embodiment of the present invention, such as... Figure 2 As shown, the device status update system mainly includes a cloud server, a gateway, and multiple IoT devices. These multiple IoT devices can include various different types of IoT devices, such as... Figure 2In this context, IoT devices 1, 2, and 3 belong to one category, while IoT devices 4, 5, and 6 belong to another. For example, multiple IoT devices could include three smart air conditioners and three smart lights.
[0044] Specifically, the aforementioned multiple IoT devices and gateways can form a mesh network. The identity of an IoT device can be its mesh address, which is the address of the IoT device in the mesh network. Each IoT device in the mesh network has only one unique identity.
[0045] By utilizing the topic relationships stored in the cloud server, the Mesh Address of each IoT device within the coverage area of the Mesh network can be found. For example, using the topic relationships stored in the cloud server, the identification identifiers of each of the three smart lights within the coverage area of the Mesh network can be found as Mesh Address 11, Mesh Address 12, and Mesh Address 13, respectively, and the identification identifiers of each of the two smart air conditioners within the coverage area of the Mesh network can be found as Mesh Address 21 and Mesh Address 22, respectively.
[0046] When a cloud server sends control commands to a target IoT device via a gateway, it can utilize the topic relationships stored in the cloud server to find the Mesh Address of the target IoT device within the Mesh network coverage area and send the control command to the gateway. The gateway then forwards the received control command to the target IoT device. For example, when the cloud server sends a control command to smart light 1, it can utilize the topic relationships stored in the cloud server to find the Mesh Address 11 of smart light 1 within the Mesh network coverage area and send the control command to the gateway. The gateway then forwards the received control command to smart light 1.
[0047] Specifically, control commands can be used to adjust the device status of each IoT device among multiple IoT devices. For example, a control command can be used to update the historical device status "Running" of each of two smart air conditioners to the current device status "Stopped". As another example, a control command can be used to update the historical device status "Running" of smart air conditioner 1 to the current device status "Stopped", and then update the historical device status "Stopped" of smart air conditioner 1 to the current device status "Running".
[0048] The cloud server can receive the current device status of the target IoT device reported by the target IoT device through the gateway. For example, the cloud server can receive a report from smart air conditioner 1 that the current device status of smart air conditioner 1 is "stopped" through the gateway.
[0049] The cloud server can determine the target IoT device corresponding to the Mesh Address through Topic relationships, and update the historical device status of the target IoT device to the current device information reported by the target IoT device. For example, the cloud server can determine that the IoT device corresponding to Mesh Address 21 is Smart Air Conditioner 1 through Topic relationships, and update the historical device status of Smart Air Conditioner 1 from "Running" to the current device information reported by Smart Air Conditioner 1 as "Stopped".
[0050] It should be noted that in this embodiment, the gateway is only used to transmit control commands and report feedback messages, and does not perform other operations.
[0051] Based on steps S12 to S16 above, control commands are sent to the target IoT device via the gateway through the topic relationships stored on the cloud server, and feedback messages reported by the target IoT device are received via the gateway. Finally, on the cloud server, the historical device status of the target IoT device is updated to the current device status based on the topic relationships and feedback messages. This achieves the goal of improving the update speed of device status, thereby realizing the technical effect of timely updating of device status. This solves the technical problem in related technologies where the delayed reporting of a large number of device statuses when a single gateway manages devices leads to untimely updates of device status.
[0052] Optionally, step S12 further includes the following steps:
[0053] Step S121: Find the target identity identifier of the target IoT device from the topic relationship;
[0054] Step S122: Based on the target identity, encapsulate the control command into a mesh network protocol message;
[0055] Step S123: Send a MeshNet protocol message to the target IoT device via the gateway.
[0056] Specifically, the Mesh Address of the target IoT device in the Mesh network can be found from the Topic relationship. Then, based on the Mesh Address of the target IoT device, the control command is encapsulated into a Mesh Protocol message, and finally the Mesh Protocol message is sent to the target IoT device through the gateway.
[0057] For example, the Mesh Address 11 of the smart air conditioner 1 in the Mesh network can be found from the Topic relationship. Then, based on the Mesh Address 11 of the smart air conditioner 1, the control command is encapsulated into a Mesh Network Protocol message 11, and finally the Mesh Network Protocol message 11 is sent to the smart air conditioner 1 through the gateway.
[0058] Based on the above steps S121 to S123, by finding the target identity identifier of the target IoT device from the topic relationship, and then encapsulating the control command into a mesh network protocol message based on the target identity identifier, and finally sending the mesh network protocol message to the target IoT device through the gateway, the operation of the gateway can be simplified, enabling the gateway to transmit control commands to the target IoT device in a timely manner, thereby improving the update speed of device status.
[0059] Optionally, step S16 further includes the following step:
[0060] Step S161: Find the target identity identifier of the target IoT device from the topic relationship;
[0061] Step S162: Based on the target identity, search for the historical device status of the target IoT device on the cloud server;
[0062] Step S163: Update the historical device status to the current device status according to the feedback message.
[0063] Specifically, after the cloud server receives the current device status reported by the target IoT device through the gateway, it looks up the Mesh Address of the target IoT device from the Topic relationship, and then looks up the historical device status of the target IoT device on the cloud server based on the Mesh Address of the target IoT device. Finally, it updates the historical device status of the target IoT device on the cloud server to the current device status reported by the target IoT device.
[0064] For example, after the cloud server receives the report from the smart air conditioner 1 that the current device status is "stopped" through the gateway, it looks up the Mesh Address 21 of the smart air conditioner 1 in the Topic relationship, and looks up the historical device status of the smart air conditioner 1 as "running" on the cloud server based on the Mesh Address 11 of the smart air conditioner 1. Then, it updates the historical device status "running" of the smart air conditioner 1 on the cloud server to the current device status "stopped" reported by the smart air conditioner 1.
[0065] Based on the above steps S161 to S163, by searching for the target identity identifier of the target IoT device from the topic relationship, and then searching for the historical device status of the target IoT device on the cloud server based on the target identity identifier, and finally updating the historical device status to the current device status according to the feedback message, the operation of the gateway can be simplified, enabling the gateway to upload the device status of the IoT device to the cloud server in a timely manner, thereby improving the update speed of the device status.
[0066] Optionally, the device status update method further includes the following steps:
[0067] Step S17: In response to updating the historical device status to the current device status on the cloud server, a first notification message is sent to at least one terminal device, wherein the first notification message is used to notify at least one terminal device to update the locally stored historical device status to the current device status.
[0068] Specifically, after the cloud server updates the historical device status to the current device status, it sends a first notification message to at least one terminal device, notifying the terminal device to update the historical device status stored in the terminal device to the current device status.
[0069] For example, when the cloud server updates the historical device status of smart air conditioner 1 from "running" to the current device status "stopped", it sends a notification to mobile phone 1, notifying mobile phone 1 to update the historical device status of smart air conditioner 1 stored in mobile phone 1 from "running" to the current device status "stopped".
[0070] Based on step S17 above, by responding to updating the historical device status to the current device status on the cloud server and sending a first notification message to at least one terminal device, the terminal device can be promptly notified to synchronize and update the device status.
[0071] Optionally, the device status update method further includes the following steps:
[0072] Step S13: In response to successfully sending a control command to the target IoT device via the gateway, the historical device state is updated to the target device state based on the topic relationship, and a second notification message is sent to at least one terminal device, wherein the second notification message is used to notify at least one terminal device to update the locally stored historical device state to the target device state.
[0073] Specifically, when the cloud server successfully sends a control command to the target IoT device through the gateway, it locates the target IoT device based on the Topic relationship, updates the historical device status of the target IoT device stored in the cloud server to the target device status, and simultaneously sends a second notification message to at least one terminal device to notify the terminal device to update the historical device status of the target IoT device stored in the terminal device to the target device status.
[0074] For example, when the cloud server successfully sends a "stop" command to the smart air conditioner 1 through the gateway, it finds the smart air conditioner 1 according to the Topic relationship, and then updates the historical device status of the smart air conditioner 1 stored in the cloud server as "running" to the target device status as "stopped". At the same time, it sends a notification message to the mobile phone 1 to notify the mobile phone 1 to update the historical device status of the smart air conditioner 1 stored in the mobile phone 1 as "running" to the target device status as "stopped".
[0075] Based on step S13 above, by responding to the successful sending of a control command to the target IoT device via the gateway, updating the historical device status to the target device status based on the topic relationship, and sending a second notification message to at least one terminal device, the device status can be updated in a timely manner, thereby improving the update speed of the device status.
[0076] Optionally, the feedback message is that the target IoT device waits for a preset time before reporting to the cloud server via the gateway, where the preset time is used to confirm whether the cloud server will send the control command again.
[0077] Specifically, after the target IoT device receives a control command from the cloud server through the gateway, the target IoT device will wait for a preset time to confirm whether the cloud server will send another control command. If no new control command is received within the preset time, the target IoT device's current device status will be uploaded to the cloud server through the gateway.
[0078] For example, after smart air conditioner 1 receives a control command from the cloud server through the gateway, smart air conditioner 1 will wait 15 seconds to confirm whether the cloud server will send another control command. If no new control command is received within 15 seconds, smart air conditioner 1 will upload its current device status to the cloud server through the gateway.
[0079] By delaying the reporting of the current device status of the target IoT device, the cloud server can verify whether the device status of the IoT device stored on the cloud server is correct, thus avoiding inaccurate device status caused by packet loss.
[0080] Optionally, in step S163, updating the historical device status to the current device status according to the feedback message includes:
[0081] S1631, determine whether the current device status is consistent with the target device status based on the feedback message;
[0082] S1632, in response to the inconsistency between the current device state and the target device state, update the target device state to the current device state.
[0083] Specifically, it determines whether the current device state of the IoT device in the feedback message is consistent with the target device state. When the current device state of the IoT device is inconsistent with the target device state, it updates the target device state to the current device state.
[0084] For example, if the current device status of smart air conditioner 1 in the feedback message is "stopped", while the target device status of smart air conditioner 1 stored in the cloud server is "running", it is determined that the current device status of smart air conditioner 1 and the target device status are inconsistent. Therefore, the target device status of smart air conditioner 1 is changed from "running" to the current device status "stopped".
[0085] Based on the above steps S1631 to S1632, by determining whether the current device status is consistent with the target device status based on the feedback message, and then responding to the inconsistency between the current device status and the target device status, the target device status is updated to the current device status. This can verify whether the device status of the IoT device stored on the cloud server is correct and can avoid inaccurate device status caused by packet loss.
[0086] Optionally, the device status update method further includes the following steps:
[0087] Step S18: In response to updating the target device state to the current device state on the cloud server, a third notification message is sent to at least one terminal device, wherein the third notification message is used to notify at least one terminal device to update the locally stored target device state to the current device state.
[0088] Specifically, when the target device status is updated to the current device status on the cloud server, a third notification message is sent to at least one terminal device to notify the at least one terminal device to update the target device status stored locally to the current device status.
[0089] For example, when the target device status of smart air conditioner 1 is updated from "running" to "stopped" on the cloud server, a notification message is sent to mobile phone 1 and mobile phone 2 to notify mobile phone 1 and mobile phone 2 to update the target device status of smart air conditioner 1 stored in mobile phone 1 and mobile phone 2 from "running" to "stopped".
[0090] Based on step S18 above, by responding to updating the target device status to the current device status on the cloud server and sending a third notification message to at least one terminal device, the device status can be updated in a timely manner, thereby improving the update speed of the device status.
[0091] The device status update method provided in at least some embodiments of this invention sends control commands to target IoT devices via a gateway based on topic relationships stored on a cloud server. The gateway then receives feedback messages reported by the target IoT devices. Finally, on the cloud server, the historical device status of the target IoT devices is updated to the current device status based on the topic relationships and feedback messages. Therefore, in these embodiments, the gateway is only used for message transmission and does not manage IoT devices, thus avoiding limitations on the number of IoT devices managed by the gateway and enabling the construction of a Mesh network across IoT platforms. Furthermore, by storing topic relationships on a cloud server instead of the gateway, the usage of gateway storage space is effectively reduced. Moreover, through centralized management on the cloud server, the device status in the cloud server is updated upon successful transmission of the control command, and each terminal is notified to synchronize the device status update. The final device status is reported with a delay after the control device completes its operation, ensuring timely reporting of device status and avoiding network congestion caused by a large number of devices reporting.
[0092] The above-mentioned device status update method will be further described below with reference to the accompanying drawings.
[0093] Figure 3 This is a schematic diagram of a device status update method according to one embodiment of the present invention, as shown below. Figure 3 As shown, the workflow of the device status update method is as follows:
[0094] Step S301: Search for the target identity identifier of the target IoT device from the topic relationships stored on the cloud server;
[0095] Step S302: Based on the target identity, the control command is encapsulated into a MeshNet protocol message, wherein the control command is used to adjust the device status of each IoT device among multiple IoT devices;
[0096] Step S303: Send a mesh network protocol message;
[0097] Step S304: Transmit mesh network protocol messages;
[0098] Step S305: Adjust the device status based on the mesh network protocol message;
[0099] Step S306: Report a feedback message, wherein the feedback message carries information including: the current device status of the target IoT device;
[0100] Step S307: Forward the feedback message;
[0101] Step S308: Receive feedback messages reported by the target IoT device via the gateway;
[0102] Step S309: Based on the received target identity identifier of the target IoT device, search for the historical device status of the target IoT device on the cloud server;
[0103] Step S310: Update the historical device status to the current device status according to the feedback message;
[0104] Step S311: In response to updating the historical device status to the current device status on the cloud server, a first notification message is sent to at least one terminal device, wherein the first notification message is used to notify at least one terminal device to update the locally stored historical device status to the current device status.
[0105] In step S312, the terminal device updates the historical device status stored locally to the current device status.
[0106] In the workflow of the above-mentioned device status update method, based on the topic relationships stored on the cloud server, control commands are sent to the target IoT device via the gateway, and then the feedback messages reported by the target IoT device are received via the gateway. Finally, on the cloud server, the historical device status of the target IoT device is updated to the current device status based on the topic relationships and feedback messages. This achieves the goal of improving the update speed of device status, thereby realizing the technical effect of timely updating of device status. This solves the technical problem in related technologies where the delayed reporting of a large number of device statuses when a single gateway manages devices leads to untimely updates of device status.
[0107] The following section will use a smart air conditioner as an example to explain in detail the workflow of the device status update method:
[0108] First, the Mesh Address 21 of the smart air conditioner 1 is found from the topic relationships stored on the cloud server. Based on the Mesh Address 21 of the smart air conditioner 1, the control command is encapsulated into a Mesh protocol message to update the device status of the smart air conditioner 1 to "stop" and the Mesh protocol message is sent to the gateway.
[0109] Then, the gateway will pass the received Mesh protocol message to the smart air conditioner 1. After the smart air conditioner 1 adjusts its device status to "stop" based on the Mesh protocol message, the smart air conditioner 1 will report its current device status as "stop" to the gateway.
[0110] Subsequently, the gateway forwards the current device status of smart air conditioner 1 as "stopped" to the cloud server. Then, the cloud server receives the current device status reported by smart air conditioner 1 as "stopped" through the gateway, searches for the historical device status of smart air conditioner 1 as "running" on the cloud server based on the MeshAddress 21 of smart air conditioner 1, and updates the historical device status of smart air conditioner 1 from "running" to the current device status "stopped". After updating the historical device status of smart air conditioner 1 from "running" to "stopped" on the cloud server, a notification message is sent to mobile phone 1 to notify mobile phone 1 to update the historical device status of smart air conditioner 1 stored in mobile phone 1 from "running" to the current device status "stopped".
[0111] Finally, mobile phone 1 updates the historical device status of smart air conditioner 1 stored in mobile phone 1 from "running" to the current device status "stopped", thereby completing the device status update of smart air conditioner 1.
[0112] Figure 4 This is a schematic diagram of another device state update method according to one embodiment of the present invention, such as... Figure 4 As shown, the workflow of the device status update method is as follows:
[0113] Step S401: Search for the target identity identifier of the target IoT device from the topic relationships stored on the cloud server;
[0114] Step S402: Based on the target identity, the control command is encapsulated into a MeshNet protocol message, wherein the control command is used to adjust the device status of each IoT device among multiple IoT devices;
[0115] Step S403: Send a mesh network protocol message;
[0116] Step S404: Transmit mesh network protocol messages;
[0117] Step S405: In response to successfully sending a control command to the target IoT device via the gateway, update the historical device status to the target device status based on the topic relationship;
[0118] Step S406: Send a second notification message to at least one terminal device, wherein the second notification message is used to notify at least one terminal device to update the locally stored historical device status to the target device status.
[0119] Step S407: Update the historical device status stored locally to the target device status.
[0120] Step S408: Adjust the device status based on the mesh network protocol message;
[0121] Step S409: After waiting for a preset time, a feedback message is sent. The feedback message carries information including the current device status of the target IoT device.
[0122] Step S410: Forward the feedback message;
[0123] Step S411: Receive feedback messages reported by the target IoT device via the gateway;
[0124] Step S412: Based on the received target identity identifier of the target IoT device, search for the target device status of the target IoT device on the cloud server;
[0125] Step S413: Determine whether the current device status is consistent with the target device status based on the feedback message;
[0126] Step S414: In response to the inconsistency between the current device state and the target device state, update the target device state to the current device state;
[0127] Step S415: In response to updating the target device status to the current device status on the cloud server, a third notification message is sent to at least one terminal device, wherein the third notification message is used to notify at least one terminal device to update the target device status stored locally to the current device status.
[0128] Step S416: Update the target device status stored locally to the current device status.
[0129] In the workflow of the above-mentioned device status update method, control commands are sent to the target IoT device via a gateway based on the topic relationships stored on the cloud server. Then, the gateway receives the feedback messages reported by the target IoT device. Finally, on the cloud server, the historical device status of the target IoT device is updated to the current device status based on the topic relationships and feedback messages. This achieves the goal of improving the update speed of device status, thereby realizing the technical effect of timely updating of device status. This solves the technical problem in related technologies where the delayed reporting of a large number of device statuses when a single gateway manages devices leads to untimely updates of device status.
[0130] The following section will use a smart air conditioner as an example to explain in detail the workflow of the device status update method:
[0131] First, the Mesh Address 21 of the smart air conditioner 1 is found from the topic relationships stored on the cloud server. Based on the Mesh Address 21 of the smart air conditioner 1, the control command is encapsulated into a Mesh protocol message to update the device status of the smart air conditioner 1 to "stop". The Mesh protocol message is then sent to the gateway, and the gateway transmits the received Mesh protocol message to the smart air conditioner 1.
[0132] Subsequently, after successfully sending a control command to the smart air conditioner 1 through the gateway, the cloud server updates the historical device status "running" of the smart air conditioner 1 stored in the cloud server to the target device status "stopping" according to the topic relationship, and sends a notification message to the mobile phone 1 to notify the mobile phone 1 to update the historical device status "running" of the smart air conditioner 1 stored in the mobile phone 1 to the target device status "stopping". After receiving the notification message, the mobile phone 1 updates the historical device status "running" of the smart air conditioner 1 stored in the mobile phone 1 to the target device status "stopping".
[0133] Subsequently, Smart Air Conditioner 1 adjusts its device status based on Mesh protocol messages and waits for 15 seconds. If no new control commands are received, it reports its current device status as "Running" to the gateway. The gateway forwards the "Running" status of Smart Air Conditioner 1 to the cloud server. After the cloud server receives the "Running" status reported by Smart Air Conditioner 1 through the gateway, it searches for the target device status of Smart Air Conditioner 1 on the cloud server based on Smart Air Conditioner 1's Mesh Address 21, which is "Stopped".
[0134] Finally, if it is determined that the current device status "Running" of smart air conditioner 1 is inconsistent with the target device status "Stopped", the target device status "Stopped" of smart air conditioner 1 will be updated to the current device status "Running" in the cloud server. Then, a notification message will be sent to mobile phones 1 and 2 to notify them to update the target device status "Stopped" of smart air conditioner 1 stored in their mobile phones to the current device status "Running". After receiving the notification message, mobile phones 1 and 2 will update the target device status "Stopped" of smart air conditioner 1 stored in their mobile phones to the current device status "Running", thereby completing the device status update of smart air conditioner 1.
[0135] The following section will use smart lighting as an example to detail the workflow of the device status update method:
[0136] First, the Mesh Address 11 of the smart light 1 is found in the topic relationships stored on the cloud server. Based on the Mesh Address 11 of the smart light 1, the control command is encapsulated into a Mesh protocol message to update the device status of the smart light 1 to "off" and send the Mesh protocol message to the gateway. The gateway then forwards the received Mesh protocol message to the smart light 1.
[0137] Subsequently, after successfully sending a control command to the smart light 1 through the gateway, the cloud server updates the historical device status of the smart light 1 stored in the cloud server as "on" to the target device status as "off" according to the topic relationship, and sends a notification message to the mobile phone 1 to notify the mobile phone 1 to update the historical device status of the smart light 1 stored in the mobile phone 1 as "on" to the target device status as "off". After receiving the notification message, the mobile phone 1 updates the historical device status of the smart light 1 stored in the mobile phone 1 as "on" to the target device status as "off".
[0138] Subsequently, the smart light 1 adjusts its device status based on the Mesh protocol message and waits for 15 seconds. If no new control command is received, it reports its current device status as "off" to the gateway. The gateway forwards the "off" status to the cloud server. After the cloud server receives the "off" status reported by the smart light 1 through the gateway, it searches for the target device status of the smart light 1 as "off" based on the Mesh Address 21 of the smart light 1 on the cloud server. It then determines that the current device status "off" of the smart light 1 matches the target device status "off", thus completing the device status update of the smart light 1.
[0139] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0140] This embodiment also provides a device status update apparatus for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that implements a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0141] Figure 5 This is a structural block diagram of a device status update apparatus according to one embodiment of the present invention, such as... Figure 5As shown, the device includes: a sending module 501, used to send control commands to a target IoT device via a gateway based on topic relationships stored on a cloud server, wherein the topic relationships are used to find the identity of each IoT device among multiple IoT devices within the coverage area of the mesh network, the gateway is used to transmit the control commands, and the control commands are used to adjust the device status of each IoT device among the multiple IoT devices; a receiving module 502, used to receive feedback messages reported by the target IoT device via the gateway, wherein the feedback messages carry information including the current device status of the target IoT device; and an updating module 503, used to update the historical device status of the target IoT device to the current device status on a cloud server based on the topic relationships and the feedback messages.
[0142] Optionally, the sending module 501 is further configured to: find the target identity of the target IoT device from the topic relationship; encapsulate the control command into a MeshNet protocol message based on the target identity; and send the MeshNet protocol message to the target IoT device via the gateway.
[0143] Optionally, the update module 503 is also used to: find the target identity of the target IoT device from the topic relationship; find the historical device status of the target IoT device on the cloud server based on the target identity; and update the historical device status to the current device status according to the feedback message.
[0144] Optionally, the sending module 501 is further configured to: in response to updating the historical device status to the current device status on the cloud server, send a first notification message to at least one terminal device, wherein the first notification message is used to notify at least one terminal device to update the locally stored historical device status to the current device status.
[0145] Optionally, the device status update apparatus further includes: a processing module 504, configured to, in response to successfully sending a control command to the target IoT device via the gateway, update the historical device status to the target device status based on the topic relationship, and send a second notification message to at least one terminal device, wherein the second notification message is used to notify at least one terminal device to update the locally stored historical device status to the target device status.
[0146] Optionally, the update module 503 is further configured to: determine whether the current device state is consistent with the target device state based on the feedback message; and update the target device state to the current device state in response to the inconsistency between the current device state and the target device state.
[0147] Optionally, the sending module 501 is further configured to: in response to updating the target device status to the current device status on the cloud server, send a third notification message to at least one terminal device, wherein the third notification message is used to notify at least one terminal device to update the locally stored target device status to the current device status.
[0148] It should be noted that the above modules can be implemented by software or hardware. For the latter, they can be implemented in the following ways, but are not limited to: all the above modules are located in the same processor; or, the above modules are located in different processors in any combination.
[0149] Embodiments of the present invention also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps of any of the above method embodiments when run by a processor.
[0150] Optionally, in this embodiment, the storage medium may be configured to store a computer program for performing the following steps:
[0151] Step S1: Based on the topic relationships stored on the cloud server, a control command is sent to the target IoT device via the gateway. The topic relationships are used to find the identity of each IoT device among multiple IoT devices within the mesh network coverage area. The gateway is used to transmit the control command, and the control command is used to adjust the device status of each IoT device among multiple IoT devices.
[0152] Step S2: Receive feedback messages reported by the target IoT device via the gateway. The feedback messages carry information including the current device status of the target IoT device.
[0153] Step S3: On the cloud server, update the historical device status of the target IoT device to the current device status based on topic relationships and feedback messages.
[0154] Optionally, in this embodiment, the storage medium may include, but is not limited to, various media capable of storing computer programs, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0155] Embodiments of the present invention also provide an electronic device including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.
[0156] Optionally, in this embodiment, the processor can be configured to perform the following steps via a computer program:
[0157] Step S1: Based on the topic relationships stored on the cloud server, a control command is sent to the target IoT device via the gateway. The topic relationships are used to find the identity of each IoT device among multiple IoT devices within the mesh network coverage area. The gateway is used to transmit the control command, and the control command is used to adjust the device status of each IoT device among multiple IoT devices.
[0158] Step S2: Receive feedback messages reported by the target IoT device via the gateway. The feedback messages carry information including the current device status of the target IoT device.
[0159] Step S3: On the cloud server, update the historical device status of the target IoT device to the current device status based on topic relationships and feedback messages.
[0160] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0161] In the above embodiments of the present invention, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0162] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For instance, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.
[0163] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0164] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0165] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0166] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A method for updating device status, characterized in that, include: The target identity identifier of the target IoT device is found from the topic relationship, wherein the topic relationship is used to find the identity identifier of each IoT device among multiple IoT devices within the coverage area of the mesh network; Based on the target identity, the control command is encapsulated into a MeshNet protocol message, wherein the control command is used to adjust the device status of each of the plurality of IoT devices; The MeshNet protocol message is sent to the target IoT device via a gateway, wherein the gateway is used to transparently transmit the control command; The gateway receives feedback messages reported by the target IoT device, wherein the feedback messages carry information including: the current device status of the target IoT device; Find the target identity identifier of the target IoT device from the topic relationship; Based on the target identity identifier, search the historical device status of the target IoT device on the cloud server; The historical device status is updated to the current device status according to the feedback message.
2. The device status update method according to claim 1, characterized in that, The device status update method further includes: In response to updating the historical device status to the current device status on the cloud server, a first notification message is sent to at least one terminal device, wherein the first notification message is used to notify the at least one terminal device to update the locally stored historical device status to the current device status.
3. The device status update method according to claim 1, characterized in that, The device status update method further includes: In response to successfully sending the control command to the target IoT device via the gateway, the historical device state is updated to the target device state based on the topic relationship, and a second notification message is sent to at least one terminal device, wherein the second notification message is used to notify the at least one terminal device to update the locally stored historical device state to the target device state.
4. The device status update method according to claim 1, characterized in that, The feedback message is reported by the target IoT device to the cloud server via the gateway after waiting for a preset time. The preset time is used to confirm whether the cloud server should send the control command again.
5. The device status update method according to claim 3, characterized in that, Updating the historical device status to the current device status according to the feedback message includes: Based on the feedback message, determine whether the current device state is consistent with the target device state; In response to the inconsistency between the current device state and the target device state, the target device state is updated to the current device state.
6. The device status update method according to claim 5, characterized in that, The device status update method further includes: In response to updating the target device status to the current device status on the cloud server, a third notification message is sent to the at least one terminal device, wherein the third notification message is used to notify the at least one terminal device to update the locally stored target device status to the current device status.
7. A device for updating equipment status, characterized in that, include: A sending module is configured to: search for the target identity identifier of the target IoT device from a topic relationship, wherein the topic relationship is used to search for the identity identifier of each IoT device among multiple IoT devices within the coverage area of the mesh network; based on the target identity identifier, encapsulate control commands into a mesh protocol message, wherein the control commands are used to adjust the device state of each IoT device among the multiple IoT devices; and send the mesh protocol message to the target IoT device via a gateway, wherein the gateway is used to transparently transmit the control commands. The receiving module is configured to receive a feedback message reported by the target IoT device via the gateway, wherein the information carried in the feedback message includes: the current device status of the target IoT device; The update module is used to find the target identity identifier of the target IoT device from the topic relationship; based on the target identity identifier, find the historical device status of the target IoT device on the cloud server; and update the historical device status to the current device status according to the feedback message.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program is configured to execute the device state update method according to any one of claims 1 to 6 when run by a processor.
9. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to run the computer program to perform the device state update method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Equipment state query method and device and server
CN111698335A
Internet of Things equipment control instruction sending method based on distributed technology
CN111787031A
Data processing method and device based on Internet of Things
CN111970363A