Data synchronization method and system, gateway device, proxy gateway and storage medium
By comparing the version number difference between the gateway device and the proxy gateway in a wireless mesh network, the device control events to be synchronized are determined, achieving data consistency and efficient and reliable synchronization of the proxy gateway nodes. This solves the data synchronization problem after the coordinator gateway fails, and improves the user experience.
Patent Information
- Application Number
- CN202111182615.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-11
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2041-10-11
AI Technical Summary
In wireless, low-speed, low-power mesh networks, when the coordinator gateway fails, the automation scenario data cannot be synchronized, resulting in inconsistent data content of the proxy gateway nodes. Furthermore, the full data synchronization consumes bandwidth and affects the reliability of other message transmissions.
By acquiring configuration update data and updating the scenario version number, and under the trigger conditions, comparing the version number difference between the gateway device and the proxy gateway, the device control events to be synchronized are determined, enabling differentiated data transmission and ensuring data consistency and efficient and reliable synchronization of all proxy gateway nodes.
It solves the problem of data asynchrony between proxy gateway nodes, reduces the synchronization transmission pressure between gateway devices and proxy gateways, achieves efficient and reliable data transmission, and improves user experience.
Smart Images

Figure CN115967722B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communications, and in particular to a device control data synchronization method and system, a gateway device, a proxy gateway, and a computer-readable storage medium. Background Technology
[0002] Currently, most smart home systems based on wireless, low-speed, low-power mesh networks (such as Zigbee wireless network technology) implement "automated scenes" (e.g., pressing a wireless switch executes an "away from home" scene, turning off all devices in the network; or if a wireless human sensor detects movement and the brightness is below a certain threshold, turning on lights in the corresponding location, etc.) in the cloud or in a coordinating gateway. Furthermore, the synchronization of automated scene data is achieved through high-speed transmission media (such as Wi-Fi, 4G, etc.). However, this approach has a serious drawback: when the coordinating gateway fails, the automated scene cannot be executed, severely impacting the user experience. Therefore, some improved solutions involve offloading automated scene data to specific nodes in the network. When the coordinating gateway fails, these nodes can replace the gateway to execute the automated scene. However, in a wireless, low-speed, low-power mesh network, synchronizing automated scene data to these proxy gateway nodes presents several challenges, as follows:
[0003] First, in wireless, low-speed, low-power mesh networks, a coordinator gateway needs to synchronize data with multiple proxy gateway nodes. When the coordinator gateway performs synchronization operations on these nodes, some proxy gateway nodes may be in an "online" state, while some nodes may be in an "offline" state due to power failure or distance from the coordinator. As a result, the data content of each proxy gateway node in the automation scenario will be inconsistent.
[0004] Second, if data synchronization is performed in full every time, it will severely consume bandwidth in this low-speed network, affecting the reliability of other wireless message transmissions. Summary of the Invention
[0005] To address the aforementioned technical problems, this application provides a method and system for device control data transmission, a gateway device, a proxy gateway, and a computer-readable storage medium that can effectively ensure the consistency of automated scenario data content for each proxy gateway node in the system and achieve efficient and reliable data synchronization.
[0006] To achieve the above objectives, the technical solution of this application embodiment is implemented as follows:
[0007] In a first aspect, embodiments of this application provide a device control data synchronization method, applied to a gateway device, comprising:
[0008] Obtain configuration update data for the device control scenario;
[0009] Based on the configuration update data, the configuration data version information of the device control scenario is updated according to the set rules to obtain the updated scenario version number;
[0010] When the data synchronization triggering conditions are met, the updated scenario version number is sent to the proxy gateway, the difference between the updated scenario version number and the historical scenario version number currently stored by the proxy gateway is determined, and the device control event to be synchronized is determined based on the difference and sent to the proxy gateway.
[0011] Secondly, embodiments of this application also provide a device control data synchronization method, applied to a proxy gateway, including:
[0012] Receive the updated scenario version number of the device control scenario issued by the gateway device;
[0013] Based on the currently stored historical scene version number, the historical scene version number is reported to the gateway device, and / or the difference between the updated scene version number and the historical scene version number currently stored by the proxy gateway is determined and reported to the gateway device;
[0014] The gateway device receives a device control event to be synchronized based on the difference between the updated scenario version number and the historical scenario version number currently stored by the proxy gateway, and updates the scenario data and configuration data version information of the device control scenario according to the device control event to be synchronized.
[0015] Thirdly, embodiments of this application also provide a gateway device, including:
[0016] The acquisition module is used to acquire configuration update data for the device control scenario;
[0017] The first update module is used to update the configuration data version information of the device control scenario according to the configuration update data and according to the set rules to obtain the update scenario version number;
[0018] The first sending module is used to send the updated scenario version number to the proxy gateway when the data synchronization trigger condition is met, determine the difference between the updated scenario version number and the historical scenario version number currently stored by the proxy gateway, and determine the device control event to be synchronized based on the difference and send it to the proxy gateway.
[0019] Fourthly, embodiments of this application also provide a proxy gateway, including:
[0020] The receiving module is used to receive the updated scenario version number of the device control scenario issued by the gateway device;
[0021] The second sending module is used to report the historical scene version number to the gateway device based on the currently stored historical scene version number, and / or to determine the difference between the updated scene version number and the historical scene version number currently stored by the proxy gateway and report it to the gateway device.
[0022] The second update module is used to receive a device control event to be synchronized issued by the gateway device based on the difference between the updated scenario version number and the historical scenario version number currently stored by the proxy gateway, and to update the scenario data and configuration data version information of the device control scenario according to the device control event to be synchronized.
[0023] Fifthly, embodiments of this application also provide a gateway device, including a first processor and a first memory. The first memory stores a computer program that can be executed by the first processor. When the computer program is executed by the first processor, it implements the device control data synchronization method applied to the gateway device in any embodiment of this application.
[0024] Sixthly, embodiments of this application also provide a proxy gateway, including a second processor and a second memory. The second memory stores a computer program that can be executed by the second processor. When the computer program is executed by the second processor, it implements the data synchronization method applied to the proxy gateway in any embodiment of this application.
[0025] Seventhly, embodiments of this application also provide a device control data synchronization system, comprising: a gateway device as described in any embodiment of this application and a plurality of proxy gateways as described in any embodiment of this application, wherein,
[0026] The gateway device is used to send the device control event to be synchronized to at least one of the proxy gateways when the data synchronization triggering conditions are met.
[0027] The proxy gateway is used to receive the device control events to be synchronized, and update the scene data and configuration data version information of the device control scenario according to the device control events to be synchronized.
[0028] Eighthly, embodiments of this application also provide a computer-readable storage medium storing a computer program, which, when executed by a controller, implements the device control data synchronization method described in any embodiment of this application.
[0029] The device control data synchronization method and system, gateway device, proxy gateway, and computer-readable storage medium provided in the above embodiments of this application involve the gateway device acquiring configuration update data of the corresponding device control event in the device control scenario, updating the configuration data version information of the device control scenario according to the configuration update data according to the set rules to obtain the updated scenario version number, and sending the updated scenario version number to the proxy gateway when the data synchronization trigger condition is met. Based on the difference between the updated scenario version number and the historical scenario version number currently stored by the proxy gateway, the device control event to be synchronized is determined and sent to the proxy gateway. Thus, by setting up a data synchronization trigger mechanism between the gateway device and multiple proxy gateways, the difference between the scenario version number of the configuration data obtained by the gateway device and the scenario version number stored by the proxy gateway is compared. Based on the difference, the device control events that need to be synchronized are determined and then sent to the proxy gateways with the difference. This solves the problem of the "offline" proxy gateway and the "online" proxy gateway being out of sync, and can effectively synchronize all device control events currently stored by each proxy gateway with all device control events currently stored by the gateway device. Moreover, the incremental transmission of differentiated data between the gateway device and the proxy gateways effectively reduces the transmission pressure when the gateway device and the proxy gateways synchronize data, ensuring efficient and reliable data transmission and improving the user experience. Attached Figure Description
[0030] Figure 1 This is an application scenario diagram of a device control data synchronization system according to one embodiment of this application;
[0031] Figure 2 This is a diagram illustrating another optional application scenario of the device control data synchronization system in one embodiment of this application;
[0032] Figure 3 This is a flowchart of a device control data synchronization method applied to a gateway device in one embodiment of this application;
[0033] Figure 4 This is a flowchart of a device control data synchronization method applied to a proxy gateway in one embodiment of this application;
[0034] Figure 5 This is a flowchart of a device control data synchronization method applied to a device control data synchronization system, which is an optional specific example of this application;
[0035] Figure 6 This is a schematic diagram of a gateway device in one embodiment of this application;
[0036] Figure 7 This is a schematic diagram of a proxy gateway device in one embodiment of this application;
[0037] Figure 8This is a schematic diagram of the gateway device in one embodiment of this application;
[0038] Figure 9 This is a schematic diagram of the proxy gateway structure in one embodiment of this application. Detailed Implementation
[0039] The technical solution of this application will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0040] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein in the specification of this application is for the purpose of describing particular embodiments only and is not intended to limit the ways in which this application may be implemented. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.
[0041] In the description of this application, it should be understood that the terms "center," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," and "outer," etc., indicating the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, are used only for the convenience of describing this application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation on this application. In the description of this application, unless otherwise stated, "a plurality of" means two or more.
[0042] In the description of this application, it should be noted that, unless otherwise expressly specified and limited, the terms "installation," "connection," and "joining" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal communication between two components. Those skilled in the art can understand the specific meaning of the above terms in this application according to the specific circumstances.
[0043] Please refer to the following: Figure 1 and Figure 2 This is a schematic diagram illustrating an application environment for a device control data synchronization method applicable to embodiments of this application. The device control data synchronization method provided in this application embodiment can be applied to, for example... Figure 1The device control data synchronization system shown includes a gateway device 101 and multiple proxy gateways 102. In the wireless mesh network, the gateway device 101 acts as a "control gate" between the proxy gateways and the server. It can receive configuration update instructions issued by the terminal 201 and / or the server 202, and determine whether to send the device control events to be synchronized to the multiple proxy gateways when the data synchronization trigger conditions are met. The proxy gateways 102 are used to receive the device control events to be synchronized and update the scene data and configuration data version information of the currently stored device control scene according to the device control events to be synchronized. In this embodiment, the gateway device 101 can be a coordinator gateway device. The proxy gateways 102 can be high-powered products in smart home products, such as air conditioners, televisions, smart door locks, smart lights, and other home products. The terminal device 201 can be any device with communication and storage functions, such as smartphones, desktop computers, laptops, tablets, or other smart communication devices with network connectivity. The server 202 can be a network access server, database server, cloud server, etc. This application embodiment does not limit this.
[0044] Optionally, the gateway device 101 can be built based on the ZigBee protocol, and the proxy gateway 102 can be pre-added to the gateway device 101. For example, the proxy gateway 102 can be a device in the same kit that the gateway device 101 belongs to when it leaves the factory; or it can be a device that is subsequently connected to the gateway device 101 through user operation.
[0045] Optionally, gateway device 101 and proxy gateway 102 can establish a network connection based on the ZigBee protocol, thereby joining a ZigBee wireless mesh network.
[0046] It is understood that the above application environment is merely an exemplary description for the convenience of understanding the following embodiments, and does not constitute any limitation on the actual application environment that can be implemented in the embodiments of this application.
[0047] Please see Figure 3 This application provides a device control data synchronization method, which can be applied to... Figure 1 The gateway device 101 in the system. The device control data synchronization method includes, but is not limited to, S301 to S303, as detailed below:
[0048] S301: Obtain configuration update data for the device control scenario.
[0049] Here, a scenario refers to setting one or more pre-defined controlled devices to a pre-defined, expected state. For example, in a "coming home" scenario, a user typically wants to turn on the living room lights, open the curtains, and turn on the air conditioner. Therefore, "turn on the living room lights, open the curtains, turn on the air conditioner" can be configured as the actions performed by the controlled devices in this scenario. Similarly, in a "getting up" scenario, a user typically wants to open the curtains, turn on the sockets on the table, and turn on the sockets in the living room. Therefore, "open the curtains, turn on the sockets on the table, turn on the sockets in the living room" can be configured as the actions performed by the controlled devices in this scenario. A device control scenario refers to a scenario containing at least one device control event, through which the corresponding controlled device is controlled to reach a pre-defined, expected state. Each device control event corresponds to one automated control action, and each device control event corresponds to automated control data for one specific action performed by the controlled device. For example, a device control event might correspond to the on / off state or a change in the operating state of a controlled device.
[0050] The configuration update data includes the addition and / or deletion and / or modification of device control events contained in the device control scenario. The device control event refers to an operation event that controls the controlled device to turn on, off, or switch its working state. Obtaining the configuration update data for the device control scenario can refer to the gateway device obtaining the configuration update data for the device control scenario. For example, the gateway device obtains the full configuration update data for the device control scenario from the database server. That is, the configuration update data includes unupdated device control events, including a device control event added to an existing device control scenario, a device control event deleted, and / or a device control event modified. The configuration update data for the device control scenario can be generated by the database server based on user configuration operations performed on the device control scenario using a terminal device. This is achieved by adding, deleting, or modifying device control events through configuration operations. In an optional example, the configuration update data is a content mapping table formed by adding / deleting / modifying device control events. The specific content mapping table corresponding to the configuration update data of the device control scenario can be found in Table 1 below.
[0051]
[0052]
[0053] Table 1
[0054] Here, the content mapping table includes: multiple device control events in the configuration update data of the device control scenario, a sequence number ID used to identify different device control events, a version number used to characterize the update timing of the device control event to determine whether it is a device control event to be synchronized, and a valid value characterizing whether the device control event is valid.
[0055] S302: Based on the configuration update data, update the configuration data version information of the device control scenario according to the set rules to obtain the updated scenario version number.
[0056] Setting rules refers to pre-defined rules for updating the version information of configuration data for device control scenarios. The configuration data version information includes the configuration data version number and / or the configuration data version generation time. Specifically, each time the configuration data version information of the device control scenario is updated based on configuration update data, the configuration data version information used as the basis for the update refers to the version number of the device control event with the largest version number among the device control events currently included in the device control scenario and / or the update time of the device control event whose configuration data version generation time is closest to the current time. Taking the configuration data version number included in the configuration data version information as the version number of the device control event with the largest version number among the device control events as an example, in Table 1, the version number 13 of the device control event with ID number 4 is the version number of the device control event with the largest version number among all device control events. Therefore, the configuration data version number of the device control scenario represented by Table 1 is set to 13. The version number of a device control event is a number assigned to the device control event; for example, in Table 1, the version number of the device control event with ID number 1 is set to 11, and the version number of the device control event with ID number 2 is set to 12. The updated scenario version number refers to the latest scenario version number obtained after each update of the configuration data version number of the device control scenario based on the configuration update data.
[0057] Correspondingly, taking the encoding method of encoding the configuration data version number of the device control scenario by linearly increasing natural numbers as an example, the step of updating the configuration data version information of the device control scenario according to the configuration update data and the set rules to obtain the updated scenario version number can refer to the gateway device, based on the configuration update data, assigning specific numbering to each added, deleted, and / or modified device control event in the device control scenario according to the configuration data version number and the rule of increasing natural numbers, and taking the version number of the device control event with the largest version number as the updated scenario version number. For example, Table 2 is a content mapping table corresponding to the configuration data of the device control scenario. Combined with Table 1, it can be seen that the device control event with ID 4 in Table 1 is the device control event added based on Table 2. Among them, the version number 13 of the device control event with ID 4 is the updated version number determined based on the configuration data version number 12 corresponding to Table 2 according to the rule of increasing natural numbers.
[0058]
[0059] Table 2
[0060] S303: When the data synchronization triggering condition is met, the updated scenario version number is sent to the proxy gateway, the difference between the updated scenario version number and the historical scenario version number currently stored by the proxy gateway is determined, and the device control event to be synchronized is determined based on the difference and sent to the proxy gateway.
[0061] Meeting the data synchronization trigger condition means that the gateway device has the prerequisite to send data to the proxy gateway. When this condition is met, the gateway device is triggered to send the updated scenario version number and the device control event to be synchronized to the proxy gateway. The historical scenario version number currently stored by the proxy gateway can refer to the last updated scenario version number successfully received by the proxy gateway from the gateway device before the current time. Sending the updated scenario version number to the proxy gateway when the data synchronization trigger condition is met means that the gateway device sends the updated scenario version number to the proxy gateway when the data synchronization trigger condition is met. Determining the difference between the updated scenario version number and the historical scenario version number currently stored by the proxy gateway, and determining the device control event to be synchronized based on the difference and sending it to the proxy gateway means that the gateway device obtains the historical scenario version number currently stored by the proxy gateway, compares the updated scenario version number stored by itself with the historical scenario version number, determines the device control event to be synchronized based on the difference, and then sends the device control event to be synchronized to the proxy gateway. For example, please refer to Table 3, which is the content mapping table corresponding to the historical scenario data currently stored by the proxy gateway.
[0062]
[0063]
[0064] Table 3
[0065] Here, the gateway device obtains the historical scene version number currently stored by the proxy gateway as 12; referring to Table 1, the gateway device obtains the updated scene version number stored by itself as 13; the gateway device compares the updated scene version number stored by itself with the historical scene version number, and determines that the device control event to be synchronized is the device control event with version number 13 based on the difference of 1 after comparison. Therefore, the gateway device determines the device control event with version number 13 stored by itself as the device control event to be synchronized and sends it to the proxy gateway.
[0066] The device control data synchronization method provided in the above embodiments of this application involves a gateway device acquiring configuration update data of a corresponding device control event in a device control scenario, updating the configuration data version information of the device control scenario according to a set rule based on the configuration update data to obtain an updated scenario version number, and, when the data synchronization triggering condition is met, sending the updated scenario version number to a proxy gateway, determining the difference between the updated scenario version number and the historical scenario version number currently stored by the proxy gateway, and determining the device control event to be synchronized based on the difference and sending it to the proxy gateway. Thus, by setting up a data synchronization trigger mechanism between the gateway device and multiple proxy gateways, the difference between the scenario version number of the configuration data obtained by the gateway device and the scenario version number stored by the proxy gateway is compared. Based on the difference, the device control events that need to be synchronized are determined and then sent to the proxy gateways with the difference. This solves the problem of the "offline" proxy gateway and the "online" proxy gateway being out of sync, and can effectively synchronize all device control events currently stored by each proxy gateway with all device control events currently stored by the gateway device. Moreover, the incremental transmission of differentiated data between the gateway device and the proxy gateways effectively reduces the transmission pressure when the gateway device and the proxy gateways synchronize data, ensuring efficient and reliable data transmission and improving the user experience.
[0067] In an optional embodiment, the step of updating the configuration data version information of the device control scenario according to the configuration update data and a set rule to obtain an updated scenario version number includes: updating the number and validity of the device control events included in the device control scenario according to the configuration update data and a set encoding rule to obtain an updated event version correspondence; and updating the configuration data version number of the device control scenario to obtain an updated scenario version number.
[0068] The defined encoding rules include a first rule for encoding the version number of the configuration data of the device control scenario, and a second rule for updating the version number and validity of device control events in the device control scenario. For example, the first rule could be an encoding method that linearly increments the version number of the configuration data of the device control scenario using natural numbers, and the second rule could be an encoding method that linearly increments the version number of the device control events using natural numbers and uses a specified value to represent the update method of the corresponding device control event. The device control event number refers to the version number corresponding to each device control event. The validity of a device control event refers to whether the corresponding device control event is currently in an active or inactive state. The event version correspondence refers to the correspondence between device control events and version numbers.
[0069] Taking the first rule as an encoding method that encodes the configuration data version number of the device control scenario in a linearly increasing natural number, and the second rule as an encoding method that encodes the version number of the device control event in a linearly increasing natural number and uses a specified value to represent the update of the corresponding device control event as an example, the step of updating the number and validity of the device control events included in the device control scenario according to the configuration update data and the set encoding rule to obtain the updated event version correspondence; and updating the configuration data version number of the device control scenario to obtain the updated scenario version number can refer to: the gateway device updating the number and validity of the device control events included in the device control scenario according to the configuration update data and the second rule to obtain the updated event version correspondence; and updating the configuration data version number of the device control scenario according to the first rule to obtain the updated scenario version number. For example, based on the addition of device control events in the device control scenario, the gateway device updates the version number of the device control events in the device control scenario according to the configuration data version number of the device control scenario, by incrementing the version number of the device control event by one for each added device control event. Furthermore, the validity of the device control event is determined to be valid based on the nature of the added change, thus obtaining the correspondence between the version number and the validity of the added device control event.
[0070] In the above embodiments, the gateway device updates the device control event numbers and validity according to the set encoding rules based on the configuration update data to obtain the updated event version correspondence; and updates the configuration data version number of the device control scenario to obtain the updated scenario version number. In this way, splitting the configuration update data into multiple device control events and updating the version numbers and validity of the updated device control events and the configuration data version number according to the set encoding rules helps to quickly determine the differences between the configuration update data and the configuration data, thereby reducing the transmission pressure of synchronization data between the gateway device and the proxy gateway, promoting efficient and reliable transmission of synchronization data, and improving the user experience.
[0071] In one optional embodiment, determining the difference between the updated scenario version number and the historical scenario version number currently stored by the proxy gateway, and determining the device control event to be synchronized and sending it to the proxy gateway based on the difference, includes: determining the target number of the device control event to be synchronized based on the difference between the updated scenario version number and the historical scenario version number currently stored by the proxy gateway, and based on the difference and the correspondence between the updated event versions; and sending the device control event matching the target number to the proxy gateway.
[0072] The target number refers to the version number of the device control event to be sent, as determined by the gateway device. Determining the target number of the device control event to be synchronized based on the difference between the updated scenario version number and the historical scenario version number currently stored by the proxy gateway, and the correspondence between the updated event versions, and then sending the device control event matching the target number to the proxy gateway, can mean that: the gateway device obtains the historical scenario version number currently stored by the proxy gateway, compares the updated scenario version number stored by itself with the historical scenario version number, determines the number of device control events to be synchronized based on the difference, and then determines the version number of the device control event to be sent based on the number of device control events to be synchronized and the event version correspondence. For example, please refer to Table 4, which is a content mapping table corresponding to another historical configuration data currently stored by the proxy gateway. Combined with the update scenario version number of the gateway device in Table 1, here, the gateway device obtains the historical scenario version number 10 currently stored by the proxy gateway, and compares the update scenario version number 13 stored by itself with the historical scenario version number 10. Based on the difference after comparison, the number of device control events to be synchronized is determined to be 3. Then, based on the number of device control events to be synchronized and the event version correspondence in Table 1, the device control events to be issued are the device control events with version numbers 11 to 13 in Table 1.
[0073]
[0074] Table 4
[0075] In the above embodiments, based on the difference between the updated scenario version number and the historical scenario version number currently stored by the proxy gateway, and the correspondence between the updated event versions, a target number of the device control event to be synchronized is determined; the device control event matching the target number is then sent to the proxy gateway. This helps to quickly identify differentiated data in the configuration update data, thereby reducing the transmission pressure of data synchronization between the gateway device and the proxy gateway, promoting efficient and reliable data transmission, and improving the user experience.
[0076] In one optional embodiment, determining the target number of the device control event to be synchronized based on the difference and the updated event version correspondence includes: determining the difference between the updated scenario version number and the historical scenario version number currently stored by the proxy gateway; determining, based on the difference, an intermediate scenario version number in which the gateway device has made changes to the configuration data of the device control scenario relative to the proxy gateway; and determining, according to the event version correspondence corresponding to the intermediate scenario version number, the target number of the device control event to be synchronized as a new number contained relative to the historical scenario version number.
[0077] Intermediate scenario version numbers refer to all other version numbers between the historical scenario version number and the updated scenario version number. The determination of intermediate scenario version numbers where the gateway device has changed the configuration data of the device control scenario relative to the proxy gateway based on the difference between the updated scenario version number and the historical scenario version number currently stored by the proxy gateway can mean that the gateway device determines the intermediate scenario version numbers where the gateway device has changed the configuration data of the device control scenario relative to the proxy gateway based on the difference between the updated scenario version number and the historical scenario version number currently stored by the proxy gateway. For example, please continue to refer to Tables 1 and 4, where the gateway device determines intermediate scenario version numbers 11 and / or 12 and / or 13 where the gateway device has changed the configuration data of the device control scenario relative to the proxy gateway based on a difference of 3 between the updated scenario version number in Table 1 and the historical scenario version number currently stored by the proxy gateway in Table 4. The step of determining the target number of the device control event to be synchronized relative to the historical scene version number based on the event version correspondence corresponding to the intermediate scene version number can refer to the gateway device determining the target number of the device control event to be synchronized relative to the historical scene version number based on the event version correspondence corresponding to the intermediate scene version number. For example, the gateway device determines the device control event with version number 11 contained in intermediate scene version number 11 as the target number of the device control event to be synchronized based on the intermediate scene version number 11 and / or intermediate scene version number 12 and / or intermediate scene version number 13 and the corresponding event version correspondence; determines the device control events with version numbers 11 and 12 contained in intermediate scene version number 12 as the target number of the device control event to be synchronized; and determines the device control events with version numbers 11, 12 and 13 contained in intermediate scene version number 13 as the target number of the device control event to be synchronized.
[0078] It is worth noting that when a proxy gateway rejoins the network of the gateway device after going offline, there may be multiple intermediate versions between the proxy gateway and the gateway device. For example, please refer to Table 5, which is a content mapping table corresponding to the historical configuration data currently stored by the proxy gateway after rejoining the network of the gateway device. The historical scenario version number currently stored by the proxy gateway is 7, and the configuration data of the device control scenario of the proxy gateway only contains device control events with IDs 1 and 2. Referring to Table 6, which is a content mapping table of the updated configuration data of the gateway device, the scenario version number of the gateway device is 13, and the configuration update data of the device control scenario of the gateway device contains device control events with IDs 1 to 4. Here, the gateway device obtains the historical scenario version number 7 currently stored by the proxy gateway, and compares it with the historical scenario version number 7 based on its own stored updated scenario version number 13. Based on the difference after comparison, the number of device control events to be synchronized is determined to be 6, thus confirming that there are 6 intermediate version numbers between the proxy gateway and the gateway device. Given that the updated configuration data of the gateway device only contains four device control events, it can be inferred that during the event segment from when the proxy gateway went offline to when it rejoined the network where the gateway device is located, the intermediate version numbers 8 to 10 in the gateway device have been overwritten by the intermediate version numbers with higher version numbers. Therefore, during the data synchronization process with the proxy gateway, the gateway device will ignore the overwritten intermediate version numbers and determine the data to be synchronized based on the content mapping table corresponding to the currently existing intermediate version number with the highest version number. Thus, based on the number of device control events to be synchronized and the current event version correspondence in Table 6, the gateway device determines that the device control events to be issued are the device control events with version numbers 11 to 13 in Table 6.
[0079]
[0080] Table 5
[0081]
[0082]
[0083] Table 6
[0084] In this embodiment, the gateway device determines the difference between the updated scenario version number and the historical scenario version number currently stored by the proxy gateway. Based on the difference, it determines an intermediate scenario version number where the gateway device has made changes to the configuration data of the device control scenario relative to the proxy gateway. According to the event version correspondence corresponding to the intermediate scenario version number, it determines the target number of the device control event to be synchronized, which is a new number relative to the historical scenario version number. This helps the gateway device quickly identify differentiated data in the configuration update data and send the device control events to be synchronized to the proxy gateway without omission, thereby reducing the transmission pressure of data synchronization between the gateway device and the proxy gateway, promoting efficient and reliable data transmission, and improving the user experience.
[0085] In an optional embodiment, for example, the updated scenario version number is N2, the historical scenario version number is N1, and the difference is D; determining the difference between the updated scenario version number and the historical scenario version number currently stored by the proxy gateway, and determining the target number of the device control event to be synchronized based on the difference and the correspondence of the updated event version, includes: determining, based on the difference D between the updated scenario version number N2 and the historical scenario version number N1 currently stored by the proxy gateway, that the intermediate scenario version number for which the gateway device has changed the configuration data of the device control scenario relative to the proxy gateway is between N2-D+1 and N2; wherein, N2 is greater than N1; and determining, based on the correspondence of the event version corresponding to the intermediate scenario version number between N2-D+1 and N2, the device control event with the new number included in the intermediate scenario version number relative to the historical scenario version number is the device control event to be synchronized.
[0086] The determination that the intermediate scenario version number for which the gateway device has made changes to the configuration data of the device control scenario relative to the proxy gateway is between N2-D+1 and N2, based on the difference D between the updated scenario version number N2 and the historical scenario version number N1 currently stored by the proxy gateway, can mean that the gateway device determines that the intermediate scenario version number for which the gateway device has made changes to the configuration data of the device control scenario relative to the proxy gateway is between N2-D+1 and N2, where N2 is greater than N1. For example, please refer to Tables 1 and 5. The gateway device's updated scenario version number based on Table 1 is 13, and the proxy gateway's currently stored historical scenario version number based on Table 5 is 10. The difference between the updated scenario version number and the currently stored historical scenario version number is 3. Therefore, the gateway device determines that the intermediate scenario version number for which the gateway device has changed the configuration data of the device control scenario relative to the proxy gateway can be intermediate scenario version number 11 and / or intermediate scenario version number 12 and / or intermediate scenario version number 13, as shown in Tables 7 and 8 below and Table 1 above, respectively. The step of determining the device control event with the new number included in the intermediate scenario version number relative to the historical scenario version number as a device control event to be synchronized, based on the event version correspondence between the intermediate scenario version numbers between N2-D+1 and N2, can mean that the gateway device determines the device control event with the new number included in the intermediate scenario version number relative to the historical scenario version number as a device control event to be synchronized, according to the event version correspondence between the intermediate scenario version numbers between N2-D+1 and N2. For example, please refer to Table 7, which is the content mapping table for intermediate scene data. Here, the gateway device determines, based on the event version correspondence of intermediate scene version number 11, that the device control event with version number 11 included in historical scene version number 10 in Table 5 is a device control event to be synchronized. As another example, please refer to Table 8, which is the content mapping table for another intermediate scene data. Here, the gateway device determines, based on the event version correspondence of intermediate scene version number 12, that the device control events with version number 11 and version number 12 included in historical scene version number 10 in Table 5 are device control events to be synchronized.
[0087]
[0088] Table 7
[0089]
[0090] Table 8
[0091] In this embodiment, the gateway device determines, based on the difference between the updated scenario version number and the historical scenario version number currently stored by the proxy gateway, that the intermediate scenario version number for which the gateway device has modified the configuration data of the device control scenario relative to the proxy gateway is between N2-D+1 and N2. According to the event version correspondence between the intermediate scenario version numbers between N2-D+1 and N2, the gateway device determines the device control event with the new number included in the intermediate scenario version number relative to the historical scenario version number as the device control event to be synchronized. This helps the gateway device quickly identify the device control events to be synchronized and send them to the proxy gateway without omission, thereby reducing the transmission pressure of data synchronization between the gateway device and the proxy gateway, promoting efficient and reliable data transmission, and improving the user experience.
[0092] In an optional embodiment, the configuration update data includes adding, deleting, and / or modifying device control events included in the device control scenario; the step of updating the numbering and validity of the device control events included in the device control scenario according to the configuration update data and a set coding rule to obtain an updated event version correspondence includes: when the configuration update data is for adding device control events, adding new device control events to the device control scenario, adding new numbers to the newly added device control events according to the set coding rule, setting the validity value of the newly added device control events to a first value, and obtaining the updated event version based on the numbering and validity of the newly added device control events. The corresponding relationship; and / or, when the configuration update data is for deleting device control events, the valid value of the device control events to be deleted included in the device control scenario is set to a second value, and the updated event version corresponding relationship is obtained according to the number and validity of the deleted device control events; and / or, when the configuration update data is for modifying device control events, the valid value of the device control events before modification is set to a second value, the modified device control events are added and a new number is added to the added device control events according to the set coding rules, the validity value of the added device control events is set to a first value, and the updated event version corresponding relationship is obtained according to the number and validity of the modified device control events.
[0093] Here, when the configuration update data involves adding device control events, the gateway device adds new device control events to the device control scenario and assigns a new number to each new device control event according to a set coding rule. The validity value of the new device control event is set to a first value. The updated event version correspondence is obtained based on the number and validity of the new device control event. For example, please refer to Table 9, which is the content mapping table corresponding to the configuration scenario data of the gateway device. When the configuration update data of the gateway device involves adding device control events, the gateway device sets the version number of the new device control events in the device control scenario to a specific number based on the configuration scenario version number of the device control scenario, using a coding rule that increments by natural numbers. The validity of the new device control events is set to valid, with the value 1 representing the valid value of the new device control event. Specifically, refer to the device control event with version number 10 added in Table 10, where Table 10 is the content mapping table corresponding to the configuration update data after adding device control events.
[0094]
[0095] Table 9
[0096]
[0097] Table 10
[0098] Here, when the configuration update data is for deleting device control events, the gateway device sets the valid value of the device control events to be deleted in the device control scenario to a second value. The updated event version correspondence is obtained based on the number and validity of the deleted device control events. Specifically, when the configuration update data is for deleting device control events, the gateway device sets the device control events to be deleted in the device control scenario to be invalid, using the value 0 to represent the valid value of the device control events to be deleted. The version number of the deleted device control events is assigned a specific number based on the version number of the original device control scenario, according to the encoding rule of increasing natural numbers. For details, please refer to the device control event with version number 7 in Table 9 and the device control event with version number 10 in Table 11. Table 11 is the content mapping table corresponding to the configuration update data after deleting device control events.
[0099]
[0100]
[0101] Table 11
[0102] Here, when the configuration update data involves modifying a device control event, the gateway device sets the valid value of the device control event before modification to a second value, adds a new modified device control event, and assigns a new number to the new device control event according to a set encoding rule. The valid value of the new device control event is then set to a first value. The updated event version correspondence is obtained based on the number and validity of the modified device control event. For example, when the configuration update data involves modifying a device control event, the gateway device sets the device control event to be modified within the device control scenario to invalid, modifies the valid value of the device control event to be modified to the value 0, and then adds a new device control event. The gateway device sets the version number of the new device control event to a specific number based on the version number of the device control scenario before modification, using an incrementing encoding rule. The validity of the new device control event is set to valid, with the value 1 representing the valid value of the new device control event. Specifically, this can be compared to the device control events with version number 7 in Table 9 and version number 11 in Table 12, where Table 12 is a content mapping table corresponding to the configuration update data after modifying the device control event.
[0103]
[0104] In this embodiment of the application, by listing several ways in which the configuration update data includes, such as adding, deleting, and modifying device control events, and the corresponding event version relationship of the update device control events, the gateway device can quickly determine the differentiated data in the configuration update data relative to the historical scenario data. This reduces the transmission pressure of data synchronization between the gateway device and the proxy gateway, helps to ensure efficient and reliable data transmission, and improves the user experience.
[0105] In an optional embodiment, the device control data synchronization method further includes: determining whether at least one of the following conditions is met: obtaining a configuration update instruction issued by the terminal device or the cloud, obtaining configuration update data issued by the terminal device or the cloud, obtaining a request synchronization instruction sent by the proxy gateway, the network conditions not meeting the preset requirements, or the set synchronization time period; if the conditions are met, it is determined that the current data synchronization triggering conditions are met.
[0106] Network conditions refer to conditions characterizing network quality, such as the network data transmission rate. The specific conditions for obtaining configuration update instructions from the terminal device or cloud, obtaining configuration update data from the terminal device or cloud, obtaining a synchronization request instruction from the proxy gateway, network conditions not meeting preset requirements, and the set synchronization time period can be: the gateway device actively obtaining configuration update instructions from the terminal device or cloud, the gateway device receiving configuration update data from the terminal device or cloud, the gateway device receiving a synchronization request instruction from the proxy gateway, the gateway device's network data transmission rate being insufficient for smooth network data transmission, and the gateway device detecting that it is time to synchronize data with the proxy gateway. Here, if the gateway device determines that at least one of the above conditions exists, it determines that the data synchronization trigger condition is met.
[0107] In this way, by pre-setting data synchronization trigger conditions, the gateway device can automatically detect whether the preset synchronization trigger conditions are met to trigger data synchronization with the proxy gateway. Multiple trigger conditions trigger data synchronization between the gateway device and the proxy gateway, which is conducive to timely data synchronization between various proxy gateways and the gateway device, thus improving the user experience.
[0108] In an optional embodiment, after the device control event to be synchronized is determined based on the difference and sent to the proxy gateway, the method further includes: sending data integrity verification information to the proxy gateway; receiving verification information returned by the proxy gateway based on the received data integrity verification information to verify whether the update was successful; and determining the data synchronization completion status of the gateway device based on the verification information.
[0109] Integrity verification information can be message digest information generated based on the content of the updated configuration data. This message digest information transforms a message of arbitrary length into a fixed-length message. It is generated by calculating the message using a one-way hash function. The digest algorithm is irreversible, such as CRC32, MD5, SHA1, etc. The message digest information is mainly used to verify whether the content of the device control events to be synchronized by the gateway device has been completely sent to the proxy gateway. Sending data integrity verification information to the proxy gateway can refer to the gateway device sending the message digest information to the proxy gateway; receiving verification information returned by the proxy gateway based on the received data integrity verification information to verify whether the update was successful, and determining the data synchronization completion status of the gateway device based on the verification information, can refer to the gateway device receiving the verification information returned by the proxy gateway based on the received message digest information to verify whether the update was successful, and determining the data synchronization completion status of the gateway device based on the verification information. For example, a gateway device sends a message digest of 0x123xx678 to a proxy gateway. After receiving this message digest, the proxy gateway compares it with its own message digest generated after updating historical scene data. If the message digest generated by the proxy gateway is also 0x123xx678, it returns a successful verification message to the gateway device. The gateway device determines that its data synchronization is complete based on the successful verification message. If the message digest generated by the proxy gateway is not 0x123xx678, it returns a failed verification message to the gateway device. The gateway device determines that its data synchronization is incomplete based on the failed verification message.
[0110] In this embodiment, the gateway device determines whether data synchronization with the proxy gateway is complete by sending data integrity verification information to the proxy gateway. This helps the gateway device determine which proxy gateways in the network have completed the synchronization of configuration scenario data and which have not. Thus, data is sent separately to the proxy gateways that have not completed the synchronization of configuration scenario data, which is conducive to efficiently completing data synchronization between the gateway device and all proxy gateways.
[0111] Please see Figure 4 This application provides a device control data synchronization method, applied to a proxy gateway, comprising:
[0112] Step S401: Receive the updated scenario version number of the device control scenario issued by the gateway device.
[0113] The updated scenario version number refers to the latest version number obtained after the gateway device updates the configuration data version number of the device control scenario each time based on the configuration update data. The configuration data version number of the device control scenario refers to the version number of the device control event with the highest version number among all device control events included in the device control scenario. For example, in Table 1, the version number 13 of the device control event with ID number 4 is the version number of the device control event with the highest version number among all device control events; therefore, the configuration data version number of the device control scenario represented by Table 1 is set to 13. The updated scenario version number of the device control scenario received from the gateway device refers to the updated scenario version number of the device control scenario received by the proxy gateway from the gateway device. For example, the proxy gateway receives the scenario version number 13 from Table 1 issued by the gateway device.
[0114] Step S402: Based on the currently stored historical scene version number, report the historical scene version number to the gateway device, and / or determine and report the difference between the updated scene version number and the historical scene version number currently stored by the proxy gateway to the gateway device.
[0115] The currently stored historical scenario version number refers to the configuration update scenario version number that the proxy gateway last successfully received from the gateway device before the current moment. The step of reporting the historical scenario version number to the gateway device based on the currently stored historical scenario version number, and / or determining and reporting the difference between the updated scenario version number and the currently stored historical scenario version number to the gateway device, can mean: the proxy gateway sends the currently stored historical scenario version number to the gateway device; and / or the proxy gateway compares the currently stored historical scenario version number with the received updated scenario version number, determines the difference between the updated scenario version number and the currently stored historical scenario version number, and reports the difference to the gateway device. For example, please refer to Tables 1 and 14, where Table 1 is the content mapping table corresponding to the configuration update data of the gateway device; and Table 14 is the content mapping table corresponding to the historical scenario data of the proxy gateway. Here, the update scenario version number sent by the gateway device to the proxy gateway is 13, the historical scenario version number currently stored by the proxy gateway is 10, the proxy gateway determines that the difference between the update scenario version number and the historical scenario version number currently stored by the proxy gateway is 3, and reports the difference 3 to the gateway device.
[0116]
[0117] Table 14
[0118] Step S403: Receive the device control event to be synchronized issued by the gateway device based on the difference between the updated scenario version number and the historical scenario version number currently stored by the proxy gateway, and update the scenario data and configuration data version information of the device control scenario according to the device control event to be synchronized.
[0119] The proxy gateway receives the updated scenario version number of the device control scenario issued by the gateway device. For example, referring to Table 1, the gateway device updates the configuration data version number of the device control scenario based on the configuration update data of the newly added device control event with ID 4, obtaining an updated scenario version number of 13. When the synchronization trigger condition is met, the gateway device sends the updated scenario version number 13 to the proxy gateway, and the proxy gateway receives the updated scenario version number 13 of the device control scenario issued by the gateway device. Receiving the device control event to be synchronized issued by the gateway device based on the difference between the updated scenario version number and the historical scenario version number currently stored by the proxy gateway, and updating the scenario data and configuration data version information of the device control scenario based on the device control event to be synchronized, can refer to: the proxy gateway receiving the device control event to be synchronized issued by the gateway device based on the difference between the updated scenario version number and the historical scenario version number currently stored by the proxy gateway, and updating the scenario data and configuration data version number of the device control scenario based on the device control event to be synchronized. For example, please refer to Tables 1 and 14, where Table 1 is the content mapping table corresponding to the configuration update data of the gateway device; and Table 14 is the content mapping table corresponding to the historical scenario data of the proxy gateway. Here, the gateway device determines the device control events to be synchronized as device control events with version numbers 11 to 13 based on the difference of 3 between the update scenario version number 13 and the historical scenario version number 10 currently stored by the proxy gateway. The proxy gateway receives the device control events with version numbers 11 to 13 issued by the gateway device, and updates the device control events, their validity, and configuration data version numbers in the device control scenarios currently stored by the gateway device according to the device control events with version numbers 11 to 13.
[0120] In the above embodiments, the proxy gateway receives the updated scenario version number of the device control scenario issued by the gateway device, and determines the device control events to be synchronized between the two based on the difference between the updated scenario version number and the historical scenario version number currently stored by the proxy gateway. In this way, incremental transmission of differentiated data is used between the gateway device and the proxy gateway, which effectively reduces the transmission pressure when the gateway device and the proxy gateway synchronize data, ensures efficient and reliable data transmission, and improves the user experience.
[0121] In an optional embodiment, the device control data synchronization method further includes: receiving data integrity verification information sent by the gateway device; determining, based on the data integrity verification information, whether the updated configuration data version number of the device control scenario is consistent with the updated scenario version number sent by the gateway device; if consistent, returning verification success information to the gateway device.
[0122] Receiving the data integrity verification information sent by the gateway device can refer to the proxy gateway receiving the data integrity verification information sent by the gateway device. For example, the proxy gateway may receive message digest information sent by the gateway device. The message digest information can be 0x123xx678 (CRC32 or MD5, etc.). Determining whether the updated configuration data version number of the device control scenario is consistent with the updated scenario version number sent by the gateway device based on the data integrity verification information, and returning successful verification information to the gateway device if they are consistent, can refer to the proxy gateway determining whether the updated configuration data version number of the device control scenario is consistent with the updated scenario version number sent by the gateway device based on the data integrity verification information; if they are consistent, returning successful verification information to the gateway device. For example, the proxy gateway receives message digest information sent by the gateway device and generates updated message digest information based on the updated configuration update data of the updated device control scenario. Then, the proxy gateway determines whether the message digest information sent by the gateway device is consistent with the updated message digest information. If they are consistent, the proxy gateway determines that the version number of the updated device control scenario configuration data is consistent with the version number of the updated scenario sent by the gateway device, and returns a verification message indicating successful verification to the gateway device.
[0123] In the above embodiments, the proxy gateway determines whether the data synchronization between itself and the gateway device is successful by receiving data integrity verification information sent by the gateway device. This facilitates timely and efficient data synchronization between the proxy gateway and the gateway device.
[0124] In an optional embodiment, the device control data synchronization method further includes: periodically reporting the historical scene version number of the proxy gateway to the gateway device; receiving response information sent by the gateway device based on the historical scene version number, and determining whether to update the scene data and configuration data information of the device control scene of the proxy gateway based on whether the response information contains a device control event to be synchronized.
[0125] The periodic reporting of the historical scene version number of the proxy gateway to the gateway device can refer to: the proxy gateway periodically and proactively reporting its historical scene version number to the gateway device; or, the proxy gateway receiving a trigger message periodically issued by the gateway device to obtain its historical scene version number, and the proxy gateway reporting its historical scene version number to the gateway device based on the trigger message. The receipt of response information from the gateway device based on the historical scene version number, and determining whether to update the scene data and configuration data version information of the proxy gateway's device control scene based on whether the response information contains a device control event to be synchronized, can refer to: the proxy gateway receiving the response information from the gateway device based on the historical scene version number; if the response information contains a device control event to be synchronized, then the proxy gateway needs to update the currently stored scene data and configuration data version information of the device control scene; if the response information does not contain a device control event to be synchronized, then the proxy gateway does not need to update the currently stored scene data and configuration data version information of the device control scene.
[0126] In the above embodiments, the proxy gateway periodically sends the currently stored historical scene version number to the gateway device to check whether the scene data between the proxy gateway and the gateway device is synchronized. This helps to ensure timely and efficient data synchronization between the proxy gateway and the gateway device, thereby improving the user experience.
[0127] To gain a more comprehensive understanding of the device control data synchronization method provided in this application, please refer to [link / reference needed]. Figure 5 The following is an exemplary description of a device control data synchronization method, which is applied to a device control data synchronization system consisting of a gateway device and multiple proxy gateways. Specifically, data synchronization between the gateway device and one of the multiple proxy gateways may include:
[0128] S501, the gateway device obtains the configuration update data for the device control scenario sent from the cloud;
[0129] The configuration update data includes the addition, deletion, and / or modification of device control events contained in the device control scenario.
[0130] S502, the gateway device updates the device control event number and validity in the device control scenario according to the configuration update data and according to the set coding rules to obtain the updated event version correspondence and update the configuration data version number of the device control scenario to obtain the updated scenario version number.
[0131] S503, the gateway device obtains the current stored historical scene version number of the proxy gateway;
[0132] S504, the gateway device determines the difference between the updated scenario version number and the historical scenario version number. If the difference is greater than zero, proceed to S505; otherwise, proceed to S512.
[0133] S505, the gateway device determines the device control event to be synchronized based on the difference and the updated event version correspondence;
[0134] S506, The gateway device sends the device control event to be synchronized and the update scenario version number to the proxy gateway;
[0135] S507, the proxy gateway receives the updated scenario version number and the device control event to be synchronized, and updates the scenario data and configuration data version number of the device control scenario according to the device control event to be synchronized;
[0136] S508, the gateway device generates message digest information based on the configuration update data and sends the message digest information to the proxy gateway;
[0137] S509, the proxy gateway receives the message digest information generated by the configuration update data and compares it with the message digest information generated by the scenario data and configuration data version number of the device control scenario stored in its own storage; if the message digest information of the two are consistent, proceed to S510; otherwise, proceed to S511.
[0138] S510, the proxy gateway returns a successful update verification message to the gateway device;
[0139] S511, the proxy gateway returns a verification message indicating that the update failed to the gateway device;
[0140] S512, the gateway device confirms that data synchronization is complete.
[0141] In the above embodiments, the gateway device initiates a data synchronization trigger mechanism with multiple proxy gateways by obtaining the configuration update data for device control scenarios issued by the cloud. This effectively synchronizes all device control events currently stored by each proxy gateway with all device control events currently stored by the gateway device. Moreover, the incremental transmission of differentiated data between the gateway device and the proxy gateways effectively reduces the transmission pressure when synchronizing data, ensuring efficient and reliable data transmission and improving the user experience.
[0142] To provide a clearer understanding of the device control data synchronization method provided in this application, Tables 15 to 18 are used as specific examples to illustrate the original configuration data and configuration update data of the device control scenario in the gateway device.
[0143]
[0144] Table 15
[0145]
[0146] Table 16
[0147]
[0148] Table 17
[0149]
[0150]
[0151] Table 18
[0152] Users can update the configuration data of the device control scenario using a terminal device. The terminal device obtains the user's updated configuration data for the device control scenario and sends it to the gateway device. Please refer to Tables 15 and 16, where Table 15 shows the original configuration data of the device control scenario in the gateway device, and Table 16 shows the updated configuration data of the device control scenario in the gateway device. Based on the original configuration data of the device control scenario containing three device control events with IDs 1, 2, and 3, the device control event with ID 3 is deleted. The updated configuration data obtained by the gateway device is: the configuration update data obtained by the gateway device for deleting the device control event with ID 3 and version number 9 in the original configuration data; and according to the updated configuration data, the version number of the device control event with ID 3 and version number 9 is set to 10, the valid value is set to 0, and the updated scenario version number is set to 10 according to preset rules. Please refer to Tables 16 and 17, where Table 16 shows the historical configuration data of the device control scenario in the gateway device, and Table 17 shows the updated configuration data of the device control scenario in the gateway device. Based on the original configuration data of the device control scenario, which includes three device control events with IDs 1, 2, and 3, the device control events with IDs 1 and 2 are modified. The gateway device obtains the following configuration update data for the device control scenario: the gateway device obtains the configuration update data for modifying the device control events with IDs 1 and 7, and IDs 2 and 8 in the original configuration data. According to the configuration update data, the gateway device sets the version number of the device control event with ID 1 and 7 to 11 and the valid value to 1, and sets the version number of the device control event with ID 2 and 8 to 12 and the valid value to 1, and sets the updated scenario version number to 12, following a preset encoding rule. Please refer to Tables 17 and 18. Table 17 shows the historical configuration data of the device control scenario in the gateway device, and Table 18 shows the configuration update data of the device control scenario in the gateway device. Based on the historical configuration data of the device control scenario, which includes three device control events with IDs 1, 2, and 3, a new device control event with ID 4 is added. The gateway device obtains the configuration update data for the device control scenario as follows: the gateway device obtains the configuration update data for the newly added device control event with ID 4; and according to the configuration update data, the version number of the newly added device control event with ID 4 is set to 13, the valid value is set to 1, and the updated scenario version number is set to 13 according to the preset encoding rules.
[0153] To provide a clearer understanding of the device control data synchronization method provided in this application, the following optional specific example illustrates the comparison between the configuration update data of the device control scenario in the gateway device and the historical scenario data currently stored in the proxy gateway.
[0154]
[0155] Table 19
[0156]
[0157] Table 20
[0158]
[0159] Table 21
[0160]
[0161] Table 22
[0162] The gateway device obtains the configuration update data sent by the terminal and the version number of the currently stored historical scenario sent by the proxy gateway. Please refer to Tables 19 and 20. Table 19 is the content mapping table of the configuration update data of the device control scenario in the gateway device, and Table 20 is the content mapping table of the currently stored historical scenario data in the proxy gateway. Here, based on the updated scenario version number 13 obtained by the gateway device and the historical scenario version number 9 obtained by the proxy gateway, the gateway device determines the difference between the updated scenario version number and the historical scenario version number currently stored by the proxy gateway. Based on the difference, the gateway device determines the device control events to be synchronized to be sent to the proxy gateway as follows: Based on the difference of 4 between the updated scenario version number 13 in Table 19 and the historical scenario version number 9 currently stored by the proxy gateway in Table 20, the gateway device determines to send the device control events with version numbers 10 to 13 in Table 19 to the proxy gateway. However, since the historical configuration data currently stored by the proxy gateway does not include the device control event with ID 3, and the valid value of the device control event with ID 3 and version number 10 in Table 19 is 0, that is, the device control event with version number 10 in Table 19 is an invalid event, the gateway device only needs to send the device control events with version numbers 11 to 13 to the proxy gateway. Please refer to Tables 19 and 21. Table 19 is a content mapping table of configuration update data for device control scenarios in the gateway device, and Table 21 is a content mapping table of another historical scenario data currently stored in the proxy gateway. Here, based on the updated scenario version number 13 obtained by the gateway device and the historical scenario version number 10 of the proxy gateway, the gateway device determines the difference between the updated scenario version number and the historical scenario version number currently stored by the proxy gateway. Based on the difference, the gateway device determines that the device control events to be synchronized will be sent to the proxy gateway as follows: Based on the difference of 3 between the updated scenario version number 13 in Table 19 and the historical scenario version number 10 currently stored by the proxy gateway in Table 21, the gateway device determines that device control events with version numbers 11 to 13 in Table 19 will be sent to the proxy gateway. Please refer to Tables 19 and 22. Table 19 is a content mapping table of configuration update data for device control scenarios in the gateway device, and Table 22 is a content mapping table of another historical scenario data currently stored in the proxy gateway. Here, based on the updated scene version number of 13 obtained by the gateway device and the historical scene version number of 12 obtained by the proxy gateway, the gateway device determines the difference between the updated scene version number and the historical scene version number currently stored by the proxy gateway, and determines the device control event to be synchronized to be sent to the proxy gateway based on the difference between the updated scene version number 13 in Table 19 and the historical scene version number 12 currently stored by the proxy gateway in Table 22, and determines to send the device control event with version number 13 in Table 19 to the proxy gateway.
[0163] Please see Figure 6In another aspect, this application also provides a gateway device, comprising: an acquisition module 601, configured to acquire configuration update data for a device control scenario; a first update module 602, configured to update the configuration data version information of the device control scenario according to the configuration update data and a set rule to obtain an update scenario version number; and a first sending module 603, configured to send the update scenario version number to a proxy gateway when the data synchronization trigger condition is met, determine the difference between the update scenario version number and the historical scenario version number currently stored by the proxy gateway, and determine the device control event to be synchronized based on the difference and send it to the proxy gateway.
[0164] The first update module 602 is further configured to update the number and validity of the device control events included in the device control scenario according to the configuration update data and according to the set encoding rules to obtain the updated event version correspondence, and update the configuration data version number of the device control scenario included in the device control scenario to obtain the updated scenario version number.
[0165] The first sending module 603 is further configured to determine the difference between the updated scenario version number and the historical scenario version number currently stored by the proxy gateway, and based on the difference and the correspondence between the updated event versions, determine the target number of the device control event to be synchronized; and send the device control event matching the target number to the proxy gateway.
[0166] The first sending module 603 is further configured to determine the difference between the updated scenario version number and the historical scenario version number currently stored by the proxy gateway, and based on the difference, determine the intermediate scenario version number in which the gateway device has changed the configuration data of the device control scenario relative to the proxy gateway; and determine the target number of the device control event to be synchronized with the new number contained in the historical scenario version number according to the event version correspondence corresponding to the intermediate scenario version number.
[0167] The first update module 602 is further configured to, when the configuration update data is for adding device control events, add new device control events included in the device control scenario, add a new number to the newly added device control events according to a set coding rule, set the validity value of the newly added device control events to a first value, and obtain an updated event version correspondence based on the number and validity of the newly added device control events; and / or, when the configuration update data is for deleting device control events, set the validity value of the device control events to be deleted included in the device control scenario to a second value, and obtain an updated event version correspondence based on the number and validity of the deleted device control events; and / or, when the configuration update data is for modifying device control events, set the validity value of the device control events before modification to a second value, add modified device control events, add a new number to the newly added device control events according to a set coding rule, set the validity value of the newly added device control events to a first value, and obtain an updated event version correspondence based on the number and validity of the modified device control events.
[0168] The gateway device further includes a determination module 604, used to determine whether at least one of the following conditions is met: obtaining a configuration update instruction sent by a terminal device or the cloud, obtaining configuration update data sent by a terminal device or the cloud, obtaining a request synchronization instruction sent by a proxy gateway, network conditions not meeting preset requirements, or a set synchronization time period; if the conditions are met, it is determined that the current data synchronization triggering conditions are met.
[0169] The gateway device further includes: the first sending module 603, which is further configured to send data integrity verification information to the proxy gateway; the determining module 604, which is further configured to receive verification information returned by the proxy gateway based on the received data integrity verification information to verify whether the update was successful, and determine the data synchronization completion status of the gateway device according to the verification information.
[0170] Please see Figure 7 In another aspect, this application also provides a proxy gateway, comprising: a receiving module 701, configured to receive the updated scenario version number of the device control scenario issued by a gateway device; a second sending module 702, configured to report the historical scenario version number to the gateway device based on the currently stored historical scenario version number, and / or determine the difference between the updated scenario version number and the historical scenario version number currently stored by the proxy gateway and report it to the gateway device; and a second updating module 703, configured to receive a device control event to be synchronized issued by the gateway device based on the difference between the updated scenario version number and the historical scenario version number currently stored by the proxy gateway, and update the scenario data and configuration data version number of the device control scenario according to the device control event to be synchronized.
[0171] The proxy gateway further includes: the receiving module 701, which is also used to receive data integrity verification information sent by the gateway device; the second sending module 702, which is also used to determine whether the updated configuration data version number of the device control scenario is consistent with the updated scenario version number sent by the gateway device based on the data integrity verification information; if consistent, returning verification information indicating successful verification to the gateway device.
[0172] The proxy gateway further includes: the second sending module 702, which is also used to periodically report the historical scene version number of the proxy gateway to the gateway device; and the second updating module 703, which is also used to receive response information sent by the gateway device based on the historical scene version number, and determine whether to update the scene data and configuration data version number of the device control scene of the proxy gateway according to whether the response information contains a device control event to be synchronized.
[0173] It should be noted that the gateway device and proxy gateway provided in the above embodiments are only illustrated by the division of the above program modules in the process of realizing device control data synchronization. In practical applications, the above processing can be assigned to different program modules as needed, that is, the internal structure of the device can be divided into different program modules to complete all or part of the method steps described above. In addition, the gateway device provided in the above embodiments and the device control data synchronization method embodiment applied to the gateway device belong to the same concept, and the proxy gateway provided in the above embodiments and the device control data synchronization method embodiment applied to the proxy gateway belong to the same concept. For details of their specific implementation process, please refer to the method embodiments, which will not be repeated here.
[0174] In another respect, please refer to this application. Figure 8 The application also provides a gateway device, including a first processor 801 and a first memory 802. The first memory 802 stores a computer program that can be executed by the first processor 801. When the computer program is executed by the first processor 801, it implements the device control data synchronization method provided by any embodiment of the present application for the gateway device, and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0175] In another respect, please refer to this application. Figure 9 The application also provides a proxy gateway, including a second processor 901 and a second memory 902. The second memory 902 stores a computer program that can be executed by the second processor 901. When the computer program is executed by the second processor 901, it implements the device control data synchronization method provided by the proxy gateway in any embodiment of the present application and can achieve the same technical effect. To avoid repetition, it will not be described in detail here.
[0176] This application also provides a computer-readable storage medium storing a computer program. When executed by a processor, this computer program implements the various processes of the above-described device control data synchronization method embodiments and achieves the same technical effects. To avoid repetition, it will not be described again here. The computer-readable storage medium may include a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0177] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A device control data synchronization method, applied to a gateway device, characterized in that, include: Obtain configuration update data for the device control scenario; The device control scenario refers to controlling the state of a corresponding controlled device to reach a desired state through at least one device control event. The device control event refers to an operation event that controls the state switching of the controlled device. The configuration update data includes update data for the device control events in the device control scenario. Based on the configuration update data, the configuration data version information of the device control scenario is updated according to the set rules to obtain the updated scenario version number; When the data synchronization triggering conditions are met, the updated scenario version number is sent to the proxy gateway, the difference between the updated scenario version number and the historical scenario version number currently stored by the proxy gateway is determined, and the device control event to be synchronized is determined based on the difference and sent to the proxy gateway. The proxy gateway is a special node that, after the gateway device fails, takes over the execution of the device control scenario to control the state of the corresponding controlled device to reach the expected state. The step of updating the configuration data version information of the device control scenario according to the configuration update data and a set rule to obtain the updated scenario version number includes: Based on the configuration update data, the number and validity of the device control events included in the device control scenario are updated according to the set coding rules to obtain the updated event version correspondence, and the configuration data version number of the device control scenario included in the device control scenario is updated to obtain the updated scenario version number. The step of determining the difference between the updated scenario version number and the historical scenario version number currently stored by the proxy gateway, and determining the device control event to be synchronized and sending it to the proxy gateway based on the difference, includes: Determine the difference between the updated scenario version number and the historical scenario version number currently stored by the proxy gateway. Based on the difference, determine the intermediate scenario version number in which the gateway device has changed the configuration data of the device control scenario relative to the proxy gateway. According to the event version correspondence corresponding to the intermediate scenario version number, determine the target number of the device control event to be synchronized relative to the historical scenario version number. The device control event matching the target number is sent to the proxy gateway.
2. The device control data synchronization method as described in claim 1, characterized in that, The configuration update data includes the addition, deletion, and / or modification of device control events included in the device control scenario; the step of updating the numbering and validity of the device control events included in the device control scenario according to the configuration update data and a set coding rule to obtain the updated event version correspondence includes: When the configuration update data involves adding device control events, the device control events included in the device control scenario are added, and new numbers are assigned to the newly added device control events according to a set coding rule. The validity value of the newly added device control events is set to a first value, and the updated event version correspondence is obtained based on the numbers and validity of the newly added device control events; and / or, When the configuration update data involves deleting device control events, the valid value of the device control events to be deleted included in the device control scenario is set to a second value. The updated event version correspondence is obtained based on the number and validity of the deleted device control events; and / or, When the configuration update data involves modifying a device control event, the valid value of the device control event before modification is set to a second value, and a new modified device control event is added. A new number is added to the new device control event according to the set coding rules, and the valid value of the new device control event is set to a first value. The updated event version correspondence is obtained based on the number and validity of the modified device control event.
3. The device control data synchronization method as described in claim 1 or 2, characterized in that, Also includes: Determine whether at least one of the following conditions is met: obtaining a configuration update command issued by the terminal device or the cloud, obtaining configuration update data issued by the terminal device or the cloud, obtaining a request synchronization command sent by the proxy gateway, network conditions not meeting the preset requirements, or the set synchronization time period. If the conditions are met, then the current data synchronization trigger condition is determined to be satisfied.
4. The device control data synchronization method as described in claim 1 or 2, characterized in that, After the step of determining the device control event to be synchronized based on the difference and sending it to the proxy gateway, the method further includes: Send data integrity verification information to the proxy gateway; The system receives verification information returned by the proxy gateway based on the received data integrity verification information to verify whether the update was successful, and determines the data synchronization completion status of the gateway device based on the verification information.
5. A device control data synchronization method, applied to a proxy gateway, wherein the proxy gateway is a special node that, after the gateway device fails, replaces the gateway device to execute the device control scenario to control the state of the corresponding controlled device to reach the expected state; characterized in that, include: Receive the updated scenario version number of the device control scenario issued by the gateway device; The device control scenario refers to controlling the state of the corresponding controlled device to reach the expected state through at least one device control event. The device control event refers to the operation event that controls the state switching of the controlled device. The update scenario version number is obtained by the gateway device updating the number and validity of the device control events included in the device control scenario according to the configuration update data and the set coding rules to obtain the updated event version correspondence, as well as updating the configuration data version number of the device control scenario included in the device control scenario. Based on the currently stored historical scene version number, the historical scene version number is reported to the gateway device, and / or the difference between the updated scene version number and the historical scene version number currently stored by the proxy gateway is determined and reported to the gateway device; Receive a device control event to be synchronized from the gateway device based on the difference between the updated scenario version number and the historical scenario version number currently stored by the proxy gateway, and update the scenario data and configuration data version information of the device control scenario according to the device control event to be synchronized; The device control event to be synchronized is determined by the gateway device based on the difference, which indicates that the gateway device has made changes to the configuration data of the device control scenario relative to the proxy gateway. According to the event version correspondence corresponding to the intermediate scenario version number, a new number contained relative to the historical scenario version number is determined as the target number, and the device control event matching the target number is taken as the device control event to be synchronized.
6. The equipment control data synchronization method as described in claim 5, characterized in that, Also includes: Receive data integrity verification information sent by the gateway device; Based on the data integrity verification information, determine whether the updated configuration data version number of the device control scenario is consistent with the updated scenario version number issued by the gateway device; If they match, a verification message indicating successful verification is returned to the gateway device.
7. The equipment control data synchronization method as described in claim 5, characterized in that, Also includes: The proxy gateway periodically reports the historical scenario version number to the gateway device. The system receives response information from the gateway device based on the historical scenario version number, and determines whether to update the scenario data and configuration data version information of the proxy gateway's device control scenario based on whether the response information contains a device control event to be synchronized.
8. A gateway device, characterized in that, include: The acquisition module is used to acquire configuration update data for the device control scenario; The device control scenario refers to controlling the state of a corresponding controlled device to reach a desired state through at least one device control event. The device control event refers to an operation event that controls the state switching of the controlled device. The configuration update data includes update data for the device control events in the device control scenario. The first update module is used to update the configuration data version information of the device control scenario according to the configuration update data and a set rule to obtain an updated scenario version number; wherein, the first update module is specifically used to update the number and validity of the device control events included in the device control scenario according to the configuration update data and a set coding rule to obtain an updated event version correspondence, and to update the configuration data version number of the device control scenario included in the device control scenario to obtain an updated scenario version number; The first sending module is used to send the updated scenario version number to the proxy gateway when the data synchronization trigger condition is met, determine the difference between the updated scenario version number and the historical scenario version number currently stored by the proxy gateway, and determine the device control event to be synchronized based on the difference and send it to the proxy gateway. The proxy gateway is a special node that, after the gateway device fails, takes over the execution of the device control scenario to control the state of the corresponding controlled device to reach the expected state. Specifically, the first sending module is used to determine the difference between the updated scenario version number and the historical scenario version number currently stored by the proxy gateway, determine the intermediate scenario version number in which the gateway device has changed the configuration data of the device control scenario relative to the proxy gateway based on the difference, determine the target number of the device control event to be synchronized relative to the historical scenario version number according to the event version correspondence of the intermediate scenario version number, and send the device control event matching the target number to the proxy gateway.
9. A proxy gateway, characterized in that, The proxy gateway is a special node that, after the gateway device fails, takes over the execution of the device control scenario to control the state of the corresponding controlled device to reach the expected state; including: The receiving module is used to receive the updated scenario version number of the device control scenario issued by the gateway device; the device control scenario refers to controlling the state of the corresponding controlled device to reach the expected state through at least one device control event, and the device control event refers to the operation event that controls the state switching of the controlled device; The second sending module is used to report the historical scene version number to the gateway device based on the currently stored historical scene version number, and / or to determine the difference between the updated scene version number and the historical scene version number currently stored by the proxy gateway and report it to the gateway device; the updated scene version number is obtained by the gateway device updating the number and validity of the device control events included in the device control scene according to the configuration update data and the set encoding rules to obtain the updated event version correspondence, and updating the configuration data version number of the device control scene included in the device control scene; The second update module is used to receive a device control event to be synchronized issued by the gateway device based on the difference between the updated scenario version number and the historical scenario version number currently stored by the proxy gateway, and to update the scenario data and configuration data version information of the device control scenario according to the device control event to be synchronized; the device control event to be synchronized is determined by the gateway device based on the difference, which indicates that the gateway device has made changes to the configuration data of the device control scenario relative to the proxy gateway, and the new number contained relative to the historical scenario version number is determined as the target number according to the event version correspondence corresponding to the intermediate scenario version number, and the device control event matching the target number is taken as the device control event to be synchronized.
10. A gateway device, characterized in that, It includes a first processor and a first memory, wherein the first memory stores a computer program that can be executed by the first processor, and the computer program, when executed by the first processor, implements the device control data synchronization method as described in any one of claims 1 to 4.
11. A proxy gateway, characterized in that, It includes a second processor and a second memory, wherein the second memory stores a computer program that can be executed by the second processor, and the computer program, when executed by the second processor, implements the device control data synchronization method as described in any one of claims 5 to 7.
12. A device control data synchronization system, characterized in that, include: The gateway device of claim 10 and the proxy gateways of claims 11, wherein, The gateway device is used to send the device control events to be synchronized to at least one of the proxy gateways; The proxy gateway is used to receive the device control events to be synchronized, and update the scene data and configuration data version information of the device control scenario according to the device control events to be synchronized.
13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by the controller, implements the device control data synchronization method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Data synchronization method and device, electronic equipment and storage medium
CN109600423A
Application data processing method, device and equipment
CN112559194A
