Gateway replacement method and device, electronic equipment and storage medium
By migrating the device management information of the old gateway to the new gateway on the Internet of Things cloud platform and matching the attribute information, the problems of data loss and cumbersome operations during gateway replacement are solved, and a simplified replacement process and data integrity guarantee are achieved.
Patent Information
- Application Number
- CN202411817733.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-11
- Publication Date
- 2025-04-11
AI Technical Summary
In smart homes, when the gateway is upgraded or damaged, users need to reset each sub-device and re-enter the network, which is cumbersome and can easily lead to data loss.
Through the Internet of Things cloud platform, obtain the attribute information of the new gateway, clear the device management information of the new gateway, migrate the device management information of the old gateway to the new gateway, and modify the attribute information of the new gateway to match the information of the old gateway, and finally send network distribution instructions to the sub-device to establish a new gateway connection.
The gateway replacement process is simplified, the reset and network access operation of each sub-device is avoided, and the data loss caused by gateway replacement is effectively prevented, and the integrity and security of user data is ensured.
Smart Images

Figure CN119814566A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data communication technology, and in particular to a gateway replacement method, device, electronic device and storage medium. Background Art
[0002] At present, as the core of the IoT home, the smart gateway can manage and connect many IOT (Internet of Things) sub-devices and realize local computing and storage of smart scenes and other functions. A gateway usually manages dozens or even hundreds of sub-devices, which are distributed in various locations of the house and generally communicate with the gateway through the Zigbee protocol. However, in actual use, once the gateway is upgraded or damaged, the user has to reset each sub-device and reconnect to the network. The operation is extremely cumbersome, and most of the time, after-sales personnel are required to come to the site for installation and replacement, which brings great inconvenience to the user; moreover, this method may also cause the loss of device data and scene data in the smart gateway.
[0003] In summary, the technical problems existing in the relevant technologies need to be improved. Summary of the invention
[0004] The embodiments of the present application aim to solve at least one of the technical problems in the related art to a certain extent. To this end, the main purpose of the embodiments of the present application is to propose a gateway replacement method, device, electronic device and storage medium, which can simplify the process of replacing the gateway, and at the same time, can effectively prevent data loss caused by gateway upgrade or damage, and ensure the integrity and security of user data.
[0005] To achieve the above purpose, one aspect of an embodiment of the present application proposes a gateway replacement method, which is applied to an Internet of Things cloud platform, wherein the Internet of Things cloud platform stores old gateway data of an old gateway, wherein the old gateway data includes old gateway attribute information and old gateway device management information, and the method comprises the following steps:
[0006] Get new gateway attribute information of the new gateway;
[0007] Sending a data clearing instruction to the new gateway, so that the new gateway clears the new gateway device management information stored in the new gateway according to the data clearing instruction;
[0008] Sending the old gateway device management information to the new gateway for storage;
[0009] Modify the new gateway attribute information of the new gateway to the old gateway attribute information;
[0010] Sending a sub-device network configuration instruction to the sub-device connected to the old gateway, so that the sub-device establishes a network connection with the new gateway according to the sub-device network configuration instruction;
[0011] If the sub-device successfully establishes a network connection with the new gateway and the sub-device responds normally to the target scene instruction, it is confirmed that the replacement of the new gateway is completed.
[0012] In some embodiments, the old gateway device management information includes old gateway sub-device data and old gateway scenario data, and sending the old gateway device management information to the new gateway for storage includes:
[0013] Extracting the old gateway sub-device data and the old gateway scenario data from the old gateway device management information;
[0014] Sending the old gateway sub-device data and the sub-device data adding instruction to the new gateway, so that the new gateway stores the old gateway sub-device data according to the sub-device data adding instruction, and uses the old gateway sub-device data as the current gateway sub-device data of the new gateway;
[0015] The old gateway scenario data and scenario configuration instructions are sent to the new gateway, so that the new gateway stores the old gateway scenario data according to the scenario configuration instructions, and uses the old gateway scenario data as the current gateway scenario data of the new gateway.
[0016] In some embodiments, the old gateway attribute information includes an old gateway channel code and an old gateway identification code, the new gateway attribute information includes a new gateway channel code and a new gateway identification code, and the modifying the new gateway attribute information of the new gateway to the old gateway attribute information includes:
[0017] Modify the new gateway identification code in the new gateway attribute information of the new gateway to the old gateway identification code in the old gateway attribute information, so as to use the old gateway identification code as the current gateway identification code of the new gateway;
[0018] The new gateway channel code in the new gateway attribute information of the new gateway is modified to the old gateway channel code in the old gateway attribute information, so as to use the old gateway channel code as the current gateway channel code of the new gateway.
[0019] In some embodiments, the modifying the new gateway identification code in the new gateway attribute information of the new gateway to the old gateway identification code in the old gateway attribute information so as to use the old gateway identification code as the current gateway identification code of the new gateway includes:
[0020] Extracting the old gateway identification code from the old gateway attribute information;
[0021] Extracting the new gateway identification code from the new gateway attribute information;
[0022] The old gateway identification code and the new gateway identification code are stored in a rollback record table; wherein the rollback record table is used to store executable instructions corresponding to the current gateway, and the executable instructions include a new gateway identification code rollback instruction corresponding to the new gateway;
[0023] The new gateway identification code corresponding to the new gateway is modified to the old gateway identification code according to the new gateway identification code rollback instruction, so as to use the old gateway identification code as the current gateway identification code of the new gateway.
[0024] In some embodiments, the method further comprises:
[0025] If the new gateway identification code corresponding to the new gateway is successfully modified to the old gateway identification code, deleting the new gateway identification code rollback instruction in the rollback record table;
[0026] If the new gateway identification code corresponding to the new gateway is not successfully modified to the old gateway identification code, restart the new gateway, and monitor the running status of the new gateway through the Internet of Things cloud platform;
[0027] If the running state of the new gateway is online, querying the rollback record table to see whether there is a rollback instruction of the new gateway identification code of the new gateway;
[0028] If the rollback record table contains the new gateway identification code rollback instruction of the new gateway, resetting the current gateway identification code of the new gateway according to the new gateway identification code rollback instruction;
[0029] If the rollback record table does not contain the new gateway identification code rollback instruction of the new gateway, the new gateway identification code replacement process corresponding to the new gateway is terminated.
[0030] In some embodiments, after modifying the new gateway identification code corresponding to the new gateway to the old gateway identification code according to the new gateway identification code rollback instruction so as to use the old gateway identification code as the current gateway identification code of the new gateway, the method further includes:
[0031] If the old gateway remains in normal use, extracting the new gateway identification code corresponding to the new gateway; wherein the new gateway identification code is the original gateway identification code of the new gateway;
[0032] Generate an old gateway identification code rollback instruction corresponding to the old gateway based on the new gateway identification code, and store the old gateway identification code rollback instruction in the rollback record table;
[0033] If the running state of the old gateway is an online state, the old gateway identification code corresponding to the old gateway is modified to the new gateway identification code according to the old gateway identification code rollback instruction;
[0034] If the old gateway identification code corresponding to the old gateway is successfully modified to the new gateway identification code, the old gateway identification code rollback instruction in the rollback record table is deleted.
[0035] In some embodiments, the modifying the new gateway channel code in the new gateway attribute information of the new gateway to the old gateway channel code in the old gateway attribute information so as to use the old gateway channel code as the current gateway channel code of the new gateway includes:
[0036] Obtaining the old gateway channel code in the old gateway attribute information;
[0037] Obtaining the new gateway channel code in the new gateway attribute information;
[0038] A channel code change instruction is sent to the new gateway, so that the new gateway changes the new gateway channel code corresponding to the new gateway to the old gateway channel code according to the channel code change instruction, so as to use the old gateway channel code as the current gateway channel code of the new gateway.
[0039] To achieve the above purpose, another aspect of the embodiment of the present application proposes a gateway replacement device, which is applied to an Internet of Things cloud platform. The Internet of Things cloud platform stores old gateway data of an old gateway, and the old gateway data includes old gateway attribute information and old gateway device management information. The device includes the following modules:
[0040] A gateway attribute information acquisition module, used to acquire new gateway attribute information of a new gateway;
[0041] A gateway device information data clearing module, used for sending a data clearing instruction to the new gateway, so that the new gateway clears the new gateway device management information stored in the new gateway according to the data clearing instruction;
[0042] A gateway device management information replacement module, used to send the old gateway device management information to the new gateway for storage;
[0043] A gateway attribute information replacement module, used to modify the new gateway attribute information of the new gateway to the old gateway attribute information;
[0044] A sub-device connection module, used to send a sub-device network configuration instruction to the sub-device connected to the old gateway, so that the sub-device establishes a network connection with the new gateway according to the sub-device network configuration instruction;
[0045] The new gateway replacement verification module is used to confirm that the replacement of the new gateway is completed if the sub-device successfully establishes a network connection with the new gateway and the sub-device responds normally to the target scene instruction.
[0046] To achieve the above-mentioned purpose, another aspect of an embodiment of the present application provides an electronic device, the electronic device comprising a memory and a processor, the memory storing a computer program, and the processor implementing the above-mentioned method when executing the computer program.
[0047] To achieve the above objective, another aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method described above is implemented.
[0048] The embodiments of the present application include at least the following beneficial effects: the present application provides a gateway replacement method, device, electronic device and storage medium, the scheme is applied to the Internet of Things cloud platform, the Internet of Things cloud platform stores the old gateway data of the old gateway, the old gateway data includes the old gateway attribute information and the old gateway device management information, by obtaining the new gateway attribute information of the new gateway; sending a data clearing instruction to the new gateway, so that the new gateway clears the new gateway device management information stored in the new gateway according to the data clearing instruction; sending the old gateway device management information to the new gateway for storage; modifying the new gateway attribute information of the new gateway to the old gateway attribute information; sending a sub-device network configuration instruction to the sub-device connected to the old gateway, so that the sub-device establishes a network connection with the new gateway according to the sub-device network configuration instruction; if the sub-device successfully establishes a network connection with the new gateway, and the sub-device responds normally to the target scenario instruction, it is confirmed that the replacement of the new gateway is completed. The embodiment of the present application migrates the old gateway attribute information and the old gateway device management information of the old gateway to the new gateway through the Internet of Things cloud platform, without the need to reset the network access operation for each sub-device, which greatly simplifies the process of replacing the gateway. At the same time, it can effectively prevent data loss caused by gateway upgrades or damage, ensure the integrity and security of user data, and thus improve user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Figure 1 is a flow chart of the steps of a gateway replacement method provided in an embodiment of the present application;
[0050] Figure 2 It is a schematic diagram of a gateway network configuration process provided by an embodiment of the present application;
[0051] Figure 3It is a flowchart of a gateway replacement method provided in an embodiment of the present application;
[0052] Figure 4 It is a schematic diagram of a flow chart of gateway data update provided by an embodiment of the present application;
[0053] Figure 5 This is a schematic diagram of a process for replacing an old gateway identification code with a new one provided in an embodiment of the present application;
[0054] Figure 6 It is a schematic diagram of a process of replacing an identification code of an old gateway provided in an embodiment of the present application;
[0055] Figure 7 It is a schematic diagram of a process of replacing a new gateway channel provided in an embodiment of the present application;
[0056] Figure 8 It is a structural schematic diagram of a gateway replacement device provided in an embodiment of the present application;
[0057] Fig. 9 It is a schematic diagram of the hardware structure of the electronic device provided in the embodiment of the present application. DETAILED DESCRIPTION
[0058] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is further described in detail below in conjunction with the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the embodiments of the present application. They are only examples of devices and methods consistent with some aspects of the embodiments of the present application as detailed in the attached claims.
[0059] It is understood that the terms "first", "second", etc. used in this application can be used to describe various concepts in this article, but unless otherwise specified, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another concept. For example, without departing from the scope of the embodiment of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the words "if" and "if" as used herein can be interpreted as "at the time of" or "when" or "in response to determination".
[0060] The terms "at least one", "multiple", "each", "any", etc. used in this application, at least one includes one, two or more, multiple includes two or more, each refers to each of the corresponding multiple, and any refers to any one of the multiple.
[0061] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0062] At present, as the core of the IoT home, the smart gateway can manage and connect many IoT (Internet of Things) sub-devices and realize local computing and storage of smart scenes and other functions. A gateway usually manages dozens or even hundreds of sub-devices, which are distributed in various locations of the house and generally communicate with the gateway through the Zigbee protocol. However, in actual use, once the gateway is upgraded or damaged, the user has to reset each sub-device and reconnect to the network, which is extremely cumbersome. Most of the time, after-sales personnel are required to come to the site to install and replace, which brings great inconvenience to the user; moreover, this method may also cause the loss of device data and scene data in the smart gateway.
[0063] In view of this, a gateway replacement method, device, electronic device and storage medium are provided in the embodiment of the present application. The scheme is applied to the Internet of Things cloud platform. The Internet of Things cloud platform stores the old gateway data of the old gateway, and the old gateway data includes the old gateway attribute information and the old gateway device management information. By obtaining the new gateway attribute information of the new gateway; sending a data clearing instruction to the new gateway, so that the new gateway clears the new gateway device management information stored in the new gateway according to the data clearing instruction; sending the old gateway device management information to the new gateway for storage; modifying the new gateway attribute information of the new gateway to the old gateway attribute information; sending a sub-device network configuration instruction to the sub-device connected to the old gateway, so that the sub-device establishes a network connection with the new gateway according to the sub-device network configuration instruction; if the sub-device successfully establishes a network connection with the new gateway, and the sub-device responds normally to the target scene instruction, it is confirmed that the replacement of the new gateway is completed. The embodiment of the present application migrates the old gateway attribute information and the old gateway device management information of the old gateway to the new gateway through the Internet of Things cloud platform, without the need to reset the network access operation for each sub-device, which greatly simplifies the process of replacing the gateway. At the same time, it can effectively prevent data loss caused by gateway upgrades or damage, and ensure the integrity and security of user data, thereby improving user experience.
[0064] The gateway replacement method provided in the embodiment of the present application relates to the field of data communication technology. The gateway replacement method provided in the embodiment of the present application can be applied to a terminal, can also be applied to a server, and can also be software running in a terminal or a server. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, and a car terminal, etc., but is not limited to this; the server side can be configured as an independent physical server, or it can be configured as a server cluster or a distributed system composed of multiple physical servers, and can also be configured to provide cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network, content distribution network) and big data and artificial intelligence platforms and other basic cloud computing services. The cloud server, the server can also be a node server in the blockchain network; the software can be an application that implements the gateway replacement method, etc., but is not limited to the above forms.
[0065] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld devices or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronic devices, network PCs (Personal Computers, personal computers), minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.
[0066] See also Figure 1 , Figure 1 is an optional step flow chart of a gateway replacement method provided in an embodiment of the present application, which is applied to an Internet of Things cloud platform, wherein the Internet of Things cloud platform stores old gateway data of an old gateway, wherein the old gateway data includes old gateway attribute information and old gateway device management information, Figure 1 The method may include but is not limited to steps S101 to S106.
[0067] Step S101, obtaining new gateway attribute information of a new gateway;
[0068] The gateway in the embodiment of the present application is mainly for the intelligent gateway. As the core of the IoT home, the intelligent gateway can manage and connect many IoT sub-devices and realize local computing and storage of intelligent scenes and other functions. A gateway usually manages dozens or even hundreds of sub-devices, which are distributed in various locations of the house and generally communicate with the gateway through the Zigbee protocol. Among them, the gateway establishes a connection with the IoT cloud platform through the Internet, and the sub-device establishes a connection with the gateway through a wireless communication protocol (such as the ZigBee protocol, etc.). The sub-device is usually not directly connected to the IoT cloud platform, but the sub-device is indirectly connected to the IoT cloud platform through the gateway.
[0069] Among them, the IoT cloud platform stores the old gateway data of the old gateway, the old gateway data includes the old gateway attribute information and the old gateway device management information, the old gateway attribute information includes the old gateway channel code and the old gateway identification code, and the old gateway device management information includes the old gateway sub-device data and the old gateway scene data. Among them, the old gateway channel code is the channel code corresponding to the old gateway, the old gateway identification code is the identification code corresponding to the old gateway, the old gateway sub-device data is the sub-device data corresponding to the old gateway, and the old gateway scene data is the scene data corresponding to the old gateway.
[0070] The old gateway is a gateway device originally used in the IoT system. In actual application, the old gateway may be a gateway device that needs to be upgraded or a damaged gateway device. It should be noted that in the embodiment of the present application, the process of replacing the gateway is mainly for the gateway device that needs to be upgraded, and the process of configuring a new gateway for the damaged gateway device is similar to the process of upgrading, so the embodiment of the present application will not be repeated here.
[0071] For the new gateway, it is a gateway device used to replace the old gateway, wherein the new gateway attribute information includes the new gateway channel code and the new gateway identification code, and the new gateway attribute information refers to the original attribute information of the new gateway before the gateway is replaced. It can be understood that the new gateway channel code is the original channel code of the new gateway before the gateway is replaced, and the new gateway identification code is the original identification code of the new gateway before the gateway is replaced. The data corresponding to the new gateway after the gateway is replaced is called the current gateway data. For example, the attribute information corresponding to the new gateway after the new gateway is replaced is called the current attribute information, the channel code corresponding to the new gateway after the new gateway is replaced is called the current channel code, and the identification code corresponding to the new gateway after the new gateway is replaced is called the current identification code. Among them, the new gateway channel code is the channel code corresponding to the new gateway, and the new gateway identification code is the identification code corresponding to the new gateway.
[0072] Among them, the channel code is the 2.4G signal channel (hexadecimal code) for communication between the sub-device and the gateway, and the identification code is the unique identification code issued by the gateway to the sub-device after the sub-device joins the network, which is used to identify different gateways in the same channel.
[0073] Optionally, the sub-device data mainly includes information such as a device MAC (Media Access Control) address, a heartbeat frequency, a connection timeout period, etc., which is provided to the gateway to manage the sub-device status.
[0074] Before step S101 (i.e. before the gateway replacement process is performed), the gateway needs to be configured for network operation. For details, please refer to Figure 2 , Figure 2 is a schematic diagram of a gateway network configuration process provided by an embodiment of the present application; Figure 2 As shown, the user can configure the gateway through Bluetooth, AP (Access Point, wireless access point) and other network configuration methods in the application (Application, APP) of the mobile terminal. After the user configures the gateway in the APP each time, it is necessary to determine the network configuration type to confirm whether the gateway attribute information of the current network configuration gateway needs to be uploaded to the IoT cloud platform. When the network configuration type is "binding gateway configuration" and "changing gateway configuration", the gateway will select a suitable 2.4G channel (signal channel) as the sub-device communication channel according to the current network environment. After the gateway is configured, the gateway attribute message (gateway channel code and gateway identification code) will be reported to the IoT cloud platform. Assuming that the network configuration type is "network configuration only", the gateway configuration process can be directly ended.
[0075] Step S102, sending a data clearing instruction to the new gateway, so that the new gateway clears the new gateway device management information stored in the new gateway according to the data clearing instruction;
[0076] The new gateway device management information includes new gateway sub-device data and new gateway scenario data.
[0077] The data clearing instruction is an instruction sent by the IoT cloud platform to the new gateway, which is used to instruct the new gateway to perform data clearing or resetting operations, such as Figure 2 As shown, if the subsequent operation of network configuration is to bind or replace the target gateway, then after the network configuration is successful, the IoT cloud platform will issue a data clearing instruction to clear the gateway sub-device data and scene data of the new gateway, so as to prevent dirty data interference in the new gateway.
[0078] In the specific implementation, the gateway replacement is mainly initiated by the user in the APP. After the new gateway is configured via Bluetooth, the user clicks the control to replace the gateway and sends the request to replace the gateway to the IoT cloud platform. The IoT cloud platform executes the gateway replacement process. Please refer to Figure 3 , Figure 3 is a flow chart of a gateway replacement method provided in an embodiment of the present application; Figure 3 As shown, first the user clicks on the control for changing the gateway on the APP to generate a request for changing the gateway, and then sends the request for changing the gateway to the IoT cloud platform, which executes the gateway replacement process. The gateway replacement process mainly includes copying gateway data, replacing the old and new gateway identification codes, changing the new gateway channel, and testing the sub-device connection.
[0079] Step S103, sending the old gateway device management information to the new gateway for storage;
[0080] In some embodiments, step S103 may include: extracting old gateway sub-device data and old gateway scene data from the old gateway device management information; sending the old gateway sub-device data and sub-device data adding instructions to the new gateway, so that the new gateway stores the old gateway sub-device data according to the sub-device data adding instructions, so as to use the old gateway sub-device data as the current gateway sub-device data of the new gateway; sending the old gateway scene data and scene configuration instructions to the new gateway, so that the new gateway stores the old gateway scene data according to the scene configuration instructions, so as to use the old gateway scene data as the current gateway scene data of the new gateway.
[0081] Among them, for the current gateway sub-device data, it is the old gateway sub-device data corresponding to the old gateway, and does not include the original new gateway sub-device data of the new gateway. It is the sub-device data of the new gateway at the current moment; similarly, for the current gateway scene data, it is the old gateway scene data corresponding to the old gateway, and does not include the original new gateway scene data of the new gateway. It is the scene data of the new gateway at the current moment.
[0082] Among them, the old gateway device management information in the old gateway mainly includes the old gateway sub-device data and the old gateway scene data. Specifically, the old gateway device management information includes the sub-device data of the gateway sub-device bound by the user through the IoT cloud platform in the APP, and the scene data generated by creating the scene linkage configuration. These data will be stored in the IoT cloud platform.
[0083] In the specific implementation, see Figure 4 , Figure 4 is a schematic diagram of a flow chart of gateway data update provided by an embodiment of the present application; Figure 4As shown in FIG. 1 , the process of sending the old gateway device management information to the new gateway for storage is as follows: first, the old gateway device management information (old gateway sub-device data and old gateway scene data) in the old gateway is uploaded to the IoT cloud platform for storage; then, the IoT cloud platform copies a copy of the saved old gateway sub-device data, and generates a sub-device data adding instruction based on the old gateway sub-device data, and then sends the old gateway sub-device data and the sub-device data adding instruction to the new gateway. After receiving the sub-device data adding instruction, the new gateway saves the old gateway sub-device data to the local database for storage; similarly, the IoT cloud The platform will copy the saved scene data of the old gateway, generate scene configuration instructions based on the old gateway scene data, and then send the old gateway scene data and scene configuration instructions to the new gateway. After receiving the scene configuration instructions, the new gateway will save the old gateway scene data to the local database for storage. In the process of copying the old gateway scene data to the new gateway, multiple scene configuration instructions will be generated and sent to the new gateway. In the specific implementation, for a large amount of scene data, the scene configuration instructions in the scene will be automatically split into device action instructions one by one and sent. After a single instruction fails, it will continue to retry.
[0084] Step S104, modifying the new gateway attribute information of the new gateway to the old gateway attribute information;
[0085] In some embodiments, step S104 may include: modifying the new gateway identification code in the new gateway attribute information of the new gateway to the old gateway identification code in the old gateway attribute information, so as to use the old gateway identification code as the current gateway identification code of the new gateway; modifying the new gateway channel code in the new gateway attribute information of the new gateway to the old gateway channel code in the old gateway attribute information, so as to use the old gateway channel code as the current gateway channel code of the new gateway.
[0086] Among them, for the current gateway identification code, it is the old gateway identification code corresponding to the old gateway, does not include the original new gateway identification code of the new gateway, and is the identification code of the new gateway at the current moment; similarly, for the current gateway channel code, it is the old gateway channel code corresponding to the old gateway, does not include the original new gateway channel code of the new gateway, and is the channel code of the new gateway at the current moment.
[0087] In some specific embodiments, modifying the new gateway identification code in the new gateway attribute information of the new gateway to the old gateway identification code in the old gateway attribute information so as to use the old gateway identification code as the current gateway identification code of the new gateway may include: extracting the old gateway identification code in the old gateway attribute information; extracting the new gateway identification code in the new gateway attribute information; storing the old gateway identification code and the new gateway identification code in a rollback record table; wherein the rollback record table is used to store executable instructions corresponding to the current gateway, and the executable instructions include a new gateway identification code rollback instruction corresponding to the new gateway; modifying the new gateway identification code corresponding to the new gateway to the old gateway identification code according to the new gateway identification code rollback instruction so as to use the old gateway identification code as the current gateway identification code of the new gateway.
[0088] In some embodiments, it may also include: if the new gateway identification code corresponding to the new gateway is successfully modified to the old gateway identification code, then deleting the new gateway identification code rollback instruction in the rollback record table; if the new gateway identification code corresponding to the new gateway is not successfully modified to the old gateway identification code, then restarting the new gateway, and monitoring the operating status of the new gateway through the Internet of Things cloud platform; if the operating status of the new gateway is online, then querying the rollback record table whether there is a new gateway identification code rollback instruction for the new gateway; if there is a new gateway identification code rollback instruction for the new gateway in the rollback record table, then resetting the current gateway identification code of the new gateway according to the new gateway identification code rollback instruction; if there is no new gateway identification code rollback instruction in the rollback record table, then ending the new gateway identification code replacement process corresponding to the new gateway.
[0089] Among them, the rollback record table is a database table or data structure, which is used to store rollback instructions that may need to be executed during specific operations (such as changing the gateway identification code). The rollback record table mainly stores an executable instruction of the current gateway. Exemplarily, the executable instructions in the rollback record table may include identification code rollback instructions, and the identification code rollback instructions can be used to modify the gateway identification code.
[0090] In a specific implementation, during the process of replacing the identification codes of the new and old gateways, the executable instructions include a new gateway identification code rollback instruction corresponding to the new gateway, and the new gateway identification code rollback instruction is an instruction for modifying the new gateway identification code corresponding to the new gateway to the old gateway identification code, so as to use the old gateway identification code as the current gateway identification code of the new gateway.
[0091] Specifically, the gateway identification code is a unique value, and rollback measures must be ensured after the replacement of the identification code of the new gateway and the old gateway fails. Figure 5 , Figure 5 is a flow chart of replacing the old and new gateway identification codes provided by an embodiment of the present application; Figure 5As shown in the figure, the specific process of replacing the new and old gateway identification codes is as follows: first, the IoT cloud platform queries and extracts the new gateway identification code and the old gateway identification code; then, the new gateway identification code and the old gateway identification code are saved in the rollback record table; then, the new gateway identification code of the new gateway is updated according to the new gateway identification code rollback instruction stored in the rollback record table, that is, the new gateway identification code is modified to the old gateway identification code according to the new gateway identification code rollback instruction; further, when the new gateway identification code is updated successfully, the rollback record of the new gateway in the rollback record table is deleted, that is, the new gateway identification code rollback instruction in the rollback record table is deleted; when the new gateway identification code update fails, the new gateway is powered off and restarted, and the IoT After the Internet of Things cloud platform monitors the new gateway online, it executes the new gateway identification code rollback instruction, deletes the old gateway identification code rollback instruction, and resets the new gateway identification code of the new gateway. That is, when the new gateway identification code update fails, the new gateway is powered off and restarted. After the Internet of Things cloud platform monitors the new gateway online, it queries whether there is a rollback record of the new gateway in the rollback record table (that is, the new gateway identification code rollback instruction). If there is a rollback record of the new gateway in the rollback record table, the new gateway identification code of the new gateway is reset (that is, return to execute the step of modifying the new gateway identification code to the old gateway identification code according to the new gateway identification code rollback instruction); if there is no rollback record of the new gateway in the rollback record table, the process ends.
[0092] In some embodiments, after the new gateway identification code corresponding to the new gateway is modified to the old gateway identification code according to the new gateway identification code rollback instruction so as to use the old gateway identification code as the current gateway identification code of the new gateway, it may also include: if the old gateway remains in normal use, extracting the new gateway identification code corresponding to the new gateway; wherein the new gateway identification code is the original gateway identification code of the new gateway; generating an old gateway identification code rollback instruction corresponding to the old gateway based on the new gateway identification code, and storing the old gateway identification code rollback instruction in a rollback record table; if the running status of the old gateway is an online status, modifying the old gateway identification code corresponding to the old gateway to the new gateway identification code according to the old gateway identification code rollback instruction; if the old gateway identification code corresponding to the old gateway is successfully modified to the new gateway identification code, deleting the old gateway identification code rollback instruction in the rollback record table.
[0093] Optionally, in the process of replacing the identification code of the old gateway, the executable instructions include a rollback instruction of the old and new gateway identification codes corresponding to the old gateway, and the old gateway identification code rollback instruction is an instruction for modifying the old gateway identification code corresponding to the old gateway to the new gateway identification code, so as to use the new gateway identification code as the current gateway identification code of the old gateway. It should be noted that the new gateway identification code is the original gateway identification code of the new gateway, that is, the original identification code before the gateway replacement operation is performed on the new gateway.
[0094] In a specific implementation, an old gateway replaced due to upgrading or other reasons can generally continue to be used. In order to prevent confusion in the identification code of the old gateway, it is necessary to replace the new gateway or generate a new identification code when the old gateway is back online to ensure uniqueness. In the embodiment of the present application, the original identification code of the new gateway is mainly used as the current gateway identification code of the old gateway as an example. It should be noted that this step does not need to be performed for a gateway that is replaced due to damage.
[0095] Specifically, see Figure 6 , Figure 6 is a flow chart of replacing an identification code of an old gateway provided in an embodiment of the present application; Figure 6 As shown in the figure, the process of replacing the identification code of the old gateway is as follows: after the new gateway identification code of the new gateway is replaced with the old gateway identification code, if the old gateway can still be used, the current gateway identification code of the old gateway needs to be replaced to prevent conflicts with the new gateway, resulting in the inability of the sub-device to access the network with the new gateway. Specifically, it is necessary to generate an update instruction (i.e., the old gateway identification code rollback instruction) for the new gateway identification code before the gateway is replaced and store it in the rollback record table as a pending execution record of the old gateway, such as Figure 6 As shown, first, the IoT cloud platform queries and extracts the original new gateway identification code of the new gateway; then, the new gateway identification code is saved in the rollback record table; the IoT cloud platform monitors whether the old gateway is online. If the old gateway is online, an instruction (i.e., the old gateway identification code rollback instruction) is issued to update the old gateway identification code of the old gateway to the original new gateway identification code of the new gateway, and the two identification codes are replaced. If the old gateway identification code of the old gateway is successfully modified to the original new gateway identification code of the new gateway, the old gateway rollback record in the rollback record table is deleted (i.e., the old gateway identification code rollback instruction). If the old gateway identification code of the old gateway fails to be successfully modified to the original new gateway identification code of the new gateway, an instruction is issued to restart the old gateway. At this time, the sub-device will be disconnected from the old gateway, and the sub-device will find the new gateway corresponding to the gateway identification code in the current channel for reconnection. The IoT cloud platform monitors the old gateway. Once the old gateway is online, the rollback record in the rollback record table is executed to replace the identification code. In addition, if the old gateway is not online or there is no rollback record of the old gateway in the rollback record table, the process ends.
[0096] In some specific embodiments, modifying the new gateway channel code in the new gateway attribute information of the new gateway to the old gateway channel code in the old gateway attribute information so as to use the old gateway channel code as the current gateway channel code of the new gateway may include: obtaining the old gateway channel code in the old gateway attribute information; obtaining the new gateway channel code in the new gateway attribute information; sending a channel code change instruction to the new gateway so that the new gateway changes the new gateway channel code corresponding to the new gateway to the old gateway channel code according to the channel code change instruction so as to use the old gateway channel code as the current gateway channel code of the new gateway.
[0097] Among them, the current gateway channel code is the old gateway channel code corresponding to the old gateway, and does not include the original new gateway channel code of the new gateway, which is the channel code of the new gateway at the current moment.
[0098] In the specific implementation, see Figure 7 , Figure 7 is a schematic diagram of a new gateway channel replacement process provided by an embodiment of the present application; Figure 7 As shown in the figure, the specific process of replacing the new gateway channel is as follows: first, after the new gateway is configured and goes online, it will report the current gateway channel code, and send the old gateway channel code of the old gateway to the new gateway in the form of sending instructions through the IoT cloud platform; then, the IoT cloud platform will send instructions to restart the ZigBee network of the new gateway, so that the new gateway can switch to the same signal channel as the old gateway.
[0099] Step S105, sending a sub-device network configuration instruction to the sub-device connected to the old gateway, so that the sub-device establishes a network connection with the new gateway according to the sub-device network configuration instruction;
[0100] In the specific implementation, Figure 7 As shown, after the new gateway changes the channel in step S104, the function of allowing sub-devices to be networked is turned off. After the channel change is completed, the IoT cloud platform will issue an instruction to enable sub-device network configuration. The sub-device that has been disconnected from the old gateway will automatically search for the new gateway in the current channel. After verifying the identification code of the new gateway, the sub-device will apply to the new gateway to establish a ZigBee connection and report the status and attribute information of the sub-device.
[0101] Specifically, the new gateway verifies the current sub-device data of the sub-device to be connected by using the sub-device data of the old gateway copied in step S103, that is, it mainly checks whether the MAC address of the sub-device applying to establish a connection is in the gateway sub-device database of the new gateway. If the verification passes, the connection is established; if not, the sub-device is denied connection.
[0102] Step S106: If the sub-device successfully establishes a network connection with the new gateway and the sub-device responds normally to the target scenario instruction, it is confirmed that the replacement of the new gateway is completed.
[0103] In the specific implementation, the user can send scene configuration instructions (target scene instructions) through the APP to identify whether the connected sub-device can respond normally. If the sub-device can respond normally, the new gateway can report information to the IoT cloud platform normally, which means that the new gateway has been replaced.
[0104] Specifically, Figure 7As shown in the figure, the complete process of replacing the channel of the new gateway includes four steps: replacing the channel code, restarting the Zigbee network, starting the sub-device network configuration, and verifying the sub-device information. Specifically, first, after the new gateway is configured, it will report the current gateway channel code online, and send the old gateway channel code of the old gateway to the new gateway through the Internet of Things cloud platform. Then, the Internet of Things cloud platform will issue an instruction to restart the Zigbee network of the new gateway, so that the new gateway can switch to the same signal channel as the old gateway. After the new gateway has replaced the channel, the function of allowing the sub-device to configure the network is closed. After the channel replacement is completed, the Internet of Things cloud platform will issue an instruction to start the sub-device network configuration. The sub-device that has been disconnected from the old gateway will automatically find the new gateway in the current channel. After verifying the identification code of the new gateway, the sub-device will apply to the new gateway to establish a Zigbee connection and report the status and attribute information of the sub-device.
[0105] The embodiment of the present application obtains the new gateway attribute information of the new gateway; sends a data clearing instruction to the new gateway so that the new gateway clears the new gateway device management information stored in the new gateway according to the data clearing instruction; sends the old gateway device management information to the new gateway for storage; modifies the new gateway attribute information of the new gateway to the old gateway attribute information; sends a sub-device network configuration instruction to the sub-device connected to the old gateway so that the sub-device establishes a network connection with the new gateway according to the sub-device network configuration instruction; if the sub-device successfully establishes a network connection with the new gateway, and the sub-device responds normally to the target scenario instruction, it is confirmed that the replacement of the new gateway is complete. The embodiment of the present application migrates the old gateway attribute information and the old gateway device management information of the old gateway to the new gateway through the Internet of Things cloud platform, without the need to reset the network access operation for each sub-device, which greatly simplifies the process of replacing the gateway. At the same time, it can effectively prevent data loss caused by gateway upgrades or damage, ensure the integrity and security of user data, and thus improve user experience.
[0106] In summary, a gateway replacement method provided in an embodiment of the present application allows the user to complete the migration of device data and local scene data of an old gateway or a damaged gateway from an old gateway to a new gateway by simply performing simple operations through an application program of a mobile terminal, thereby achieving one-click upgrade or replacement of a new gateway without the need to reset the network access operation for each sub-device, greatly simplifying the process of upgrading or replacing the gateway. At the same time, through the function of upgrading the gateway or replacing the new gateway with one click, the user's operation time and energy investment are reduced, and the convenience of use and user experience of the smart home system are improved; and it can effectively prevent the loss of device data and local scene data caused by gateway upgrades or damage, thereby ensuring the integrity and security of user data.
[0107] See also Figure 8The embodiment of the present application further provides a gateway replacement device 800, which is applied to an Internet of Things cloud platform. The Internet of Things cloud platform stores old gateway data of an old gateway, and the old gateway data includes old gateway attribute information and old gateway device management information. The device includes the following modules:
[0108] The gateway attribute information acquisition module 801 is used to acquire new gateway attribute information of a new gateway;
[0109] A gateway device information data clearing module 802 is used to send a data clearing instruction to the new gateway, so that the new gateway clears the new gateway device management information stored in the new gateway according to the data clearing instruction;
[0110] A gateway device management information replacement module 803 is used to send the old gateway device management information to the new gateway for storage;
[0111] A gateway attribute information replacement module 804, configured to modify the new gateway attribute information of the new gateway to the old gateway attribute information;
[0112] The sub-device connection module 805 is used to send a sub-device network configuration instruction to the sub-device connected to the old gateway, so that the sub-device establishes a network connection with the new gateway according to the sub-device network configuration instruction;
[0113] The new gateway replacement verification module 806 is used to confirm that the replacement of the new gateway is completed if the sub-device successfully establishes a network connection with the new gateway and the sub-device responds normally to the target scenario instruction.
[0114] It can be understood that the contents of the above method embodiments are all applicable to the present device embodiments, the functions specifically implemented by the present device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0115] The embodiment of the present application also provides an electronic device, the electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the above-mentioned gateway replacement method when executing the computer program. The electronic device can be any intelligent terminal including a tablet computer, a car computer, etc.
[0116] It can be understood that the contents of the above method embodiments are all applicable to the present device embodiments, the functions specifically implemented by the present device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0117] See also Fig. 9 , Fig. 9 The hardware structure of an electronic device of another embodiment is illustrated, and the electronic device includes:
[0118] The processor 901 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC for short), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application;
[0119] The memory 902 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 902 can store an operating system and other applications. When the technical solution provided in the embodiment of this specification is implemented by software or firmware, the relevant program code is stored in the memory 902, and the processor 901 calls and executes the gateway replacement method of the embodiment of the present application;
[0120] Input / output interface 903, used to implement information input and output;
[0121] Communication interface 904, used to realize communication interaction between the device and other devices, which can be realized through wired mode (such as USB, network cable, etc.) or wireless mode (such as mobile network, WI FI, Bluetooth, etc.);
[0122] A bus 905 that transmits information between the various components of the device (e.g., the processor 901, the memory 902, the input / output interface 903, and the communication interface 904);
[0123] The processor 901 , the memory 902 , the input / output interface 903 and the communication interface 904 are connected to each other in communication within the device via a bus 905 .
[0124] An embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the above-mentioned gateway replacement method is implemented.
[0125] It can be understood that the contents of the above method embodiments are all applicable to the present storage medium embodiments, the functions specifically implemented by the present storage medium embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0126] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0127] The gateway replacement method, gateway replacement device, electronic device and storage medium provided in the embodiment of the present application are applied to the Internet of Things cloud platform. The Internet of Things cloud platform stores the old gateway data of the old gateway, and the old gateway data includes the old gateway attribute information and the old gateway device management information. By obtaining the new gateway attribute information of the new gateway; sending a data clearing instruction to the new gateway, so that the new gateway clears the new gateway device management information stored in the new gateway according to the data clearing instruction; sending the old gateway device management information to the new gateway for storage; modifying the new gateway attribute information of the new gateway to the old gateway attribute information; sending a sub-device network configuration instruction to the sub-device connected to the old gateway, so that the sub-device establishes a network connection with the new gateway according to the sub-device network configuration instruction; if the sub-device successfully establishes a network connection with the new gateway, and the sub-device responds normally to the target scenario instruction, it is confirmed that the replacement of the new gateway is completed. The embodiment of the present application migrates the old gateway attribute information and the old gateway device management information of the old gateway to the new gateway through the Internet of Things cloud platform, without the need to reset the network access operation for each sub-device, which greatly simplifies the process of replacing the gateway. At the same time, it can effectively prevent data loss caused by gateway upgrades or damage, ensure the integrity and security of user data, and thus improve user experience.
[0128] The embodiments described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0129] Those skilled in the art will appreciate that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.
[0130] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0131] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.
[0132] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0133] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0134] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the above units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0135] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0136] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0137] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including multiple instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store programs.
[0138] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the rights of the present invention is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present invention should be within the scope of the rights of the present invention.
Claims
1. A gateway replacement method, characterized in that: Applied to an Internet of Things cloud platform, the Internet of Things cloud platform stores old gateway data of an old gateway, the old gateway data includes old gateway attribute information and old gateway device management information, and the method includes the following steps: Get new gateway attribute information of the new gateway; Sending a data clearing instruction to the new gateway, so that the new gateway clears the new gateway device management information stored in the new gateway according to the data clearing instruction; Sending the old gateway device management information to the new gateway for storage; Modify the new gateway attribute information of the new gateway to the old gateway attribute information; Sending a sub-device network configuration instruction to the sub-device connected to the old gateway, so that the sub-device establishes a network connection with the new gateway according to the sub-device network configuration instruction; If the sub-device successfully establishes a network connection with the new gateway and the sub-device responds normally to the target scene instruction, it is confirmed that the replacement of the new gateway is completed.
2. The method according to claim 1, characterized in that The old gateway device management information includes old gateway sub-device data and old gateway scenario data, and the sending of the old gateway device management information to the new gateway for storage includes: Extracting the old gateway sub-device data and the old gateway scenario data from the old gateway device management information; Sending the old gateway sub-device data and the sub-device data adding instruction to the new gateway, so that the new gateway stores the old gateway sub-device data according to the sub-device data adding instruction, and uses the old gateway sub-device data as the current gateway sub-device data of the new gateway; The old gateway scenario data and scenario configuration instructions are sent to the new gateway, so that the new gateway stores the old gateway scenario data according to the scenario configuration instructions, and uses the old gateway scenario data as the current gateway scenario data of the new gateway.
3. The method according to claim 1, characterized in that The old gateway attribute information includes an old gateway channel code and an old gateway identification code, the new gateway attribute information includes a new gateway channel code and a new gateway identification code, and the modifying of the new gateway attribute information of the new gateway to the old gateway attribute information includes: Modify the new gateway identification code in the new gateway attribute information of the new gateway to the old gateway identification code in the old gateway attribute information, so as to use the old gateway identification code as the current gateway identification code of the new gateway; The new gateway channel code in the new gateway attribute information of the new gateway is modified to the old gateway channel code in the old gateway attribute information, so as to use the old gateway channel code as the current gateway channel code of the new gateway.
4. The method according to claim 3, characterized in that: The step of modifying the new gateway identification code in the new gateway attribute information of the new gateway to the old gateway identification code in the old gateway attribute information so as to use the old gateway identification code as the current gateway identification code of the new gateway includes: Extracting the old gateway identification code from the old gateway attribute information; Extracting the new gateway identification code from the new gateway attribute information; The old gateway identification code and the new gateway identification code are stored in a rollback record table; wherein the rollback record table is used to store executable instructions corresponding to the current gateway, and the executable instructions include a new gateway identification code rollback instruction corresponding to the new gateway; The new gateway identification code corresponding to the new gateway is modified to the old gateway identification code according to the new gateway identification code rollback instruction, so as to use the old gateway identification code as the current gateway identification code of the new gateway.
5. The method according to claim 4, characterized in that The method further comprises: If the new gateway identification code corresponding to the new gateway is successfully modified to the old gateway identification code, deleting the new gateway identification code rollback instruction in the rollback record table; If the new gateway identification code corresponding to the new gateway is not successfully modified to the old gateway identification code, restart the new gateway, and monitor the running status of the new gateway through the Internet of Things cloud platform; If the running state of the new gateway is online, querying the rollback record table to see whether there is a rollback instruction of the new gateway identification code of the new gateway; If the rollback record table contains the new gateway identification code rollback instruction of the new gateway, resetting the current gateway identification code of the new gateway according to the new gateway identification code rollback instruction; If the rollback record table does not contain the new gateway identification code rollback instruction of the new gateway, the new gateway identification code replacement process corresponding to the new gateway is terminated.
6. The method according to claim 4, characterized in that After modifying the new gateway identification code corresponding to the new gateway to the old gateway identification code according to the new gateway identification code rollback instruction so as to use the old gateway identification code as the current gateway identification code of the new gateway, the method further includes: If the old gateway remains in normal use, extracting the new gateway identification code corresponding to the new gateway; wherein the new gateway identification code is the original gateway identification code of the new gateway; Generate an old gateway identification code rollback instruction corresponding to the old gateway based on the new gateway identification code, and store the old gateway identification code rollback instruction in the rollback record table; If the running state of the old gateway is an online state, the old gateway identification code corresponding to the old gateway is modified to the new gateway identification code according to the old gateway identification code rollback instruction; If the old gateway identification code corresponding to the old gateway is successfully modified to the new gateway identification code, the old gateway identification code rollback instruction in the rollback record table is deleted.
7. The method according to claim 3, characterized in that The step of modifying the new gateway channel code in the new gateway attribute information of the new gateway to the old gateway channel code in the old gateway attribute information so as to use the old gateway channel code as the current gateway channel code of the new gateway includes: Obtaining the old gateway channel code in the old gateway attribute information; Obtaining the new gateway channel code in the new gateway attribute information; A channel code change instruction is sent to the new gateway, so that the new gateway changes the new gateway channel code corresponding to the new gateway to the old gateway channel code according to the channel code change instruction, so as to use the old gateway channel code as the current gateway channel code of the new gateway.
8. A gateway replacement device, characterized in that: Applied to an Internet of Things cloud platform, the Internet of Things cloud platform stores old gateway data of old gateways, the old gateway data includes old gateway attribute information and old gateway device management information, and the device includes the following modules: A gateway attribute information acquisition module, used to acquire new gateway attribute information of a new gateway; A gateway device information data clearing module, used for sending a data clearing instruction to the new gateway, so that the new gateway clears the new gateway device management information stored in the new gateway according to the data clearing instruction; A gateway device management information replacement module, used to send the old gateway device management information to the new gateway for storage; A gateway attribute information replacement module, used to modify the new gateway attribute information of the new gateway to the old gateway attribute information; A sub-device connection module, used to send a sub-device network configuration instruction to the sub-device connected to the old gateway, so that the sub-device establishes a network connection with the new gateway according to the sub-device network configuration instruction; The new gateway replacement verification module is used to confirm that the replacement of the new gateway is completed if the sub-device successfully establishes a network connection with the new gateway and the sub-device responds normally to the target scene instruction.
9. An electronic device, characterized in that: The electronic device comprises a memory and a processor, the memory stores a computer program, and the processor implements the method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.