A data synchronization method, a server and a device end

CN122933650APending Publication Date: 2026-10-16SHENZHEN MICROBT ELECTRONICS TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510425484.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-02
Publication Date
2026-10-16

AI Technical Summary

Technical Problem

主控模块的唤醒和运行需要消耗大量电能,频繁唤醒会显著增加设备的能耗,增加设备的电量损耗

Benefits of technology

[0019]本发明实施例提供的数据同步方法,可应用于物联网系统。通过第一服务端主动感知设备接入物联网系统,在检测到目标设备接入物联网系统的情况下,第一服务端自动检索目标设备是否存在需要同步的数据(期望属性值),如果有则主动下发给目标设备。本发明实施例通过主动感知设备接入、以及主动检索和推送数据的方式,可以有效避免设备在无需同步数据时唤醒主控模块;使得设备可以在接入物联网系统时不用唤醒主控模块,而是在接收到需要同步的数据之后,再唤醒主控模块以更新目标属性的属性值,完成数据同步。由此可以极大减少主控模块的不必要唤醒次数,从而实现对电量损耗的有效控制,显著降低设备的能耗。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122933650A_ABST
    Figure CN122933650A_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a data synchronization method, a server and a device. The method comprises: when it is detected that a target device accesses an Internet of Things system, querying whether an expected attribute value exists in each entry corresponding to the target device in a preset database; the expected attribute value is set according to an attribute setting request sent by a client; each entry in the preset database is used for recording related information of an attribute of a device; if it is queried that the expected attribute value corresponding to a target attribute of the target device exists, the expected attribute value corresponding to the target attribute is issued to the target device, so that the target device wakes up a master module. Embodiments of the present application enable the device to not wake up the master module when accessing the Internet of Things system, but to wake up the master module after receiving the data that needs to be synchronized, so that the number of unnecessary wake-ups of the master module can be reduced, and the energy consumption of the device can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of communication technology, and in particular to a data synchronization method, a server, and a device. Background Technology

[0002] In Internet of Things (IoT) systems, device attributes, desired device attribute values, and device shadows are key mechanisms for ensuring data synchronization between the cloud and devices.

[0003] Device attributes describe the device's operational state, such as temperature, humidity, and on / off status. Desired device attribute values ​​represent the desired state the device should achieve. A device shadow is a virtual copy of the device maintained in the cloud, storing both the device's latest state and its desired state.

[0004] Each time a device comes online, it retrieves the desired and latest states from the cloud's device shadow and updates its own state accordingly. However, in weak network environments, devices may frequently disconnect and reconnect. Each time the device reconnects, the main control module is woken up and retrieves data from the cloud to determine if it needs to update its state. The waking up and operation of the main control module consumes a significant amount of power, and frequent wake-ups significantly increase the device's energy consumption and power consumption. Furthermore, frequent data synchronization increases network traffic, further exacerbating communication problems in weak network environments. Summary of the Invention

[0005] This invention provides a data synchronization method, server, and device, which can reduce the number of unnecessary wake-ups of the main control module, thereby achieving effective control over power consumption and reducing the energy consumption of the device.

[0006] In a first aspect, embodiments of the present invention disclose a data synchronization method applied to a first server in an Internet of Things (IoT) system, the method comprising:

[0007] When a target device is detected to be connected to the IoT system, the system queries a pre-set database to check if a desired attribute value exists in each entry corresponding to the target device. The desired attribute value is set according to the attribute setting request sent by the client. Each entry in the pre-set database is used to record relevant information about an attribute of a device.

[0008] If a desired attribute value corresponding to the target attribute of the target device is found, the desired attribute value corresponding to the target attribute is sent to the target device so that the target device can wake up its main control module.

[0009] Secondly, embodiments of the present invention disclose a data synchronization method applied to a device in an Internet of Things (IoT) system, the method comprising:

[0010] The system receives the expected attribute value corresponding to the target attribute of the device from the first server in the IoT system; wherein the expected attribute value corresponding to the target attribute is sent by the first server when it detects that the device has accessed the IoT system and finds that the expected attribute value exists in the corresponding entry of the device in the preset database; the expected attribute value is set by the first server according to the attribute setting request sent by the client; each entry in the preset database is used to record relevant information of an attribute of a device;

[0011] The main control module on the device is woken up based on the expected attribute value corresponding to the target attribute.

[0012] Thirdly, embodiments of the present invention disclose a first server applied to an Internet of Things (IoT) system, the first server comprising:

[0013] The sensing and retrieval module is used to query a preset database to check whether a desired attribute value exists in each entry corresponding to the target device when the target device is detected to be connected to the Internet of Things system; the desired attribute value is set according to the attribute setting request sent by the client; each entry in the preset database is used to record relevant information of an attribute of a device;

[0014] The data delivery module is used to send the expected attribute value corresponding to the target attribute to the target device if the expected attribute value corresponding to the target attribute is found in the query, so as to wake up the main control module of the target device.

[0015] Fourthly, embodiments of the present invention disclose a device terminal applied to an Internet of Things (IoT) system, the device terminal comprising:

[0016] The data receiving module is used to receive the expected attribute value corresponding to the target attribute of the device sent by the first server in the IoT system; wherein, the expected attribute value corresponding to the target attribute is sent by the first server when it detects that the device has accessed the IoT system and finds that the expected attribute value exists in the corresponding entry of the device in the preset database; the expected attribute value is set by the first server according to the attribute setting request sent by the client; each entry in the preset database is used to record relevant information of an attribute of a device;

[0017] The main control wake-up module is used to wake up the main control module on the device side according to the expected attribute value corresponding to the target attribute.

[0018] The embodiments of the present invention have the following advantages:

[0019] The data synchronization method provided in this invention can be applied to Internet of Things (IoT) systems. By having a first server actively sense device access to the IoT system, upon detecting that a target device has accessed the IoT system, the first server automatically searches the target device for data (expected attribute values) that needs to be synchronized. If found, it actively sends the data to the target device. This invention, through active sensing of device access and active data retrieval and push, effectively avoids waking up the main control module when data synchronization is not required. This allows the device to access the IoT system without waking up the main control module, but only wakes it up after receiving the data to be synchronized to update the target attribute values, thus completing data synchronization. This significantly reduces the number of unnecessary wake-ups of the main control module, thereby effectively controlling power consumption and significantly reducing the device's energy consumption. Attached Figure Description

[0020] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0021] Figure 1 This is a flowchart illustrating the steps of an embodiment of the data synchronization method of the present invention;

[0022] Figure 2 This is a schematic diagram of the structure of an Internet of Things (IoT) system according to the present invention;

[0023] Figure 3 This is a flowchart illustrating the steps of another embodiment of the data synchronization method of the present invention;

[0024] Figure 4 This is a structural block diagram of a first server embodiment of the present invention;

[0025] Figure 5 This is a structural block diagram of one embodiment of the device side of the present invention;

[0026] Figure 6 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation

[0027] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0028] The terms "first," "second," etc., used in the specification and claims of this invention are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, the first object can be one or more. Furthermore, the term "and / or" in the specification and claims is used to describe the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, and B alone. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. In embodiments of this invention, the term "multiple" refers to two or more, and other quantifiers are similar.

[0029] Reference Figure 1 The diagram illustrates a flowchart of an embodiment of a data synchronization method according to the present invention, applied to a first server in an Internet of Things (IoT) system. The method may include the following steps:

[0030] Step 101: When the target device is detected to be connected to the IoT system, query the preset database to see if there is a desired attribute value in each entry corresponding to the target device; the desired attribute value is set according to the attribute setting request sent by the client; each entry in the preset database is used to record relevant information of an attribute of a device;

[0031] Step 102: If a desired attribute value corresponding to the target attribute of the target device is found, the desired attribute value corresponding to the target attribute is sent to the target device so that the target device can wake up its main control module.

[0032] The data synchronization method of this invention can be applied to Internet of Things (IoT) systems. The IoT refers to a network that connects various physical devices via the internet to achieve data exchange and communication. These devices typically embed sensors, software, and other technologies to collect and share data. The core objective of the IoT is to achieve intelligent interaction between devices, improving efficiency and convenience. In this invention, the IoT system may include a device terminal, a first server terminal, and a second server terminal.

[0033] The first server is a newly added server in the IoT system according to this embodiment of the invention, which can be used to provide data synchronization services. Further, the first server can be a server in a first service cluster. This embodiment of the invention can provide a first service cluster, which may include at least one first server, providing a unified service to the outside world. This embodiment of the invention does not limit the specific form of the first server; the first server can be a cloud server, a cloud platform, or a containerized service, etc.

[0034] The second server is a core component for message passing in the IoT system. For example, the second server can be a broker server based on the MQTT (Message Queuing Telemetry Transport) protocol, responsible for receiving, storing, and forwarding messages from devices. For instance, it receives messages from publishers and accurately routes them to subscribers who have subscribed to the corresponding topics based on the message's subject. Further, the second server can be one of the servers in a second service cluster, which may include at least one second server to provide a unified service. This embodiment of the invention does not limit the specific form of the second server; for example, the second server can be a broker server or an HTTP server, etc.

[0035] In this embodiment of the invention, the first server and the second server are collectively referred to as the cloud.

[0036] The device can be a physical or virtual entity connected to an Internet of Things (IoT) system. The device can act as a publisher or subscriber, publishing or subscribing to messages. This embodiment of the invention does not limit the specific type of the device. For example, the device can be a sensor, such as a temperature sensor, humidity sensor, light sensor, or air quality sensor; it can also be a smart home device, such as a home camera, door lock, robot vacuum cleaner, or air conditioner.

[0037] Different devices possess different attributes, which are parameters describing a device's characteristics, status, and functions. For example, device attributes may include operating modes, which determine how the device operates, such as the cooling, heating, and ventilation modes of an air conditioner, or the automatic cleaning, spot cleaning, and edge cleaning modes of a robot vacuum cleaner. Device attributes may include temperature, commonly found in temperature-controlled devices such as air conditioners and refrigerators. This attribute reflects the device's current temperature status or adjustable temperature range. Device attributes may include resolution, commonly found in image acquisition or display devices. This attribute determines the sharpness and detail of the captured image. Device attributes may include network configurations, including parameters required for the device to connect to a network, such as the WiFi (wireless network) name, password, and IP (Internet Protocol Address).

[0038] It is understood that the above device attributes are for illustrative purposes only. Business users can set device attribute values ​​according to actual needs to meet the requirements of different scenarios. For example, in actual operation, a business user can log in to the client and search for the target device in the operation interface. Then, in the target device's attribute setting interface, they can operate on the target device's target attributes. For example, setting the target device's working mode, setting the temperature, adjusting network configuration, etc. Thus, the client can send an attribute setting request to the first server. This attribute setting request can carry the target device's device identifier, the target attribute's attribute identifier, and the target attribute's target value. The first server, based on the received attribute setting request, sets the entry corresponding to the target device's target attribute in a pre-set database, for example, setting the target value to the expected attribute value corresponding to the target attribute. The business user can be a user with access permissions.

[0039] In this embodiment of the invention, the business party can set target attributes for the target device in a pre-configured database through a first server while the target device is offline. When the business party sets attributes for an offline device, the target value set for the target attribute becomes the expected attribute value and is stored in the corresponding entry in the pre-configured database. Once the target device comes online, the first server proactively sends the expected attribute values ​​that need to be synchronized to the target device, thereby enabling effective management and synchronization of device attributes even when the device is offline, improving data reliability and consistency.

[0040] It's important to clarify that "device offline" means the device is not connected to the IoT system, i.e., it hasn't established a persistent connection with any second server. "Device online" means the device is connected to the IoT system, i.e., it has established a persistent connection with a second server. A persistent connection is a continuous, stable, and long-term open connection between the device and the second server to meet the needs of frequent, real-time data exchange. The device initiates a connection request to the second server using a specific network protocol (such as MQTT). After the second server accepts the request, both parties complete a handshake, formally establishing a persistent connection. This connection will not be easily broken unless the device goes offline, experiences a network failure, or actively closes the connection.

[0041] This invention implements a pre-configured database on the first server side. The pre-configured database can be used to store relevant information about various attributes of each device. The pre-configured database may include several entries, each entry recording relevant information about a specific attribute of a device. This invention does not limit the implementation method of the pre-configured database; for example, the database may be a relational database, a non-relational database, a distributed database, etc.

[0042] In this embodiment of the invention, when the first server detects that the target device has accessed the Internet of Things system, it queries the preset database to see if there is a desired attribute value in each entry corresponding to the target device. If the desired attribute value corresponding to the target attribute of the target device is found, the server sends the desired attribute value corresponding to the target attribute to the target device so that the target device can wake up its main control module and update its own target attribute according to the desired attribute value corresponding to the target attribute, thereby realizing data synchronization of the target device.

[0043] This invention, in its embodiments, proactively senses device access to the Internet of Things (IoT) system via a first server. Upon detecting that a target device is connected to the IoT system, the first server automatically searches the target device for data (expected attribute values) that needs to be synchronized. If found, it proactively sends this data to the target device. By proactively sensing device access and actively searching and pushing data, this invention effectively avoids waking the main control module when data synchronization is not required. Instead, the main control module is only woken up after the device receives the data that needs synchronization to update the target attribute values ​​and complete the data synchronization. This significantly reduces the number of unnecessary wake-ups of the main control module, thereby effectively controlling power consumption and significantly reducing the device's energy consumption.

[0044] Furthermore, after sending the desired attribute value corresponding to the target attribute to the target device, the method may further include:

[0045] The system receives the updated attribute value reported by the target device and updates the entry corresponding to the target attribute of the target device in the preset database according to the updated attribute value. The updated attribute value reported by the target device is the attribute value after updating its own target attribute according to the expected attribute value corresponding to the target attribute sent by the first server.

[0046] After receiving the expected attribute value corresponding to the target attribute sent by the first server, the target device updates its own target attribute according to the received expected attribute value to obtain the updated attribute value. Then, it reports the updated attribute value to the first server. The first server can update the entry corresponding to the target attribute of the target device in the preset database according to the updated attribute value, thereby realizing the synchronization of attribute data on the device and attribute data in the cloud.

[0047] Reference Figure 2 The diagram illustrates the structure of an Internet of Things (IoT) system according to an embodiment of the present invention. Figure 2 As shown, the Internet of Things (IoT) system may include a first server 201, a device 202, and a pre-configured database 203. Figure 2 As shown, the data synchronization process can be as follows:

[0048] A1. The business party sets the target value for the target attribute of the target device through the first server.

[0049] A2. The first server stores the target value set by the business party as the expected attribute value corresponding to the target attribute of the target device into the preset database.

[0050] A3. The first server detected that the target device has accessed the Internet of Things system.

[0051] A4. The first server searches the preset database to see if the expected attribute value of the target device exists.

[0052] A5. If the desired attribute value is found, send it to the target device.

[0053] A6. The main control module of the target device is woken up. The main control module updates its own target attribute value according to the received expected attribute value. After the update is completed, it reports the updated attribute value to the first server.

[0054] A7. The first server updates the preset database based on the received updated attribute values.

[0055] In one example, the preset database contains entries as shown in Table 1.

[0056] Table 1

[0057] Equipment identification Attribute identifier Current attribute value Expected attribute value deviceID1 deviceID1_p1 Current value 1 Expected value 1 deviceID1 deviceID1_p2 Current value 2 Expected value 2 deviceID1 deviceID1_p3 Current value 3 null … … … … deviceID2 deviceID2_p1 Current value n Expected value n … … … …

[0058] As shown in Table 1, each row represents an entry. The device identifier in the first row is deviceID1, and the attribute identifier is deviceID1_p1. Assuming the device identified by deviceID1 is called device 1, the first row represents information related to one attribute of device 1, and the second row represents information related to another attribute of device 1. This information includes, but is not limited to, the current attribute value, the expected attribute value, the version number, and the update time.

[0059] Here, the current attribute value represents the current value of a specific attribute on a device. The expected attribute value represents the expected value of a specific attribute on a device; this expected value can be set by the business side through the client for devices in an offline state. The version number represents the version information of a specific attribute on a device. The update time represents the time when the relevant information of a specific attribute on a device changed.

[0060] It should be noted that if the business party sets different expected attribute values ​​for the same attribute of the device multiple times before the device goes live, the latest expected attribute value will overwrite the previous one. That is, each entry in the preset database records the most recently set expected attribute value.

[0061] In this embodiment of the invention, when the first server detects that the target device has accessed the Internet of Things system, it queries the preset database to see if there is a desired attribute value in each entry corresponding to the target device. If the desired attribute value corresponding to the target attribute of the target device is found, the server sends the desired attribute value corresponding to the target attribute to the target device so that the target device updates its own target attribute according to the desired attribute value corresponding to the target attribute, thereby achieving data synchronization.

[0062] In this embodiment of the invention, the expected attribute value corresponding to the target attribute of the target device queried from the preset database is referred to as the synchronization data of the target device.

[0063] After updating its target attributes, the target device reports the updated attribute values ​​to the first server. The first server can then update the entries corresponding to the target attributes of the target device in the preset database based on these updated attribute values, thereby synchronizing the attribute data on the device with that in the cloud. For example, since device 1 has updated the value of its deviceID1_p1 attribute to the expected value 1, the updated attribute value corresponding to deviceID1_p1 of device 1 is the expected value 1. Upon receiving this updated attribute value, the first server modifies the current attribute value in the entry corresponding to deviceID1_p1 of device 1 in the preset database to the expected value 1. Furthermore, since the current attribute value of device 1 is already consistent with the expected attribute value (expected value 1), the first server can delete the expected value 1 from the entry corresponding to deviceID1_p1 of device 1 in the preset database. This ensures that the data state on the device and in the cloud remains consistent.

[0064] In an optional embodiment of the present invention, the step of querying the preset database to see if the desired attribute value exists in each entry corresponding to the target device may include:

[0065] Step S11: Using the device identifier of the target device as an index, retrieve all entries that match the device identifier in the preset database;

[0066] Step S12: If at least one of the retrieved entries contains a desired attribute value, then it is determined that a desired attribute value corresponding to the target attribute of the target device has been found, and the attribute corresponding to the entry containing the desired attribute value is determined to be the target attribute.

[0067] For example, when the first server detects that device 1 has accessed the IoT system, it can query the entries corresponding to device 1 in a pre-set database. Specifically, using the device identifier deviceID1 of device 1 as an index, it retrieves all entries matching this device identifier in the pre-set database. All matching entries include the first three entries in Table 1. Among them, the first two entries contain expected attribute values, so the target attributes are determined to be deviceID1_p1 and deviceID1_p2. The first server can send synchronization data to the target device (device 1) with the device identifier deviceID1. This synchronization data includes the expected attribute value (expected value 1) corresponding to the target attribute deviceID1_p1 and the expected attribute value (expected value 2) corresponding to the target attribute deviceID1_p2.

[0068] After receiving the aforementioned synchronization data, device 1 updates the value of its deviceID1_p1 attribute to the expected value 1 and the value of its deviceID1_p2 attribute to the expected value 2. It then reports the updated attribute values ​​to the first server, such as the updated attribute value (expected value 1) for deviceID1_p1 and the updated attribute value (expected value 2) for deviceID1_p2. The first server can then update the entry corresponding to the target attribute of device 1 in the preset database based on the updated attribute values.

[0069] In an optional embodiment of the present invention, the first server and the second server in the Internet of Things (IoT) system are deployed independently; the detection of the target device accessing the IoT system may include:

[0070] If a first message is received from the second server, it is determined that the target device has been detected to be connected to the IoT system; the first message is sent by the second server after establishing a long connection with the target device.

[0071] In this embodiment of the invention, a first server is added to the Internet of Things (IoT) system. The first server and the second server are deployed independently. The first server can actively sense the target device's access to the IoT system through the second server, and actively send the expected attribute value corresponding to the target attribute to the target device through the second server.

[0072] Specifically, after the target device establishes a long connection with the second server, the second server can send a first message to the first server to notify the first server that a target device has accessed the IoT system. It is understood that this embodiment of the invention does not limit the method by which the first server detects the target device's access to the IoT system. For example, this embodiment of the invention can detect the target device's access to the IoT system in a timely manner by having the second server in the IoT system actively notify the user. The second server, acting as a message broker in the IoT system, can receive messages from different IoT devices and accurately route these messages to their respective destinations according to preset rules. When a target device establishes a long connection with a second server in the IoT system, the target device is considered to have accessed the IoT system, and the second server can then send a first message to the first server to promptly notify the first server that a target device has accessed the IoT system.

[0073] Furthermore, the first message may carry the device identifier of the target device. After receiving the first message, the first server searches a preset database based on the device identifier of the target device. If a desired attribute value that the target device needs to synchronize is found in the preset database, the server sends the desired attribute value corresponding to the target attribute to the second server. Since the target device and the second server have established a long connection, the target device can listen to the desired attribute value corresponding to the target attribute sent by the first server to the second server through this long connection, and then update its own target attribute.

[0074] Furthermore, receiving the updated attribute values ​​reported by the target device may include:

[0075] The server receives a second message from the second server. The second message is sent by the second server after receiving the updated attribute value reported by the target device. The second message carries the updated attribute value.

[0076] The target device updates its own target attribute based on the received expected attribute value corresponding to the target attribute, obtaining the updated attribute value. After the update, it sends the updated attribute value to the second server. Upon receiving the updated attribute value reported by the target device, the second server can send a second message to the first server, carrying the updated attribute value. Upon receiving the second message, the first server can update the entry corresponding to the target attribute of the target device in the preset database based on the updated attribute value.

[0077] Furthermore, since the target device establishes a long connection with the second server to access the IoT system, in this embodiment of the invention, the target device reports its updated attribute value through the established long connection with the second server. The second server then sends a second message carrying the updated attribute value to the first server, so that the first server updates the entry corresponding to the target attribute of the target device in the preset database according to the updated attribute value. During this process, the original communication object on the device side does not need to be changed; the device side still communicates with the second server, and does not need to establish a connection with the first server for communication. This reduces the operation on the device side and lowers its energy consumption.

[0078] This invention does not limit the network protocols used between the first server and the second server, or between the second server and the device. For example, in an IoT system based on the MQTT protocol, the MQTT protocol can be used for communication. For instance, the first message and the second message can be messages based on the MQTT protocol. Of course, in IoT systems based on other network protocols, other network protocols can also be used for communication, such as the HTTP protocol. This invention primarily uses the MQTT protocol as an example for description.

[0079] In an optional embodiment of the present invention, the target device may include a communication module and a main control module, and the target device establishes a long connection with the second server through the communication module.

[0080] The communication module, primarily responsible for data transmission and interaction between the device and external sources (such as a second server), is the core component for enabling device networking. It allows the device to connect to an IoT system and communicate with the second server. Through the communication module, the device can receive synchronized data from the cloud, such as desired attribute values ​​set by the business. Furthermore, the communication module can report the device's own data, such as updated attribute values, to the cloud to ensure data synchronization between the device and the cloud, enabling the device to adjust its state according to the business's needs. The main control module is the core control unit of the device, responsible for managing and coordinating the work of various internal components, determining the overall operating logic and functional implementation of the device.

[0081] Furthermore, the step of sending the desired attribute value corresponding to the target attribute to the target device so that the target device wakes up its main control module may include:

[0082] A target protocol message is sent to the second server so that the communication module of the target device can listen to the target protocol message based on the long connection and identify the target wake-up word in it, and then send a wake-up signal to the main control module to wake up the main control module; the target protocol message carries the target wake-up word and the expected attribute value corresponding to the target attribute.

[0083] In this embodiment of the invention, the main control module on the device side can be in a sleep state when there are no processing tasks to reduce unnecessary energy consumption. The processing tasks include, but are not limited to, data update operations, such as updating the value of a target attribute to a desired attribute value.

[0084] The business unit connects to the first server via a client and sets expected attribute values ​​for the target device. The first server then stores these expected attribute values ​​in a pre-built database. When the first server detects that the target device has connected to the IoT system and finds expected attribute values ​​in the pre-built database that need to be synchronized to the target device, it initiates the data synchronization process, preparing to send the expected attribute values ​​to be synchronized to the target device. At this point, a need arises to wake up the target device's main control module to update the data.

[0085] In this embodiment of the invention, a target wake-up word is carried in the target protocol message sent from the first server to the second server. This target wake-up word is predefined in the communication module of the device. The target wake-up word is an identifier that triggers the wake-up of the main control module. The communication module of the target device is in a listening state; once it detects a target protocol message containing the target wake-up word, it can identify the target wake-up word. The communication module and the main control module can be connected via, for example, a serial communication interface. After identifying the target wake-up word, the communication module can send a wake-up signal to the main control module through the serial communication interface. Upon receiving the wake-up signal, the main control module is awakened and enters a working state, thereby beginning to read the desired attribute value corresponding to the target attribute from the target protocol message and performing an update operation.

[0086] In practical implementation, the energy consumption on the device side mainly comes from the main control module. This embodiment of the invention optimizes the data synchronization process, requiring only the communication module to be activated when the device connects to the IoT system, without needing to wake up the main control module. The device no longer needs to actively pull data from the cloud to determine if there is data to be synchronized each time it goes online. Instead, the first server actively searches the device for data that needs to be synchronized, and when data is found, it actively sends the synchronization data. The device then wakes up the main control module after receiving the synchronization data. If there is no data to be synchronized on the cloud, even if the device goes online, there is no need to wake up the main control module, avoiding unnecessary energy consumption.

[0087] It is understood that the embodiments of the present invention do not limit the method for waking up the main control module of the target device. The embodiments of the present invention add a target wake-up word to the target protocol message carrying the synchronization data of the target device by actively sensing device access and actively retrieving and pushing data through the first server. When the communication module of the target device recognizes the target wake-up word, it can wake up the main control module of the target device, which can reduce the analysis and processing operations on the device side and further reduce the power consumption of the device side.

[0088] In this embodiment of the invention, the expected attribute value of the target device retrieved by the first server in the preset database may include the target value set by the business party for at least one attribute of the target device. For example, in the above example, for device 1, the expected attribute value retrieved by the first server includes the target values ​​(expected value 1 and expected value 2) set by the business party for two attributes of device 1, as shown in the first two entries of Table 1.

[0089] Furthermore, the desired attribute value can also represent the target operating mode set by the business party for the target device, which may include a constant power mode or a sleep / wake-up mode. Therefore, the business party can modify the device's operating mode offline.

[0090] Constant power mode refers to the device remaining continuously powered on, with all its internal modules always in a ready-to-operate state. Sleep / wake-up mode is an energy-saving operating mode where the device is in a low-power sleep state most of the time, retaining only essential functions. It is only activated and enters working mode when it receives a specific wake-up signal.

[0091] In one example, the business side changes the operating mode of a target device (such as a passive camera) from "constant power mode" to "sleep / wake-up mode" by setting desired attribute values. The specific process is as follows:

[0092] The business user logs into the client and searches for the target device (the passive camera) in the operation interface. Then, in the target device's attribute settings interface, they change the operating mode from "Never-Powered Mode" to "Sleep / Wake-up Mode". The first server receives this attribute setting request, which carries the device identifier of the target device (e.g., the passive camera), the attribute identifier of the target device's target attribute (e.g., the operating mode), and the target value of the target attribute (e.g., sleep / wake-up mode). Based on the received attribute setting request, the first server sets the corresponding entry for the target device's target attribute in a preset database. For example, in the entry corresponding to the passive camera's operating mode, it sets the desired attribute value to "Sleep / Wake-up Mode".

[0093] Once the passive camera establishes a long connection with a second server, the second server sends a first message to the first server. This first message may carry the device identifier of the target device (the passive camera). The first server determines that it has detected the passive camera accessing the IoT system, and then searches a pre-set database based on the passive camera's device identifier. If the database contains the desired attribute value that the passive camera needs to synchronize, the server sends the desired attribute value (such as sleep / wake-up mode) to the passive camera.

[0094] Specifically, the first server sends a target protocol message (such as an MQTT protocol message) carrying a target wake-up word to the second server. This message includes not only the target wake-up word but also the desired attribute values ​​to be set. Since the passive camera's communication module maintains a constant connection with the second server, the passive camera can listen to the target protocol message sent from the first server to the second server.

[0095] After the communication module detects the target protocol message, it identifies the target wake-up word and sends a wake-up signal to the main control module via the serial communication interface, thereby waking up the main control module. Once awakened, the main control module begins reading the desired attribute value from the target protocol message, which is the "sleep / wake-up mode". Based on the received "sleep / wake-up mode" value, the main control module updates the passive camera's operating mode, switching from the original "constant power mode" to "sleep / wake-up mode".

[0096] For example, after switching to "sleep / wake-up mode", the passive camera can enter a low-power sleep state when no specific triggering event (such as human movement) is detected; it will only enter the working state when a specific triggering event is detected, and will enter the sleep state again after the task is completed, which can reduce the device's power consumption.

[0097] It is understood that the operating mode is a device attribute, and the above modification of the operating mode of the passive camera is merely an application example of this invention. This embodiment of the invention does not limit the device type of the target device or the attribute type of the target attribute.

[0098] For example, the target device can be a smart air conditioner, and the target attribute can be the operating mode of the smart air conditioner, such as cooling, heating, or ventilation mode. Through this embodiment of the invention, the business party can log in to the client and send an attribute setting request to the first server to set the target operating mode of the smart air conditioner (such as cooling, heating, or ventilation mode). The first server sets the expected attribute value corresponding to the target attribute (such as operating mode) of the smart air conditioner in a preset database to the target operating mode. After detecting that the smart air conditioner is connected to the IoT system, the first server wakes up the main control module of the smart air conditioner by sending a target protocol message carrying the target wake-up word and the expected attribute value (the target operating mode), so that the smart air conditioner updates its operating mode to the target operating mode.

[0099] For example, the target device can be an image acquisition device, and the target attribute can be the resolution of the image acquisition device. Through this embodiment of the invention, the service provider can log in to the client and send an attribute setting request to the first server to set the target resolution of the image acquisition device. The first server sets the expected attribute value corresponding to the target attribute (such as resolution) of the image acquisition device in a preset database to the target resolution. After detecting that the image acquisition device has accessed the IoT system, the first server wakes up the main control module of the image acquisition device by sending a target protocol message carrying a target wake-up word and the expected attribute value (the target resolution), so that the image acquisition device updates its resolution to the target resolution.

[0100] For example, the target device can be an intelligent lighting system, and the target attribute can be the operating mode of the intelligent lighting system, such as a normal lighting mode or an energy-saving mode. An energy-saving mode refers to reducing light brightness or turning off some lights to achieve energy conservation. Through this embodiment of the invention, the business party can log in to the client and send an attribute setting request to the first server to set the target operating mode (such as a normal lighting mode or an energy-saving mode) of the intelligent lighting system. The first server sets the expected attribute value corresponding to the target attribute (such as the operating mode) of the intelligent lighting system in a preset database to the target operating mode. After detecting that the intelligent lighting system has accessed the Internet of Things system, the first server wakes up the main control module of the intelligent lighting system by sending a target protocol message carrying the target wake-up word and the expected attribute value (the target operating mode), so that the intelligent lighting system updates its operating mode to the target operating mode.

[0101] In an optional embodiment of the present invention, the method may further include:

[0102] After setting the desired attribute value in the preset database according to the attribute setting request sent by the client, the update time is recorded in the corresponding entry.

[0103] The update time indicates when information related to a specific attribute of a device changes. For example, after a business user sets a desired attribute value for a device, they can record the setting time of that desired attribute value in the update time of the corresponding entry. Therefore, the validity of the desired attribute value can be determined based on this update time.

[0104] In an optional embodiment of the present invention, the step of querying the preset database to see if the desired attribute value exists in each entry corresponding to the target device may include:

[0105] In the preset database, query whether there are any expected attribute values ​​in each entry corresponding to the target device whose update time conforms to the preset strategy.

[0106] In practice, a pre-defined strategy can be set for updating device attributes. For example, for a specific target device (such as an air conditioner), the pre-defined strategy can be set to only respond to the expected attribute values ​​set for that day. This pre-defined strategy can be set on the first server and / or the device side.

[0107] When the first server detects that a target device (such as the air conditioner) has accessed the IoT system, it queries the pre-set database to check if a desired attribute value exists in each entry corresponding to the target device. If a desired attribute value exists, but its update time was set the previous day instead of the current day, then the desired attribute value is determined to be inconsistent with the pre-set policy, and it will not be sent to the target device. If the update time of the desired attribute value is set the current day, then the desired attribute value is determined to be consistent with the pre-set policy, and it can be sent to the target device.

[0108] In an optional embodiment of the present invention, updating the entry corresponding to the target attribute of the target device in the preset database according to the updated attribute value may include:

[0109] In the preset database, the desired attribute value is deleted from the entry corresponding to the target attribute of the target device, and the updated attribute value is recorded as the current attribute value corresponding to the target attribute.

[0110] After the target device updates its own target attribute according to the expected attribute value corresponding to the received target attribute, its own target attribute has been updated to the expected attribute value, and the updated attribute value reported by the target device is also consistent with the expected attribute value. Therefore, in the preset database, the expected attribute value has become the current attribute value in the entry corresponding to the target attribute of the target device. Thus, the first server can delete the expected attribute value from the entry corresponding to the target attribute of the target device and record the updated attribute value as the current attribute value corresponding to the target attribute.

[0111] Furthermore, after updating the entry corresponding to the target attribute of the target device in the preset database according to the updated attribute value, the first server can also record the time of this update in the corresponding entry.

[0112] Taking the above example as an example, the updated entries are shown in Table 2.

[0113] Table 2

[0114] Equipment identification Attribute identifier Current attribute value Expected attribute value Update time deviceID1 deviceID1_p1 Expected value 1 null t1 deviceID1 deviceID1_p2 Expected value 2 null t2 deviceID1 deviceID1_p3 Current value 3 null t3 … … … … deviceID2 deviceID2_p1 Current value n Expected value n tn … … … …

[0115] In this embodiment of the invention, the update time may include the time when the business party sets the desired attribute value, and may also include the time when the first server updates the corresponding entry based on the updated attribute value reported by the target device. Therefore, when a device malfunctions, the update time can serve as auxiliary information for locating the problem. For example, if a certain attribute of a device stops updating, the update time recorded in the corresponding entry for that device can be used to infer the time of the fault and narrow down the investigation scope.

[0116] It is understood that the embodiments of the present invention do not limit the specific content of the attribute-related information recorded for each entry in the preset database. For example, in addition to recording the update time of the attribute, information such as the version number of the attribute can also be recorded.

[0117] The version number can represent the version information of a certain attribute of a device. Furthermore, when an attribute has no expected value, its version number can be set to 0 or empty. Therefore, by querying whether the version number is 0 or empty, it can be determined whether the corresponding attribute has an expected value, thus speeding up the retrieval process. This embodiment of the invention does not limit the format of the version number entries. For example, for the same attribute, the version number can be incremented sequentially, with the latest version number overwriting the previous version number.

[0118] Furthermore, the first server updates the entry corresponding to the target attribute of the target device in the preset database according to the updated attribute value reported by the target device. This may also include: clearing the version number in the entry, such as setting the version number to 0 or empty, indicating that the attribute has no expected attribute value.

[0119] Reference Figure 3 The diagram illustrates a flowchart of another embodiment of the data synchronization method of the present invention, applied to the device side of an Internet of Things (IoT) system. The method may include the following steps:

[0120] Step 301: Receive the expected attribute value corresponding to the target attribute of the device from the first server in the IoT system; wherein, the expected attribute value corresponding to the target attribute is sent by the first server when it detects that the device has accessed the IoT system and finds the expected attribute value in the corresponding entry of the device in the preset database; the expected attribute value is set by the first server according to the attribute setting request sent by the client; each entry in the preset database is used to record relevant information of an attribute of a device;

[0121] Step 302: Wake up the main control module on the device side according to the expected attribute value corresponding to the target attribute.

[0122] It should be noted that the execution steps on the device side have been specifically described in the foregoing embodiments and will not be repeated here. The device side includes a main control module, which enters a sleep state when there are no processing tasks. After receiving the synchronization data (the expected attribute value corresponding to the target attribute of the device side) sent by the first server, the device side can wake up its main control module to perform data update operations and realize data synchronization.

[0123] Optionally, the first server and the second server in the IoT system are deployed independently; the method may further include:

[0124] The device establishes a long connection with the second server, so that the second server sends a first message to the first server after the long connection is established;

[0125] The step of receiving the expected attribute value corresponding to the target attribute of the device sent by the first server in the Internet of Things system includes:

[0126] The device listens for the expected attribute value corresponding to the target attribute of the device sent from the first server to the second server through the long connection.

[0127] The step of reporting the updated attribute value to the first server includes:

[0128] The device reports the updated attribute value to the second server through the long connection, so that the second server sends a second message to the first server, the second message carrying the updated attribute value.

[0129] Optionally, the device may further include a communication module, which is used to establish a long connection with the second server. The method may further include:

[0130] After the communication module listens to the target protocol message sent to the second server based on the long connection and identifies the target wake-up word in it, it sends a wake-up signal to the main control module to wake up the main control module; the target protocol message carries the target wake-up word and the expected attribute value corresponding to the target attribute.

[0131] Optionally, the method may further include:

[0132] After updating its own target attribute according to the expected attribute value corresponding to the target attribute, the device obtains the updated attribute value corresponding to its own target attribute and reports the updated attribute value to the first server.

[0133] In summary, the data synchronization method provided in this invention can be applied to Internet of Things (IoT) systems. By having a first server actively sense device access to the IoT system, upon detecting a target device's access, the first server automatically searches the target device for data (expected attribute values) that needs to be synchronized. If found, it actively sends the data to the target device. This invention, through active device access sensing and active data retrieval and push, effectively avoids waking the main control module when data synchronization is not required. This allows the device to access the IoT system without waking the main control module, but only wakes it after receiving the data to be synchronized to update the target attribute values, thus completing data synchronization. This significantly reduces the number of unnecessary wake-ups of the main control module, thereby effectively controlling power consumption and significantly reducing the device's energy consumption.

[0134] For the sake of simplicity, the method embodiments are described as a series of actions. However, those skilled in the art should understand that the embodiments of the present invention are not limited to the described order of actions, because according to the embodiments of the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions involved are not necessarily essential to the embodiments of the present invention.

[0135] Reference Figure 4 The diagram illustrates a structural block diagram of a first server embodiment of the present invention. The first server is applied to an Internet of Things (IoT) system and may include:

[0136] The sensing and retrieval module 401 is used to query a preset database to check whether a desired attribute value exists in each entry corresponding to the target device when the target device is detected to be connected to the Internet of Things system; the desired attribute value is set according to the attribute setting request sent by the client; each entry in the preset database is used to record relevant information of an attribute of a device;

[0137] The data delivery module 402 is used to send the expected attribute value corresponding to the target attribute to the target device if the expected attribute value corresponding to the target attribute of the target device is found to exist, so as to wake up the main control module of the target device.

[0138] Optionally, the first server may further include:

[0139] The data update module is used to receive the updated attribute values ​​reported by the target device and update the entries corresponding to the target attributes of the target device in the preset database according to the updated attribute values; wherein, the updated attribute values ​​reported by the target device are attribute values ​​after updating its own target attributes according to the expected attribute values ​​corresponding to the target attributes sent by the first server.

[0140] Optionally, the first server and the second server in the IoT system are deployed independently; the sensing and retrieval module is specifically used for:

[0141] If a first message is received from the second server, it is determined that the target device has been detected to be connected to the IoT system; the first message is sent by the second server after establishing a long connection with the target device.

[0142] Optionally, the data update module is specifically used for:

[0143] The server receives a second message from the second server. The second message is sent by the second server after receiving the updated attribute value reported by the target device. The second message carries the updated attribute value.

[0144] Optionally, the target device includes a communication module and a main control module, and the target device establishes a long connection with the second server through the communication module;

[0145] The data delivery module is specifically used for:

[0146] A target protocol message is sent to the second server so that the communication module of the target device can listen to the target protocol message based on the long connection and identify the target wake-up word in it, and then send a wake-up signal to the main control module to wake up the main control module; the target protocol message carries the target wake-up word and the expected attribute value corresponding to the target attribute.

[0147] Optionally, the sensing and retrieval module includes:

[0148] The retrieval submodule is used to retrieve all entries that match the device identifier of the target device from the preset database;

[0149] The determination submodule is used to determine, if at least one of the retrieved entries contains a desired attribute value, the desired attribute value corresponding to the target attribute of the target device that was found, and to determine the attribute corresponding to the entry containing the desired attribute value as the target attribute.

[0150] Optionally, the first server further includes:

[0151] The time recording module is used to record the update time in the corresponding entry after the desired attribute value is set in the preset database according to the attribute setting request sent by the client.

[0152] The sensing and retrieval module is specifically used for:

[0153] In the preset database, query whether there are any expected attribute values ​​in each entry corresponding to the target device whose update time conforms to the preset strategy.

[0154] Optionally, the data update module is specifically used for:

[0155] In the preset database, the desired attribute value is deleted from the entry corresponding to the target attribute of the target device, and the updated attribute value is recorded as the current attribute value corresponding to the target attribute.

[0156] Optionally, the desired attribute value includes a target value set for at least one attribute of the target device, or the desired attribute value includes a target operating mode set for the target device, which may include, but is not limited to, constant power mode or sleep / wake-up mode.

[0157] Reference Figure 5 The diagram illustrates a structural block diagram of a device-side embodiment of the present invention. The device-side is applied to an Internet of Things (IoT) system and may include:

[0158] The data receiving module 501 is used to receive the expected attribute value corresponding to the target attribute of the device sent by the first server in the Internet of Things system; wherein, the expected attribute value corresponding to the target attribute is sent by the first server when it detects that the device has accessed the Internet of Things system and finds that the expected attribute value exists in the corresponding entry of the device in the preset database; the expected attribute value is set by the first server according to the attribute setting request sent by the client; each entry in the preset database is used to record the relevant information of an attribute of a device;

[0159] The main control wake-up module 502 is used to wake up the main control module on the device side according to the expected attribute value corresponding to the target attribute.

[0160] Optionally, the device may further include:

[0161] The data synchronization module is used to update its own target attribute according to the expected attribute value corresponding to the target attribute, and obtain the updated attribute value.

[0162] The data reporting module is used to report the updated attribute value to the first server so that the first server updates the entry corresponding to the target attribute of the device in the preset database according to the updated attribute value.

[0163] Optionally, the first server and the second server in the IoT system are deployed independently; the device also includes:

[0164] A connection establishment module is used to establish a long connection with the second server, so that the second server sends a first message to the first server after the long connection is established;

[0165] The data receiving module is specifically used for:

[0166] The long connection is used to listen for the expected attribute value corresponding to the target attribute of the device sent from the first server to the second server.

[0167] The data reporting module is specifically used for:

[0168] The updated attribute value is reported to the second server through the long connection, so that the second server sends a second message to the first server, the second message carrying the updated attribute value.

[0169] Optionally, the device includes a communication module and a main control module. The communication module is used to establish a long connection with the second server, and the main control module is in a sleep state.

[0170] The communication module is further configured to send a target signal to the main control module after listening to the target protocol message sent to the second server based on the long connection, so as to wake up the main control module; the target protocol message carries the target wake-up word and the expected attribute value corresponding to the target attribute.

[0171] This invention also discloses an Internet of Things (IoT) system, such as... Figure 2 As shown, the Internet of Things system includes a first server 201, a device 202, and a pre-built database 203, wherein:

[0172] The first server 201 is used to query a preset database for whether there is a desired attribute value in each entry corresponding to the target device when the target device is detected to be connected to the Internet of Things system; the desired attribute value is set according to the attribute setting request sent by the client; if the desired attribute value corresponding to the target attribute of the target device is found, the desired attribute value corresponding to the target attribute is sent to the target device.

[0173] The preset database 203 is used to store at least one entry, each entry being used to record information related to an attribute of a device;

[0174] The device 202 is used to wake up its own main control module according to the expected attribute value corresponding to the target attribute.

[0175] Optionally, the device terminal 202 is further configured to update its own target attribute according to the expected attribute value corresponding to the target attribute, obtain the updated attribute value, and report the updated attribute value to the first device terminal;

[0176] The first server 203 is further configured to receive the updated attribute value reported by the target device, and update the entry corresponding to the target attribute of the target device in the preset database according to the updated attribute value.

[0177] Optionally, the first server and the second server in the IoT system are deployed independently;

[0178] The first server is further configured to determine, if it receives a first message from the second server, that a target device has been detected to be connected to the Internet of Things system; the first message is sent by the second server after establishing a long connection with the target device;

[0179] The first server is further configured to receive a second message from the second server, the second message being sent by the second server after receiving the updated attribute value reported by the target device, the second message carrying the updated attribute value.

[0180] Optionally, the device includes a communication module and a main control module, and the device establishes a long connection with the second server through the communication module;

[0181] The first server is also used for:

[0182] Send the target protocol message to the second server;

[0183] The device is further configured to send a target signal to the main control module after the communication module listens for the target protocol message based on the long connection, so as to wake up the main control module; the target protocol message carries the target wake-up word and the expected attribute value corresponding to the target attribute.

[0184] Optionally, the first server is further configured to use the device identifier of the target device as an index to retrieve all entries that match the device identifier in the preset database; if at least one of the retrieved entries contains a desired attribute value, then it is determined that a desired attribute value corresponding to the target attribute of the target device has been found, and the attribute corresponding to the entry containing the desired attribute value is determined to be the target attribute.

[0185] Optionally, the first server is further configured to set the desired attribute value in the preset database according to the attribute setting request sent by the client, and record the update time in the corresponding entry; and query the preset database to see if there is a desired attribute value whose update time conforms to the preset strategy in each entry corresponding to the target device.

[0186] Optionally, the first server is further configured to: delete the desired attribute value from the entry corresponding to the target attribute of the target device in the preset database, and record the updated attribute value as the current attribute value corresponding to the target attribute.

[0187] Optionally, the desired attribute value includes a target value set for at least one attribute of the target device, or the desired attribute value includes a target operating mode set for the target device, the target operating mode including constant power mode or sleep / wake-up mode.

[0188] This invention deploys a first server in an IoT system. The first server actively senses device access to the IoT system. Upon detecting a target device's access, the first server automatically searches the target device for data (expected attribute values) that needs to be synchronized. If found, it actively sends the data to the target device. By actively sensing device access and actively searching and pushing data, this invention effectively avoids waking up the main control module when data synchronization is not required. This allows the device to access the IoT system without waking the main control module, but only wakes it up after receiving the data to update the target attribute values, thus completing data synchronization. This significantly reduces the number of unnecessary wake-ups of the main control module, thereby effectively controlling power consumption and significantly reducing device energy consumption.

[0189] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.

[0190] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.

[0191] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.

[0192] Reference Figure 6 This is a schematic diagram of the structure of the electronic device provided in an embodiment of the present invention. Figure 6 As shown, the electronic device includes: a processor, a memory, a communication interface, and a communication bus. The processor, the memory, and the communication interface communicate with each other through the communication bus. The memory is used to store at least one executable instruction, which causes the processor to perform the steps of the data synchronization method of the aforementioned embodiment.

[0193] This invention provides a non-transitory computer-readable storage medium that, when the instructions in the storage medium are executed by a program or processor of a terminal, enables the terminal to perform the steps of the data synchronization method described in the foregoing embodiments.

[0194] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.

[0195] Furthermore, the beneficial effects of using the same method will not be repeated here. For technical details not disclosed in the computer program products or computer program embodiments involved in this application, please refer to the description of the method embodiments of this application.

[0196] Other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This invention is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of the invention are indicated by the following claims.

[0197] It should be understood that the present invention is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of the invention is limited only by the appended claims.

[0198] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

[0199] The data synchronization method, server, and device provided by this invention have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this invention. Therefore, the content of this specification should not be construed as a limitation of this invention.

Claims

1. A data synchronization method, characterized in that, The method, applied to the first server in an Internet of Things (IoT) system, includes: When a target device is detected to be connected to the IoT system, the system queries a pre-set database to check if a desired attribute value exists in each entry corresponding to the target device. The desired attribute value is set according to the attribute setting request sent by the client. Each entry in the pre-set database is used to record relevant information about an attribute of a device. If a desired attribute value corresponding to the target attribute of the target device is found, the desired attribute value corresponding to the target attribute is sent to the target device so that the target device can wake up its main control module.

2. The method according to claim 1, characterized in that, The first server and the second server in the IoT system are deployed independently. The detection of a target device accessing the Internet of Things system includes: If a first message is received from the second server, it is determined that the target device has been detected to be connected to the Internet of Things system; The first message is sent after the second server establishes a long connection with the target device.

3. The method according to claim 2, characterized in that, The target device includes a communication module and a main control module. Sending the desired attribute value corresponding to the target attribute to the target device to wake up its main control module includes: The first server sends a target protocol message to the second server, so that the communication module of the target device listens to the target protocol message based on the long connection and identifies the target wake-up word in it, and then sends a wake-up signal to the main control module to wake up the main control module; the target protocol message carries the target wake-up word and the expected attribute value corresponding to the target attribute.

4. The method according to claim 1, characterized in that, After sending the desired attribute value corresponding to the target attribute to the target device, the method further includes: The system receives the updated attribute value reported by the target device and updates the entry corresponding to the target attribute of the target device in the preset database according to the updated attribute value. The updated attribute value reported by the target device is the attribute value after updating its own target attribute according to the expected attribute value corresponding to the target attribute sent by the first server.

5. The method according to claim 4, characterized in that, The step of receiving the updated attribute values ​​reported by the target device includes: The first server receives a second message from the second server. The second message is sent by the second server after receiving the updated attribute value reported by the target device, and the second message carries the updated attribute value.

6. The method according to claim 4, characterized in that, The step of updating the entry corresponding to the target attribute of the target device in the preset database according to the updated attribute value includes: In the preset database, the desired attribute value is deleted from the entry corresponding to the target attribute of the target device, and the updated attribute value is recorded as the current attribute value corresponding to the target attribute.

7. The method according to claim 1, characterized in that, The method further includes: After the first server sets the desired attribute value in the preset database according to the attribute setting request sent by the client, it records the update time in the corresponding entry; The step of querying the preset database to see if the desired attribute value exists in each entry corresponding to the target device includes: In the preset database, query whether there are any expected attribute values ​​in each entry corresponding to the target device whose update time conforms to the preset strategy.

8. The method according to claim 1, characterized in that, The step of querying the preset database to see if the desired attribute value exists in each entry corresponding to the target device includes: Using the device identifier of the target device as an index, retrieve all entries that match the device identifier from the preset database; If at least one of the retrieved entries contains a desired attribute value, then it is determined that a desired attribute value corresponding to the target attribute of the target device has been found, and the attribute corresponding to the entry containing the desired attribute value is determined to be the target attribute.

9. The method according to any one of claims 1 to 8, characterized in that, The desired attribute value includes a target value set for at least one attribute of the target device, or the desired attribute value includes a target operating mode set for the target device.

10. A data synchronization method, characterized in that, The method, applied to the device side of an Internet of Things (IoT) system, includes: The system receives the expected attribute value corresponding to the target attribute of the device from the first server in the IoT system; wherein the expected attribute value corresponding to the target attribute is sent by the first server when it detects that the device has accessed the IoT system and finds that the expected attribute value exists in the corresponding entry of the device in the preset database; the expected attribute value is set by the first server according to the attribute setting request sent by the client; each entry in the preset database is used to record relevant information of an attribute of a device; The main control module on the device is woken up based on the expected attribute value corresponding to the target attribute.

11. The method according to claim 10, characterized in that, The first server and the second server in the IoT system are deployed independently; the method further includes: The device establishes a long connection with the second server, so that the second server sends a first message to the first server after the long connection is established; The step of receiving the expected attribute value corresponding to the target attribute of the device sent by the first server in the Internet of Things system includes: The long connection is used to listen for the expected attribute value corresponding to the target attribute of the device sent by the first server to the second server.

12. The method according to claim 11, characterized in that, The device also includes a communication module, which is used to establish a long connection with the second server. The method further includes: After the communication module listens to the target protocol message sent to the second server based on the long connection and identifies the target wake-up word in it, it sends a wake-up signal to the main control module to wake up the main control module; the target protocol message carries the target wake-up word and the expected attribute value corresponding to the target attribute.

13. A first server, characterized in that, The first server, applied to an Internet of Things (IoT) system, includes: The sensing and retrieval module is used to query a preset database to check whether a desired attribute value exists in each entry corresponding to the target device when the target device is detected to be connected to the Internet of Things system; the desired attribute value is set according to the attribute setting request sent by the client; each entry in the preset database is used to record relevant information of an attribute of a device; The data delivery module is used to send the expected attribute value corresponding to the target attribute to the target device if the expected attribute value corresponding to the target attribute is found in the query, so as to wake up the main control module of the target device.

14. A device terminal, characterized in that, The device, used in Internet of Things (IoT) systems, includes: The data receiving module is used to receive the expected attribute value corresponding to the target attribute of the device sent by the first server in the IoT system; wherein, the expected attribute value corresponding to the target attribute is sent by the first server when it detects that the device has accessed the IoT system and finds that the expected attribute value exists in the corresponding entry of the device in the preset database; the expected attribute value is set by the first server according to the attribute setting request sent by the client; each entry in the preset database is used to record relevant information of an attribute of a device; The main control wake-up module is used to wake up the main control module on the device side according to the expected attribute value corresponding to the target attribute.