Data synchronization method, smart home system, terminal equipment and storage medium

By classifying and storing concurrent data synchronization methods according to data reading and writing frequency in the smart home system, the bottleneck of concurrent data operations between local servers and cloud servers is solved, efficient and secure data synchronization is achieved, and the normal operation of the system and user experience are ensured.

CN120639784APending Publication Date: 2025-09-12ULTIMATE IOT (HENAN) TECHNOLOGY LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510691673.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-27
Publication Date
2025-09-12

AI Technical Summary

Technical Problem

In smart home systems, there is a bottleneck in data concurrency operations between local servers and cloud servers, which leads to database corruption and data asynchrony, affecting the normal operation of system functions.

Method used

By classifying smart home data according to its reading and writing frequency and storing it in different databases, and sending synchronization signals to the cloud server when the data is updated, data is uploaded using confirmation signals and agreed data interfaces, and single, incremental and full transmission methods are adopted to ensure the accuracy and efficiency of data synchronization.

Benefits of technology

It achieves efficient and secure synchronization of data between local servers and cloud servers, ensures the normal operation of the smart home system and user experience, and avoids database damage and data confusion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120639784A_ABST
    Figure CN120639784A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of smart home, and discloses a data synchronization method, a smart home system, terminal equipment and a storage medium, and the data synchronization method comprises the steps: classifying and storing smart home data in a database according to the read-write frequency of the smart home data; sending a synchronization signal to a cloud server according to the type of the smart home data under the condition that the smart home data is updated; under the condition that a confirmation signal returned by the cloud server is received, the updated smart home data are read from the database; and uploading the read smart home data to a cloud server through an agreed data interface, so that the cloud server receives the updated smart home data. According to the invention, high-efficiency and safe data read-write operation is realized, the problem that the data of the local server and the data of the cloud server are asynchronous is solved, and normal operation of the smart home system is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of smart home technology, and in particular to a data synchronization method, a smart home system, a terminal device, and a storage medium. Background Art

[0002] In smart home systems, local servers need to store and access data, and data needs to be frequently exchanged between local and cloud servers. Currently, local servers face a bottleneck in concurrent operations when reading and writing data from the database. Forcing simultaneous reading and writing can lead to database corruption or data corruption. Data asynchrony between local and cloud servers can cause inaccurate data on the cloud server. When the cloud uses this inaccurate data to process business, calculations fail to meet expectations, leading to functional anomalies in various scenarios. Summary of the Invention

[0003] In view of this, the embodiments of the present application provide a data synchronization method, a smart home system, a terminal device and a storage medium, which can effectively solve the problem of database corruption that is prone to occur when the local server reads and writes data, and the problem of data being out of synchronization with the cloud server.

[0004] In a first aspect, an embodiment of the present application provides a data synchronization method, applied to a local server, the method comprising:

[0005] Classify and store the smart home data in a database according to the reading and writing frequency of the smart home data;

[0006] When the smart home data is updated, sending a synchronization signal to a cloud server according to the type of the smart home data;

[0007] Upon receiving a confirmation signal returned by the cloud server, reading the updated smart home data from the database;

[0008] The read smart home data is uploaded to the cloud server through the agreed data interface, so that the cloud server receives the updated smart home data.

[0009] In a first possible embodiment of the first aspect, the data synchronization method further includes:

[0010] receiving a request instruction from the cloud server, and uploading the smart home data to the cloud server according to the request instruction;

[0011] Under the condition of abnormal data synchronization with the cloud server, the smart home data is re-uploaded to the cloud server according to the preset data transmission rules until the cloud server receives the smart home data.

[0012] In a second possible embodiment of the first aspect, re-uploading the smart home data to the cloud server according to a preset data transmission rule includes:

[0013] When not connected to the cloud server, record the synchronization signals that have not been reported and delete the repeated synchronization signals;

[0014] Under the condition of being connected to the cloud server, sending the unreported synchronization signal to the cloud server to upload the updated smart home data to the cloud server;

[0015] receiving a retry instruction from the cloud server under the condition that the cloud server does not receive the smart home data;

[0016] Upon receiving the retry instruction, the smart home data is uploaded to the cloud server at preset intervals.

[0017] In a third possible embodiment of the first aspect, classifying and storing the smart home data in a database according to a reading and writing frequency of the smart home data includes:

[0018] storing the smart home data with high reading frequency in a first database;

[0019] The smart home data with high writing frequency is stored in the second database.

[0020] In a fourth possible embodiment of the first aspect, the local server includes a plurality of first databases and a plurality of second databases, and the method further includes:

[0021] Read the smart home data in each of the first databases through a query statement;

[0022] Based on the additional database mechanism, the smart home data in multiple first databases are read simultaneously through the query statement.

[0023] In a fifth possible embodiment of the first aspect, the smart home data includes multiple types, and different types of smart home data correspond to unique synchronization signals.

[0024] In a sixth possible embodiment of the first aspect, different types of smart home data correspond to uniquely agreed data interfaces, and uploading the read smart home data to the cloud server through the agreed data interface includes:

[0025] According to the magnitude of the updated smart home data, the smart home data is uploaded to the cloud server in different transmission modes, wherein the transmission modes include single data transmission, incremental data transmission and full data transmission.

[0026] In a second aspect, an embodiment of the present application provides a smart home system, comprising: a local server and a cloud server;

[0027] The local server is used to classify and store the smart home data in a database according to the reading and writing frequency of the smart home data;

[0028] The local server is further configured to send a synchronization signal to the cloud server according to the type of the smart home data when the smart home data is updated;

[0029] The cloud server is used to receive the synchronization signal and return a confirmation signal to the local server;

[0030] The local server is further configured to read the updated smart home data from the database upon receiving a confirmation signal returned by the cloud server;

[0031] The local server is further configured to upload the read smart home data to the cloud server via an agreed data interface;

[0032] The cloud server is also used to receive updated smart home data.

[0033] In a third aspect, an embodiment of the present application provides a terminal device, which includes a processor and a memory, the memory storing a computer program, and the processor being configured to execute the computer program to implement the above-mentioned data synchronization method.

[0034] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium storing a computer program, which implements the above-mentioned data synchronization method when executed on a processor.

[0035] The embodiments of the present application have the following beneficial effects:

[0036] A data synchronization method according to an embodiment of the present application is applied to a local server, and the data synchronization method includes: classifying and storing smart home data in a database according to the read and write frequency of the smart home data; sending a synchronization signal to a cloud server according to the type of smart home data when the smart home data is updated; reading the updated smart home data from the database when a confirmation signal is received from the cloud server; uploading the read smart home data to the cloud server through an agreed data interface, so that the cloud server receives the updated smart home data. Based on the above scheme, the data synchronization method stores the smart home data separately in different databases according to the read and write frequency, thereby achieving efficient and secure data reading and writing operations. The data synchronization method can solve the problem of data asynchrony between the local server and the cloud server, thereby ensuring the normal operation of all functions of the smart home system. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can be obtained based on these drawings without creative work.

[0038] Figure 1 A schematic structural diagram of a smart home system according to an embodiment of the present application is shown;

[0039] Figure 2 A first flow chart of the data synchronization method according to an embodiment of the present application is shown;

[0040] Figure 3 A second flow chart of the data synchronization method according to an embodiment of the present application is shown.

[0041] Description of main component symbols:

[0042] 100-Smart home system; 110-Local server; 120-Cloud server; 130-Smart home devices. DETAILED DESCRIPTION

[0043] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments.

[0044] The components of the embodiments of the present application generally described and illustrated in the drawings herein may be arranged and designed in a variety of different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the claimed application, but rather merely represents selected embodiments of the present application. All other embodiments obtained by those skilled in the art based on the embodiments of the present application without creative effort are within the scope of protection of the present application.

[0045] Hereinafter, the terms "including", "having" and their cognates used in various embodiments of the present application are intended only to indicate specific features, numbers, steps, operations, elements, components or combinations of the aforementioned items, and should not be understood as excluding the existence of one or more other features, numbers, steps, operations, elements, components or combinations of the aforementioned items or adding the possibility of one or more features, numbers, steps, operations, elements, components or combinations of the aforementioned items. In addition, the terms "first", "second", "third" and the like are only used to distinguish descriptions and should not be understood as indicating or implying relative importance.

[0046] Unless otherwise defined, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by those skilled in the art to which the various embodiments of the present application belong. The terms (such as those defined in generally used dictionaries) will be interpreted as having the same meaning as in the context of the relevant technical field and will not be interpreted as having an idealized meaning or an overly formal meaning unless clearly defined in the various embodiments of the present application.

[0047] The following describes some embodiments of the present application in detail with reference to the accompanying drawings. In the absence of conflict, the following embodiments and features in the embodiments may be combined with each other.

[0048] In smart home systems, local servers, like cloud servers, have the need to read and write data information, and they need to be able to perform operations such as addition, deletion, query, and modification conveniently and quickly within the local server. However, local servers have concurrent reading and writing issues in concurrent operations. For example, for the same database at the same time, you cannot write to the database while reading from it, and you cannot read from the database while writing to it. In other words, concurrent reading is supported but concurrent reading and writing are not supported at the same time. If concurrent reading and writing are forced, the database will be damaged or the data will be confused. For local servers used in the smart home industry, in order to speed up data processing and improve the user experience, it is very urgent to solve the concurrent reading and writing problems of the local database.

[0049] On the other hand, data asynchrony between the local server (such as the router or gateway at home) and the cloud server will cause many problems: the user terminal may obtain incorrect data from the cloud server and display it; some scenarios controlled by the cloud server (such as timed lighting and voice-controlled devices) may fail; when controlling smart home devices through a cloud voice assistant (such as a smart speaker), the corresponding smart home device may not be found.

[0050] Furthermore, in order to improve the various defects in the above-mentioned existing technologies, the present application provides a data synchronization method, a smart home system, a terminal device and a storage medium. By allocating different types of data to different databases, the read-write conflict problems existing in traditional single databases can be avoided, and the local server and the cloud server can ensure that the data can be accurately synchronized whether there is an Internet connection or not, thereby better meeting the real-time, reliability and performance requirements of smart home applications.

[0051] First, the embodiment of the present application provides a smart home system 100. Please refer to Figure 1 , which is a schematic diagram of the structure of a smart home system 100 provided in an embodiment of the present application. The smart home system 100 may include: a local server 110 and a cloud server 120. The local server 110 and the cloud server 120 may be connected under the same network to achieve data transmission and interaction.

[0052] In this embodiment, the local server 110 is used to classify and store the smart home data in the database and the database according to the reading and writing frequency of the smart home data; the local server 110 is also used to send a synchronization signal to the cloud server 120 according to the type of smart home data when the smart home data is updated; the cloud server 120 is used to receive the synchronization signal and return a confirmation signal to the local server 110; the local server 110 is also used to read the updated smart home data from the database when receiving the confirmation signal returned by the cloud server 120; the local server 110 is also used to upload the read smart home data to the cloud server 120 through the agreed data interface; the cloud server 120 is also used to receive the updated smart home data.

[0053] In one embodiment, the smart home system 100 also includes a plurality of smart home devices 130, which may include but are not limited to smart light bulbs, smart sockets, smart door locks, smart cameras, thermostats, etc. The local server 110 is used to connect the smart home devices 130 to the cloud server 120, and can independently run some functions without a network. The cloud server 120 is used to conduct in-depth mining based on smart home data, optimize user experience, and predict possible needs. Among them, smart home data includes data on multiple aspects such as the status of smart home devices 130, user behavior, and environmental information, for example, the status of smart light bulbs (brightness, color temperature, switch), user scene settings, indoor temperature changes, etc.

[0054] In this embodiment, smart home devices 130 upload real-time smart home data to a local server 110 via a local area network and receive control commands from the local server 110. When network connectivity is available, the local server 110 synchronizes important aggregated smart home data with the cloud server 120 and also retrieves new configuration information or software updates from the cloud. User terminals can interact directly with the local server 110 through local applications or remotely control the system through web or mobile applications provided by the cloud server 120.

[0055] For ease of understanding, the following examples of this application will be described in Figure 1 Taking the smart home system 100 shown as an example, the data synchronization method provided in the embodiment of the present application is explained in conjunction with Figure 1.

[0056] Please refer to Figure 2 , Figure 2 A flow chart of a data synchronization method provided by an embodiment of the present application is shown. The data synchronization method can be applied to the local server 110 described above, and the data synchronization method may include the following steps:

[0057] S210 , classifying and storing the smart home data in a database according to the reading and writing frequency of the smart home data.

[0058] For example, in the smart home system 100, since the local server 110 generally does not require strong performance, a lightweight, configuration-free database such as SQLite is often used to meet local data storage needs. Although lightweight, configuration-free databases can meet normal usage, they have concurrent read and write issues.

[0059] In one embodiment, the present application categorizes smart home data based on its read and write frequency. This smart home data includes data with a high read frequency, typically information frequently queried by users or frequently read by devices, such as historical records and user preferences. This smart home data also includes data with a high write frequency, typically information that requires frequent updates, such as real-time sensor data, device status change records, and log files. The present application stores smart home data with a high read frequency in a first database and stores smart home data with a high write frequency in a second database.

[0060] It can be understood that this application classifies and divides the smart home data to be stored according to the reading and writing frequency based on the actual scenarios of smart home use, realizes the separation of data and library, solves the concurrency problem, maximizes the data operation speed and user experience, and improves the database security and overall performance.

[0061] In one embodiment, the local server 110 includes multiple first databases and multiple second databases. The data synchronization method further includes: reading smart home data from each first database using a query statement; and simultaneously reading smart home data from multiple first databases using a query statement based on an attach database mechanism. In this embodiment, when data needs to be read from multiple first databases simultaneously, this can be achieved using the database system's attach database function. The attach database mechanism allows multiple databases to be "mounted" into the same query environment, enabling cross-database operations with a single query statement. Queries are used to access data and query, update, and manage databases.

[0062] In one embodiment, the query statement may be a SQL (Structured Query Language) query statement. The first database stores frequently accessed smart home data. Using a standard SQL query statement, data in a single first database can be efficiently accessed. Under the additional database mechanism, SQL queries can be used to simultaneously access data from multiple first databases.

[0063] It can be understood that the present application stores data with a high read frequency in the first database, and concurrent operations on smart home data can be achieved within the local server 110 because there is no problem of blocking caused by concurrent locks between different databases. The above method can also ensure the safe operation of the database, greatly reducing database damage and data confusion. Moreover, due to the characteristics of lightweight databases, as the database becomes larger, the database reading and writing speed will slow down. Due to the partitioning of the database, the size of the database is reduced, and the database performance is once again brought into play. At the same time, when it is necessary to operate multiple databases at the same time, the function of the attached database can be used to use a single query statement to read data from multiple databases at the same time, further speeding up the process.

[0064] S220 , when the smart home data is updated, a synchronization signal is sent to the cloud server 120 according to the type of the smart home data.

[0065] In one embodiment, smart home data includes multiple types, which can be divided into device data, scene data and room data. Among them, device data is the status and attributes of each smart home device 130, including the device's unique identifier (such as ID), current status (switch, working mode, etc.), connection status (online / offline) and energy consumption information. Scene data describes the linkage relationship between multiple devices, which is user-defined or system-preset, including scene names (such as "away mode", "sleep mode"), trigger conditions (such as time, event), participating devices and their corresponding actions. Room data classifies devices and scenes into different rooms based on physical space, including room names (such as "living room", "bedroom"), a list of devices in the room and corresponding scene settings.

[0066] In another embodiment, each type of smart home data corresponds to a unique synchronization signal. In this embodiment, the synchronization signal is used to notify the cloud server 120 that a certain type of smart home data has changed and needs to be updated. To ensure the accuracy and reliability of the data synchronization process, each synchronization signal is unique within the entire smart home system 100.

[0067] In one embodiment, each signal has a unique ID or code to distinguish different data categories. Local server 110 monitors the status of various smart home data in real time and generates a corresponding synchronization signal when it detects a change in a certain data type. Local server 110 transmits the generated synchronization signal to cloud server 120, notifying it of the corresponding data change.

[0068] As can be appreciated, local server 110's classification of smart home data enables efficient management and data synchronization within smart home system 100. Synchronization signals are triggered only when smart home data changes. Through a unique design, each synchronization signal is directed to a specific data category, avoiding data update errors caused by signal confusion and ensuring consistency between cloud and local data. In a complex smart home system 100, multiple smart home devices 130 may simultaneously generate data changes. Synchronization signals can notify the cloud one by one, ensuring that all changes are correctly processed.

[0069] S230 , upon receiving a confirmation signal returned by the cloud server 120 , reading updated smart home data from the database.

[0070] In this embodiment, during the data synchronization process of the smart home system 100, the confirmation signal is a type of feedback information returned by the cloud server 120 to the local server 110. It is used to confirm that the cloud has successfully received the synchronization signal and instruct the local server 110 to read the updated smart home data from the database and send the read data to the cloud server 120 through the agreed data interface. In this application, the confirmation signal allows the local server 110 to determine whether the cloud has correctly received the updated data, thereby avoiding data loss due to network problems.

[0071] S240, uploading the read smart home data to the cloud server 120 through the agreed data interface, so that the cloud server 120 receives the updated smart home data.

[0072] In this embodiment, different types of smart home data correspond to unique agreed data interfaces. The local server 110 sets an agreed data interface for sending each type of smart home data according to the type of smart home data. The local server 110 is used to send the corresponding type of smart home data through the agreed data interface, so as to efficiently and accurately send different types of smart home data through the agreed data interface.

[0073] In one embodiment, the present application uploads the smart home data to the cloud server 120 in different transmission modes according to the magnitude of the updated smart home data, wherein the transmission modes include single data transmission, incremental data transmission and full data transmission.

[0074] In this embodiment, when a device or a specific data item changes, the smart home data can be uploaded to the cloud via a single data transmission. Single data transmission means that in the smart home system 100, when a data item of a device (such as the status or parameters of a device) changes, only the single data item is transmitted to the cloud server 120. When part of a certain type of smart home data changes, part of the smart home data can be transmitted to the cloud via incremental data transmission. Incremental data transmission means that when part of the data in a certain type of data changes, only the changed part is transmitted to the cloud. When a certain type of smart home data needs to be completely refreshed or initialized, the smart home data can be transmitted to the cloud via full data transmission. Full data transmission means that the complete content of a certain type of smart home data is transmitted to the cloud.

[0075] It can be understood that this application can obtain data in single, incremental, full and other ways according to the data volume, which can significantly improve the data synchronization efficiency between the local server 110 and the cloud server 120, allowing the cloud server 120 to obtain the required data at the fastest speed.

[0076] In one embodiment, the local server 110 receives a request instruction from the cloud server 120 to upload the smart home data to the cloud server 120 according to the request instruction; in this embodiment, the cloud server 120 can actively obtain the required smart home data from the local server 110 by sending a request instruction to the local server 110.

[0077] In another embodiment, under the condition of abnormal data synchronization with the cloud server 120, the local server 110 re-uploads the smart home data to the cloud server 120 according to a preset data transmission rule until the cloud server 120 receives the smart home data.

[0078] In one embodiment, if Figure 3 As shown, this application uses preset data transmission rules to handle data synchronization exceptions, specifically including the following steps:

[0079] S241, under the condition of not being connected to the cloud server 120, record the synchronization signals that have not been reported and delete the repeated synchronization signals.

[0080] In this embodiment, in the smart home system 100, the network connection between the local server 110 and the cloud server 120 may become unstable due to various reasons (such as bandwidth limitations, network outages, etc.). In such cases, the local server 110 is capable of operating independently and recording changes in smart home data. When a certain type of smart home data changes, a corresponding synchronization signal is generated. The system also automatically checks whether a synchronization signal with the same identifier already exists in the cache. If so, the duplicate synchronization signal is deleted to reduce redundancy.

[0081] S242 , under the condition of being connected to the cloud server 120 , sending the unreported synchronization signal to the cloud server 120 to upload the updated smart home data to the cloud server 120 .

[0082] In this embodiment, if the local server 110 detects that the network is restored, the data synchronization process is triggered, and all unreported synchronization signals in the local cache are sent to the cloud server 120, so that the server receives updated smart home data.

[0083] S243 , receiving a retry instruction from the cloud server 120 under the condition that the cloud server 120 does not receive the smart home data.

[0084] In one embodiment, after receiving the synchronization signal, if the cloud server 120 fails to obtain data from the local server 110 due to unknown reasons, for example, the cloud server does not receive the synchronization signal, data synchronization with the local server 110 may fail. When the cloud server 120 finds that a certain segment of smart home data has not been successfully received, it generates a retry instruction containing a missing data identifier and sends it to the local server 110.

[0085] S244, upon receiving the retry instruction, uploading the smart home data to the cloud server 120 at preset intervals.

[0086] In one embodiment, after receiving the retry instruction, local server 110 retrying to upload the smart home data to cloud server 120 at predetermined intervals. By setting a fixed retry interval, the possibility of multiple failures within a short period of time is reduced. It is understood that if the network is unstable and cloud server 120 does not have an urgent need for the data, local server 110 can retransmit the data at a fixed interval.

[0087] The present application also provides a terminal device. Exemplarily, the terminal device may be a local server 110. The terminal device includes a processor and a memory, wherein the memory stores a computer program, and the processor runs the computer program, thereby enabling the terminal device to execute the above-mentioned data synchronization method.

[0088] Among them, the processor can be an integrated circuit chip with signal processing capabilities. The processor can be a general-purpose processor, including a central processing unit (CPU), a graphics processing unit (GPU) and a network processor (NP), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or at least one of other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc., which can implement or execute the disclosed methods, steps and logic block diagrams in the embodiments of the present application.

[0089] The memory may be, but is not limited to, a random access memory (RAM), a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), etc. The memory is used to store a computer program, and the processor may execute the computer program accordingly after receiving an execution instruction.

[0090] The present application also provides a computer-readable storage medium for storing the computer program used in the local server. For example, the computer-readable storage medium may include, but is not limited to, various media capable of storing program code, such as a USB flash drive, a mobile hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0091] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and structure diagrams in the accompanying drawings show the possible architectures, functions and operations of the devices, methods and computer program products according to the multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of the code, and the module, program segment or a part of the code contains one or more executable instructions for implementing the specified logical functions. It should also be noted that in an alternative implementation, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the structure diagram and / or flowchart, and the combination of boxes in the structure diagram and / or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or action, or can be implemented using a combination of dedicated hardware and computer instructions.

[0092] In addition, the functional modules or units in the various embodiments of the present application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.

[0093] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a computer device (which can be a smart phone, personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application.

[0094] The above is only a specific implementation method of the present application, but the scope of protection of the present application is not limited thereto. Any technician familiar with this technical field can easily think of changes or replacements within the technical scope disclosed in this application, which should be covered by the scope of protection of the present application.

Claims

1. A data synchronization method, characterized in that: Applied to a local server, the method includes: Classify and store the smart home data in a database according to the reading and writing frequency of the smart home data; When the smart home data is updated, sending a synchronization signal to a cloud server according to the type of the smart home data; Upon receiving a confirmation signal returned by the cloud server, reading the updated smart home data from the database; The read smart home data is uploaded to the cloud server through the agreed data interface, so that the cloud server receives the updated smart home data.

2. The data synchronization method according to claim 1, characterized in that: Also includes: receiving a request instruction from the cloud server, and uploading the smart home data to the cloud server according to the request instruction; Under the condition of abnormal data synchronization with the cloud server, the smart home data is re-uploaded to the cloud server according to the preset data transmission rules until the cloud server receives the smart home data.

3. The data synchronization method according to claim 2, wherein: The step of re-uploading the smart home data to the cloud server according to a preset data transmission rule includes: When not connected to the cloud server, record the synchronization signals that have not been reported and delete the repeated synchronization signals; Under the condition of being connected to the cloud server, sending the unreported synchronization signal to the cloud server to upload the updated smart home data to the cloud server; receiving a retry instruction from the cloud server under the condition that the cloud server does not receive the smart home data; Upon receiving the retry instruction, the smart home data is uploaded to the cloud server at preset intervals.

4. The data synchronization method according to claim 1, wherein: The step of classifying and storing the smart home data in a database according to the reading and writing frequency of the smart home data includes: storing the smart home data with high reading frequency in a first database; The smart home data with high writing frequency is stored in the second database.

5. The data synchronization method according to claim 4, characterized in that: The local server includes a plurality of the first databases and a plurality of the second databases, and the method further includes: Read the smart home data in each of the first databases through a query statement; Based on the additional database mechanism, the smart home data in multiple first databases are read simultaneously through the query statement.

6. The data synchronization method according to claim 1, characterized in that: The smart home data includes multiple types, and different types of smart home data correspond to unique synchronization signals.

7. The data synchronization method according to claim 1, characterized in that: Different types of smart home data correspond to unique agreed data interfaces, and uploading the read smart home data to the cloud server through the agreed data interfaces includes: According to the magnitude of the updated smart home data, the smart home data is uploaded to the cloud server in different transmission modes, wherein the transmission modes include single data transmission, incremental data transmission and full data transmission.

8. A smart home system, characterized in that: include: Local servers and cloud servers; The local server is used to classify and store the smart home data in a database according to the reading and writing frequency of the smart home data; The local server is further configured to send a synchronization signal to the cloud server according to the type of the smart home data when the smart home data is updated; The cloud server is used to receive the synchronization signal and return a confirmation signal to the local server; The local server is further configured to read the updated smart home data from the database upon receiving a confirmation signal returned by the cloud server; The local server is further configured to upload the read smart home data to the cloud server via an agreed data interface; The cloud server is also used to receive updated smart home data.

9. A terminal device, characterized in that: The terminal device further includes a processor and a memory, wherein the memory stores a computer program, and the processor is configured to execute the computer program to implement the data synchronization method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that The device stores a computer program, which, when executed on a processor, implements the data synchronization method according to any one of claims 1 to 7.