A master-slave negotiation multi-gateway intelligent Zigbee network system
Through the master-slave negotiation of the multi-gateway intelligent Zigbee network system, the system stability problem caused by single gateway failure is solved, automatic switching and network self-recovery is realized, user experience and system robustness are improved, and maintenance costs are reduced.
Patent Information
- Application Number
- CN202011470210.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-15
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2040-12-15
AI Technical Summary
In existing smart home systems, the failure of a single edge gateway will cause the entire system to fail to operate normally, and the signal transmission control is low in real-time, poor user experience, and high maintenance costs.
Adopt the master-slave negotiation multi-gateway intelligent Zigbee network system, through self-negotiation master-slave mode and sentinel mode, automatic switching and data management of edge gateways are realized, ensuring system stability and availability, and monitoring the gateway status through election algorithms and heartbeat mechanisms to achieve Network self-recovery.
It improves the operating robustness and user experience of the system, reduces the overhead and maintenance costs of the cloud platform, solves the problem of terminal node coverage in multi-layer environments, simplifies the gateway replacement process, and realizes automatic recovery and efficient management of the network.
Smart Images

Figure CN112788798B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a master-slave negotiation multi-gateway intelligent Zigbee network system. Background Art
[0002] With the development of the Internet of Things, smart devices in the home have become more abundant and active. It is not enough to just connect these smart devices to the network. We need to make better use of the data generated by these smart devices to serve the current family. Considering issues such as network bandwidth, response speed, and user experience, we usually need to deploy a home edge gateway to collect data from on-site smart devices in real time. At the same time, we need to clean, calculate, and store a large amount of data at the edge node, and then upload the calculated data to the cloud according to specific rules and interact with the cloud. If there is only one edge gateway in the system, not only is the performance requirement of this edge gateway high, the number of system sub-devices is strictly limited, and it also affects the stability and availability of the entire system. Once the gateway fails, the entire system will not be able to operate normally.
[0003] At present, smart home scenes and multi-control are completely dependent on the central node edge gateway. On the one hand, if the gateway fails, the scene or multi-control cannot be executed. On the other hand, the signal is transmitted through multiple levels, the control real-time performance is low, and the user experience is poor.
[0004] If the edge gateway is damaged and needs to be replaced, a series of construction operations such as re-networking and reconfiguration of the associated sub-devices are required, which greatly increases the manufacturer's after-sales maintenance costs. Summary of the invention
[0005] The technical problem to be solved by the present invention is to provide a master-slave negotiation multi-gateway intelligent Zigbee network system to improve the robustness of system operation.
[0006] In a first aspect, the present invention provides a master-slave negotiation multi-gateway intelligent Zigbee network system, comprising: a perception layer, a transmission layer and a gateway layer;
[0007] The perception layer is composed of distributed intelligent terminal nodes, which collect / publish data and forward the data to the gateway layer;
[0008] The transport layer is used to connect the gateway layer and the IoT platform to achieve two-way authentication between the terminal and the cloud as well as encrypted data transmission;
[0009] The gateway layer includes at least one edge gateway, each edge gateway collects data from the smart terminal nodes it manages in real time, cleans and computes a large amount of data, and then converts a variety of different data into a unified data model. The calculated data is then used for local circulation storage or direct response on the one hand, and uploaded to the cloud through the transport layer according to specific rules on the other hand to interact with the cloud;
[0010] The gateway layer adopts a self-negotiating master-slave mode, that is, a core gateway, or a core gateway and at least one slave gateway. The core gateway is the data pipeline between the gateway layer and the Internet of Things platform. It will establish a connection with the Internet of Things platform and subscribe / publish data from the perception layer and the Internet of Things platform in real time. After the slave gateway collects data from the smart terminal nodes it manages in real time and performs a series of operations, if it needs to interact with the platform, it communicates through the data pipeline established by the core gateway.
[0011] Furthermore, the self-negotiation master-slave mode adopts a sentinel mode; the edge gateways form a sentinel system, and the status of each edge gateway is monitored by the sentinel system; if the core gateway is monitored to enter an offline state, a slave gateway is upgraded to a new master gateway.
[0012] Furthermore, the sentinel system monitors the status of each edge gateway through a heartbeat mechanism.
[0013] Furthermore, the self-negotiation adopts an election algorithm. When the master gateway goes offline and is considered to be offline by a slave gateway, the slave gateway negotiates with other slave gateways to select the master gateway. The gateway requires other slave gateways to select it as the master gateway. According to the first-come-first-served principle, the gateway is elected as the new master gateway and the master gateway switching operation is performed.
[0014] Furthermore, when the master gateway operates normally, the master gateway collects parameter information of all zigbee coordinators under the backup master gateway and slave gateway, and uploads it to the cloud;
[0015] When an edge gateway needs to be replaced, the sn address corresponding to the configuration coordinator is replaced, and the backup coordination parameters are transmitted to the replaced edge gateway. At this time, the coordinator information in the replaced edge gateway is overwritten to achieve network recovery.
[0016] Furthermore, the coordinator parameters are divided into local and remote. The local records are real-time coordinator information, and the remote records are backup configuration parameters. When the setting information in the two parameter information remains unchanged, no replacement is performed; when the setting information changes, it means that the gateway has indeed been abnormal or replaced, and replacement is performed at this time;
[0017] When the main gateway is replaced but the sn address has not been replaced, the cloud backup will not be erased because the sn address does not correspond. The replacement operation will only be performed after the sn address is replaced.
[0018] Furthermore, the master gateway collects parameter information of all zigbee coordinators under the backup master gateway and the slave gateway, which is further specifically: the master gateway periodically collects parameter information of all zigbee coordinators under the backup master gateway and the slave gateway.
[0019] Furthermore, the sub-nodes that each edge gateway is responsible for are configured, and the sub-nodes are allocated to the nearest edge gateway according to the proximity principle; and a list of sub-nodes allowed to access is configured on each edge gateway, and sub-nodes outside the sub-node list are not allowed to join the edge gateway.
[0020] One or more technical solutions provided in the embodiments of the present invention have at least the following technical effects or advantages:
[0021] 1. One master and multiple slaves auto-negotiation effectively improves the robustness of operation. The edge gateway logic module automatically negotiates the master-slave mode. After the negotiation is successful, the system works in one master and multiple slaves mode. If the master gateway is abnormal, the remaining slave gateways will automatically negotiate to generate a new master gateway to ensure continued stable operation. Because multiple gateways only maintain one connection with the cloud for effective communication, the overhead and cost of the cloud platform are greatly reduced, and it is also conducive to the object-oriented development and maintenance of the platform.
[0022] 2. Study the Zigbee multi-coordinator solution to solve the problem that terminal nodes cannot be fully covered by the same Zigbee network in a multi-floor or large flat environment. Multiple Zigbee networks are created through multiple slave gateways, and each terminal node joins its adjacent network, thereby achieving orderly operation of interconnection and interoperability, and at the same time breaking through the bottleneck of the number of terminal nodes supported in the system.
[0023] 3. By using the intelligent management of the Zigbee sub-network by the gateway, the sub-nodes that each gateway is responsible for can be configured, which is not only convenient for the construction and maintenance of the network, but also the gateway can intelligently configure the optimal scenario and multi-control implementation method. For example, if multiple sub-nodes need to realize the state synchronization function, if they are under the same gateway, the gateway will adopt the configuration method of binding between sub-nodes, so that the function can be realized without the gateway. If they are not under the same gateway, the method of linkage control through the gateway will be adopted; the same applies to the scenario configuration.
[0024] 4. When the gateway is damaged and needs to be replaced after sales, the self-recovery function can be used to achieve migration by simply replacing the SN code, without the need for tedious work such as re-exiting and re-configuring its sub-nodes, greatly simplifying the operation and maintenance work.
[0025] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] The present invention will be further described below in conjunction with embodiments with reference to the accompanying drawings.
[0027] Figure 1 This is a diagram of the architecture of the distributed home edge gateway system of the present invention;
[0028] Figure 2 This is an illustration of the self-negotiation of the present invention. Figure 1 ;
[0029] Figure 3 This is an illustration of the self-negotiation of the present invention. Figure 2 ;
[0030] Figure 4 This is an illustration of the self-negotiation of the present invention. Figure 3 ;
[0031] Figure 5 Obtaining a state diagram for the present invention;
[0032] Figure 6 A flow chart of the edge gateway of the present invention realizing the self-negotiation master-slave mode;
[0033] Figure 7 is the election flow chart of the present invention;
[0034] Figure 8 It is the flow chart of the network distribution of the present invention;
[0035] Fig. 9 This is a flow chart of the network self-recovery of the present invention. DETAILED DESCRIPTION
[0036] The embodiment of the present application provides a master-slave negotiation multi-gateway intelligent Zigbee network system, which is composed of multiple Zigbee coordinator gateways, multiple Zigbee routing nodes and terminal nodes. First, multiple Zigbee coordinator gateways use autonomous negotiation to elect a master gateway, and the rest are slave gateways. When the master gateway is abnormal, the system elects another gateway as the master gateway in real time. The master gateway is mainly responsible for connecting to the cloud server and performing data calculations and interactions for the entire system. Each gateway is independently responsible for the intelligent creation of the Zigbee network of its subsystem. The project divides a reasonable Zigbee network architecture according to the on-site node deployment situation and configures it into each gateway. Then the gateway allows its child nodes to join according to the configuration until the entire system is created. The gateway implements the self-recovery function by configuring the relevant parameters of the Zigbee network.
[0037] The technical solution in the embodiment of the present application has the following general idea:
[0038] like Figure 1 As shown in the figure, the distributed home edge gateway system architecture based on auto-negotiation mainly includes the perception layer, transmission layer and gateway layer.
[0039] The perception layer is composed of distributed intelligent terminal nodes. The intelligent terminal nodes collect / publish data and forward the data to the gateway layer. The perception layer includes Zigbee routing nodes and terminal nodes.
[0040] The transport layer is used to connect the gateway layer and the IoT platform. Based on the MQTT protocol, it realizes two-way authentication and data encryption transmission between the terminal and the cloud.
[0041] The gateway layer is composed of multiple edge gateways. Each edge gateway collects data from the smart terminal nodes it manages in real time, cleans and calculates large amounts of data, and then converts a variety of different data into a unified data model. The calculated data is then used for local circulation storage or direct response on the one hand, and uploaded to the cloud through the transport layer according to specific rules on the other hand to interact with the cloud. Each edge gateway includes a Zigbee coordinator.
[0042] 1. Self-negotiation process
[0043] The key to this system is that the gateway layer adopts the self-negotiation master-slave mode, that is, there is a core gateway and multiple slave gateways in the system. The core gateway is the data pipeline between the gateway layer and the Internet of Things platform. It will establish an MQTT connection with the Internet of Things platform to subscribe / publish data from the perception layer and the Internet of Things platform in real time; after the slave gateway collects data from the smart terminal nodes it manages in real time and performs a series of operations, if it needs to interact with the platform, it can communicate through the data pipeline established by the core gateway.
[0044] like Figure 2 As shown in the figure, the system adopts the sentinel mode to implement self-negotiation to ensure the high availability of the system: the Sentinel system composed of one or more Sentinel instances can monitor any number of edge gateways, and automatically upgrade a slave gateway to a new master gateway when the monitored master gateway goes offline.
[0045] like Figure 3 As shown in the figure, after Gateway1 goes offline:
[0046] like Figure 4 As shown, upgrade Gateway2 to the new primary gateway:
[0047] like Figure 5As shown in the figure, Sentinel sends info heartbeat to the sentinel instance that created the command connection once a second to determine the status of the current instance. If the connection is invalid within down-after-milliseconds, the instance is considered to be subjectively offline. After that, the sentinel will ask other sentinel instances whether to also consider the gateway as subjectively offline. When a certain quorum is exceeded, it is considered to be objectively offline.
[0048] like Figure 6 As shown in the figure, this system adopts the election algorithm for self-negotiation. When the main gateway goes offline and is regarded as an objective offline state by a sentinel, the sentinel will negotiate with other sentinels to elect a lerder. Each sentinel that finds that the main gateway has entered an objective offline state can ask other sentinels to elect itself as the lerder. The election is first come first served. At the same time, each sentinel will automatically increase the election ID for each election, and only one lerder will be selected in each round of election.
[0049] like Figure 7 As shown, the election process is as follows:
[0050] 1. Initialization phase, check the cache library
[0051] 2. When entering the election phase, send election requests to other nodes and receive replies from other nodes
[0052] 3. Other nodes reply whether they agree to become the master node according to the order in which they receive the election request. In each round of election ID, each candidate has only one vote.
[0053] 4. If the node initiating the election has more than half of the votes, it becomes the master node and its status changes to Leader. When other nodes detect that there is an online Leader, they return the election results.
[0054] 5. If there are sentinels greater than or equal to num(sentinels) / 2+1, a sentinel is elected as the lerder. Then the sentinel switches to the main gateway.
[0055] 2. Zigbee network division
[0056] like Figure 8As shown in the figure, this system can divide the network for the terminal nodes of the Zigbee protocol, and can configure the sub-nodes that each gateway is responsible for. According to the actual deployment of the nodes on site, the sub-nodes can be targeted and assigned to reasonable gateways. For example, the nodes in the master bedroom belong to the gateway of the master bedroom. The gateway allows the sub-nodes to which it belongs to access the network according to the configuration, and kicks the sub-nodes that do not belong to it from entering the network by mistake, so as to prevent the sub-nodes that do not belong to it from joining, so that each sub-node is gradually added to the assigned gateway until the entire system is created.
[0057] This solution is also applicable to adjusting the sub-nodes that the gateway is responsible for at any time. When the configuration is updated, if some sub-nodes no longer belong to this gateway, they will also be kicked out of the network. It can be applied to construction scenarios where networking is first established and then configuration is performed.
[0058] Network division not only facilitates the management of multiple coordinators within the household, but also prevents child nodes from mistakenly entering the next door, upstairs, downstairs, or even the next building during batch construction of the building, causing troubleshooting difficulties, thereby improving construction efficiency.
[0059] 3. Zigbee network self-recovery
[0060] like Fig. 9 As shown, this system supports Zigbee network self-recovery. When the parameters of the Zigbee coordinator in the gateway change or the gateway is damaged and replaced, the new gateway can automatically restore the Zigbee network without re-networking and other operations.
[0061] After the gateway creates a Zigbee network and runs normally, the gateway will collect all the Zigbee coordinator parameter information under the backup gateway, including IEEE address, short address, PANID, transmit power, transmit channel, extended PANID, global key, global frame technology, network key, network frame count, network key serial number, etc. This information can be obtained and uploaded to the cloud for backup during construction. In addition, in order to prevent some parameters from having a certain timeliness, the gateway will regularly update the parameter information during the normal operation of the system, and actively report it to the cloud for backup to ensure that the data backed up in the cloud is the latest parameter information.
[0062] When the gateway coordinator is replaced, the current gateway coordinator runs with new parameters and cannot communicate with the existing child nodes. At this time, the configuration only needs to replace the sn address corresponding to the coordinator. The configuration is the configuration in the gateway, a database of coordinator-related parameters, and the backup coordinator parameter information is transmitted to the gateway. The gateway will overwrite the current coordinator information, just like cloning the old coordinator, so that it can naturally connect and communicate with the child nodes, eliminating a series of operations such as re-exiting the network and re-entering the network configuration, thereby realizing the function of automatic network recovery.
[0063] The coordinator parameters are divided into local and remote. The local records are real-time coordinator information, while the remote records are backup configuration parameters. When the main information (such as IEEE, PANID) of the two parameter information remains unchanged, but only some counts change, it is normal and will not be replaced. Only when the main information changes, it means that the gateway is indeed abnormal or replaced, and then it will be replaced. Similarly, when the gateway is replaced but the sn and other operations have not been replaced, the cloud backup will not be erased because the sn does not correspond. When the sn is replaced, the replacement operation will be performed, and the previous information will be restored after the replacement, and regular backup will continue. The switch is naturally performed. The sn address is the unique serial number of the gateway. If the construction app is not used to notify the cloud of the replacement, it cannot be backed up.
[0064] Embodiment 1
[0065] like Figure 1 As shown, this embodiment provides a master-slave negotiation multi-gateway intelligent Zigbee network system, including: a perception layer, a transmission layer and a gateway layer;
[0066] The perception layer is composed of distributed intelligent terminal nodes, which collect / publish data and forward the data to the gateway layer;
[0067] The transport layer is used to connect the gateway layer and the IoT platform to achieve two-way authentication between the terminal and the cloud as well as encrypted data transmission;
[0068] The gateway layer includes at least one edge gateway, each edge gateway collects data from the smart terminal nodes it manages in real time, cleans and computes a large amount of data, and then converts a variety of different data into a unified data model. The calculated data is then used for local circulation storage or direct response on the one hand, and uploaded to the cloud through the transport layer according to specific rules on the other hand to interact with the cloud;
[0069] The gateway layer adopts a self-negotiating master-slave mode, that is, a core gateway, or a core gateway and at least one slave gateway. The core gateway is the data pipeline between the gateway layer and the Internet of Things platform. It will establish a connection with the Internet of Things platform and subscribe / publish data from the perception layer and the Internet of Things platform in real time. After the slave gateway collects data from the smart terminal nodes it manages in real time and performs a series of operations, if it needs to interact with the platform, it communicates through the data pipeline established by the core gateway.
[0070] The self-negotiation master-slave mode adopts the sentinel mode; the edge gateways form a sentinel system, and the status of each edge gateway is monitored by the sentinel system; if the core gateway is monitored to enter the offline state, a slave gateway is upgraded to the new master gateway, and the sentinel system monitors the status of each edge gateway through a heartbeat mechanism.
[0071] The self-negotiation adopts an election algorithm. When the master gateway goes offline and is considered offline by a slave gateway, the slave gateway negotiates with other slave gateways to select the master gateway. The gateway requires other slave gateways to select it as the master gateway. According to the first-come-first-served principle, the gateway is elected as the new master gateway and the master gateway switching operation is performed.
[0072] When the main gateway is operating normally, it regularly collects parameter information of all ZigBee coordinators under the backup main gateway and slave gateway, and uploads it to the cloud;
[0073] When an edge gateway needs to be replaced, the sn address corresponding to the configuration coordinator is replaced, and the backup coordination parameters are transmitted to the replaced edge gateway. At this time, the coordinator information in the replaced edge gateway is overwritten to achieve network recovery. The coordinator parameters are divided into local and remote. The local record is the real-time coordinator information, and the remote is the backup configuration parameters. When the setting information in the two parameter information remains unchanged, no replacement is performed; when the setting information changes, it means that the gateway is indeed abnormal or replaced, and replacement is performed at this time;
[0074] When the main gateway is replaced but the sn address has not been replaced, the cloud backup will not be erased because the sn address does not correspond. The replacement operation will only be performed after the sn address is replaced.
[0075] Configure the sub-nodes that each edge gateway is responsible for, and assign the sub-nodes to the nearest edge gateway based on the proximity principle; and configure a list of sub-nodes allowed to access each edge gateway, and sub-nodes outside the sub-node list are not allowed to join the edge gateway.
[0076] Although the specific implementation modes of the present invention are described above, those skilled in the art should understand that the specific implementation modes described are only illustrative and are not intended to limit the scope of the present invention. Equivalent modifications and changes made by those skilled in the art in accordance with the spirit of the present invention should be included in the scope of protection of the claims of the present invention.
Claims
1. A master-slave negotiation multi-gateway intelligent Zigbee network system, characterized by: include: Perception layer, transport layer, and gateway layer; The perception layer is composed of distributed intelligent terminal nodes, which collect / publish data and forward the data to the gateway layer; The transport layer is used to connect the gateway layer and the IoT platform to achieve two-way authentication between the terminal and the cloud as well as encrypted data transmission; The gateway layer includes at least one edge gateway, each edge gateway collects data from the smart terminal nodes it manages in real time, cleans and computes a large amount of data, and then converts a variety of different data into a unified data model. The calculated data is then used for local circulation storage or direct response on the one hand, and uploaded to the cloud through the transport layer according to specific rules on the other hand to interact with the cloud; The gateway layer adopts a self-negotiation master-slave mode, that is, a core gateway, or a core gateway and at least one slave gateway. The core gateway is the data pipeline between the gateway layer and the Internet of Things platform. It will establish a connection with the Internet of Things platform and subscribe / publish data between the perception layer and the Internet of Things platform in real time; After the gateway collects data from the intelligent terminal nodes it manages in real time and performs a series of operations, if it needs to interact with the platform, it communicates through the data pipeline established by the core gateway; When the main gateway is operating normally, it regularly collects parameter information of all ZigBee coordinators under the backup main gateway and slave gateway, and uploads it to the cloud; When an edge gateway needs to be replaced, the sn address corresponding to the configuration coordinator is replaced, and the backup coordination parameters are transmitted to the replaced edge gateway. At this time, the coordinator information in the replaced edge gateway is overwritten to achieve network recovery; The coordinator parameters are divided into local and remote. The local records are real-time coordinator information, and the remote records are backup configuration parameters. When the setting information in the two parameter information remains unchanged, no replacement is performed; when the setting information changes, it means that the gateway has indeed been abnormal or replaced, and replacement is performed at this time; When the main gateway is replaced but the sn address has not been replaced, the cloud backup will not be erased because the sn address does not correspond. The replacement operation will only be performed after the sn address is replaced.
2. The master-slave negotiation multi-gateway intelligent Zigbee network system according to claim 1, characterized in that: The self-negotiation master-slave mode adopts the sentinel mode; the edge gateways form a sentinel system, and the status of each edge gateway is monitored by the sentinel system; if the core gateway is monitored to enter the offline state, a slave gateway is upgraded to a new master gateway.
3. The master-slave negotiation multi-gateway intelligent Zigbee network system according to claim 2, characterized in that: The sentinel system monitors the status of each edge gateway through a heartbeat mechanism.
4. The master-slave negotiation multi-gateway intelligent Zigbee network system according to claim 1, characterized in that: The self-negotiation adopts an election algorithm. When the master gateway goes offline and is considered offline by a slave gateway, the slave gateway negotiates with other slave gateways to select the master gateway. The gateway requires other slave gateways to select it as the master gateway. According to the first-come-first-served principle, the gateway is elected as the new master gateway and the master gateway switching operation is performed.
5. The master-slave negotiation multi-gateway intelligent Zigbee network system according to claim 1, characterized in that: Configure the sub-nodes that each edge gateway is responsible for, and assign the sub-nodes to the nearest edge gateway based on the proximity principle; and configure a list of sub-nodes allowed to access each edge gateway, and sub-nodes outside the sub-node list are not allowed to join the edge gateway.
