Author: Zhu Rongliang, Unit: China Mobile Smart Home Operation Center Labs GuideWith the development of society, intelligence has brought great convenience to people's lives. The application of smart home is becoming more and more extensive. People often only need a mobile phone to remotely manage various smart home devices at home. So how do these smart devices interact with the platform? This article takes the home gateway as an example to introduce the relevant interactive control technology between devices and platforms. 1 Traditional interactive control technologyBefore introducing the interactive control technology of the device platform, let's first look at the traditional interactive methods that people are more familiar with for managing optical modems and routers. Those who have configured a router know that we can open the router's LAN management page (for example: http://192.168.1.1) by connecting to the router WiFi or plugging in a network cable, and directly set and manage various parameters of the router. This method mainly starts an intranet service on the router, and users can access the service by connecting to the router's intranet. Its disadvantage is that it can only be used in the local area network, which is not convenient for remote operation (although remote web management can be enabled, it increases the risk of exposing the router to the public network). Similarly, the data is basically processed locally, and there are many limitations in terms of functions. Therefore, it is usually considered that the device accesses the platform and the platform manages the device. Taking the home gateway as an example, the following mainly introduces the device platform interactive control technology based on the gateway. 2. Gateway-based device platform interactive control technologyIn order to realize the platform management of devices, it is necessary to install the service of accessing the platform on the device (in the form of a process on the operating system of the gateway device), and the device can access the platform unidirectionally to upload data and obtain command data. There are two common protocols for device access to the platform: UDP and TCP. Among them, UDP is a connectionless transmission protocol that provides simple unreliable information transmission services and is suitable for data reporting scenarios. In order to realize the management of devices, the platform needs to return the corresponding control instructions to the device, and the TCP protocol is often used for control instruction interaction. The interaction methods based on the TCP protocol are divided into two methods: long connection and short connection. 2.1 Interaction based on TCP long connectionIn the TCP long connection mode, the device and the platform are almost always connected (they will reconnect when the connection is disconnected), and the platform can push command messages to the device at any time. The following takes MQTT as an example to introduce its data interaction principle. MQTT is a lightweight publish/subscribe message transmission protocol that communicates based on TCP long connections. MQTT was originally created by Dr. Andy Stanford-Clark and Dr. Arlen Nipper in 1999. Its original purpose was to connect sensors on oil pipelines to satellites to achieve unmanned monitoring of thousands of miles of oil and gas pipelines. It has now become one of the most mainstream transmission protocols for major IoT platforms at home and abroad [1,2]. The schematic diagram of the device platform interaction based on the gateway is shown in Figure 1. In the communication process, there are three identities in the MQTT protocol: publisher, broker, and subscriber. In this case, the business platform is the message publisher, the MQTT service is the broker, and the gateway is the subscriber. The interaction process is as follows: the platform deploys the MQTT service, and the gateway maintains communication with the platform based on the MQTT protocol and subscribes to messages from the platform at the same time; the user initiates remote management of the gateway to the business platform through the APP, mini-programs, WEB services and other carriers on the mobile phone; the business platform initiates a message publishing request to the MQTT service; the MQTT service pushes the message to the gateway, and the gateway executes the relevant instructions after receiving the message. Among them, the publisher and subscriber of the message are both clients, the message broker is the server, and the message publisher can be a subscriber at the same time. Figure 1 2.2 Interaction based on TCP short connectionIn TCP short connection mode, the device maintains communication with the platform through the heartbeat polling mechanism, and each request will re-establish the connection. In this mode, the device platform interaction diagram is shown in Figure 2. The interaction process is as follows: the gateway initiates TCP heartbeats to maintain communication with the device platform through polling (initiating requests at regular intervals); when the user initiates a remote management request to the business platform through the client, the business platform initiates a command notification to the device platform; the device platform records this command request and returns the command identifier when the gateway initiates a heartbeat next time; the gateway initiates the corresponding business request or executes the command according to the received command identifier. Figure 2 In the above methods, MQTT is simple, stable, open, and lightweight, but all devices need to maintain a connection with the platform. Under the TCP short connection heartbeat polling mechanism, there is a polling cycle for the interaction between the device and the platform. If the cycle is too short, the platform will be under great pressure; if the cycle is too long, the platform pressure can be reduced, but the business processing is not timely and the experience is very poor. When the number of devices reaches more than 100 million, whether it is MQTT communication based on TCP long connection or heartbeat polling mechanism based on TCP short connection, there is a problem of platform centralization (all devices need to communicate directly with the platform), resulting in huge communication pressure on the platform. The following is an improved solution "layered mode". Its schematic diagram is shown in Figure 3. The platform connected to the gateway is transformed into a split into a first-level platform and a second-level platform mode. The business platform connects to the first-level platform, and the first-level platform connects to each second-level platform. Each second-level platform maintains communication with a part of the gateway. This can disperse the platform pressure, but the establishment of too many platforms also increases the platform maintenance cost. Figure 3 3. Edge computingWith the development of 5G, the development of edge computing has been spawned. The above interaction mode can also be realized through edge computing. The interaction diagram is shown in Figure 4. The main transformation points are as follows: empower edge nodes, move the business management services originally deployed on the gateway to the edge nodes, and the edge nodes maintain communication with the platform. At the same time, the gateways to which they are connected are managed through the edge nodes. Through the edge computing transformation method, the communication pressure of the cloud platform can be greatly alleviated, and the timeliness of message interaction can be guaranteed, but the edge nodes need to be upgraded and transformed. Figure 4 |
>>: Mobile phone + satellite, how difficult is it?
At the press conference of the National Developme...
The bigwigs in the tech industry all have their o...
UFOVPS has launched a promotional event during th...
Hello everyone, I am Xiaozaojun. The joyful and ...
5G has been officially put into commercial use. R...
1. Data Lake and Lakehouse At the 2021 Developer ...
[Original article from 51CTO.com] On November 29t...
Inter-Process Communication (IPC) refers to the t...
1. Introduction to QinQ The VLAN ID field defined...
On January 22, according to Feixiang.com, on Janu...
RAKsmart has launched a promotional event for Mar...
iWebFusion's VPS price may not seem cheap, bu...
Why did the once-noisy "big event" die ...
Yecao Cloud has launched a 2024 Spring Festival p...
Can you bear not going online? Obviously not, bec...