Data synchronization method, electronic equipment and computer readable storage medium
By selecting the local device with the best status within the local area network as the central node, synchronizing and transforming local scene data, the problem of high network dependence is solved, and device linkage effect is achieved in weak network environment.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HANGZHOU HUACHENG SOFTWARE TECH CO LTD
- Filing Date
- 2026-02-27
- Publication Date
- 2026-05-01
AI Technical Summary
Existing technologies rely on cloud devices to achieve smart device linkage, resulting in high network dependence and linkage failure in environments with weak or no network.
By synchronizing local scene data to the target device within the local area network, using the local device as the central node for data processing and transmission, and selecting the device with the best status for data conversion and synchronization, the linkage of local devices is achieved.
Improve the success rate and stability of device linkage in weak network environments, realize device linkage within a local area network, and reduce dependence on Internet connection.
Smart Images

Figure CN121967438A_ABST
Abstract
Description
Data synchronization methods, electronic devices and computer-readable storage media Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to a data synchronization method, an electronic device, and a computer-readable storage medium. Background Technology
[0002] With the development of smart homes, there are more and more scenarios where smart devices interact with each other. Currently, most interaction scenarios involve a smart device detecting a trigger condition, reporting the trigger condition to a cloud device, which then generates an action based on the trigger condition and sends the action to the corresponding smart device to complete the interaction.
[0003] However, solutions relying on cloud-based device collaboration will completely fail when the network is weak or offline. Therefore, cloud-based device collaboration solutions require a stable internet connection, making them highly dependent on the internet and difficult to implement in environments with weak or offline networks. Summary of the Invention
[0004] The main technical problem addressed by this application is to provide a data synchronization method, an electronic device, and a computer-readable storage medium that can realize local scene data synchronization within a local area network by synchronizing local scene data to a target device.
[0005] To address the aforementioned technical problems, this application provides a data synchronization method. This method is applied to a cloud device, which is communicatively connected to various local devices located on the same local area network. The method includes: in response to receiving current cloud-based scene data, acquiring status information of each local device; determining a target device from among the local devices based on the status information; performing local scene data conversion processing on the current cloud-based scene data according to the target device to obtain local scene data; and synchronizing the local scene data to the target device so that the target device executes the local scene data.
[0006] To address the aforementioned technical problems, this application provides a data execution method applied to a target device located on the same local area network as other local devices. The method includes: responding to a received trigger command; selecting an execution device from the target device and the other local devices based on the trigger command; the target device including local scene data, the local scene data being obtained by a cloud device upon receiving current cloud scene data and acquiring status information of each local device; determining the target device from the local devices based on the status information of each local device; performing local scene data conversion processing on the current cloud scene data using the target device to obtain the local scene data; synchronizing the local scene data to the target device; and sending the data to be executed corresponding to the trigger command to the execution device for execution processing.
[0007] To solve the above-mentioned technical problems, another technical solution adopted in this application is: to provide an electronic device, including a memory and a processor, wherein the memory stores program instructions, and the processor retrieves the program instructions from the memory to execute the above-mentioned data synchronization method.
[0008] To solve the above-mentioned technical problems, another technical solution adopted in this application is to provide a computer-readable storage medium including program data, which is used to implement the above-mentioned data synchronization method when executed by a processor.
[0009] The data synchronization method of this application responds to receiving current cloud-based scene data and obtaining the status information of each local device; it then determines the target device from among the local devices based on the status information of each local device; it performs local scene data conversion processing on the current cloud-based scene data according to the target device to obtain local scene data; and it synchronizes the local scene data to the target device so that the target device can execute the local scene data. The above scheme, by selecting the target device based on the status information of each local device, can choose the local device with the best current status as the target device, improving the success rate of scene delivery; and by synchronizing the local scene data to the target device, it supports the linkage of each local device within a local area network, improving the device linkage effect in weak network environments. Attached Figure Description
[0010] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. Among them: Figure 1 is a flowchart illustrating an exemplary embodiment of the data synchronization method shown in this application; Figure 2 is a flowchart illustrating an exemplary embodiment of the data synchronization method and data execution method shown in this application; Figure 3 is a structural diagram illustrating an exemplary embodiment of the data synchronization device shown in this application; Figure 4 is a structural diagram illustrating an exemplary embodiment of the data execution device shown in this application; Figure 5 is a structural diagram illustrating an embodiment of the electronic device provided in this application; Figure 6 is a structural diagram illustrating an embodiment of the computer-readable storage medium provided in this application. Detailed Implementation
[0011] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. It is understood that the specific embodiments described herein are only for explaining this application and not for limiting it. Furthermore, it should be noted that, for ease of description, only the parts related to this application are shown in the accompanying drawings, not all structures. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.
[0012] First, it's important to note that interconnected scenarios between multiple devices are becoming a trend in smart homes. Common device interconnection relies on a cloud-based device as a central hub for receiving, processing, and sending information. However, each local device needs to connect to the cloud device via the internet, which places high demands on network quality.
[0013] Based on this, embodiments of this application propose a data synchronization method, an electronic device, and a computer-readable storage medium. A target device is selected from local devices, and local scene data is synchronized to the target device to achieve local linkage through the target device. For details, please refer to Figure 1, which is a flowchart illustrating an exemplary embodiment of the data synchronization method shown in this application.
[0014] The execution entity of the data synchronization method can be a terminal device, a server, or other processing device. The terminal device can be a user equipment (UE), computer, mobile device, user terminal, terminal, cellular phone, cordless phone, personal digital assistant (PDA), handheld device, computing device, in-vehicle device, wearable device, etc. The execution entity of the data synchronization method can also be a data synchronization device, which can be a cloud device. The cloud device communicates with each local device, and each local device is located on the same local area network. In some possible implementations, this data synchronization method can be implemented by the processor calling computer-readable instructions stored in memory.
[0015] Specifically, the data synchronization method in this embodiment includes the following steps: S110: In response to receiving the current cloud scene data, obtain the status information of each local device.
[0016] The current cloud-based scene data refers to the linkage logic stored in cloud devices. It refers to the tasks of receiving, processing, and forwarding data, centered on the cloud device. As an example, the workflow of the current cloud-based scene data typically involves local device A sensing data and sending it to the cloud device via the internet. The cloud device then analyzes the data, generates execution instructions, and sends these instructions to local device B via the internet for execution. For example, users can pre-set the current cloud-based scene data on the client side, defining how the scene works. The current cloud-based scene data generally includes trigger conditions, execution actions, constraints, and other information. Trigger conditions refer to the conditions that initiate the scene, such as a network camera detecting target movement; execution actions refer to the actions to be performed upon detecting the trigger conditions, such as sending an alarm notification to the client; and preset conditions refer to actions that are only executed under corresponding additional conditions, such as execution only on weekdays.
[0017] A local device refers to a device located on the same local area network (LAN). For example, devices connected to the same LAN in a home environment are considered local devices in this embodiment. The number of local devices can be one or more. Local devices may include, but are not limited to, sensing devices such as temperature and humidity sensors and smoke sensors; execution devices such as smart switches and smart curtains; and central control and interaction devices such as smart speakers.
[0018] Status information refers to the ability of a local device to communicate with other devices. For example, the status information of a local device can be determined based on its device capabilities and network status. Alternatively, the status information can be determined based on its device capabilities, network status, and historical online duration.
[0019] After receiving the current cloud scene data, the cloud device can obtain the status information of each local device, which can be the linkage rules created by the user through the client.
[0020] S120: Determine the target device from each local device based on the status information of each local device.
[0021] The target device is a selected local device that receives local scene data. For example, the local device with the best status information can be selected as the target device. Alternatively, the top N local devices ranked from best to worst status information can be selected as the target devices. In some embodiments, the status information of the local device includes device capabilities, and any local device selected from those whose device capabilities meet the requirements is selected as the target device. In other embodiments, the status information of the local device includes device capabilities and network status, and the target device is selected from among the local devices based on their device capabilities and network status. In other embodiments, the status information of the local device includes device capabilities and historical online duration, and the target device is selected from among the local devices based on their device capabilities and historical online duration. In other embodiments, the status information of the local device includes device capabilities, network status, and historical online duration, and the target device is selected from among the local devices based on their device capabilities, network status, and historical online duration. In other embodiments, the status information of the local device includes network status and historical online duration, and the target device is selected from among the local devices based on their network status and historical online duration.
[0022] S130: Based on the target device, perform local scene data conversion processing on the current cloud scene data to obtain local scene data.
[0023] Local scenario data refers to the linkage logic stored on a local device. It refers to the data reception, processing, and forwarding tasks performed by the local device, with the local device acting as the central hub. As an example, the workflow for local scenario data typically involves local device A sensing data and sending it to the target device via the local area network (LAN). The target device then processes the data, generates an execution command, and sends the command to local device B for execution via the LAN.
[0024] For example, the current cloud scene data can be transformed to obtain local scene data, converting the current cloud scene data structure into a data structure supported by the target device. The data transformation process may include the following steps: If the execution actions of the cloud device in each current cloud scene data meet the device execution requirements, then the execution actions of the cloud device are replaced with the execution actions of the target device to obtain local scene data; if the execution actions of the cloud device in each current cloud scene data do not meet the device execution requirements, then the cloud scene is preserved, and the cloud device executes the current cloud scene data. The current cloud scene data includes events and attributes. Attributes refer to the state changes of each device, and events are divided into local device events and cloud device events. Cloud device events refer to the events generated by the cloud device after the local device events are reported to the cloud device and then analyzed and processed by the cloud device. For example, when creating current cloud scene data, the trigger condition could be "target appears," and the action could be "alarm." The corresponding local device events are detecting a target entering a preset area, a target falling, or detecting a change in the screen, while the cloud device event is "issuing a screen change alert." In this case, the cloud device event needs to be converted to trigger whenever any of the three local device events occurs. After conversion, it is still a single-trigger scenario, where the target device directly receives the corresponding local device event and triggers the corresponding action. In a multi-trigger scenario, if none of the trigger conditions are event types, when the target device receives a local device event, it waits for messages from other local device events to trigger the action. As an example, suppose the current cloud scene data includes the linkage triggering of attribute P(a), attribute P(b), local device event E(a), local device event E(b), and cloud device event C(e). First, the cloud device event C(e) is transformed. For example, the cloud device event C(e) can be transformed into a combination of E(c)||E(d), which means that any receipt of local device event E(c) and local device event E(d) will trigger the action. The local scene data after the current cloud scene data is transformed can be seen in Table 1:
[0025] Table 1S140: Synchronize local scene data to the target device so that the target device can execute the local scene data.
[0026] After acquiring the target device and converting the current cloud scene data into local scene data, the cloud device synchronizes the local scene data to the target device, enabling the target device to assume the function of a central node and execute the local scene data.
[0027] As can be seen, the data synchronization method in this application embodiment responds to receiving current cloud scene data and obtaining the status information of each local device; determines the target device from among the local devices based on the status information of each local device; performs local scene data conversion processing on the current cloud scene data according to the target device to obtain local scene data; and synchronizes the local scene data to the target device so that the target device can execute the local scene data. The above scheme, by selecting the target device based on the status information of each local device, can select the local device with the best current status as the target device, improving the success rate of scene delivery; and by synchronizing the local scene data to the target device, it supports the linkage of each local device within the local area network, improving the device linkage effect in weak network environments.
[0028] In some embodiments, the status information of the local devices includes network status and / or historical online duration. Step S120, which determines the target device from among the local devices based on their status information, may include the following steps: sorting the network status and / or historical online duration of each local device to obtain a local device sequence; and selecting the local device in the sequence that ranks before a preset number as the target device. This allows for the selection of local devices with stronger communication capabilities as the target device, ensuring a higher success rate for data transmission in the local scenario.
[0029] For example, the network status of each local device can be sorted to obtain a local device sequence; alternatively, the historical online duration of each local device can be sorted to obtain a local device sequence; or both the network status and historical online duration of each local device can be sorted to obtain a local device sequence. The sorting process can include sorting by network status from best to worst, sorting by historical online duration from longest to shortest, or determining the total score of each local device based on its network status and historical online duration, and then sorting by the total score from highest to lowest. Of course, the sorting method can be changed according to actual needs, and this embodiment does not limit it.
[0030] The network status of each local device refers to its network signal strength. In some embodiments, the network status of each local device can be determined using its latency parameters. Specifically, the current latency and maximum latency of each local device are obtained; a latency score is calculated for each local device based on its current latency and maximum latency; and the network status of the corresponding local device is determined based on its latency score. Thus, the local device with lower latency is selected as the target device based on its latency score, ensuring timely message reception.
[0031] Latency refers to the information obtained when a cloud device actively sends test data packets to a local device and tests their round-trip time. Current latency refers to the latency value measured at the current time. Maximum latency refers to the highest latency value among multiple measurements within a preset time period. After obtaining the current latency and maximum latency of each local device, the cloud device analyzes and processes these values to obtain a latency score for each local device. As an example, the latency ratio between the current latency and the maximum latency can be obtained; when the difference between the latency ratio of a preset value and a preset multiple meets the score requirement, the difference between the preset value and the preset multiple is determined as the latency score. The preset value and preset multiple can be set to the same value, for example, 100, and the score requirement can be a positive value. The calculation formula can be: Latency Score = max(0, 100 - ((current latency ms / maximum latency ms)) As another example, the latency difference between the maximum latency and the current latency can be obtained; the latency score of the local device is determined based on the difference between the preset value and the latency difference.
[0032] In other embodiments, the network status of each local device can be determined by the packet loss rate of each local device. Specifically, the current packet loss rate of each local device is obtained; a packet loss rate score is calculated for each local device based on its current packet loss rate; and the network status of the corresponding local device is determined based on its packet loss rate score.
[0033] Packet loss rate refers to the percentage of data packets that fail to reach the local device out of the total number of data packets sent during data communication. A high packet loss rate can easily prevent instructions from reaching the corresponding local device, affecting the automated execution of the local device. After obtaining the current packet loss rate of each local device, the cloud device calculates a packet loss rate score for each local device based on the current packet loss rate. For example, the packet loss rate score can be obtained by taking the difference between a preset value and a preset multiple of the current packet loss rate. The preset value and preset multiple can be the same, for example, both 100. The calculation formula is as follows: Packet loss rate score = max(0, 100 - (current packet loss rate)). 100)) In other embodiments, the network status of each local device can be determined by the latency parameters and packet loss rate of each local device. Specifically, a latency score is determined for each local device based on its current latency and maximum latency; a packet loss rate score is determined for each local device based on its current packet loss rate; and a network quality value for each local device is calculated based on its latency score and packet loss rate score.
[0034] The historical online duration of each local device refers to the total online duration of each local device within a historical time period. For example, a historical online score is determined for each local device based on its historical online duration, and then a target device is selected from the local devices based on their historical online scores. For example, the historical online score can be determined as the ratio between the historical online duration within a historical time period and the total duration of that historical time period. Alternatively, after obtaining the ratio between the historical online duration within a historical time period and the total duration of that historical time period, a predetermined multiple can be used to determine the historical online score. The historical online scores of each local device are sorted to obtain a local device sequence; the local device that ranks before a predetermined number in the local device sequence is selected as the target device.
[0035] In other embodiments, the network status of each local device can be determined using its latency parameters, packet loss rate, and historical online duration. Specifically, a latency score is determined based on the current latency and maximum latency of each local device; a packet loss rate score is determined based on the current packet loss rate of each local device; a historical online score is determined based on the historical online duration of each local device; statistical processing is performed on the latency score, packet loss rate score, and historical online score of each local device to obtain a total score for each local device; the local devices are sorted according to their total scores to obtain a local device sequence; and the local device ranked before a preset number in the local device sequence is selected as the target device.
[0036] In other embodiments, a target device can be selected from among the local devices based on their device capabilities. It is determined whether the device capabilities of each local device support the local scenario; if so, the corresponding local device is identified as the target device.
[0037] In other embodiments, the target device can be determined by checking whether all conditional actions in the current cloud-based scene data are supported by the local device. If so, the local device is identified as the target device. In other embodiments, the cloud device can also determine whether all conditional actions in the current cloud-based scene data are supported by the local device and whether the local scene is supported. If so, the target device is determined based on the device status of the corresponding supported local device. If not all conditional actions in the current cloud-based scene data are supported by the local device and / or the local scene is not supported, the cloud device continues to execute the current cloud-based scene data and does not send it to the target device.
[0038] Once the target device is identified, the cloud device sends local scene data to the target device. It then checks if the data transmission was successful within a preset time period. If successful, the cloud scene is updated to the local scene; otherwise, the cloud device continues to process the current cloud scene data. After sending the local scene data to the target device, the target device acts as a central node for receiving, analyzing, and forwarding information.
[0039] After receiving local scene data, the target device initiates local scene data registration. The local scene data received by the target device is based on the cloud device receiving current cloud scene data and obtaining the status information of each local device. The target device is then selected from among the local devices based on their status information. The target device performs local scene data conversion processing on the current cloud scene data to obtain the local scene data. This local scene data is then synchronized to the target device. Upon receiving a trigger command, the target device and other local devices are selected for execution. The data to be executed corresponding to the trigger command is sent to the execution device for processing. This enables data transmission within the local area network, resulting in faster response times and lower volatility.
[0040] Trigger instructions are used to instruct the target device to generate corresponding data to be executed. For example, when a local device detects a local device event, it reports the local device event to the target device and generates a trigger instruction based on the local device event. Alternatively, the target device can periodically retrieve the attributes of each local device, and generate a trigger instruction when the attributes of each local device meet the triggering conditions.
[0041] After receiving the trigger command, the target device analyzes and processes the command to determine the executing device and the data to be executed. For example, if the local scenario data indicates that device A triggers a motion detection event, then device B will execute an alarm action. When device A detects the motion detection event, it reports the event to the target device. The target device analyzes and processes the event, determines that device B will be the executing device, and the data to be executed is an alarm, then sends an alarm command to device B.
[0042] The target device receives local scene data and registers the preset trigger conditions and preset execution actions in the local scene data. In actual application, if the target device receives a trigger command, it matches the trigger conditions in the trigger command with the preset trigger conditions in the local scene data of the target device to obtain the preset trigger conditions that match the trigger conditions in the trigger command; the local device corresponding to the matching preset trigger conditions in the local scene data is identified as the execution device.
[0043] Local scene data in the target device refers to scene data received from cloud devices. This local scene data contains pre-set device linkage rules, including preset trigger conditions and preset execution actions. If the trigger condition in a received trigger command matches a preset trigger condition in the local scene data, the local device corresponding to the preset trigger condition is designated as the execution device, and the preset execution action corresponding to the local device is determined as the execution action of the execution device. For example, in a smart home scenario, if the local scene data pre-defines that starting local device A will start local device B, then in practical applications, if the target device receives a message indicating that local device A has started, it determines the execution action to be starting local device B and sends a start command to local device B.
[0044] Furthermore, to enhance the security of inter-device linkage and prevent unavailable devices from linking locally, each local device can be verified before the target device receives the trigger command. Once verification is successful, a network connection is established between the local devices, with the target device acting as the central node to execute local scenario data. For example, the linkage encryption factor of each local device is obtained; the linkage encryption factors of each local device are matched to obtain a matching result between any two local devices; in response to each matching result indicating a successful match, a linkage connection is established between the local devices.
[0045] The linkage encryption factor is used to verify whether local devices can achieve local linkage. When the linkage encryption factors of all local devices are the same, it indicates that the local devices have successfully matched and a linkage connection can be established. When the linkage encryption factors of the local devices are different, it indicates that the local devices have failed to match, and local linkage cannot be achieved. The target device needs to resynchronize the scene data. For example, the linkage encryption factor can be an encryption factor generated by the cloud device for local linkage between local devices when the local device binds to the client. The linkage encryption factor can be an irreversibly unique encrypted random character at the user level, which is sent to the local device when the local device binding is successful.
[0046] In other embodiments, the target device can also obtain the linkage encryption factors of each local device; select a verification device from among the local devices, and match the linkage encryption factors of other local devices with the linkage encryption factors of the verification device to obtain matching results; if all matching results indicate successful matching, then a linkage connection is established between the local devices. After establishing the linkage connection between the local devices, the target device can act as a central node to receive trigger commands sent by other local devices and determine whether the local scenario data is satisfied; if satisfied, the corresponding local device is triggered to perform linkage. Further, when the corresponding execution device performs an action, it sends the execution result to the target device; after receiving the execution result, if the target device is connected to the cloud device online, it reports the execution result to the cloud device so that the user can perceive the execution of the local scenario data; if the target device is offline, it stores the execution result locally and receives the batch report of the execution result after the target device comes back online.
[0047] When the target device executes local scene data, it can periodically send scene update commands to the cloud device to confirm whether the local scene data needs to be updated. This allows for the timely removal of unauthorized devices, preventing unusable or unauthorized devices from continuing to operate locally. For example, the target device sends scene update commands to the cloud device at preset intervals. The cloud device then receives the next cloud scene data within the preset time based on the received command, compares the current cloud scene data with the next cloud scene data, and obtains a comparison result. In response to the updated comparison result, the next cloud scene data undergoes local scene data conversion processing to obtain converted next cloud scene data. The converted next cloud scene data is then sent to the target device. Finally, scene data update processing is performed based on the received converted next cloud scene data from the cloud device.
[0048] A scene update command is used to instruct the cloud device to confirm whether the current cloud scene data has been updated. If an update has occurred, the data is resynchronized to the target device. For example, the target device can periodically send scene update commands to the cloud device. In other embodiments, the cloud device can also generate a scene update command upon detecting a scene update and synchronize the updated scene data to the target device according to the command. Scene updates include, but are not limited to, changes in the binding status of the local device, the failure of the local device's linkage encryption factor, and receiving changes to the current cloud scene data from the client, such as changes to trigger conditions or actions, which cause the local scene data to need to be changed or local linkage to fail.
[0049] The next cloud scene data refers to the cloud scene data received by the cloud device within a preset time. It should be noted that if the scene is updated, the comparison result between the next cloud scene data received by the cloud device and the current cloud scene data will be inconsistent; if the scene is not updated, the comparison result between the next cloud scene data received by the cloud device and the current cloud scene data will be consistent.
[0050] To elaborate on the application of this application in the data synchronization method and data execution method, the flowchart shown in Figure 2 is used for further explanation. The details are as follows: First, it should be noted that the embodiments of this application propose a data processing system, including a client, a cloud device, and a local device. The client is communicatively connected to the cloud device, and the cloud device is communicatively connected to the local device. All local devices are located on the same local area network.
[0051] When a user operates the client, they bind the local device. When the cloud device binds the local device, it generates a linkage encryption factor for the local device and sends the linkage encryption factor to the local device for local linkage. When the user operates the client to unbind the local device, the linkage encryption factor in the local device needs to be cleared.
[0052] The cloud device acquires current cloud scene data and performs local scene judgment, including: the cloud device receives device capabilities, network status, and historical online duration reported by local devices. Device capabilities include whether they support local scenes and whether they have integrated the capability to act as a central node; the cloud device selects a target device from among the local devices based on the device capabilities, network status, and historical online duration reported by each local device; the cloud device converts the current cloud scene data into local scene data based on the target device, and synchronizes the local scene data to the target device.
[0053] The target device receives local scene data and registers the preset trigger conditions and preset execution actions in the local scene data. The target device verifies whether the linkage encryption factors of each local device are the same. If they are different, the target device needs to resynchronize the local scene data from the cloud device. If they are the same, the local scene data is executed. When the target device receives a trigger command, it determines whether there is a corresponding execution action in the local scene data based on the trigger conditions in the trigger command. If there is, it sends the corresponding data to be executed to the corresponding execution device, which includes the execution action. After the execution device completes the execution, it returns the execution result to the target device. After receiving the execution result, if the target device is connected to the cloud device, it reports the execution result to the cloud device. If the target device is offline, it needs to wait for the target device to come online and then report the execution results in batches. The cloud device receives and stores the execution results.
[0054] In addition, when the cloud device detects that the target device is offline and then comes back online, the binding status of the local device changes (e.g., device unbinding), the linkage encryption factor of the local device becomes invalid, the client changes the current cloud scene data, or the linkage encryption factor verification between local devices fails, the cloud device needs to send updated local scene data to the target device; the target device then updates itself based on the received updated local scene data.
[0055] Please refer to Figure 3, which is a schematic diagram of an exemplary embodiment of the data synchronization device shown in this application. The data synchronization device 300 includes an acquisition module 310, a determination module 320, a conversion module 330, and a synchronization module 340. The acquisition module 310 is used to acquire the status information of each local device in response to receiving current cloud scene data; the determination module 320 is used to determine the target device from the local devices based on the status information of each local device; the conversion module 330 is used to perform local scene data conversion processing on the current cloud scene data according to the target device to obtain local scene data; and the synchronization module 340 is used to synchronize the local scene data to the target device so that the target device can execute the local scene data.
[0056] In the above scheme, the data synchronization device receives the current cloud-based scene data and obtains the status information of each local device; based on the status information of each local device, it determines the target device from among the local devices; it performs local scene data conversion processing on the current cloud-based scene data according to the target device to obtain local scene data; and it synchronizes the local scene data to the target device so that the target device can execute the local scene data. This scheme, by selecting the target device based on the status information of each local device, can choose the local device with the best current status as the target device, improving the success rate of scene delivery; and by synchronizing the local scene data to the target device, it supports the linkage of each local device within the local area network, improving the device linkage effect in weak network environments.
[0057] Please refer to Figure 4, which is a schematic diagram of an exemplary embodiment of the data execution device shown in this application. The data execution device 400 includes a selection module 410 and an execution module 420. The selection module 410 is used to select an execution device from a target device and other local devices in response to receiving a trigger command. The execution module 420 is used to send the data to be executed corresponding to the trigger command to the execution device for execution processing.
[0058] In the above scheme, the data execution device responds to the received trigger command, selects an execution device from the target device and other local devices according to the trigger command, and sends the data to be executed corresponding to the trigger command to the execution device for execution processing. This scheme achieves the reception, analysis, and forwarding of trigger commands and data to be executed within a local area network, without relying on the internet, thus having lower network requirements, wider applicability, and higher stability.
[0059] The functions of each module can be found in the implementation examples of the data synchronization method and data execution method, which will not be repeated here.
[0060] To implement the data synchronization method and / or data execution method of the above embodiments, this application proposes another electronic device. Please refer to FIG5 for details. FIG5 is a schematic diagram of the structure of an embodiment of the electronic device provided in this application.
[0061] Electronic device 500 includes memory 510 and processor 520, wherein memory 510 and processor 520 are coupled together.
[0062] The memory 510 is used to store program data, and the processor 520 is used to execute the program data to implement the data synchronization method and / or data execution method of the above embodiments.
[0063] In this embodiment, processor 520 can also be referred to as CPU (Central Processing Unit). Processor 520 may be an integrated circuit chip with signal processing capabilities. Processor 520 can also be a general-purpose processor, digital signal processor (DSP), application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component. The general-purpose processor can be a microprocessor, or processor 520 can be any conventional processor.
[0064] This application also provides a computer-readable storage medium, as shown in FIG6, wherein the computer-readable storage medium 600 is used to store program data 610, which, when executed by a processor, is used to implement the data synchronization method and / or data execution method as described in the method embodiments of this application.
[0065] The methods involved in the data synchronization method and / or data execution method embodiments of this application, when implemented as software functional units and sold or used as independent products, can be stored in a device, such as a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0066] The above description is merely an embodiment of this application and does not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.
[0067] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus. The term "and / or" is merely a description of the association of 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. Additionally, the character " / " in this document generally indicates that the preceding and following related objects are in an "or" relationship. Furthermore, "many" in this document means two or more. In addition, the term "at least one" in this document means any combination of at least two of any one or more of a plurality of elements, such as including at least one of A, B, and C, and may mean including any one or more elements selected from the set consisting of A, B, and C.
Claims
1. A data synchronization method, characterized in that, The data synchronization method is applied to a cloud device, which is communicatively connected to various local devices, all of which are located on the same local area network. The method includes: in response to receiving current cloud scene data, obtaining status information of each local device; determining a target device from among the local devices based on the status information of each local device; performing local scene data conversion processing on the current cloud scene data according to the target device to obtain local scene data; and synchronizing the local scene data to the target device so that the target device can execute the local scene data.
2. The data synchronization method according to claim 1, characterized in that, The status information includes network status and / or historical online duration. The step of determining the target device from each local device based on the status information of each local device includes: sorting the network status and / or historical online duration of each local device to obtain a local device sequence; and selecting the local device in the local device sequence that is ranked before a preset number as the target device.
3. The data synchronization method according to claim 2, characterized in that, Before the step of sorting the network status and / or historical online duration of each local device to obtain a local device sequence, the method includes: obtaining the current latency and maximum latency of each local device; calculating the latency score of each local device based on the current latency and maximum latency of each local device; and determining the network status of the corresponding local device based on the latency score of each local device.
4. The data synchronization method according to claim 2, characterized in that, Before the step of sorting the network status and / or historical online duration of each local device to obtain a local device sequence, the method includes: obtaining the current packet loss rate of each local device; calculating the packet loss rate score of each local device based on the current packet loss rate of each local device; and determining the network status of the corresponding local device based on the packet loss rate score of each local device.
5. A data execution method, characterized in that, The data execution method is applied to a target device, which is located on the same local area network as other local devices. The method includes: responding to receiving a trigger command; selecting an execution device from the target device and the other local devices according to the trigger command; the target device includes local scene data, which is obtained based on the status information of each local device obtained by a cloud device upon receiving current cloud scene data; determining the target device from each local device based on the status information of each local device; performing local scene data conversion processing on the current cloud scene data according to the target device to obtain the local scene data; synchronizing the local scene data to the target device; and sending the data to be executed corresponding to the trigger command to the execution device for execution processing.
6. The data execution method according to claim 5, characterized in that, The step of selecting an execution device from the target device and the other local devices according to the trigger instruction includes: matching the trigger condition in the trigger instruction with the preset trigger condition in the local scene data of the target device to obtain the preset trigger condition that matches the trigger condition in the trigger instruction; and determining the local device in the local scene data that corresponds to the matched preset trigger condition as the execution device.
7. The data execution method according to claim 5, characterized in that, Before the step of selecting an execution device from the target device and the other local devices according to the trigger instruction in response to receiving the trigger instruction, the method includes: obtaining the linkage encryption factor of each local device; performing matching processing on the linkage encryption factor of each local device to obtain the matching result of any two local devices; and establishing a linkage connection between each local device in response to each matching result indicating a successful match.
8. The data execution method according to claim 5, characterized in that, The target device is communicatively connected to the cloud device. The method further includes: sending a scene update command to the cloud device at preset time intervals, so that the cloud device receives the next cloud scene data within the preset time period based on the received scene update command, and compares the current cloud scene data and the next cloud scene data to obtain a comparison result; in response to the update of the comparison result representation, performing local scene data conversion processing on the next cloud scene data to obtain converted next cloud scene data; sending the converted next cloud scene data to the target device; and performing scene data update processing based on the received converted next cloud scene data sent by the cloud device.
9. An electronic device, characterized in that, include: A memory and a processor, wherein the memory stores program instructions, and the processor retrieves the program instructions from the memory to execute the data synchronization method as claimed in any one of claims 1-4 and / or the data execution method as claimed in any one of claims 5-8.
10. A computer-readable storage medium, characterized in that, The system stores program data, which, when executed by a processor, is used to implement the data synchronization method as described in any one of claims 1-4 and / or the data execution method as described in any one of claims 5-8.