Autonomous networking method based on local area network election, smart home system and storage medium
By defining the role of gateway devices in the smart home system and adopting an automatic election mechanism, the problems of ad hoc network and abnormal recovery in the LAN are solved, and efficient and reliable LAN control is achieved to ensure that the system can operate normally when it is separated from the external network and recover.
Patent Information
- Application Number
- CN202410982156.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-22
- Publication Date
- 2024-12-13
AI Technical Summary
The existing smart home control system cannot realize the local area network ad hoc network and the automatic election of master-slave gateways when it is separated from the external network environment, resulting in low communication efficiency and lack of abnormal recovery mechanisms, and cannot achieve high-reliable local area network control.
By defining the role of the gateway device as the primary gateway, slave gateway and backup gateway within the LAN, the automatic election mechanism is used to select the main gateway based on the capability level and weight, and automatically re-enable the gateway device when powering on, unbinding or disconnecting the connection. Elections ensure that the system can efficiently form networks and resume communications when it is separated from the external network.
It realizes high reliability control within the LAN in the environment that is separated from the external network, improves communication efficiency and system reliability, ensures that the equipment can automatically recover and maintain communication connections in abnormal situations, and improves user experience.
Smart Images

Figure CN119135523A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of smart home technology, and in particular to an autonomous networking method based on local area network election, a smart home system and a storage medium. Background Art
[0002] In the smart home ecosystem, according to the control process of data flow, control instructions are generally sent to the cloud server through the user's mobile phone app, and then the cloud server sends instructions to the gateway in the home, and then the gateway sends instructions to the specific controlled devices (such as lights and curtains). Smart homes in this mode are highly dependent on the network environment and must be supported by the external network to perfectly realize the control of smart homes. Of course, there are also some control solutions based on LANs in the industry, but due to the immaturity of the control system method, problems such as abnormal device control or LAN device disconnection are endless.
[0003] There are three main types of current technical solutions:
[0004] The first is a smart home control system that has no concept of election and no concept of LAN control. This control system is completely dependent on the external network environment, and the cloud server and the gateway are connected one by one. If there are multiple gateways in a home, the cloud needs to maintain the connection and control between multiple gateways;
[0005] The second is to realize the smart home control system of the master-slave gateway concept, but the app needs to manually specify a gateway device as the master gateway and a slave gateway, which cannot achieve adaptive and autonomous networking;
[0006] The third is the smart home control system that realizes the LAN autonomy function. However, due to the unreasonable election method, it is impossible to elect the best device as the main gateway, which leads to low communication efficiency. At the same time, the existing control systems of this type have no abnormal recovery mechanism. If the device is not connected to the LAN, there is no self-recovery method.
[0007] Above, the existing technical solutions generally have the following disadvantages:
[0008] 1. Functional deficiencies: unable to implement LAN self-organizing network, automatic election of master and slave gateways, and unable to achieve offline control without external network;
[0009] 2. Poor adaptability, poor reliability, and no abnormal recovery mechanism - the system cannot elect the best role, or has poor configurability and cannot set the election level according to the user's wishes. In the case of LAN abnormalities, for example, some routers lose packets or isolate multicast packets and broadcast packets, which affects the LAN self-organizing network, there is no recovery method, which may cause communication control failures and other problems.
[0010] In order to make smart homes interconnected within the local LAN, it is necessary to achieve LAN interconnection between devices in communication and give priority to the LAN for business, so as to achieve the requirements of high-reliability control, fast response, and availability even when the external network is offline. Summary of the invention
[0011] The purpose of the present invention is to provide an autonomous networking method, a smart home system and a storage medium based on local area network election, which can solve the problems existing in the prior art, automatically form a network when disconnected from the external network, and realize reliable control of gateway devices in the local area network.
[0012] In order to achieve the above object, one of the solutions of the present invention is:
[0013] A method for autonomous networking based on local area network election, comprising the following steps:
[0014] Step 1: Establish a local LAN channel and configure the capability level of each gateway device; define the roles of the gateway device as master gateway, slave gateway and standby gateway. The master gateway is unique in the same LAN. The master gateway maintains the gateway list and master-slave relationship in its own LAN and reports to the IoT platform. The slave gateway is connected to the master gateway through the LAN communication protocol. The standby gateway is a slave gateway with the same capability level as the master gateway.
[0015] Step 2: When the new gateway device is powered on, the main gateway is unbound or offline, and the slave gateway is disconnected from the main gateway, the device discovery in the LAN is performed within the time t, and a new main gateway is selected by automatic election;
[0016] 2a. The basis for the automatic election includes capability level and weight, wherein capability level is the first priority and weight is the second priority, and the weight calculation index includes at least the ping value between the gateway device and the router, and the lower the ping value, the higher the priority;
[0017] 2b. Whenever the master gateway changes, the remaining gateway devices are automatically marked as slave gateways and connected to the new master gateway;
[0018] Step 3: All gateway devices in the local area network periodically initiate role declarations.
[0019] In step 1, the types of capability levels include AI capability, central capability and forwarding capability, in order of priority: AI capability, central capability and forwarding capability. Gateway devices that do not have AI capability, central capability and forwarding capability do not participate in the election of the main gateway.
[0020] In step 2, after the new gateway device is powered on and discovers devices in the local area network:
[0021] If there is no master gateway, all gateway devices in the LAN will automatically elect a new master gateway; if there is already a master gateway, the new gateway device will be automatically elected as the new master gateway by comparing the capability level of the new gateway device with that of the master gateway, or the new gateway device will be automatically marked as a slave gateway;
[0022] When the main gateway is unbound or offline and discovers devices in the LAN:
[0023] All slave gateways still in the same LAN select a new master gateway through automatic election, and the remaining slave gateways in the LAN connect to the new master gateway;
[0024] After the slave gateway is disconnected from the master gateway and discovers devices in the LAN:
[0025] If there is no primary gateway, it will be automatically elected as the new primary gateway.
[0026] In step 2, the indicators for calculating the weight also include the user intervention value preset by the user for each gateway device, and other values reserved for subsequent addition of new indicators; weight = -(ping value) + user intervention value + other values.
[0027] In step 2, the ping value of the gateway device is obtained when the gateway device is connected to the router for the first time after being powered on. The ping value is an average value obtained by pinging the gateway device and the router once per second for a total of three times.
[0028] The timing for the primary gateway to report the gateway list includes:
[0029] ① After the election of the primary gateway is completed, collect data for 30 seconds, and wait for the secondary gateway / backup gateway to connect to the LAN before reporting once;
[0030] ②Power on the main gateway, collect data for 30 seconds, and wait for the slave gateway / backup gateway to connect to the LAN and then report once;
[0031] ③ When the master gateway determines that a new slave gateway / backup gateway is connected to the LAN, it will report once after collecting for 30 seconds;
[0032] ④ The main gateway reports once when it determines that a slave gateway / backup gateway has been disconnected from the LAN for more than 30 seconds.
[0033] When the IoT platform receives the reported gateway list, it collects it for 10 seconds and then initiates a LAN gateway list query to all the main gateways under the home.
[0034] The autonomous networking method based on LAN election also includes step 4 of controlling the forwarding strategy:
[0035] 4a. The status synchronization mechanism is carried out within the same LAN. The master gateway initiates a batch query when receiving a connection from a slave gateway, queries the status information of all controlled devices under the slave gateway, caches the status information and notifies other controlled devices based on their subscription status;
[0036] 4b. For the control instructions of the controlled device, if they are issued by the IoT platform, they will still go through the IoT channel and be sent directly to the controlled device according to directDid; if they are control instructions from the slave gateway / smart terminal connected to the master gateway, they will go through the LAN channel first and send the control instructions to the master gateway, which will then forward them to the LAN or IoT platform;
[0037] 4c. When the controlled device feeds back status information, the gateway where it is located sends the status information to the IoT platform through the IoT channel, and at the same time sends the status information to the main gateway through the LAN channel; the main gateway forwards the status information according to the subscription status;
[0038] 4d. The status information of sub-devices other than the sub-devices themselves involved in the dual control binding and quick control pages of the gateway and smart terminal are uniformly subscribed and queried to the main gateway. When not connected to the main gateway, they are subscribed and queried to the IoT platform.
[0039] The second solution of the present invention is:
[0040] A smart home system includes a router, an IoT platform, a smart terminal and several gateway devices. The built-in APP of the smart terminal communicates with the router through the IoT platform. The gateway device elects a main gateway through an election step and communicates with the router; the election step specifically implements the autonomous networking method.
[0041] The third solution of the present invention is:
[0042] The storage medium stores a computer program; the computer program executes the autonomous networking method.
[0043] After adopting the above technical solution, the present invention has the following technical effects:
[0044] The present invention can also automatically form a network when the entire networking system is disconnected from the external network, and realize high-reliability control of the gateway device in the local area network, and use the offline control function to ensure the reliability of the system; the present invention can solve the problems of uncertain and unreasonable elections in the prior art, and use a complete election rule to efficiently and reliably elect an optimal main gateway as the local area network hub, effectively improving communication efficiency, and under the election rule, even if a gateway device is disconnected from the local area network, in the presence of an external network, it can also ensure that the gateway device is restored from local area network control to communication with the IoT platform: after the election is completed, the control of the IoT platform only needs to communicate with the main gateway, which can solve the complexity of data interaction and effectively improve the convenience and efficiency of device management; in addition, when a user adds a new device to the local area network, the new device can be automatically added to the local area network and automatically elected, and the use of local area network control is more efficient, faster, and provides a better user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] Figure 1 It is an overall architecture diagram of a specific embodiment of the present invention and a master-slave topology change diagram after adding a wireless gateway;
[0046] Figure 2 A schematic diagram of system connection of a specific embodiment of the present invention;
[0047] Figure 3 This is a flowchart of an election when the autonomous networking method of a specific embodiment of the present invention is used for networking;
[0048] Figure 4 This is an election flow chart drawn from the perspective of the gateway device itself according to a specific embodiment of the present invention;
[0049] Figure 5 It is a re-election flow chart of the autonomous networking method according to a specific embodiment of the present invention;
[0050] Figure 6 It is a schematic diagram of the control forwarding strategy of the autonomous networking method according to a specific embodiment of the present invention. DETAILED DESCRIPTION
[0051] In order to further explain the technical solution of the present invention, the present invention is described in detail through specific embodiments below. Among them, the present invention is based on mDNS (Multicast Domain Name System, multicast domain name resolution protocol) local area network communication technology, which will not be elaborated in detail below.
[0052] The present invention discloses an autonomous networking method based on local area network election, including a router, an IoT platform, an intelligent terminal and several gateway devices. The built-in APP of the intelligent terminal communicates with the router through the IoT platform, and the gateway device selects a main gateway through an election step and communicates with the router; the election step specifically includes:
[0053] Step 1: When establishing a local LAN channel, configure the capability level of each gateway device; define the roles of the gateway device as master gateway, slave gateway, and standby gateway. The master gateway is unique in the same LAN. The master gateway maintains the gateway list and master-slave relationship in its own LAN and reports it to the IoT platform for APP display. The slave gateway is connected to the master gateway through the LAN communication protocol. The standby gateway is a slave gateway with the same capability level as the master gateway.
[0054] Step 2: When the new gateway device is powered on, the main gateway is unbound or offline, and the slave gateway is disconnected from the main gateway, the device discovery in the LAN is performed within a time period t (such as 60s, which can be configured according to actual needs), and a new main gateway is selected by automatic election;
[0055] 2a. The basis for automatic election is capability level and weight, where capability level is the first priority and weight is the second priority. That is, the gateway device with higher capability level in the same LAN is elected as the main gateway first. If there are multiple gateway devices with the highest capability level, the main gateway is selected from them by weight. At the same time, the indicator for calculating the weight includes at least the ping value between the gateway device and the router. The lower the ping value, the higher the priority.
[0056] 2b. Whenever the master gateway changes, the remaining gateway devices are automatically marked as slave gateways and connected to the new master gateway;
[0057] Step 3: All gateway devices in the LAN periodically initiate role declarations to ensure that two main gateways are not generated in the same LAN due to network problems.
[0058] Through the above scheme, the present invention can also automatically network when the entire networking system is disconnected from the external network, realize high-reliability control of the gateway device in the local area network, and use the offline control function to ensure the reliability of the system; the present invention can solve the problem of uncertain and unreasonable election in the prior art, and use a complete election rule to efficiently and reliably elect an optimal main gateway as the local area network hub, effectively improving communication efficiency, and under the election rule, even if a gateway device is disconnected from the local area network, in the case of an external network, it can also ensure that the gateway device is restored from the local area network control to the communication with the IoT platform: after the election is completed, the control of the IoT platform of the present invention only needs to communicate with the main gateway, which can solve the complexity of data interaction and effectively improve the convenience and efficiency of device management; in addition, when the user adds a new device to the local area network, the new device can automatically join the local area network and automatically elect, and the use of the local area network control is more efficient, faster, and the user experience is better.
[0059] In some embodiments of the autonomous networking method, the above-mentioned gateway devices include wireless gateways (such as Zigbee), Mopai series (such as mini2, mini2Pro, Mopai Pro, etc.) and extensions (built-in gateways), etc., according to different gateway types.
[0060] In some embodiments of the autonomous networking method, in the above step 1, the types of capability levels include AI capability, central capability and forwarding capability, in order of priority: AI capability, central capability and forwarding capability, and all three capabilities have levels of LV10 to LV30. Gateway devices that do not have AI capability, central capability and forwarding capability do not participate in the election of the main gateway.
[0061] In some embodiments of the autonomous networking method, in the above step 2, after the new gateway device is powered on and discovers devices in the local area network:
[0062] If there is no master gateway, all gateway devices in the LAN will automatically elect a new master gateway; if there is already a master gateway, the new gateway device will be compared with the master gateway to determine whether to automatically elect the new gateway device as the new master gateway. If the new gateway device is not the new master gateway, it will be automatically marked as a slave gateway.
[0063] When the main gateway is unbound or offline and discovers devices in the LAN:
[0064] All slave gateways still in the same LAN select a new master gateway through automatic election, and the remaining slave gateways in the LAN connect to the new master gateway;
[0065] After the slave gateway is disconnected from the master gateway and discovers devices in the LAN:
[0066] If there is no primary gateway, it will be automatically elected as the new primary gateway.
[0067] In some embodiments of the autonomous networking method, in the above step 2, the index for calculating the weight includes:
[0068] ① The ping value between the router and the gateway device with lower network communication delay is more suitable as the communication center, that is, the main gateway;
[0069] ② User intervention value, which generally ranges from 0 to 100 and is set manually by the user, so that the user can interfere with the election by setting a higher user intervention value on his own, and manually mark and select the gateway device he thinks is appropriate as the main gateway, so that the gateway device in the smart home not only applies to the priority of various devices, but also can switch the priority according to the user's wishes, which is more versatile and flexible;
[0070] ③Other values, which are used to facilitate the subsequent addition of reserved values for indicators.
[0071] In the above, weight = -(ping value) + user intervention value + other values. In the early stage of networking, the user intervention value and other values are calculated as 0.
[0072] In some embodiments of the autonomous networking method, in the above step 2, the ping value is obtained when the gateway device is connected to the router (i.e., the default gateway) for the first time after being powered on (i.e., the IP address is obtained). The ping value is the average of three pings per second between the gateway device and the router, and the ping value is no longer updated at other times.
[0073] In some embodiments of the autonomous networking method, the gateway list of the local area network is reported by the master gateway, and the reported content is the slave gateway / backup gateway of the local area network connected to the master gateway, and the slave gateway / backup gateway disconnected from the master gateway is not included in the reported content. Specifically, the timing of the master gateway reporting includes:
[0074] ① After the election of the primary gateway is completed, collect data for 30 seconds, and wait for the secondary gateway / backup gateway to connect to the LAN before reporting once;
[0075] ②Power on the main gateway, collect data for 30 seconds, and wait for the slave gateway / backup gateway to connect to the LAN and then report once;
[0076] ③ When the master gateway determines that a new slave gateway / backup gateway is connected to the LAN, it will report once after collecting for 30 seconds;
[0077] ④ The main gateway reports once when it determines that a slave gateway / backup gateway has been disconnected from the LAN for more than 30 seconds.
[0078] In the above, the master gateway collects the information of the slave gateways connected to it.
[0079] In some embodiments of the autonomous networking method, when the IoT platform receives the reported gateway list, it collects it for 10 seconds, and then initiates a LAN gateway list query to all the main gateways in the home to avoid the main gateways of different LANs in the same home reporting at the same time. The IoT platform may receive the information in sequence, which may cause the calculated topological relationship to be inconsistent with the actual situation.
[0080] In some embodiments of the autonomous networking method, step 4 is also included to control the forwarding strategy:
[0081] 4a. The status synchronization mechanism is carried out within the same LAN. The master gateway initiates a batch query when receiving a connection from a slave gateway, queries the status information of all controlled devices under the slave gateway, caches the status information and notifies other controlled devices based on their subscription status;
[0082] 4b. For the control instructions of the controlled device, if they are issued by the IoT platform, they will still go through the IoT channel and be sent directly to the controlled device according to directDid (the identity of the gateway where the sub-device is located); if they are control instructions from the slave gateway / smart terminal connected to the main gateway, they will uniformly go through the LAN channel first, send the control instructions to the main gateway, and the main gateway will forward them to the LAN or IoT platform (when the main gateway determines that the gateway where the controlled device is located is connected through the LAN TCP, it will forward them to the LAN, otherwise it will be uniformly forwarded to the IoT platform);
[0083] 4c. When the controlled device feeds back status information, the gateway where it is located sends the status information to the IoT platform through the IoT channel, and at the same time sends the status information to the main gateway through the LAN channel; the main gateway forwards the status information according to the subscription status, rather than directly forwarding each status information;
[0084] 4d. The status information of all sub-devices (across terminals / gateways or clouds) other than themselves involved in dual-control binding and quick control pages in the gateway and smart terminal are uniformly subscribed and queried to the main gateway. When not connected to the main gateway, subscribe and query to the IoT platform (Note: subscribe and query to the IoT platform first, and unsubscribe from the cloud when connecting to the main gateway later).
[0085] In the above, step 4 enables the present invention to support a subscription-publishing mechanism, by subscribing from the gateway to the master gateway, thereby purposefully distributing the status.
[0086] refer to Figures 1 to 6 As shown, a specific embodiment of the autonomous networking method of the present invention is shown below.
[0087] In this embodiment, the capability level is defined as follows:
[0088] AI Capabilities Active intelligence, image processing, offline free speech, etc. Central Ability Support cross-gateway / cross-terminal linkage, arming and disarming, and group control within the same LAN Forwarding capability Supports single control and scene control data forwarding across gateways / terminals in the same LAN
[0089] Among them, AI capability > central capability > forwarding capability. Gateway devices that do not have forwarding capability, central capability, and AI capability do not participate in the election of the main gateway, that is, they cannot serve as the main gateway.
[0090]
[0091] Correspondingly, the capability matrix of common gateway devices is as follows:
[0092] When defining the interface, add a new definition under TXT in the response of mDNS device discovery:
[0093] (Ⅰ) The role field indicates the role of the gateway device, which is divided into M (master gateway), S (slave gateway), and B (backup gateway). If there is no role field, it means that the gateway device does not play any role.
[0094] (II) The ab field indicates the AI capability of the gateway device, which ranges from LV10 to LV30. If there is no ab field, it means there is no AI capability. The cb field indicates the central capability of the gateway device, which ranges from LV10 to LV30. If there is no cb field, it means there is no central capability. The fb field indicates the forwarding capability of the gateway device, which ranges from LV10 to LV30. If there is no fb field, it means there is no forwarding capability.
[0095] (III) The wt field indicates the weight of the gateway device, which is the abbreviation of Weight in English.
[0096] For example, in a TXT request in mDNS, you can get TXT additional information (only part of the information is listed as an example, not complete) as follows:
[0097] TXT: mf = linxingxx / / manufacturer
[0098] md=HAZB-CE-R15-112 / / Product model
[0099] smd = HAZB-CE-R15-112 / / Software product model softModel
[0100] mac=DC:29:19:07:FF:9C
[0101] sn=1122233445556677
[0102] cb=LV10
[0103] fb=LV20
[0104] role=M
[0105] wt=-8.23
[0106] ver=1.27 / / version
[0107] See also Figure 3 and Figure 4 , respectively, are schematic diagrams of the election process from the system perspective and the device perspective when networking. Figure 3 The process mainly describes the election strategy of various types of gateway devices from the system perspective. First, it is the election process after the terminal gateway is added to the LAN. After the terminal stabilizes the election results, it joins the central gateway again. Figure 4 The process mainly describes the election processing logic of each device, which judges the home information, various level information, etc. according to the described strategy to conduct election competition, and finally obtains the best object as the main gateway.
[0108] Taking the example that all 5 gateway devices in each household are mini2, the election and role change process of each gateway device is listed in the following table:
[0109]
[0110] See also Figure 5 , when a new gateway device is powered on, the main gateway is unbound or offline, or the slave gateway is disconnected from the main gateway, a re-election is performed. When the main gateway is abnormally offline, other gateways will perform reconnection detection. After the detection cycle, if they still cannot connect to the main gateway, they will re-enter the election process and re-network to provide highly reliable network connections.
[0111] Among them, the following table lists several opportunities for the gateway device to bootstrap as the main gateway:
[0112]
[0113] The present invention also discloses a smart home system capable of executing the above-mentioned autonomous networking method.
[0114] The present invention also discloses a storage medium, which stores a computer program; the computer program can execute the above method. The storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0115] The above embodiments and drawings do not limit the product form and style of the present invention. Any appropriate changes or modifications made by ordinary technicians in the relevant technical field should be deemed to be within the patent scope of the present invention.
Claims
1. A method for autonomous networking based on local area network election, characterized in that The following steps are involved: Step 1: Establish a local LAN channel and configure the capability level of each gateway device; The roles of gateway devices are defined as master gateway, slave gateway and standby gateway. The master gateway is unique in the same LAN. The master gateway maintains the gateway list and master-slave relationship in its own LAN and reports to the IoT platform. The slave gateway is connected to the master gateway through the LAN communication protocol. The standby gateway is a slave gateway with the same capability level as the master gateway. Step 2: When the new gateway device is powered on, the main gateway is unbound or offline, and the slave gateway is disconnected from the main gateway, the device discovery in the LAN is performed within the time t, and a new main gateway is selected by automatic election; 2a. The basis for the automatic election includes capability level and weight, wherein capability level is the first priority and weight is the second priority, and the weight calculation index includes at least the ping value between the gateway device and the router, and the lower the ping value, the higher the priority; 2b. Whenever the master gateway changes, the remaining gateway devices are automatically marked as slave gateways and connected to the new master gateway; Step 3: All gateway devices in the local area network periodically initiate role declarations.
2. The autonomous networking method based on local area network election as claimed in claim 1, characterized in that: In step 1, the types of capability levels include AI capability, central capability and forwarding capability, in order of priority: AI capability, central capability and forwarding capability. Gateway devices that do not have AI capability, central capability and forwarding capability do not participate in the election of the main gateway.
3. The autonomous networking method based on local area network election as claimed in claim 1, characterized in that: In step 2, after the new gateway device is powered on and discovers devices in the local area network: If there is no master gateway, all gateway devices in the LAN will automatically elect a new master gateway; if there is already a master gateway, the new gateway device will be automatically elected as the new master gateway by comparing the capability level of the new gateway device with that of the master gateway, or the new gateway device will be automatically marked as a slave gateway; When the main gateway is unbound or offline and discovers devices in the LAN: All slave gateways still in the same LAN select a new master gateway through automatic election, and the remaining slave gateways in the LAN connect to the new master gateway; After the slave gateway is disconnected from the master gateway and discovers devices in the LAN: If there is no primary gateway, it will be automatically elected as the new primary gateway.
4. The autonomous networking method based on local area network election as claimed in claim 1, characterized in that: In step 2, the indicators for calculating the weight also include the user intervention value preset by the user for each gateway device, and other values reserved for subsequent addition of new indicators; weight = -(ping value) + user intervention value + other values.
5. The autonomous networking method based on local area network election as claimed in claim 1, characterized in that: In step 2, the ping value of the gateway device is obtained when the gateway device is connected to the router for the first time after being powered on. The ping value is an average value obtained by pinging the gateway device and the router once per second for a total of three times.
6. The autonomous networking method based on local area network election as claimed in claim 1, characterized in that: The timing for the primary gateway to report the gateway list includes: ① After the election of the primary gateway is completed, collect data for 30 seconds, and wait for the secondary gateway / backup gateway to connect to the LAN before reporting once; ②Power on the main gateway, collect data for 30 seconds, and wait for the slave gateway / backup gateway to connect to the LAN and then report once; ③ When the master gateway determines that a new slave gateway / backup gateway is connected to the LAN, it will report once after collecting for 30 seconds; ④ The main gateway reports once when it determines that a slave gateway / backup gateway has been disconnected from the LAN for more than 30 seconds.
7. The autonomous networking method based on local area network election as claimed in claim 1, characterized in that: When the IoT platform receives the reported gateway list, it collects it for 10 seconds and then initiates a LAN gateway list query to all the main gateways under the home.
8. The autonomous networking method based on local area network election according to any one of claims 1 to 7, characterized in that: It also includes step 4 to control the forwarding strategy: 4a. The status synchronization mechanism is carried out within the same LAN. The master gateway initiates a batch query when receiving a connection from a slave gateway, queries the status information of all controlled devices under the slave gateway, caches the status information and notifies other controlled devices based on their subscription status; 4b. For the control instructions of the controlled device, if they are issued by the IoT platform, they will still go through the IoT channel and be sent directly to the controlled device according to directDid; if they are control instructions from the slave gateway / smart terminal connected to the master gateway, they will go through the LAN channel first and send the control instructions to the master gateway, which will then forward them to the LAN or IoT platform; 4c. When the controlled device feeds back status information, the gateway where it is located sends the status information to the IoT platform through the IoT channel, and at the same time sends the status information to the main gateway through the LAN channel; the main gateway forwards the status information according to the subscription status; 4d. The status information of sub-devices other than the sub-devices themselves involved in the dual control binding and quick control pages of the gateway and smart terminal are uniformly subscribed and queried to the main gateway. When not connected to the main gateway, they are subscribed and queried to the IoT platform.
9. A smart home system, characterized in that: It includes a router, an IoT platform, a smart terminal and several gateway devices, wherein the built-in APP of the smart terminal communicates with the router through the IoT platform, and the gateway device selects a main gateway through an election step and communicates with the router; The election step specifically implements the autonomous networking method based on local area network election as described in any one of claims 1 to 8.
10. A storage medium, characterized in that: The storage medium stores a computer program; the computer program executes the autonomous networking method based on local area network election as described in any one of claims 1 to 8.
