Gateway group for device management, device management method, and device management apparatus
By designing a gateway group for multiple gateway devices to process device messages in the Internet of Things platform, the problem of insufficient processing capabilities of a single gateway device is solved, the message processing efficiency and accuracy are improved, and the user's real-time control experience is ensured.
Patent Information
- Application Number
- CN202411662118.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-19
- Publication Date
- 2025-02-25
AI Technical Summary
The processing capacity of a single gateway device is limited and cannot process messages from a large number of smart devices in a timely manner, resulting in low message processing efficiency and affecting the user's experience of controlling smart devices in real time.
Design a gateway group that contains multiple gateway devices, each gateway device storage device mapping table for indicating the agent's smart devices. The processing of equipment messages is improved through the division of labor by multiple gateway devices, and the processing efficiency is improved, and the accurate processing of messages is ensured by maintaining the equipment mapping table.
Through the division of labor of multiple gateway devices to process device messages, the efficiency and accuracy of message processing are improved, the situation where messages are processed by errors or repeated processing is avoided, and the user's real-time control experience is ensured.
Smart Images

Figure CN119520608A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computer technology, and in particular to a gateway group, a device management method, and a device management apparatus for device management. Background Art
[0002] The Internet of Things (IOT) platform is a cloud service for developers in the field of IoT. It can establish a secure two-way connection between smart devices and the cloud to quickly implement IoT projects. For example, in the field of smart homes, the IoT platform can connect various smart devices (such as smart bulbs, smart sockets, smart door locks, etc.) to achieve interconnection and remote control of devices.
[0003] In the related art, the IoT platform and smart devices communicate through a local area network, and usually a single gateway networking method is adopted in the local area network, that is, a gateway device is set up in a local area network, and this gateway device is responsible for connecting multiple smart devices in the local area network.
[0004] However, the processing capacity of a single gateway device is limited. When the number of smart devices in the local area network is too large, a single gateway cannot process messages from all smart devices in a timely manner. The message processing efficiency is low, affecting the user's experience of real-time control of smart devices. Summary of the invention
[0005] The embodiment of the present application provides a gateway group for device management, a device management method and a device management apparatus, and the technical solution is as follows:
[0006] On the one hand, a gateway group for device management is provided, wherein the gateway group includes a plurality of gateway devices, and the plurality of gateway devices respectively store a device mapping table, wherein the plurality of gateway devices include a first gateway device, and the first device mapping table stored in the first gateway device is used to indicate a smart device represented by the first gateway device;
[0007] The multiple gateway devices are used to respectively receive device messages, wherein the device message includes a first device identifier of a first smart device, and the device message includes at least one of a message sent by the first smart device and a message to be received by the first smart device;
[0008] The first gateway device is used to process the device message when the first device identifier matches the first device mapping table, wherein the match between the first device identifier and the first device mapping table is used to indicate that the first smart device is a smart device represented by the first gateway device.
[0009] In some embodiments, the multiple gateway devices include a second gateway device; the second gateway device is used to obtain a global device mapping table when serving as the main gateway device in the gateway group, and the global device mapping table is used to indicate the smart devices respectively represented by the multiple gateway devices; wherein the global device mapping table indicates that the first gateway device represents the first smart device with a first priority, and a third gateway device among the multiple gateway devices represents the first smart device with a second priority, and the first priority is higher than the second priority.
[0010] In some embodiments, the second gateway device is used to send a message processing notification to the third gateway device if the message processing result of the device message by the first gateway device is not received within a time limit, and the message processing notification is used to notify the third network device to process the device message; the third gateway device is used to process the device message if the message processing notification is received.
[0011] In some embodiments, the second gateway device is used to update the global device mapping table and send an update notification to other gateway devices in the gateway group when a device change event occurs in the gateway group, wherein the update notification is used to notify the other gateway devices to obtain the updated device mapping table; the other gateway devices are used to receive the update notification and obtain the updated device mapping table.
[0012] In some embodiments, the device change event includes at least one of the following events:
[0013] The gateway group receives a gateway adding operation, where the gateway adding operation is used to add a new gateway device in the gateway group;
[0014] The gateway group receives a gateway removal operation, where the gateway removal operation is used to remove a gateway device from the gateway group;
[0015] There is a faulty gateway device in the gateway group.
[0016] In some embodiments, the second gateway device is used to update the global device mapping table based on a preset allocation strategy when a device change event occurs in the gateway group; wherein the preset allocation strategy is used to allocate the proxy relationship between the gateway device in the changed gateway group and multiple smart devices connected to the gateway group.
[0017] In some embodiments, the second gateway device is used to obtain location information and load information corresponding to the gateway device in the changed gateway group when a device change event occurs in the gateway group, the location information is used to indicate the physical location of the gateway device, and the load information is used to indicate the current load status of the gateway device; the second gateway device is used to determine the proxy relationship between the gateway device in the changed gateway group and the multiple smart devices corresponding to the gateway group based on the location information and the load information and according to the preset allocation strategy; and update the global device mapping table according to the proxy relationship.
[0018] In some embodiments, the multiple gateway devices are used to determine a fourth gateway device among the multiple gateway devices as a master gateway device through a preset election strategy when the second gateway device fails.
[0019] In some embodiments, the multiple gateway devices share a first communication channel with the proxy server; the multiple gateway devices are used to respectively receive the downlink messages through the first communication channel when the device message is a downlink message sent by the proxy server to the first smart device; or, the first gateway device is used to forward the uplink message to the proxy server through the first communication channel when the device message is an uplink message sent by the first smart device to the proxy server.
[0020] In some embodiments, the first communication channel includes multiple sub-communication channels, and the multiple smart devices connected to the gateway group are assigned to the multiple sub-communication channels according to device attributes; wherein, the first smart device and the second smart device are assigned to the first sub-communication channel among the multiple sub-communication channels, and the gateway device that acts as an agent for the first smart device and the gateway device that acts as an agent for the second smart device share the first sub-communication channel between the proxy server.
[0021] On the other hand, a device management method is provided, which is performed by a first gateway device, and the method includes:
[0022] receiving a device message, wherein the device message includes a first device identifier of a first smart device, and the device message includes at least one of a message sent by the first smart device and a message to be received by the first smart device; the device message is a message sent in parallel to a plurality of gateway devices in a gateway group, the plurality of gateway devices includes the first gateway device, and the plurality of gateway devices respectively store a device mapping table;
[0023] Acquire a first device mapping table, where the first device mapping table is a device mapping table stored in the first gateway device, and the first device mapping table is used to indicate the smart device represented by the first gateway device;
[0024] In a case where the first device identifier matches the first device mapping table, the device message is processed, wherein the match between the first device identifier and the first device mapping table is used to indicate that the first smart device is a smart device proxied by the first gateway device.
[0025] In another aspect, a device management apparatus is provided, the apparatus comprising:
[0026] A receiving module, configured to receive a device message, wherein the device message includes a first device identifier of a first smart device, and the device message includes at least one of a message sent by the first smart device and a message to be received by the first smart device; the device message is a message sent in parallel to a plurality of gateway devices in a gateway group, wherein the plurality of gateway devices include a first gateway device, and the plurality of gateway devices respectively store a device mapping table;
[0027] An acquisition module, configured to acquire a first device mapping table, where the first device mapping table is a device mapping table stored in the first gateway device, and the first device mapping table is used to indicate a smart device represented by the first gateway device;
[0028] A processing module is used to process the device message when the first device identifier matches the first device mapping table, wherein the match between the first device identifier and the first device mapping table is used to indicate that the first smart device is a smart device proxied by the first gateway device.
[0029] On the other hand, a gateway device is provided, which includes a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set are loaded and executed by the processor to implement the above-mentioned device management method.
[0030] On the other hand, a computer-readable storage medium is provided, in which at least one instruction, at least one program, a code set or an instruction set is stored, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by a processor to implement the above-mentioned device management method.
[0031] On the other hand, a computer program product or a computer program is provided, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. The processor of the gateway device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the gateway device executes the above-mentioned device management method.
[0032] The beneficial effects brought by the technical solution provided by the embodiment of the present application include at least:
[0033] A gateway group is designed for device management. There are multiple gateway devices in the gateway group. Each gateway device stores a device mapping table. This device mapping table indicates the smart devices that the gateway device proxies. Each gateway device only needs to process the device messages of the smart devices that it proxies. When the gateway group receives a device message, if the device mapping table stored in the first gateway device matches the device identifier in the device message, it means that the device message is a device message of the smart device that the first gateway device proxies. Then the first gateway device processes the device message. On the one hand, the device messages received by the gateway group are processed by multiple gateway devices in a division of labor, thereby improving the processing efficiency of the device messages. On the other hand, each gateway device determines the device messages that it needs to process by maintaining the device mapping table, ensuring that the device messages can be processed accurately and avoiding the situation where the device messages are processed incorrectly or repeatedly. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0035] Figure 1 is a schematic diagram of a computer system provided by an exemplary embodiment of the present application;
[0036] Figure 2 is a schematic diagram of a device management process provided by an exemplary embodiment of the present application;
[0037] Figure 3 is a schematic diagram of a device management process provided by another exemplary embodiment of the present application;
[0038] Figure 4 is a schematic diagram of a device management process provided by another exemplary embodiment of the present application;
[0039] Figure 5 is a schematic diagram of a device management process provided by yet another exemplary embodiment of the present application;
[0040] Figure 6 It is a schematic diagram of a connection process of a gateway group on an Internet of Things platform provided by an exemplary embodiment of the present application;
[0041] Figure 7 It is a schematic diagram of an uplink message processing process of a gateway group on an Internet of Things platform provided by an exemplary embodiment of the present application;
[0042] Figure 8 It is a schematic diagram of a downlink message processing process of a gateway group on an Internet of Things platform provided by an exemplary embodiment of the present application;
[0043] Fig. 9 is a schematic diagram of grouping a gateway group provided by an exemplary embodiment of the present application;
[0044] Fig.10 is a schematic diagram of a device management method provided by an exemplary embodiment of the present application;
[0045] Fig.11 is a structural block diagram of a device management apparatus provided by an exemplary embodiment of the present application;
[0046] Fig.12 It is a structural block diagram of a gateway device provided by an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0047] In order to make the purpose, technical solution and advantages of the present application clearer, the implementation mode of the present application will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present application.
[0048] In this application, the terms "first", "second", etc. are used to distinguish identical or similar items with substantially the same effects and functions. It should be understood that there is no logical or temporal dependency between "first" and "second", nor is there any limitation on quantity and execution order.
[0049] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.) and signals involved in this application are all authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.
[0050] The Internet of Things (IOT) platform is a cloud service for developers in the field of IoT. It can establish a secure two-way connection between smart devices and the cloud to quickly implement IoT projects. For example, in the field of smart homes, the IoT platform can connect various smart devices (such as smart bulbs, smart sockets, smart door locks, etc.) to achieve interconnection and remote control of devices. In related technologies, the IoT platform and smart devices communicate through a local area network, and a single gateway networking method is usually adopted in the local area network, that is, a gateway device is set up in a local area network, and this gateway device is responsible for connecting multiple smart devices in the local area network. However, the processing capacity of a single gateway device is limited. When the number of smart devices in the local area network is too large, a single gateway cannot process the messages of all smart devices in a timely manner, and the message processing efficiency is low, which affects the user's experience of real-time control of smart devices.
[0051] Based on this, the present application provides a gateway group for device management, which is implemented as a gateway device set in a local area network of an Internet of Things platform as an example for explanation. The gateway group is used to handle data transmission, management and interaction between smart devices and servers.
[0052] For illustration, please refer to Figure 1 , which shows a structural block diagram of a computer system, the computer system includes: a gateway group 110, a smart device 120 and a server 130.
[0053] The gateway group 110 includes multiple gateway devices, and the multiple gateway devices are connected to each other; the smart device 120 has a connection relationship with each gateway device in the gateway group 110, and the server 130 has a connection relationship with each gateway device in the gateway group 110.
[0054] Schematically, the gateway group 110 and the smart device 120 are in the same mesh network, which means that they form a wireless network environment that is interconnected and works in collaboration through mesh networking. Mesh networking, or "mesh network", is a type of wireless local area network in which each node (in this application, it can be a gateway device, smart device, etc.) can communicate with other nodes to form a multi-hop network topology.
[0055] In the computer system, the number of the smart devices 120 may be one or more, and the number of the servers 130 may be one or more, which are not limited here. The following is an example in which the gateway group 110 includes gateway device 1, gateway device 2, and gateway device 3, and the smart devices 120 include smart device 1, smart device 2, smart device 3, smart device 4, and smart device 5.
[0056] Each gateway device in the gateway group 110 stores a device mapping table, which indicates the smart device that the gateway device acts as an agent. For example, gateway device 1 stores device mapping table 1, which indicates that the gateway device acts as an agent for smart device 1. Then, in the gateway group 110, gateway device 1 processes messages from smart device 1, or processes messages sent from server 130 to smart device 1.
[0057] The following description will be made by taking the case where the smart device 1 sends an uplink message a (ie, a device message) to the server 130 as an example.
[0058] Schematically, the uplink message a includes data such as the attributes, status, and device identification of the smart device 1. After the gateway group 110 receives the uplink message a, the uplink message a will be sent to each gateway device in the gateway group 110. After each gateway device receives the uplink message a, it will obtain the device identification in the uplink message a and match the device identification with the device mapping table stored in it. If the match is successful (for example, the device identification is in the device mapping table), the uplink message a will be processed. If the match fails, the uplink message a will be ignored. If the uplink message a successfully matches the device mapping table of the gateway device 1, the gateway device 1 starts to process the uplink message a, for example, sending the uplink message a to the server 130. After the processing is completed, the gateway device 1 will broadcast the message processing result of the uplink message a in the gateway group 110, that is, send the message processing result to other gateway devices in the gateway group 110.
[0059] In some embodiments, the computer system also includes a terminal 140, in which a client of a first application is installed. The first application can be implemented as a control application for a smart device, or as an application that provides control functions for a smart device. This application does not limit the form of the first application, including but not limited to App (Application, application) and mini-programs installed in the terminal 140, and can also be in the form of a web page.
[0060] The following description will be made by taking the example of the terminal 140 sending a downlink instruction b (ie, a device message) to the smart device 1 .
[0061] Schematically, the user uses the first application to control the smart device 1 (for example, to control the smart sweeping robot to start sweeping, etc.), and the user triggers the control operation on the first application. The client of the first application generates a control instruction, that is, a downlink instruction b, which includes the device identification of the smart device 1 and the specific control operation content and other data. The client of the first application sends the downlink instruction b to the server 130, and the server 130 sends the downlink instruction b to each gateway device in the gateway group 110. After receiving the downlink instruction b, each gateway device obtains the device identification in the downlink instruction b and matches the device identification with the device mapping table stored in it. If the match is successful, the downlink instruction b will be processed, and if the match fails, the downlink instruction b will be ignored. If the downlink instruction b successfully matches the device mapping table of the gateway device 1, the gateway device 1 sends the downlink instruction b to the smart device 1. After receiving the downlink instruction b, the smart device 1 will perform the corresponding task according to the downlink instruction b. After the gateway device 1 successfully sends the downlink instruction b, the gateway device 1 will broadcast the message processing result of the downlink instruction b in the gateway group 110.
[0062] In some embodiments, the multiple gateway devices in the gateway group 110 are divided into two types: a main gateway (also called a master gateway) and a sub-gateway (also called a follower gateway). Usually, there is one main gateway in a gateway group, such as Figure 1 As shown, gateway device 1 and gateway device 2 are sub-gateways, and gateway device 3 is a main gateway.
[0063] The device mapping table stored in the gateway device 3 belongs to the global device mapping table, which records the proxy relationship between all gateway devices in the gateway group 110 and the smart device 120. For example: gateway device 1 is a proxy for smart device 1 and smart device 2, gateway device 2 is a proxy for smart device 3 and smart device 4, and gateway device 3 is a proxy for smart device 5; or, gateway device 1 is a proxy for smart device 1, smart device 2 and smart device 5, and gateway device 2 is a proxy for smart device 3 and smart device 4 (that is, the main gateway does not participate in processing device messages).
[0064] Optionally, the global device mapping table indicates the main proxy gateway and the alternative proxy gateway of the smart device, for example: the main proxy gateway of smart device 1 in the global device mapping table is gateway device 1, and the alternative proxy gateway is gateway device 2. Taking the above-mentioned processing of downlink message a as an example, when other gateway devices in gateway group 110 time out and do not receive the message processing result of gateway device 1 on downlink message a, gateway device 3 will send a message processing instruction to gateway device 2 according to the global device mapping table, and gateway device 2 will send the downlink message a to server 130 as an alternative proxy device. Taking the above-mentioned processing of uplink instruction b as an example, when other gateway devices in gateway group 110 time out and do not receive the message processing result of gateway device 1 on uplink instruction b, gateway device 3 will send a message processing instruction to gateway device 2 according to the global device mapping table, and gateway device 2 will send the uplink instruction b to smart device 1 as an alternative proxy device.
[0065] It is worth noting that the gateway devices in the gateway group 110 include at least one of a router, a gateway switch, an edge gateway, a smart home gateway, etc. The smart device 120 can be implemented as a variety of smart devices such as smart door locks, smart speakers, and smart home devices. The server 130 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services, or it can be implemented as a node in a blockchain system. The terminal 140 can be an electronic device such as a mobile phone, a tablet computer, a vehicle-mounted terminal (vehicle machine), a wearable device, a PC (Personal Computer), etc. The embodiments of the present application are not limited to this.
[0066] In some embodiments, the above-mentioned server 130 refers to an MQTT (Message Queuing Telemetry Transport) server. The server 130 is installed with server software that supports the MQTT communication protocol. The MQTT communication protocol is a lightweight message transmission protocol based on the publish / subscribe model, which is widely used in data communication in the Internet of Things platform.
[0067] In summary, the present application designs a gateway group for device management. There are multiple gateway devices in the gateway group. Each gateway device stores a device mapping table. This device mapping table indicates the smart devices that the gateway device proxies. Each gateway device only needs to process the device messages of the smart devices that it proxies. When the gateway group receives a device message, if the device mapping table stored in the first gateway device matches the device identifier in the device message, indicating that the device message is a device message of the smart device that the first gateway device proxies, the first gateway device processes the device message. On the one hand, the device messages received by the gateway group are processed by multiple gateway devices in a division of labor, thereby improving the processing efficiency of the device messages. On the other hand, each gateway device determines the device messages that it needs to process by maintaining the device mapping table, ensuring that the device messages can be accurately processed and avoiding the situation where the device messages are processed incorrectly or repeatedly.
[0068] In addition, when the gateway group receives a device message, the device message will be broadcast to each gateway device in the gateway group. Then, when a gateway device fails or cannot respond in time, other gateway devices can process the device message, thereby increasing the probability of successful processing of the device message and ensuring the reliability of the device message during transmission.
[0069] The following is an introduction to the device management process performed by the gateway group provided in the embodiment of the present application.
[0070] For illustration, please refer to Figure 2 , Figure 2 A gateway group 200 for device management is shown, and the gateway group includes multiple gateway devices. Figure 2 , a first gateway device, a second gateway device, and a third gateway device among multiple gateway devices are shown. It should be noted that: Figure 2 The first gateway device, the second gateway device, and the third gateway device shown do not represent the number of gateway devices in the gateway group, and may actually be more or less. Figure 2 This is for illustrative purposes only.
[0071] Wherein, multiple gateway devices communicate with each other. Schematically, multiple gateway devices are in the same wireless mesh network (mesh network), and multiple gateway devices can communicate with each other and forward data.
[0072] The plurality of gateway devices respectively store a device mapping table.
[0073] Optionally, the locations where the multiple gateway devices store the device mapping tables include at least one of the following locations:
[0074] (1) Local storage space.
[0075] The local storage space refers to the storage medium of the gateway device itself, such as Redis, memory, etc. By storing the device mapping table in the local storage space, the gateway device can quickly access the device mapping table.
[0076] (2)Cloud storage space.
[0077] Cloud storage space refers to remote storage services connected via the Internet, such as storage solutions provided by cloud service providers.
[0078] In some embodiments, each gateway device stores the device mapping table in both the cloud storage space and the local storage space. Optionally, the cloud storage space is a shared storage space of the gateway group, that is, each gateway device in the gateway group can access its own or other gateway devices' device mapping table by accessing the cloud storage space.
[0079] The device mapping table is used to indicate the smart devices that the gateway device represents. Schematically, the device mapping table is a table used to record the association between the gateway device and the smart devices, and includes relevant information of the smart devices represented (or managed) by the gateway device, such as the device's IP address, MAC address, device type, device unique identifier, etc.
[0080] The multiple gateway devices include a first gateway device, and the first device mapping table stored in the first gateway device is used to indicate the smart device represented by the first gateway device.
[0081] Illustratively, taking the first gateway device as an example, the first device mapping table stored therein is specifically used to indicate the smart devices represented by the first gateway device.
[0082] In this application, each of the multiple gateway devices in the gateway group maintains a device mapping table. When receiving a device message sent by a specific smart device, the gateway device in the gateway group that acts as a proxy for the specific device processes the device message. The following describes the process of the gateway group processing device messages.
[0083] like Figure 2 As shown, the device management process performed by the gateway group 200 includes step 201 and step 202.
[0084] Step 201: multiple gateway devices receive device messages respectively.
[0085] In some embodiments, multiple gateway devices in a gateway group receive device messages in parallel.
[0086] Schematically, each gateway device in the gateway group has the ability to receive device messages. When a sender (such as a smart device or other sender) sends a device message to the gateway group, it will be received by multiple gateway devices at the same time.
[0087] In some other embodiments, a target gateway device in the gateway group receives the device message, and the target gateway device forwards the device message to other gateway devices other than the target gateway device among the multiple gateway devices. The target gateway device is a receiver selected by the sender of the device message.
[0088] Optionally, the number of target gateway devices may be one or more. When there are multiple target gateway devices, it should be noted that when the target gateway device forwards a device message to other gateway devices, the other gateway devices will not repeatedly receive the device message, that is, each gateway device in the gateway group usually only receives one device message.
[0089] Indicatively, the sender of the device message has the ability to select the target gateway device, and the sender can select the most suitable gateway device as the receiver of the device message based on various factors (such as the load of the gateway device, network conditions, geographical location, etc.). It is responsible for receiving messages from smart devices and forwarding these messages to other gateway devices in the gateway group.
[0090] Optionally, the target gateway device is a receiver selected by the sender of the device message based on a proximity principle.
[0091] Among them, the proximity principle refers to selecting the gateway device that is closest to the sender or has the smallest communication delay.
[0092] The device message is a message associated with the first smart device, and the device message includes a first device identifier of the first smart device. Optionally, the first device identifier is a unique identifier of the first smart device.
[0093] Optionally, the device message includes at least one of the following messages.
[0094] (1) A message sent by the first smart device.
[0095] When the first smart device needs to communicate with other devices through the gateway group, it sends a device message. This message includes but is not limited to device status updates, sensor data, control instructions, etc. The content of the device message depends on the type and function of the first smart device. For example, a temperature sensor may send a message containing the current temperature reading, while a smart light bulb may send a message containing its on / off status.
[0096] In some embodiments, the device message is used to indicate an uplink message sent by the first smart device to a proxy server in the Internet of Things platform through the gateway group.
[0097] Illustratively, a device message refers to a data packet or information unit generated by a first smart device and sent to the IoT platform. The device message may include current status information of the smart device, such as the reading of a temperature sensor, the switch status of a smart light bulb, etc.
[0098] Optionally, the device message is used to indicate an uplink message that the first smart device sends to a proxy server in the Internet of Things platform through the gateway group periodically or as needed.
[0099] In an illustrative manner, the first smart device periodically uploads the collected sensor data to the IoT platform for further analysis or processing by the IoT platform. Alternatively, when the first smart device completes the IoT platform control instruction, it generates a device message as a response to the IoT platform control instruction, indicating that the first smart device has performed the corresponding operation.
[0100] (2) A message to be received by the first smart device.
[0101] The first smart device can receive device messages from other devices. This message includes but is not limited to control instructions, status updates, configuration parameters, etc. for the first smart device. The sender of the device message can be any device that can send messages to the first smart device, such as other smart devices, gateway devices, cloud services, or user clients.
[0102] In some embodiments, the device message is used to indicate a downlink message sent by a proxy server in the Internet of Things platform to the first smart device through the gateway group.
[0103] Optionally, the downlink message may be implemented as a downlink instruction sent by the user client to the proxy server in the Internet of Things platform.
[0104] Among them, the user client refers to a client that provides the control function of the first smart device. The downlink instructions issued by the user client can directly control the operation of the first smart device, such as turning on or off the smart light bulb, adjusting the temperature setting of the thermostat, starting or stopping smart appliances, etc. Downlink instructions can also be used to configure the parameters of smart devices, such as setting up Wi-Fi networks, updating device names, configuring linkage rules between devices, etc. Downlink instructions can also request the smart device to report its current status, such as querying the current temperature of the thermostat, checking the lock status of the smart door lock, etc. Downlink instructions can be used to manage access rights to smart devices, such as adding or deleting user accounts, changing the access password of the device, etc. There is no limitation here.
[0105] Step 202: The first gateway device processes a device message when the first device identifier matches the first device mapping table.
[0106] The first device identifier matches the first device mapping table to indicate that the first smart device is a smart device represented by the first gateway device.
[0107] Illustratively, after receiving a device message, each gateway device in the gateway group will access the device mapping table stored in itself. If the first device identifier is the device identifier recorded in the device mapping table, it indicates that the match is successful, and the gateway device processes the device message; if the first device identifier is not the device identifier recorded in the device mapping table, it indicates that the match fails, and the gateway device discards the device message or temporarily stores the device message. In the case of temporarily storing the device message, the gateway device will discard the device message periodically or on demand.
[0108] Taking the first gateway device as an example, the first gateway device will access the first device mapping table; then match the first device identifier with the first device mapping table, and query whether the first device identifier is in the first device mapping table. If the first device identifier is found in the first device mapping table, it is determined that the first device identifier matches the first device mapping table successfully, which means that the first smart device indicated by the first device identifier is the smart device represented by the first gateway device, and the first gateway device will process the device message.
[0109] After determining that the first gateway device processes the device message, at least the following two situations exist:
[0110] (1) Processing completed.
[0111] When the first gateway device completes processing the device message, the first gateway device will generate a device processing result. For example, if the device message is to forward a downlink instruction to the first smart device, then after the first gateway device successfully forwards the downlink instruction to the first smart device, it will generate a device processing result. The device processing result is used to indicate that the downlink instruction is successfully sent to the first smart device.
[0112] In the present application, after the first gateway device generates a device processing result, the device processing result is broadcast to other gateway devices in the gateway group.
[0113] In some embodiments, the device management process performed by the gateway group 200 includes step 203 .
[0114] Step 203: The first gateway device sends the device processing result to other gateway devices.
[0115] Indicatively, Figure 2 As shown, the first gateway device sends the device processing result to the second gateway device and the third gateway device, wherein the second gateway device and the third gateway device are other gateway devices in the gateway group.
[0116] Optionally, other gateway devices are used to delete the temporarily stored device messages when confirming that the device message processing is successful.
[0117] or other gateway devices, for determining an error resolution strategy based on error information indicated in a device processing result when confirming that the device message processing has failed.
[0118] Schematically, different error messages correspond to different error resolution strategies. Taking the error message implemented as network timeout as an example, if the device message processing fails due to network timeout, other gateway devices will re-determine the gateway device that processes the device message, and the re-determined gateway device will process the device message.
[0119] (2)Unprocessed.
[0120] If the first gateway device fails to process the device message or fails to process the device message for a long time due to a fault or other reasons, the first gateway device will not generate a device processing result. When other gateway devices fail to receive the device processing result after a timeout, they will re-determine the gateway device that processes the device message, and the re-determined gateway device will process the device message.
[0121] In summary, the present application designs a gateway group for device management. There are multiple gateway devices in the gateway group. Each gateway device stores a device mapping table. This device mapping table indicates the smart devices that the gateway device proxies. Each gateway device only needs to process the device messages of the smart devices that it proxies. When the gateway group receives a device message, if the device mapping table stored in the first gateway device matches the device identifier in the device message, indicating that the device message is a device message of the smart device that the first gateway device proxies, the first gateway device processes the device message. On the one hand, the device messages received by the gateway group are processed by multiple gateway devices in a division of labor, thereby improving the processing efficiency of the device messages. On the other hand, each gateway device determines the device messages that it needs to process by maintaining the device mapping table, ensuring that the device messages can be accurately processed and avoiding the situation where the device messages are processed incorrectly or repeatedly.
[0122] In some embodiments, the gateway group is mainly used for data transmission between the proxy server and multiple smart devices. The multiple smart devices refer to smart devices connected to the gateway group.
[0123] Optionally, the proxy server is used to indicate the server device in the IoT platform, and the proxy server is responsible for receiving downlink messages from other devices (e.g., user clients) and forwarding the downlink messages to the gateway group. The gateway group is responsible for further forwarding the downlink messages to the smart devices connected to it.
[0124] Wherein, a plurality of gateway devices share a first communication channel with the proxy server.
[0125] Schematically, the first communication channel refers to a topic (communication path) in a publish / subscribe model, in which a proxy server, as a publisher, sends messages to a specified topic, and a gateway device, as a subscriber, subscribes to the topic to receive messages. When multiple gateway devices share the same topic, they can send messages to or receive messages from the proxy server through the common communication path.
[0126] That is, the above step 201 can be implemented as follows: when the device message is a downlink message sent by the proxy server to the first smart device, the multiple gateway devices respectively receive the downlink message through the first communication channel. The above step 202 can be implemented as follows: when the device message is an uplink message sent by the first smart device to the proxy server, the first gateway device forwards the uplink message to the proxy server through the first communication channel.
[0127] Among them, for downlink messages, since multiple gateway devices subscribe to the same topic, the proxy server sends a downlink message to the first smart device, and adds the unique identifier of the first smart device (such as "device_name", that is, the first device identifier) in the downlink message, so that each gateway device can determine whether the message belongs to the sub-device it proxies based on "device_name" after receiving the message. If it does, it processes the message, otherwise it ignores it.
[0128] In some embodiments, different topics can be created based on the device attributes of smart devices, and sub-devices can be assigned to specific topics. Each gateway device only needs to subscribe to topics related to the smart devices it represents, rather than all gateways subscribing to the same topic, thereby improving the efficiency and pertinence of communication.
[0129] Optionally, the first communication channel includes multiple sub-communication channels, and multiple smart devices connected to the gateway group are allocated to the multiple sub-communication channels according to device properties.
[0130] Device attributes include but are not limited to device type, location, function, etc. Each smart device is assigned to one or more sub-communication channels that match its attributes. In this way, devices with similar attributes can share the same communication path, thereby simplifying the network architecture and improving communication efficiency.
[0131] Take the first smart device and the second smart device as an example. The first smart device and the second smart device are assigned to the first sub-communication channel among the multiple sub-communication channels, and the gateway device acting as the proxy for the first smart device and the gateway device acting as the proxy for the second smart device share the first sub-communication channel with the proxy server.
[0132] Illustratively, the first smart device and the second smart device have the same device type or location attribute, and they are assigned to the same topic, and the gateway device acting as a proxy for the first smart device and the second smart device shares the topic for efficient data transmission and communication.
[0133] Suppose there is a smart home system that contains multiple smart devices (such as temperature sensors, humidity sensors, light controllers, etc.) and multiple gateway devices. Different topics such as "sensors" and "controllers" are created according to the device type. Each smart device is assigned to a topic that matches its type. For example, all temperature sensors and humidity sensors are assigned to the "sensors" topic.
[0134] The gateway device that acts as the proxy for the temperature sensor and humidity sensor subscribes to the "sensors" topic, so it can receive data from all temperature sensors and humidity sensors, and can also send commands to the temperature sensors and humidity sensors. The gateway device that acts as the proxy for the light controller subscribes to the "controllers" topic, so it can receive data from all light controllers, and can also send commands to light controllers.
[0135] In some embodiments, multiple gateway devices in a gateway group are divided into two types: a main gateway device and a sub-gateway device. The main gateway device is responsible for the global management of the gateway group, including the addition and removal of gateways, the determination of the proxy relationship between the gateway device and the smart device, etc. The sub-gateway device mainly processes the device messages of its own proxy, and updates the proxy relationship according to the instructions of the main gateway device.
[0136] For illustration, please refer to Figure 3 , the above Figure 2 The multiple gateway devices in the gateway group 200 also include a second gateway device.
[0137] The second gateway device is used to obtain a global device mapping table when serving as a master gateway device in the gateway group. The global device mapping table is used to indicate the intelligent devices respectively represented by the multiple gateway devices.
[0138] like Figure 3 As shown, when the second gateway device serves as the main gateway device in the gateway group, the second gateway device can also be called a master gateway device; other gateway devices in the gateway group 200 are sub-gateway devices (for example, the first gateway device and the third gateway device are both sub-gateway devices), and other gateway devices can also be called follower gateway devices.
[0139] Schematically, the gateway group is connected to multiple smart devices, and the global device mapping table records the proxy relationships between multiple smart devices and multiple gateway devices, for example: gateway device 1 is a proxy for smart device 1 and smart device 2, gateway device 3 is a proxy for smart device 3, and so on.
[0140] In some embodiments, in the global device mapping table, each smart device is associated with at least two gateway devices, wherein at least two gateway devices respectively correspond to different priorities, and the priority is used to indicate the proxy priority for the smart device. Schematically, smart device 1 is associated with gateway device 1, gateway device 2 and gateway device 3, that is, gateway device 1, gateway device 2 and gateway device 3 can all act as agents (or called management) for smart device 1, wherein the size relationship of the proxy priority is as follows: gateway device 1>gateway device 2>gateway device 3, then when the gateway group receives a device message associated with smart device 1, gateway device 1 first processes the device message. When gateway device 1 is unavailable, gateway device 2 processes the device message.
[0141] In some embodiments, each smart device is associated with two gateway devices, one of which is a primary proxy gateway device and the other is an alternative proxy gateway device. The primary proxy gateway device corresponds to a first priority and the alternative proxy gateway device corresponds to a second priority.
[0142] Optionally, the global device mapping table indicates that the first gateway device acts as a proxy for the first intelligent device with a first priority, and a third gateway device among the plurality of gateway devices acts as a proxy for the first intelligent device with a second priority, and the first priority is higher than the second priority.
[0143] In this application, if the first gateway device cannot process the device message sent by the first smart device it is acting as, the second gateway device (i.e., the main gateway device) assigns the first smart device's alternate proxy gateway device, i.e., the third gateway device, to process the device message. Figure 3 As shown, the device management process executed by the gateway group 200 also includes step 204 and step 205.
[0144] Step 204: When the second gateway device does not receive the message processing result of the device message from the first gateway device within a timeout period, the second gateway device sends a message processing notification to the third gateway device.
[0145] The message processing notification is used to notify the third network device to process the device message.
[0146] Illustratively, the moment when the second gateway device receives the device message is the first moment. If the time between the first moment and the current moment reaches the preset time, and the second gateway device has not received the message processing result of the device message from the first gateway device, it means that the second gateway device has timed out and has not received the message processing result of the device message from the first gateway device. At this time, the second gateway device queries the global device mapping table stored in the device to obtain the alternative proxy gateway device of the first smart device, that is, the third gateway device, and then the second gateway device sends a message processing notification to the third gateway device.
[0147] If the device message has been deleted in the third gateway device, the message processing notification also includes the device message; if the device message has not been deleted by the third gateway device, the message processing notification may not include the device message.
[0148] Step 205: The third gateway device processes the device message upon receiving the message processing notification.
[0149] When the third gateway device receives the message processing notification, it processes the device message. Similar to the first gateway device, when the third gateway device completes processing the device message, the third gateway device generates a device processing result and then broadcasts the device processing result to other gateway devices in the gateway group. If the second gateway device does not receive the message processing result of the device message from the third gateway device within the timeout period, it may perform at least one of the following operations:
[0150] (1) When there is no other candidate proxy gateway device for the first smart device, the first gateway device is assigned to process the device message.
[0151] (2) When there are other candidate proxy gateway devices for the first intelligent device, the other candidate proxy gateway devices are assigned to process device messages.
[0152] (3) Feedback processing error information to the sender of the device message.
[0153] In some embodiments, if the device message is a downlink message sent by the proxy server to the first smart device, the downlink message further includes the following processing flow:
[0154] (1) Add a routing tag.
[0155] Optionally, the downlink message also includes routing information, and the routing information includes the transmission path of the downlink message. For example, the routing information may be: transmitted from gateway device 1 to smart device 1 (where gateway device 1 acts as a proxy for smart device 1). Optionally, first, gateway device 2 (main gateway) receives the downlink message. When gateway device 2 receives the downlink message, it adds a routing tag according to the routing information in the downlink message, for example: sent to gateway device 1, and then gateway device 1 (sub-gateway) and gateway device 3 (sub-gateway) receive the downlink message, wherein gateway device 1 (sub-gateway) receives the downlink message and can directly determine that the downlink message needs to be processed according to the routing tag; when gateway device 3 (sub-gateway) receives the downlink message, it can directly determine that the downlink message does not need to be processed according to the routing tag. Adding a routing tag by the main gateway allows the gateway device receiving the message to quickly and accurately determine whether it is the target processor of the message.
[0156] (2) Load optimization.
[0157] Optionally, when the number of downlink messages simultaneously received in the gateway group is greater than or equal to a preset number, a flow control mechanism is used to limit the flow of downlink messages received by the current gateway group.
[0158] The flow control mechanism is used to control the number of downlink messages processed by the gateway group within a unit time period. For example, assuming that the preset number is 200, at the current moment, the gateway group simultaneously receives 300 downlink messages. The gateway group will first put these 300 messages into the message queue, send 200 of them to the gateway group, and wait for the gateway group to process some of the messages before sending the remaining unprocessed messages in the message queue to the gateway group in sequence, thereby preventing the gateway devices in the gateway group from being overloaded due to processing a large number of messages.
[0159] Optionally, for downlink messages received by the gateway group, different downlink messages have different message priorities, and the gateway group can determine the order of processing the downlink messages according to the priorities. The message priority is used to indicate the importance and urgency of the downlink message. Schematically, if a downlink message is an emergency command for a smart device (such as instructing the smart device to shut down immediately), it will be given a high priority; if a downlink message is a repair for a security vulnerability in a smart device, it will be given a high priority. The specific priority setting needs to be set according to the application scenario and is not limited here.
[0160] Among them, for the main gateway device, the device management process executed in the gateway group also has the following process:
[0161] (I) Update of the global device mapping table.
[0162] In some embodiments, the second gateway device is used to update the global device mapping table and send an update notification to other gateway devices in the gateway group when a device change event occurs in the gateway group, and the update notification is used to notify other gateway devices to obtain the updated device mapping table; other gateway devices are used to receive the update notification and obtain the updated device mapping table.
[0163] Optionally, the device change event includes at least one of the following events: 1. The gateway group receives a gateway add operation, where the gateway add operation is used to add a new gateway device in the gateway group. 2. The gateway group receives a gateway remove operation, where the gateway remove operation is used to remove a gateway device in the gateway group. 3. There is a faulty gateway device in the gateway group.
[0164] Illustratively, when a device change event is detected, the second gateway device will update the global device mapping table accordingly according to the event type. For example, if a new gateway device is added, the second gateway device obtains the new gateway device + the original multiple gateway devices, and redefines the proxy relationship between them and the multiple smart devices.
[0165] If a gateway is removed or fails, the second gateway device deletes the gateway device from the multiple gateway devices, obtains the gateway devices after the deletion process, and redefines the proxy relationship between them and the multiple smart devices.
[0166] Optionally, the second gateway device is also used to update the global device mapping table based on a preset allocation strategy when a device change event occurs in the gateway group; wherein the preset allocation strategy is used to allocate the proxy relationship between the gateway device in the changed gateway group and multiple smart devices corresponding to the gateway group.
[0167] Schematically, the second gateway device is used to obtain the location information and load information corresponding to the gateway device in the changed gateway group when a device change event occurs in the gateway group, the location information is used to indicate the physical location of the gateway device, and the load information is used to indicate the current load condition of the gateway device; the second gateway device is used to determine the proxy relationship between the gateway device in the changed gateway group and multiple smart devices corresponding to the gateway group based on the location information and the load information and according to a preset allocation strategy; and update the global device mapping table according to the proxy relationship.
[0168] Among them, based on the acquired location information and load information, the second gateway device will determine the proxy relationship between the changed gateway device and the smart device according to the preset allocation strategy, where the preset allocation strategy may consider multiple factors, such as network delay, device performance, load balancing, etc., to ensure the rationality and effectiveness of the proxy relationship.
[0169] After the second gateway device updates the global device mapping table, it will determine the device mapping table of each gateway device based on the global device mapping table, and then send the device mapping table to the corresponding gateway device. Alternatively, the second gateway device sends the device mapping table to the cloud storage space, and the gateway devices of the gateway group will periodically access their own device mapping tables in the cloud storage space. If an update is found, the gateway device will obtain the device mapping table to the local storage space to replace the previously stored device mapping table, or when the gateway device periodically accesses the cloud storage space, it directly obtains its own device mapping table to the local storage space to replace the previously stored device mapping table. Alternatively, the second gateway device sends the global device mapping table to the cloud storage space, and when the gateway device periodically accesses the cloud storage space, it updates its own device mapping table based on the global device mapping table.
[0170] (2) Reselect the main gateway device.
[0171] In some embodiments, the multiple gateway devices are used to determine, through a preset election strategy, a fourth gateway device among the multiple gateway devices as a master gateway device when a second gateway device fails.
[0172] Illustratively, all sub-gateway device (eg, first gateway device) nodes periodically send heartbeat messages to the main gateway device (eg, second gateway device), and these messages usually include device identification, status information, and timestamps.
[0173] The sub-gateway device monitors the status of the main gateway device by receiving the heartbeat response or confirmation message from the main gateway device. If the main gateway device does not send a heartbeat message or respond to the sub-gateway device's request within a certain period of time, the sub-gateway device will consider the main gateway device to be faulty. Once the main gateway device fails, the gateway group automatically elects a new main gateway device through the preset election strategy.
[0174] At the same time, the main gateway device can also detect faulty gateway devices in the gateway group through heartbeat messages. If the main gateway device does not receive a heartbeat message from a sub-gateway device within a certain period of time, it will consider that the sub-gateway device may have a fault, and will trigger the update of the global device mapping table in (a).
[0175] Optionally, the preset election strategy includes at least one of the following strategies:
[0176] (1) Election strategy based on performance and stability:
[0177] CPU usage: Elect a gateway device with lower CPU usage as the primary gateway to ensure that it has sufficient processing power to cope with possible load increases.
[0178] Memory usage: Select a gateway device with less memory usage as the primary gateway to avoid performance degradation due to insufficient memory.
[0179] Network latency: Considering the average latency between the gateway device and other devices in the network, the gateway with the lowest latency is elected as the primary gateway to reduce communication latency.
[0180] Device stability: Based on the operation history of the gateway device, the gateway with a lower failure rate is elected as the main gateway to improve the stability of the system.
[0181] (2) Election strategy based on load balancing:
[0182] Current load: Consider the current load of the gateway device, such as the number of tasks being processed, network traffic, etc., and elect a gateway with a lighter load as the main gateway to avoid overload.
[0183] Load balancing algorithm: Apply load balancing algorithms (such as polling, least number of connections, etc.) to assign tasks to gateway devices, and select the most suitable master gateway based on the algorithm results.
[0184] (3) Priority-based election strategy:
[0185] Device priority: Set priorities for gateway devices, such as dividing priorities based on factors such as device configuration, function, or geographical location, and electing the gateway with the highest priority as the main gateway.
[0186] Backup master gateway: pre-designate one or more backup master gateway devices. When the main gateway fails, the backup gateway is automatically promoted to the main gateway to reduce delays in the election process.
[0187] (4) Election strategy based on consistency and availability:
[0188] Data consistency: A gateway that can maintain data consistency (such as through distributed transactions, replication mechanisms, etc.) is elected as the primary gateway to ensure that the data in the gateway group remains consistent after failure recovery.
[0189] High availability: Consider the high availability configuration of gateway devices (such as redundancy, fault tolerance, etc.), and elect the gateway with the highest availability as the main gateway to improve the overall reliability of the system.
[0190] The above examples of preset election strategies are only for illustrative purposes. For example, in the embodiments of the present application, the Raft or Zookeeper algorithm can be used as the preset election strategy. The Raft algorithm is used as the preset election strategy: the nodes in the gateway group (i.e., gateway devices) will initiate the Leader election, each node will increase its current term (term) and convert to the Candidate state, and then send a voting request to other nodes. If a Candidate state receives votes from most nodes in the gateway group, it becomes the new Leader, i.e., the main gateway device. The Zookeeper algorithm is used as the preset election strategy: the nodes in the gateway group (i.e., gateway devices) participate in the Leader election by polling. Each node maintains a timed task to execute the election process, and the election time interval is fixed (the default is 10 seconds). When any node in the gateway group receives an election request, it sends a voting request to other nodes. After receiving the voting request, other nodes will decide whether to vote for the node according to certain rules (such as transaction ID and server ID). If a node obtains votes from most nodes in the gateway group, it becomes the new Leader, i.e., the main gateway device.
[0191] The following is an introduction to the device management process provided in the embodiment of the present application.
[0192] (1) Uplink message processing flow.
[0193] For illustration, please refer to Figure 4 , which shows a schematic diagram of a device management process.
[0194] like Figure 4 As shown, the execution entities of the device management process include: smart device 1, smart device 2, gateway device 1, gateway device 2, IoT platform and consumer end. The process includes the following steps:
[0195] Step 401 : Smart device 1 reports data a to gateway device 1 and gateway device 2 .
[0196] Smart device 1 reports attribute or status data (i.e., data a) periodically or according to event collection needs, and reports data a to all gateway devices in the gateway group. The following is an example of a gateway group including smart device 1 and smart device 2. Data a is also the device message mentioned above.
[0197] Data a includes the device identification of the smart device 1 .
[0198] Step 402 , the gateway device 1 receives data a from the smart device 1 .
[0199] Step 403 : the gateway device 2 receives data a from the smart device 1 .
[0200] After receiving data a reported by smart device 1, gateway device 2 queries its stored device mapping table. If the device identification of smart device 1 is not stored therein, it determines that smart device 1 is not a smart device of its proxy and ignores data a.
[0201] Step 404: Gateway device 1 forwards data a to the gateway group shared topic.
[0202] After receiving data a reported by smart device 1, gateway device 1 queries the device mapping table stored therein. If the device identification of smart device 1 is stored therein, it is determined that smart device 1 belongs to the smart device of its proxy. Then, after preliminary processing of data a (such as verifying data integrity and format, etc.), it is sent to the gateway group shared topic on the IoT platform. Each gateway device has the authority to publish messages to the shared topic, ensuring that data can be processed in a centralized shared topic.
[0203] Step 405: The IoT platform receives data a.
[0204] Step 406 , smart device 2 reports data b to gateway device 2 and gateway device 3 .
[0205] Smart device 2 reports attribute or status data (i.e., data b) periodically or according to event collection needs, and reports data b to all gateway devices in the gateway group. The following is an example in which the gateway group includes smart device 1 and smart device 2. Data b is also the device message mentioned above.
[0206] Data b includes the device identification of the smart device 1 .
[0207] Step 407 , the gateway device 1 receives data b from the smart device 2 .
[0208] After receiving data b reported by smart device 2, gateway device 1 queries its stored device mapping table. If the device identification of smart device 2 is not stored therein, it is determined that smart device 2 is not a smart device of its proxy and data b is ignored.
[0209] Step 408 , the gateway device 2 receives data b from the smart device 2 .
[0210] Step 409: Gateway device 2 forwards data b to the gateway group shared topic.
[0211] After gateway device 2 receives data b reported by smart device 2, it queries the device mapping table stored therein. If the device identification of smart device 2 is stored therein, it is determined that smart device 2 belongs to the smart device of its agent. After that, data b is preliminarily processed (such as verifying data integrity, format, etc.) and then sent to the gateway group shared topic on the Internet of Things platform.
[0212] Step 410: The IoT platform receives data b.
[0213] Step 411, the IoT platform pushes data to the consumer end.
[0214] Optionally, if the consumer end of the IoT platform subscribes to the shared topic of the gateway group, the IoT platform will send data a and data b to the consumer end after receiving data a and data b. The consumer end can be a data processing service, monitoring system or other application, which is responsible for further processing and analyzing the data reported by the smart device.
[0215] Optionally, after receiving the data, the consumer can store, analyze, visualize or trigger further operations. After processing the data, the consumer can feedback the processing results or execute the corresponding business logic.
[0216] The above process can ensure that smart devices can efficiently report attribute or status data through the gateway group, and the consumer can obtain and process this data by subscribing to the shared topic of the gateway group. In this way, centralized processing and management of large-scale distributed device data can be achieved.
[0217] (2) Downlink instruction processing flow.
[0218] For illustration, please refer to Figure 5 , which shows a schematic diagram of another device management process.
[0219] like Figure 5 As shown, the execution entities of the device management process include: smart device 1, gateway device 1, gateway device 2, Internet of Things platform and user client. The process includes the following steps:
[0220] Step 501: The user client sends a downlink instruction to the Internet of Things platform.
[0221] The user issues a downlink instruction to the smart device 1 through the console or API of the Internet of Things platform. The downlink instruction includes the device identifier of the smart device 1.
[0222] Step 502: The IoT platform forwards the downlink instruction to the gateway group shared topic.
[0223] The IoT platform sends the downlink command to the gateway group shared topic. All gateway devices in the gateway group subscribe to the gateway group shared topic, so all gateway devices in the gateway group can receive the downlink command.
[0224] Step 503: Gateway device 1 receives a downlink instruction sent by the gateway group sharing topic.
[0225] Step 504: Gateway device 2 receives a downlink instruction sent by the gateway group sharing topic.
[0226] Step 505 , the gateway device 1 forwards the downlink instruction to the smart device 1 .
[0227] After receiving the downlink instruction, the gateway device 1 queries the device mapping table stored therein. If the device identification of the smart device 1 is stored therein, it is determined that the smart device 1 belongs to the smart device of its agent. The gateway device 1 then processes the downlink instruction, that is, forwards the downlink instruction to the corresponding smart device 1 through the internal communication protocol.
[0228] Step 506: The smart device 1 receives and processes the downlink instruction.
[0229] Smart device 1 receives the downlink instruction and performs corresponding operations, such as controlling the device status or executing a task.
[0230] Step 507 , the smart device 1 sends the instruction execution result to the gateway device 1 .
[0231] After the smart device 1 executes the downlink instruction, it obtains the instruction execution result, and the smart device 1 can feedback the instruction execution result to the Internet of Things platform through the gateway device.
[0232] Step 508: Gateway device 1 receives the instruction execution result.
[0233] Step 509: Gateway device 1 feeds back the command execution result to the Internet of Things platform.
[0234] Step 510: The IoT platform receives the instruction execution result.
[0235] In some embodiments, the gateway group for device management provided in the embodiments of the present application can be used in the Internet of Things platform. Figures 6 to 8 The connection, uplink message processing and downlink message processing processes of the gateway group on the Internet of Things platform are introduced respectively.
[0236] (1) Gateway device connects to the IoT platform.
[0237] For illustration, please refer to Figure 6 , the gateway device of the gateway group 610 sends a connection request to the proxy service of the Internet of Things platform 620.
[0238] The processing process of the proxy server 1 for the connection request of the gateway device includes the following steps:
[0239] Step 601, determine whether the authentication is passed.
[0240] That is, determine whether the gateway device has passed the authentication.
[0241] In an illustrative manner, before the gateway device connects to the proxy server 1, it needs to pass security authentication to ensure the legitimacy of the identity of the gateway device. Before the gateway device attempts to connect to the proxy server 1, it needs to submit its identity authentication information (such as device ID, key, etc.). After receiving the authentication information, the proxy server 1 compares it with the pre-stored legitimate device information. If the information matches, the authentication is successful; otherwise, the authentication fails.
[0242] Step 602: If the authentication fails, a failure response is issued.
[0243] If the authentication fails, the proxy server 1 sends a response message of authentication failure to the gateway device. The message may include the reason for the failure so that the gateway device can check and correct it.
[0244] Step 603: If the authentication is successful, a session of the gateway device is created / maintained.
[0245] After the authentication is successful, the proxy server 1 creates a session for the gateway device and stores relevant information, where the session of the gateway device includes the following information:
[0246] (1) Device ID: The device ID is the unique identifier of a device in the IoT platform and is used to distinguish different devices.
[0247] (2) Physical model data: Physical model data is a data template that digitally describes physical devices in the physical world. It extracts the common features of devices and forms a standardized model to facilitate unified management and control of devices by applications. Physical model data usually includes elements such as device attributes, events, and actions, which are used to describe the functions and behaviors of devices. For example, the physical model data of a smart light may include attributes such as switch status, brightness, color, and events such as switch actions and low voltage alarms.
[0248] (3) Topological relationship data: Topological relationship data describes the relationship between smart devices and gateway devices. In the IoT environment, the gateway device is the main device and can mount multiple smart devices. Topological relationship data usually includes information such as the ID, type, and location of the smart device, as well as the connection status and communication parameters between the smart device and the gateway.
[0249] (4) Subscribed topic list: In the IoT platform, devices receive and process data from other devices or the cloud by subscribing to specific topics. The subscribed topic list records all topics currently subscribed by the device.
[0250] (5) Session time: refers to the duration of a session between a device and the IoT platform.
[0251] If a session already exists on the gateway device, the session information is updated, such as the session time.
[0252] Step 604: Platform agent subscription.
[0253] That is, the IoT platform proxy gateway device subscribes to the topic.
[0254] The topic subscribed by the proxy includes the following information:
[0255] (1) The topic of the gateway device itself
[0256] (2) Shared topic for all smart devices in the gateway group
[0257] The IoT platform acts as a proxy for the gateway device to subscribe to its own topic in order to receive data sent directly by the gateway device. At the same time, the IoT platform also acts as a proxy for the gateway device to subscribe to the shared topic of all smart devices under the gateway group in order to receive data forwarded by these smart devices through the gateway device. The subscribed topic information needs to be stored in the session information of the gateway device for subsequent data processing and routing.
[0258] (2) The gateway device sends an uplink message to the IoT platform.
[0259] For illustration, please refer to Figure 7 , the gateway device of the gateway group 610 sends an uplink message to the proxy server 1 of the Internet of Things platform 620.
[0260] The process of publishing the uplink message sent by the proxy server 1 to the gateway device includes the following steps:
[0261] Step 701, determine whether it is a smart device.
[0262] That is, it is determined whether the smart device sending the uplink message is a smart device represented by the gateway device.
[0263] Step 702: If not, maintain the session of the gateway device.
[0264] If it is not a smart device, the IoT platform only needs to maintain the session state of the gateway device and process other data of the gateway device.
[0265] Step 703: If yes, determine whether it is in the topological relationship.
[0266] If it is determined that the smart device sending the uplink message is a smart device proxied by the gateway device, the IoT platform needs to further check whether the smart device is in the topological relationship of the gateway device, for example, by querying the session of the gateway device to determine whether the smart device is in the topological relationship of the gateway device.
[0267] Step 704: If not, discard the message.
[0268] If the smart device is not in the topological relationship, the IoT platform may consider the message to be invalid and choose to discard it.
[0269] Step 705: If yes, create / maintain a session of the smart device.
[0270] If the smart devices are in a topological relationship, the IoT platform needs to create or update the session information of the smart devices.
[0271] The session of the smart device includes the following information:
[0272] (1) Device ID
[0273] (2) Physical model data
[0274] (3) Topological relationship data
[0275] (4) Session time
[0276] Step 706, processing the data of the smart device.
[0277] That is, processing the uplink message of the smart device, for example, further analyzing the uplink message, or sending it to the consumer end.
[0278] (3) The gateway device receives the downlink message sent by the IoT platform.
[0279] For illustration, please refer to Figure 8 , the user client 630 sends a downlink message to the proxy server 1 of the Internet of Things platform 620.
[0280] The data downlink process of the downlink message sent by the proxy server 1 to the user client 630 includes the following steps:
[0281] Step 801, determine whether it is a smart device.
[0282] That is, it is determined whether the recipient of the downlink message sent by the user client 630 is the smart device represented by the gateway device.
[0283] Step 802: If yes, publish the message to the topic of the gateway device.
[0284] If the recipient of the downlink message sent by the user client 630 is the smart device represented by the gateway device, the Internet of Things platform publishes the downlink message to the topic of the gateway device.
[0285] Step 803: If not, query the session of the smart device.
[0286] If the recipient of the downlink message sent by the user client 630 is not the smart device represented by the gateway device, the Internet of Things platform needs to query the session information of the smart device.
[0287] The session of the smart device includes the following information:
[0288] (1) Device ID
[0289] (2) Physical model data
[0290] (3) Topological relationship data
[0291] (4) Session time
[0292] Step 804, determine whether there is a gateway group.
[0293] The IoT platform needs to check whether there is a gateway group associated with the smart device.
[0294] Step 805, if not, return failure.
[0295] If it does not exist, a failure message is returned to the smart device.
[0296] Step 806: If yes, generate a shared topic according to the gateway group ID.
[0297] If a gateway group exists, the IoT platform can generate a shared topic based on the gateway group ID to send messages to all gateway devices in the group.
[0298] Step 807: Publish the message to the shared topic.
[0299] Finally, the IoT platform publishes the downlink message to the shared topic so that the gateway device can receive and forward it to the corresponding smart device.
[0300] In some embodiments, different topics can be created according to the device attributes of the smart device, and the sub-devices can be assigned to specific topics. Each gateway device only needs to subscribe to the topic related to the smart device it represents, rather than all gateways subscribing to the same topic, thereby improving the efficiency and pertinence of communication.
[0301] For illustration, please refer to Fig. 9 , which shows a schematic diagram of grouping based on topic in a gateway group, such as Fig. 9As shown, gateway device 1 and gateway device 2 act as proxies for smart device 1 and smart device 2, so gateway device 1 and gateway device 2 subscribe to topics related to smart device 1 and smart device 2; gateway device 3 and gateway device 4 act as proxies for smart device 3 and smart device 4, so gateway device 3 and gateway device 4 subscribe to topics related to smart device 3 and smart device 4.
[0302] When the user client 901 sends a control instruction (i.e., a downlink instruction) to the publisher 902 (e.g., a proxy server), the downlink instruction is stored in the message queue 903 of the proxy server, and the gateway devices in the gateway group forward the control instruction in the order of the message queue 903. If the control instruction is an instruction to control gateway device 3, the control instruction is sent to smart device 3 and smart device 4 through the shared topic 2.
[0303] The device management process performed by the first gateway device in the gateway group provided in the embodiment of the present application is described below. introduce.
[0304] Fig.10 10 is a flow chart of a device management method provided by an embodiment of the present application, the method is executed by a first gateway device, and the method includes the following steps 1010 to 1030.
[0305] Step 1010, receiving device message.
[0306] The device message includes a first device identification of the first smart device, and the device message includes at least one of a message sent by the first smart device and a message to be received by the first smart device.
[0307] The device message is a message sent in parallel to a plurality of gateway devices in a gateway group, the plurality of gateway devices including a first gateway device, and the plurality of gateway devices respectively store a device mapping table.
[0308] Step 1020: Obtain a first device mapping table.
[0309] The first device mapping table is a device mapping table stored in the first gateway device, and the first device mapping table is used to indicate the smart device represented by the first gateway device.
[0310] Step 1030: When the first device identifier matches the first device mapping table, process the device message.
[0311] The first device identifier matches the first device mapping table to indicate that the first smart device is a smart device represented by the first gateway device.
[0312] In summary, in the device management method provided by the embodiment of the present application, each gateway device stores a device mapping table, which indicates the smart devices that the gateway device proxies, and each gateway device only needs to process the device messages of the smart devices that it proxies. When the gateway group receives a device message, if the device mapping table stored in the first gateway device matches the device identifier in the device message, indicating that the device message is a device message of the smart device that the first gateway device proxies, the first gateway device processes the device message. On the one hand, the device messages received by the gateway group are processed by multiple gateway devices in a division of labor, thereby improving the processing efficiency of the device messages. On the other hand, each gateway device determines the device messages that it needs to process by maintaining the device mapping table, ensuring that the device messages can be accurately processed and avoiding the situation where the device messages are processed incorrectly or repeatedly.
[0313] For illustration, please refer to Fig.11 , which shows a structural block diagram of a device management device, the device comprising:
[0314] The receiving module 1110 is used to receive a device message, wherein the device message includes a first device identifier of a first smart device, and the device message includes at least one of a message sent by the first smart device and a message to be received by the first smart device; the device message is a message sent in parallel to multiple gateway devices in a gateway group, wherein the multiple gateway devices include the first gateway device, and the multiple gateway devices respectively store a device mapping table;
[0315] An acquisition module 1120 is configured to acquire a first device mapping table, where the first device mapping table is a device mapping table stored in the first gateway device, and the first device mapping table is used to indicate a smart device represented by the first gateway device;
[0316] The processing module 1130 is used to process the device message when the first device identifier matches the first device mapping table, wherein the match between the first device identifier and the first device mapping table is used to indicate that the first smart device is a smart device proxied by the first gateway device.
[0317] In summary, in the device management apparatus provided by the embodiment of the present application, each gateway device stores a device mapping table, which indicates the smart devices that the gateway device proxies, and each gateway device only needs to process the device messages of the smart devices that it proxies. When the gateway group receives a device message, if the device mapping table stored in the first gateway device matches the device identifier in the device message, indicating that the device message is a device message of the smart device that the first gateway device proxies, the first gateway device processes the device message. On the one hand, the device messages received by the gateway group are processed by multiple gateway devices in a division of labor, thereby improving the processing efficiency of the device messages. On the other hand, each gateway device determines the device messages that it needs to process by maintaining the device mapping table, ensuring that the device messages can be accurately processed and avoiding situations where the device messages are processed incorrectly or repeatedly.
[0318] It should be noted that the specific limitations in the embodiments of one or more device management devices provided above can be found in the above-mentioned limitations on the device management method, which will not be repeated here. Each module of the above-mentioned device can be implemented in whole or in part by software, hardware, and a combination thereof. Each module can be embedded in the processor of the gateway device in the form of hardware or independent of it, or it can be stored in the memory of the gateway device in the form of software, so that the processor can call and execute the corresponding operations of each module.
[0319] For example, Fig.12 It is a structural block diagram of a gateway device 1200 provided by an exemplary embodiment of the present application.
[0320] Typically, the gateway device 1200 includes: a processor 1201 and a memory 1202 .
[0321] The processor 1201 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 1201 may be implemented in at least one hardware form of digital signal processing (DSP), field programmable gate array (FPGA), and programmable logic array (PLA). The processor 1201 may also include a main processor and a coprocessor. The main processor is a processor for processing data in an awake state, also known as a central processing unit (CPU); the coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 1201 may be integrated with a graphics processing unit (GPU), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 1201 may also include an artificial intelligence (AI) processor, which is used to process computing operations related to machine learning.
[0322] The memory 1202 may include one or more computer-readable storage media, which may be non-transitory. The memory 1202 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 1202 is used to store at least one instruction, which is used to be executed by the processor 1201 to implement the device management method provided by each method embodiment in this application.
[0323] In some embodiments, the gateway device 1200 may also optionally include: an input interface 1203 and an output interface 1204. The processor 1201, the memory 1202, the input interface 1203, and the output interface 1204 may be connected via a bus or a signal line. Each peripheral device may be connected to the input interface 1203 and the output interface 1204 via a bus, a signal line, or a circuit board. The input interface 1203 and the output interface 1204 may be used to connect at least one peripheral device related to input / output (I / O) to the processor 1201 and the memory 1202. In some embodiments, the processor 1201, the memory 1202, the input interface 1203, and the output interface 1204 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 1201, the memory 1202, the input interface 1203, and the output interface 1204 may be implemented on a separate chip or circuit board, which is not limited in the embodiments of the present application.
[0324] Those skilled in the art will understand that Fig.12 The structure shown in the figure does not constitute a limitation on the gateway device 1200, and may include more or fewer components than shown in the figure, or combine certain components, or adopt a different component arrangement.
[0325] In an exemplary embodiment, the present application provides a chip, which includes a programmable logic circuit and / or program instructions. When the chip runs on a gateway device, it is used to implement the device management method provided by the above-mentioned various method embodiments.
[0326] In an exemplary embodiment, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program is loaded and executed by a processor to implement the device management method provided by each of the above method embodiments.
[0327] In an exemplary embodiment, the present application provides a computer program product or a computer program, the computer program product or the computer program including computer instructions, the computer instructions being stored in a computer-readable storage medium. The processor of a gateway device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the processor of the gateway device loads and executes to implement the device management method provided in the above method embodiment.
[0328] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0329] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned computer-readable storage medium may be a read-only memory, a disk or an optical disk, etc.
[0330] Those skilled in the art should be aware that in one or more of the above examples, the functions described in the embodiments of the present application can be implemented with hardware, software, firmware, or any combination thereof. When implemented using software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium. Computer-readable media include computer storage media and communication media, wherein the communication media include any media that facilitates the transmission of a computer program from one place to another. The storage medium can be any available medium that a general or special-purpose computer can access.
[0331] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A gateway group for device management, characterized in that: The gateway group includes a plurality of gateway devices, each of which stores a device mapping table, wherein the plurality of gateway devices includes a first gateway device, and the first device mapping table stored in the first gateway device is used to indicate the smart device represented by the first gateway device; The multiple gateway devices are used to respectively receive device messages, wherein the device message includes a first device identifier of a first smart device, and the device message includes at least one of a message sent by the first smart device and a message to be received by the first smart device; The first gateway device is used to process the device message when the first device identifier matches the first device mapping table, wherein the match between the first device identifier and the first device mapping table is used to indicate that the first smart device is a smart device represented by the first gateway device.
2. The gateway group according to claim 1, characterized in that: The plurality of gateway devices include a second gateway device; The second gateway device is used to obtain a global device mapping table when serving as a master gateway device in the gateway group, wherein the global device mapping table is used to indicate the smart devices respectively represented by the multiple gateway devices; The global device mapping table indicates that the first gateway device acts as a proxy for the first smart device with a first priority, and the third gateway device among the multiple gateway devices acts as a proxy for the first smart device with a second priority, and the first priority is higher than the second priority.
3. The gateway group according to claim 2, characterized in that: The second gateway device is configured to send a message processing notification to the third gateway device when the result of the message processing of the device message by the first gateway device is not received within a timeout period, wherein the message processing notification is used to notify the third network device to process the device message; The third gateway device is used to process the device message when receiving the message processing notification.
4. The gateway group according to claim 2, characterized in that: The second gateway device is used to update the global device mapping table when a device change event occurs in the gateway group, and send an update notification to other gateway devices in the gateway group, wherein the update notification is used to notify the other gateway devices to obtain the updated device mapping table; The other gateway device is used to receive the update notification; and obtain the updated device mapping table.
5. The gateway group according to claim 4, characterized in that: The device change event includes at least one of the following events: The gateway group receives a gateway adding operation, where the gateway adding operation is used to add a new gateway device in the gateway group; The gateway group receives a gateway removal operation, where the gateway removal operation is used to remove a gateway device from the gateway group; There is a faulty gateway device in the gateway group.
6. The gateway group according to claim 4, characterized in that: The second gateway device is configured to update the global device mapping table based on a preset allocation strategy when a device change event occurs in the gateway group; The preset allocation strategy is used to allocate the proxy relationship between the gateway device in the changed gateway group and the multiple smart devices connected to the gateway group.
7. The gateway group according to claim 6, characterized in that: The second gateway device is used to obtain location information and load information corresponding to the gateway device in the changed gateway group when a device change event occurs in the gateway group, wherein the location information is used to indicate the physical location of the gateway device, and the load information is used to indicate the current load condition of the gateway device; The second gateway device is used to determine the proxy relationship between the gateway devices in the changed gateway group and the multiple smart devices corresponding to the gateway group based on the location information and the load information and according to the preset allocation strategy; and update the global device mapping table according to the proxy relationship.
8. The gateway group according to claim 2, characterized in that: The multiple gateway devices are used to determine a fourth gateway device among the multiple gateway devices as a master gateway device through a preset election strategy when the second gateway device fails.
9. The gateway group according to any one of claims 1 to 8, characterized in that: The plurality of gateway devices share a first communication channel with the proxy server; The multiple gateway devices are configured to respectively receive the downlink messages through the first communication channel when the device message is a downlink message sent by the proxy server to the first smart device; or, The first gateway device is configured to forward the uplink message to the proxy server through the first communication channel when the device message is an uplink message sent by the first smart device to the proxy server.
10. The gateway group according to claim 9, characterized in that: The first communication channel includes a plurality of sub-communication channels, and the plurality of smart devices connected to the gateway group are allocated to the plurality of sub-communication channels according to device attributes; The first smart device and the second smart device are assigned to a first sub-communication channel among the multiple sub-communication channels, and a gateway device acting as a proxy for the first smart device and a gateway device acting as a proxy for the second smart device share the first sub-communication channel with the proxy server.
11. A device management method, characterized in that: Executed by a first gateway device, the method includes: receiving a device message, wherein the device message includes a first device identifier of a first smart device, and the device message includes at least one of a message sent by the first smart device and a message to be received by the first smart device; the device message is a message sent in parallel to a plurality of gateway devices in a gateway group, the plurality of gateway devices includes the first gateway device, and the plurality of gateway devices respectively store a device mapping table; Acquire a first device mapping table, where the first device mapping table is a device mapping table stored in the first gateway device, and the first device mapping table is used to indicate the smart device represented by the first gateway device; In a case where the first device identifier matches the first device mapping table, the device message is processed, wherein the match between the first device identifier and the first device mapping table is used to indicate that the first smart device is a smart device proxied by the first gateway device.
12. A device management apparatus, characterized in that: The device comprises: A receiving module, configured to receive a device message, wherein the device message includes a first device identifier of a first smart device, and the device message includes at least one of a message sent by the first smart device and a message to be received by the first smart device; the device message is a message sent in parallel to a plurality of gateway devices in a gateway group, wherein the plurality of gateway devices include a first gateway device, and the plurality of gateway devices respectively store a device mapping table; An acquisition module, configured to acquire a first device mapping table, where the first device mapping table is a device mapping table stored in the first gateway device, and the first device mapping table is used to indicate a smart device represented by the first gateway device; A processing module is used to process the device message when the first device identifier matches the first device mapping table, wherein the match between the first device identifier and the first device mapping table is used to indicate that the first smart device is a smart device proxied by the first gateway device.
13. A gateway device, characterized in that: The gateway device includes a processor and a memory, wherein at least one program is stored in the memory, and the at least one program is loaded and executed by the processor to implement the device management method according to claim 11.
14. A computer-readable storage medium, characterized in that: The storage medium stores at least one program, and the at least one program is loaded and executed by the processor to implement the device management method according to claim 11.
15. A computer program product, characterized in that The device comprises a computer program, and when the computer program is executed by a processor, the device management method according to claim 11 is implemented.
Citation Information
Cited By
Robot multi-mode data intelligent transmission method and system
CN122395161A