A multi-intelligent gateway cascading-based main gateway failure self-recovery control method and system
By using a self-recovery control method that cascades multiple smart gateways, a new master gateway is automatically elected, solving the problem of smart home system control interruption caused by master gateway failure, and achieving rapid recovery and optimized user experience.
Patent Information
- Application Number
- CN202610513882.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-04-17
- Publication Date
- 2026-07-10
Smart Images

Figure CN122372405A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of smart gateway technology, and in particular to a method and system for self-recovery control of master gateway failure based on cascading multiple smart gateways. Background Technology
[0002] In large homes or multi-space residences, due to the large number and wide distribution of smart devices, multiple smart gateways are typically required to ensure communication stability and real-time control. Existing solutions often employ a master-slave gateway cascade structure, as shown below: (1) A main gateway is responsible for unified device management, policy decision-making, and instruction distribution; (2) Multiple gateways manage their respective regional devices; (3) The master and slave gateways establish a connection through the MQTT lightweight communication protocol. User control commands are first sent to the master gateway and then forwarded by the master gateway to the corresponding slave gateway for execution.
[0003] However, the existing solutions have obvious flaws: (1) When the main gateway fails due to hardware damage, system crash or power outage, the entire smart home system will be unable to be controlled in a unified manner; (2) The recovery process usually requires manual replacement of the main gateway and reconfiguration of the device, which results in a long recovery cycle and a poor user experience; To address the shortcomings of existing solutions, we propose a self-recovery control method and system for master gateway failure based on multi-intelligent gateway cascading. Summary of the Invention
[0004] This invention proposes a self-recovery control method and system for main gateway failure based on multi-intelligent gateway cascading, in order to solve the problems mentioned in the background art.
[0005] To achieve the above objectives, the present invention adopts the following technical solution: A self-recovery control method for main gateway failure based on multi-smart gateway cascading includes the following steps: S1: Gateway status monitoring, which specifically includes the following steps: S101: First, the gateway status monitoring module continuously monitors the operating status of the original master gateway. During the normal operation of the smart home, the original master gateway maintains a connection with each slave gateway through the MQTT communication protocol and performs status synchronization periodically. S102: Determine whether the original master gateway is in normal operation. If the monitoring results show that the original master gateway is operating normally, then maintain the existing master-slave gateway structure and continue to operate. S2: Determination of failure of the original main gateway: When the gateway status monitoring module detects the following situations of the original main gateway, specifically the failure to receive the main network key-hopping information for a long time, the interruption of MQTT communication connection and the abnormal system status synchronization, the gateway failure determination module determines that the original main gateway has failed. S3: Configure backup and restore, which includes the following steps: S301: During normal operation, the original main gateway periodically backs up the system configuration through the configuration backup and recovery module and synchronizes the backup information to the slave gateway; S302: After the original primary gateway fails, the secondary gateway loads the most recent backup configuration through the configuration backup and recovery module, enabling the secondary gateway to quickly inherit the system management capabilities of the original primary gateway. S4: Candidate Master Gateway Evaluation: After S302 completes the configuration recovery, the currently online slave gateways are automatically selected as the candidate master gateway set, and their operating capabilities are evaluated through the candidate master gateway evaluation module. The specific evaluation content includes gateway performance resources, number of connected devices, coverage of key devices, and network communication quality, and finally the operating indicators of the candidate gateways are obtained. S5: AI and Rule-Based Decisions: After obtaining the operational metrics of candidate gateways, the AI / rule-based decision-making module performs a comprehensive analysis of the candidate gateways to determine the most suitable node to serve as the primary gateway. S6: User Confirmation: When the scores of multiple candidate gateways are close, the candidate gateway information can be displayed to the user through the user interaction module, and the user can make a manual confirmation through the user selection module of the user interaction module. If the system evaluation results show that there is a clearly optimal gateway, the main gateway selection can be completed automatically without user intervention. S7: Master Gateway Role Switching: The selected candidate gateway is upgraded to the new master gateway through the master gateway role switching module, and the remaining gateways are rejoined as slave gateways in the new master-slave gateway structure. S8: Local Device Control Recovery: After the main gateway role switch is completed, the device control capability is gradually restored through the local device control recovery module. Then, the main and slave gateway structure is re-established and the normal operation status is restored. At this point, the main gateway failure self-recovery process is completed.
[0006] Preferably, in S101, periodically performing status synchronization specifically includes heartbeat information exchange, MQTT connection status detection, and system operation status synchronization.
[0007] Preferably, in step S2, when the failure condition is met, the original main gateway will enter the main gateway self-recovery process.
[0008] Preferably, in step S301, the backup information includes smart device registration information, device-gateway mapping relationship, and user scenario configuration.
[0009] Preferably, in S5, at the rule level, the factors that the system prioritizes include gateways with a large number of critical devices under management, gateways with high network connection stability, and gateways with sufficient system resources. At the AI level, the system introduces a gateway capability evaluation model, which comprehensively scores the operating status of candidate gateways to assist in the election of the primary gateway. The gateway capability evaluation model is as follows: GatewayScore = w1 × CPU_free + w2 × Memory_free + w3 × Device_weight + w4 × Network_quality; Where CPU_free represents the gateway's CPU idle rate, Memory_free represents the gateway's memory idle rate, Device_weight represents the importance weight of the devices managed by the gateway, Network_quality represents the network communication quality score, and w1-w4 are weight parameters.
[0010] Preferably, in step S7, the new main gateway will undertake system functions including unified management of smart devices, control command scheduling and distribution, and automated policy execution.
[0011] Preferably, in step S8, the recovery process prioritizes critical equipment and determines the equipment recovery priority through an equipment importance analysis mechanism. Once the critical equipment is recovered, the control and automation strategies for other equipment are then restored.
[0012] This invention proposes a self-recovery control system for main gateway failure based on multi-intelligent gateway cascading, including a gateway status monitoring module, a gateway failure judgment module, a configuration backup and recovery module, a candidate main gateway evaluation module, an AI / rule decision module, a user interaction module, a main gateway role switching module, and a local device control recovery module; The gateway status monitoring module is used to continuously monitor the operating status of the original main gateway; The gateway failure detection module is used to determine whether the original primary gateway has failed based on its status. Configure the backup and recovery module to perform backup information recovery operations when the original main gateway fails; The candidate primary gateway evaluation module is used to evaluate the operational capabilities of the candidate primary gateway set after recovery is completed, and obtain the candidate gateway operation indicators. The AI / rule decision module is used to perform comprehensive analysis on candidate gateways to determine the most suitable node to serve as the main gateway. The user interaction module is used to display candidate gateway information to users. The user interaction module also includes a user selection module, which allows users to make manual confirmations. The master gateway role switching module is used to upgrade the selected candidate gateway to the new master gateway, while the remaining gateways are rejoined as slave gateways in the new master-slave gateway structure. The local device control recovery module is used to gradually restore device control capabilities, then re-establish the master-slave gateway structure, and restore normal operation. The local device control recovery module includes a master-slave relationship update module and a device control recovery module, both of which are connected to the original master gateway and slave gateway.
[0013] Compared with existing technologies, when the main gateway failure is detected, the present invention automatically elects a new main gateway from the slave gateways by configuring backup, evaluating gateway capabilities and analyzing device importance, so as to ensure the continuous operation of key functions of the smart home system, and also greatly reduce the recovery cycle and improve the user experience. Attached Figure Description
[0014] Figure 1 This is a flowchart of a self-recovery control method for a main gateway failure based on cascading multiple smart gateways proposed in this invention; Figure 2 This is a flowchart of the main gateway switching process for a main gateway failure self-recovery control method based on multi-intelligent gateway cascading proposed in this invention. Figure 3 The diagram below shows the connection block diagram of a self-recovery control system for a main gateway failure based on cascading multiple intelligent gateways proposed in this invention. Detailed Implementation
[0015] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments.
[0016] Reference Figure 1-2 A self-recovery control method for main gateway failure based on multi-smart gateway cascading includes the following steps: S1: Gateway status monitoring, which specifically includes the following steps: S101: First, the gateway status monitoring module continuously monitors the operating status of the original master gateway. During the normal operation of the smart home, the original master gateway maintains a connection with each slave gateway through the MQTT communication protocol and performs status synchronization periodically. The periodic status synchronization specifically includes heartbeat information exchange, MQTT connection status detection, and system operation status synchronization. S102: Determine whether the original master gateway is in normal operation. If the monitoring results show that the original master gateway is operating normally, then maintain the existing master-slave gateway structure and continue to operate. S2: Determination of failure of the original main gateway: When the gateway status monitoring module detects the following situations of the original main gateway, specifically, the failure to receive the main network key-hopping information for a long time, the interruption of MQTT communication connection and the abnormal system status synchronization, the gateway failure determination module determines that the original main gateway has failed. When the failure conditions are met, the original main gateway will enter the main gateway self-recovery process. S3: Configure backup and restore, which includes the following steps: S301: During normal operation, the original main gateway periodically backs up the system configuration through the configuration backup and recovery module and synchronizes the backup information to the slave gateway. The backup information includes smart device registration information, device-gateway mapping relationship, and user scenario configuration. S302: After the original primary gateway fails, the secondary gateway loads the most recent backup configuration through the configuration backup and recovery module, enabling the secondary gateway to quickly inherit the system management capabilities of the original primary gateway. S4: Candidate Master Gateway Evaluation: After S302 completes the configuration recovery, the currently online slave gateways are automatically selected as the candidate master gateway set, and their operating capabilities are evaluated through the candidate master gateway evaluation module. The specific evaluation content includes gateway performance resources, number of connected devices, coverage of key devices, and network communication quality, and finally the operating indicators of the candidate gateways are obtained. S5: AI and Rule Decision: After obtaining the operating indicators of candidate gateways, the AI / rule decision module performs a comprehensive analysis of the candidate gateways to determine the most suitable node as the main gateway. At the rule level, the system prioritizes factors including gateways with a large number of critical devices under management, gateways with high network connection stability, and gateways with sufficient system resources. At the AI level, the system introduces a gateway capability evaluation model, which comprehensively scores the operating status of candidate gateways to assist in the election of the primary gateway. The gateway capability evaluation model is as follows: GatewayScore = w1 × CPU_free + w2 × Memory_free + w3 × Device_weight + w4 × Network_quality Where CPU_free represents the gateway's CPU idle rate, Memory_free represents the gateway's memory idle rate, Device_weight represents the importance weight of the devices managed by the gateway, Network_quality represents the network communication quality score, and w1-w4 are weight parameters; S6: User Confirmation: When the scores of multiple candidate gateways are close, the candidate gateway information can be displayed to the user through the user interaction module, and the user can make a manual confirmation through the user selection module of the user interaction module. If the system evaluation results show that there is a clearly optimal gateway, the main gateway selection can be completed automatically without user intervention. S7: Master Gateway Role Switching: The selected candidate gateway is upgraded to the new master gateway through the master gateway role switching module. The new master gateway will undertake system functions including unified management of smart devices, control command scheduling and distribution, and automated policy execution. At the same time, the remaining gateways are rejoined as slave gateways in the new master-slave gateway structure. S8: Local Device Control Recovery: After the main gateway role switch is completed, the device control capabilities are gradually restored through the local device control recovery module. Then, the main and slave gateway structure is re-established and the normal operation status is restored. At this point, the main gateway failure self-recovery process is completed. The recovery process prioritizes critical devices and determines the device recovery priority through the device importance analysis mechanism. After the critical devices are restored, the control and automation strategies of other devices are restored.
[0017] It should be noted that when the main gateway fails, this embodiment automatically elects a new main gateway from the slave gateways by configuring backup, evaluating gateway capabilities, and analyzing device importance. This ensures the continuous operation of key functions of the smart home system, greatly reduces the recovery cycle, and improves the user experience.
[0018] Reference Figure 3 This embodiment proposes a self-recovery control system for main gateway failure based on multi-intelligent gateway cascading, including a gateway status monitoring module, a gateway failure judgment module, a configuration backup and recovery module, a candidate main gateway evaluation module, an AI / rule decision module, a user interaction module, a main gateway role switching module, and a local device control recovery module; The gateway status monitoring module is used to continuously monitor the operating status of the original main gateway; The gateway failure detection module is used to determine whether the original primary gateway has failed based on its status. Configure the backup and recovery module to perform backup information recovery operations when the original main gateway fails; The candidate primary gateway evaluation module is used to evaluate the operational capabilities of the candidate primary gateway set after recovery is completed, and obtain the candidate gateway operation indicators. The AI / rule decision module is used to perform comprehensive analysis on candidate gateways to determine the most suitable node to serve as the main gateway. The user interaction module is used to display candidate gateway information to users. The user interaction module also includes a user selection module, which allows users to make manual confirmations. The master gateway role switching module is used to upgrade the selected candidate gateway to the new master gateway, while the remaining gateways are rejoined as slave gateways in the new master-slave gateway structure. The local device control recovery module is used to gradually restore device control capabilities, then re-establish the master-slave gateway structure, and restore normal operation. The local device control recovery module includes a master-slave relationship update module and a device control recovery module, both of which are connected to the original master gateway and slave gateway.
[0019] It should be noted that this embodiment proposes a main gateway failure self-recovery control system based on multi-intelligent gateway cascading, which is used to implement a main gateway failure self-recovery control method based on multi-intelligent gateway cascading.
[0020] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.
Claims
1. A self-recovery control method for a primary gateway failure based on cascading multiple intelligent gateways, characterized in that, Includes the following steps: S1: Gateway status monitoring, which specifically includes the following steps: S101: First, the gateway status monitoring module continuously monitors the operating status of the original master gateway. During the normal operation of the smart home, the original master gateway maintains a connection with each slave gateway through the MQTT communication protocol and performs status synchronization periodically. S102: Determine whether the original master gateway is in normal operation. If the monitoring results show that the original master gateway is operating normally, then maintain the existing master-slave gateway structure and continue to operate. S2: Determination of failure of the original main gateway: When the gateway status monitoring module detects the following situations of the original main gateway, specifically the failure to receive the main network key-hopping information for a long time, the interruption of MQTT communication connection and the abnormal system status synchronization, the gateway failure determination module determines that the original main gateway has failed. S3: Configure backup and restore, which includes the following steps: S301: During normal operation, the original main gateway periodically backs up the system configuration through the configuration backup and recovery module and synchronizes the backup information to the slave gateway; S302: After the original primary gateway fails, the secondary gateway loads the most recent backup configuration through the configuration backup and recovery module, enabling the secondary gateway to quickly inherit the system management capabilities of the original primary gateway. S4: Candidate Master Gateway Evaluation: After S302 completes the configuration recovery, the currently online slave gateways are automatically selected as the candidate master gateway set, and their operating capabilities are evaluated through the candidate master gateway evaluation module. The specific evaluation content includes gateway performance resources, number of connected devices, coverage of key devices, and network communication quality, and finally the operating indicators of the candidate gateways are obtained. S5: AI and Rule-Based Decisions: After obtaining the operational metrics of candidate gateways, the AI / rule-based decision-making module performs a comprehensive analysis of the candidate gateways to determine the most suitable node to serve as the primary gateway. S6: User Confirmation: When the scores of multiple candidate gateways are close, the candidate gateway information can be displayed to the user through the user interaction module, and the user can make a manual confirmation through the user selection module of the user interaction module. If the system evaluation results show that there is a clearly optimal gateway, the main gateway selection can be completed automatically without user intervention. S7: Master Gateway Role Switching: The selected candidate gateway is upgraded to the new master gateway through the master gateway role switching module, and the remaining gateways are rejoined as slave gateways in the new master-slave gateway structure. S8: Local Device Control Recovery: After the main gateway role switch is completed, the device control capability is gradually restored through the local device control recovery module. Then, the main and slave gateway structure is re-established and the normal operation status is restored. At this point, the main gateway failure self-recovery process is completed.
2. The self-recovery control method for main gateway failure based on multi-intelligent gateway cascading according to claim 1, characterized in that, In S101, periodic state synchronization specifically includes heartbeat information exchange, MQTT connection status detection, and system operation status synchronization.
3. The self-recovery control method for main gateway failure based on multi-intelligent gateway cascading according to claim 1, characterized in that, In step S2, when the failure conditions are met, the original main gateway will enter the main gateway self-recovery process.
4. The self-recovery control method for main gateway failure based on multi-intelligent gateway cascading as described in claim 1, characterized in that, In S301, the backup information includes smart device registration information, device-gateway mapping relationship, and user scenario configuration.
5. The self-recovery control method for main gateway failure based on multi-intelligent gateway cascading according to claim 1, characterized in that, In S5, at the rule level, the system prioritizes factors including gateways with a large number of critical devices, gateways with high network connection stability, and gateways with sufficient system resources. At the AI level, the system introduces a gateway capability evaluation model, which comprehensively scores the operating status of candidate gateways to assist in the election of the primary gateway. The gateway capability evaluation model is as follows: GatewayScore = w1 × CPU_free + w2 × Memory_free + w3 × Device_weight +w4 × Network_quality; Where CPU_free represents the gateway's CPU idle rate, Memory_free represents the gateway's memory idle rate, Device_weight represents the importance weight of the devices managed by the gateway, Network_quality represents the network communication quality score, and w1-w4 are weight parameters.
6. The self-recovery control method for main gateway failure based on multi-intelligent gateway cascading according to claim 1, characterized in that, In S7, the new main gateway will undertake system functions including unified management of smart devices, control command scheduling and distribution, and automated policy execution.
7. The self-recovery control method for main gateway failure based on multi-intelligent gateway cascading according to claim 1, characterized in that, In S8, the recovery process prioritizes critical equipment and determines the recovery priority of equipment through an equipment importance analysis mechanism. After the critical equipment is recovered, the control and automation strategies of other equipment are then restored.
8. A self-recovery control system for a primary gateway failure based on cascading multiple intelligent gateways, used to implement the method described in any one of claims 1-7, characterized in that, It includes a gateway status monitoring module, a gateway failure judgment module, a configuration backup and recovery module, a candidate master gateway evaluation module, an AI / rule decision module, a user interaction module, a master gateway role switching module, and a local device control recovery module; The gateway status monitoring module is used to continuously monitor the operating status of the original main gateway; The gateway failure detection module is used to determine whether the original primary gateway has failed based on its status. Configure the backup and recovery module to perform backup information recovery operations when the original main gateway fails; The candidate primary gateway evaluation module is used to evaluate the operational capabilities of the candidate primary gateway set after recovery is completed, and obtain the candidate gateway operation indicators. The AI / rule decision module is used to perform comprehensive analysis on candidate gateways to determine the most suitable node to serve as the main gateway. The user interaction module is used to display candidate gateway information to users. The user interaction module also includes a user selection module, which allows users to make manual confirmations. The master gateway role switching module is used to upgrade the selected candidate gateway to the new master gateway, while the remaining gateways are rejoined as slave gateways in the new master-slave gateway structure. The local device control recovery module is used to gradually restore device control capabilities, then re-establish the master-slave gateway structure, and restore normal operation. The local device control recovery module includes a master-slave relationship update module and a device control recovery module, both of which are connected to the original master gateway and slave gateway.
