Discovery and communication method and system between intelligent household appliances in local area network
Patent Information
- Application Number
- CN202410982390.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-22
- Publication Date
- 2024-10-01
AI Technical Summary
The technical threshold is high during the installation and configuration process of smart home appliances, which requires manual setting and configuration of parameters, resulting in increased sales and maintenance costs. In addition, the IP addresses and ports of smart home appliances often change in the local area network, requiring DNS servers for mapping, which increases complexity. sex.
The discovery and communication method between smart home appliances in the local area network based on the mDNS protocol is adopted. Multicast packets are sent through the App. The smart home appliances identify and return the IP address, establish a TCP connection, and use the mDNS service name for automatic configuration and communication, avoiding the need for a central server. dependence.
It simplifies the installation and configuration process of smart home appliances, reduces the usage threshold and sales and maintenance costs, improves system stability and low coupling state between smart home appliances, and realizes automated discovery and communication.
Smart Images

Figure CN118740538A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of smart home appliances, and in particular to a discovery and communication method and system between smart home appliances in a local area network. Background Art
[0002] Current smart home appliances, such as smart lamps, curtains, speakers, televisions, etc., require installers to manually set and configure their initial parameters before use due to the high technical threshold and complicated process of installation and configuration, which greatly increases the sales and maintenance costs of smart appliances.
[0003] For example, in the Internet, if smart home appliance A wants to communicate with smart home appliance B, it must send and receive data in the form of IP address + port. Since IP address and port are both in digital form and difficult to remember, smart home appliances usually have an English string address that is easy for users to remember. Before smart home appliance A communicates with smart home appliance B, it is necessary to convert the English string address of smart home appliance B into its IP address + port. Since the IP address and port of smart home appliance B are dynamic in most cases and may change frequently, it is necessary to add a DNS server in the Internet. The DNS server records the mapping table of the addresses of all smart home appliances and the latest IP addresses. Smart home appliance A needs to query the DNS server for the IP address corresponding to the English string address of smart home appliance B to obtain the latest IP address and port of smart home appliance B. This process not only requires the investment of DNS server hardware facilities, but also requires manual configuration of parameters and network processes during the installation and use of smart home appliances, which makes the technical threshold high and the process more cumbersome.
[0004] It is particularly important to simply and efficiently configure these smart appliances into logical combinations that are convenient for users through a system, realize the linkage between smart appliances, and lower the threshold of the user's installation and configuration process. Summary of the invention
[0005] In order to solve the technical problems existing in the prior art, the purpose of the present invention is to provide a discovery and communication method and system between smart home appliances in a local area network. Based on the mDNS protocol, by formulating a unified interface, the parameters and network configurations in the installation process of smart home appliances are encapsulated and simplified, thereby lowering the use threshold of smart home appliances and reducing the sales and maintenance costs of smart home appliances.
[0006] The present invention solves the above problems through the following technical solutions:
[0007] A discovery and communication method between smart home appliances in a local area network is implemented based on the mDNS protocol, and the discovery and communication method includes:
[0008] After the user opens the App and connects to the current LAN, a multicast data packet with a special agreed service identifier field is sent;
[0009] After receiving the multicast data packet, the smart home appliance processes the received data packet information with an editable character filter. After identifying the special predetermined bytes, it returns its own IP address to the App. Otherwise, it ignores the received data packet and does not process it.
[0010] The app sends its IP address and identity authentication information to the smart appliance;
[0011] The App creates a TCP server and waits for smart home appliances to connect;
[0012] Smart appliances start communicating by creating a socket to connect to the App's service.
[0013] As a further improvement of the present invention, when the user opens the App and connects to the current local area network, the App will simultaneously open a data receiving socket that monitors the second port.
[0014] As a further improvement of the present invention, when the App is connected to a local area network, the IP address of the App is allocated by a router in the local area network;
[0015] The mDNS service name agreed between the App and the smart home appliance is xxx.app.local. After the smart home appliance is connected to the LAN, it subscribes to the service of the mDNS service name;
[0016] Every time a user opens the App on their phone and connects to the current LAN or at a preset interval, a multicast data packet will be sent to the multicast address, indicating that it can provide a service with the mDNS service name of xxx.app.local.
[0017] As a further improvement of the present invention, after the smart home appliance receives the multicast data packet, the specific processing steps include:
[0018] Identify the sender by judging the mDNS service name of the multicast data packet feature data;
[0019] After the verification is passed, the smart home appliance will establish a socket to communicate with the App and the second port, and return a response data packet to the App to send the smart home appliance's own information and configuration to the App.
[0020] As a further improvement of the present invention, the discovery and communication method further includes:
[0021] The user starts the smart appliance and automatically creates a WiFi hotspot;
[0022] The user installs the customized App and uses the App to search for the WiFi hotspot created by the smart home appliance, and configures the network for the smart home appliance after connecting;
[0023] The smart home appliance disconnects from the App and connects to the current LAN.
[0024] As a further improvement of the present invention, the user starts the smart home appliance and automatically creates a WiFi hotspot, and the specific method is:
[0025] The smart home appliance has the ability to connect to WiFi and create a WiFi hotspot. The smart home appliance assigns itself a first IP address and opens a TCP server socket to listen to the first port.
[0026] As a further improvement of the present invention, the user installs a customized App and uses the App to search for the WiFi hotspot created by the smart home appliance, and configures a network for the smart home appliance after connecting. The specific method includes:
[0027] The user uses a customized App installed on the mobile phone to search for nearby WiFi hotspots, add and connect to the WiFi hotspot created by the smart home appliance. At this time, the IP address of the App is assigned by the WiFi hotspot wireless network created by the smart home appliance;
[0028] The App establishes a TCP connection with the first IP address and the first port assigned to it by the smart home appliance. After the connection is established, the App requires the user to enter the LAN network name and login password;
[0029] The App sends the network name and login password of the LAN to the smart home appliance through the established TCP connection. After receiving the network name and login password, the smart home appliance replies to the App that it has received the password.
[0030] As a further improvement of the present invention, the smart home appliance disconnects from the App and connects to the current local area network. The specific method includes:
[0031] When the smart home appliance receives the LAN network name and login password from the App, it shuts down the WiFi hotspot created by itself and disconnects from the App.
[0032] And join the current LAN by receiving the network name and login password of the LAN. At this time, the second IP address of the smart home appliance is reallocated by the router in the LAN, so that the smart home appliance has the ability to communicate with the external network and starts to connect to the LAN. After the connection is successful, the network configuration of the smart home appliance is completed.
[0033] As a further improvement of the present invention, the smart home appliance disconnects from the App and connects to the current local area network. The specific method further includes:
[0034] The smart home appliance records the network name and login password of the LAN in the built-in storage. Each time it is started, it reads the network name and password of the LAN in the storage and connects to the LAN.
[0035] After the smart home appliance is connected to the LAN, a UPD server subscribed to port 5353 is created to receive multicast data.
[0036] At the same time, the present invention solves the above problems through the following technical solutions:
[0037] A discovery and communication system between smart home appliances in a local area network is constructed based on the mDNS protocol and is used to implement the discovery and communication method between smart home appliances in a local area network as described above. The system includes an APP, several smart home appliances and a router. The router provides a local area network connection. The smart home appliances have the ability to connect to WiFi and create WiFi hotspots. Several smart home appliances in the system are in a low coupling state.
[0038] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0039] (1) The system of the present invention can combine smart home appliances in a local area network in a simple and efficient manner, which is convenient for users to install and use. Product sales personnel no longer need to come to install and configure smart home appliances. It can also provide basic support for the development and combination of higher-dimensional usage scenario logic based on these smart home appliances.
[0040] (2) The present invention uses the mDNS protocol to enable mutual discovery and communication between smart appliances in a local area network. There is no need to build an additional central server to manage configuration and communication addresses. Several smart appliances are in a low-coupling state, which improves overall stability. At the same time, since there is no need for a central server to manage the communication addresses of several smart appliances, the discovery and communication between smart appliances are completed automatically, reducing the parameters and network configuration process during the installation of smart appliances, and lowering the threshold for using smart appliances and the sales and maintenance costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 The present invention is a flowchart of a method for discovering and communicating between smart home appliances in a local area network. DETAILED DESCRIPTION
[0042] In order to make the purpose, technical solutions and advantages of the present application clearer, the technical solutions in the embodiments of the present application will be described in more detail below in conjunction with the drawings in the preferred embodiments of the present application. In the drawings, the same or similar reference numerals throughout represent the same or similar parts or parts with the same or similar functions. The described embodiments are part of the embodiments of the present application, not all of the embodiments. The embodiments described below with reference to the drawings are exemplary and are intended to be used to explain the present application, and should not be construed as limitations on the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0043] The following will be combined Figure 1 , a method and system for discovering and communicating between smart home appliances in a local area network involved in the embodiments of the present application are described in detail. It should be noted that the following embodiments are only used to explain the present application and do not constitute a limitation on the present application.
[0044] mDNS is multicast DNS. mDNS mainly enables smart home appliances in a local area network to discover and communicate with each other without a traditional DNS server. It uses port 5353, complies with the DNS protocol, and uses the existing DNS information structure, name syntax, and resource record type. And no new operation code or response code is specified. In a local area network, smart home appliances need to know each other's IP address to communicate with each other. In most cases, the IP address of smart home appliances is not a static IP address, but an IP address dynamically assigned through the DHCP protocol. How can smart home appliances be discovered? This is where mDNS comes into play. For example, the communication between IoT smart home appliances and apps now is either through broadcasting or multicasting, where apps send some specific information, and interested smart home appliances respond to achieve the discovery of smart home appliances in the local area network.
[0045] Example:
[0046] See attached Figure 1 A discovery and communication method between smart home appliances in a local area network is implemented based on the mDNS protocol and specifically includes the following steps:
[0047] Step A: The user starts the smart home appliance and automatically creates a WiFi hotspot;
[0048] Specifically, the initialization of network configuration of smart home appliances requires that the smart home appliances themselves have the ability to connect to WiFi and create WiFi hotspots (or Bluetooth communication). When users initialize or reset smart home appliances, they will automatically enter the waiting configuration state by turning on a specific switch after startup. At this time, the smart home appliances will automatically create a hotspot with a network name of WiFi_XXX, assign themselves a first IP address of 192.168.1.80, and open a TCP server socket to listen to the first port, which is 6000.
[0049] Step B: The user installs the customized App and uses the App to search for the WiFi hotspot created by the smart home appliance, and configures the network for the smart home appliance after connecting;
[0050] Specifically, the step B comprises:
[0051] B1) The user uses the customized App installed on the mobile phone to search for nearby WiFi hotspots, add and connect to WiFi_XXX created by the smart home appliance. At this time, the IP address of the App is assigned by the WiFi hotspot wireless network created by the smart home appliance;
[0052] B2) App establishes a TCP connection with the pre-agreed first IP address and the first port (the first address 192.168.1.80:6000 assigned by the smart home appliance to itself). Specifically, a TCP client socket is created and connected to 192.168.1.80:6000. App connects to WiFi_XXX. After the connection is established, App will ask the user to enter the LAN network name and login password of the deployment system.
[0053] B3) The App sends the network name and login password of the LAN to the smart home appliance through the established TCP connection. After receiving the network name and login password, the smart home appliance replies to the App that the password has been received.
[0054] Step C: The smart home appliance disconnects from the App and connects to the current local area network;
[0055] Specifically, when the smart home appliance receives the LAN network name and login password replied by the App, the smart home appliance closes the hotspot WiFi_XXX and disconnects from the App; in this embodiment, after the hotspot WiFi_XXX established by the smart home appliance is closed, the connection between the App and it is disconnected. And join the current LAN through the received LAN network name and password. At this time, the second IP address of the smart home appliance is allocated by the router in the LAN, so that the smart home appliance has the ability to communicate with the external network or other smart home appliances, and starts to connect to the LAN. After the connection is successful, the network configuration of the smart home appliance is completed. The smart home appliance will record the network name and login password of the LAN in the built-in storage. Each time it is started, it will read the network name and password of the LAN in the storage and connect to the LAN;
[0056] In this embodiment, after the smart home appliance is connected to the local area network, it is necessary to create a UPD server subscribed to port 5353 (mDNS protocol agreement) to receive multicast data sent by the App or other smart home appliances.
[0057] Step D: After the user opens the App and connects to the current LAN, a multicast data packet with a special agreed service identification field is sent;
[0058] In this embodiment, the App is reconnected to the LAN, and the IP address of the App is reallocated by the router in the LAN;
[0059] The mDNS service name agreed upon between the App and smart home appliances is xxx.app.local, which is set in the agreed field in the mDNS data packet. After the smart home appliance is connected to the LAN, it subscribes to the service of this name. Every time the user uses the mobile phone to open the App and connect to the current LAN, or every 10 seconds, a multicast data packet with characteristic data will be sent to the multicast address 224.0.0.251:5353 to search for smart home appliances in the current LAN, without having to connect to the hotspot created by the smart home appliances to communicate with the smart home appliances. Since the smart home appliances have subscribed to the xxx.app.local service in advance, they can receive the multicast data sent by the App.
[0060] Furthermore, the App will also open a data receiving socket that listens on the second port, which is 5252.
[0061] Step E: After receiving the multicast data packet, the smart home appliance uses an editable character filter to process the received data packet information. After identifying the special predetermined bytes, it returns its own IP address to the App. Otherwise, it ignores the received data packet and does not process it.
[0062] In this embodiment, specifically, after receiving the multicast data sent by the App, the smart home appliance distinguishes whether the data is sent by the App or other smart home appliances according to whether the service name in the multicast data is xxx.app.local.
[0063] After verification, the smart home appliance will establish a socket to communicate with the App and port 5252, and return a response data packet to the App through the connection to send the smart home appliance's own information and configuration to the App.
[0064] Step F, the App sends its own IP address and identity authentication information to the smart appliance;
[0065] In this embodiment, specifically, after the App receives the information of the smart home appliance and the configured response data packet, the App can send the IP address and identity authentication information of the App to the smart home appliance through another UDP connection (unicast), and send the identity authentication information of the user who logged in to the App to the smart home appliance. After the smart home appliance receives it, it will return confirmation information if the verification is successful.
[0066] At this point, the App and the smart home appliance have learned each other's communication addresses and passed identity authentication. The App can use the established connection and a user-friendly operating interface to allow users to perform other configurations and controls on the smart home appliance.
[0067] Similarly, if there is a need for mutual query and communication between smart home appliances, the above process can also be used to obtain the other party's IP address and establish a communication channel.
[0068] Step G: The App creates a TCP server and waits for smart home appliances to connect.
[0069] Step H: The smart appliance starts communicating by creating a socket to connect to the App's service.
[0070] Steps A to C are applicable to all smart home appliances that receive the system agreement and need to join the current local area network. Steps D to F are also applicable to mutual discovery and communication between smart home appliances.
[0071] The present application builds a discovery and communication system between smart home appliances in a local area network to implement the above-mentioned discovery and communication method between smart home appliances in a local area network. The system is built based on the mDNS protocol and does not require an additional central server for management configuration and communication addresses. The system includes an APP, several smart home appliances and a router. The router provides a local area network connection. The smart home appliances have the ability to connect to WiFi and create WiFi hotspots. The smart home appliances in the system are in a low-coupling state. If any smart home appliance goes offline or is abnormal, it will not affect the normal operation of other smart home appliances in the system, thereby improving the overall stability of the system.
[0072] At the same time, since there is no need for a central server to manage the communication addresses of all smart appliances in the system, the discovery and communication between smart appliances are automatically completed by the system, reducing the parameters and network configuration process during the installation of smart appliances, lowering the threshold for using smart appliances, and thus reducing the sales and maintenance costs of smart appliances.
[0073] Although the present invention is described herein with reference to the illustrative embodiments of the present invention, the above embodiments are only preferred embodiments of the present invention, and the embodiments of the present invention are not limited to the above embodiments. It should be understood that those skilled in the art can design many other modifications and embodiments, which will fall within the scope and spirit of the principles disclosed in this application.
Claims
1. A method for discovering and communicating between smart home appliances in a local area network, characterized in that: Based on the mDNS protocol, the discovery and communication method includes: After the user opens the App and connects to the current LAN, a multicast data packet with a special agreed service identifier field is sent; After receiving the multicast data packet, the smart home appliance processes the received data packet information with an editable character filter. After identifying the special predetermined bytes, it returns its own IP address to the App. Otherwise, it ignores the received data packet and does not process it. The app sends its IP address and identity authentication information to the smart appliance; The App creates a TCP server and waits for smart home appliances to connect; Smart appliances start communicating by creating a socket to connect to the App's service.
2. According to claim 1, a method for discovering and communicating between smart home appliances in a local area network, characterized in that: When the user opens the App and connects to the current LAN, the App will simultaneously open a data receiving socket that listens on the second port.
3. According to claim 1, a method for discovering and communicating between smart home appliances in a local area network, characterized in that: When the App is connected to a local area network, the IP address of the App is assigned by a router in the local area network; The mDNS service name agreed between the App and the smart home appliance is xxx.app.local. After the smart home appliance is connected to the LAN, it subscribes to the service of the mDNS service name; Every time a user opens the App on their phone and connects to the current LAN or at a preset interval, a multicast data packet will be sent to the multicast address, indicating that it can provide a service with the mDNS service name of xxx.app.local.
4. According to claim 3, a method for discovering and communicating between smart home appliances in a local area network is characterized in that: After the smart home appliance receives the multicast data packet, the specific processing steps include: Identify the sender by judging the mDNS service name of the multicast data packet feature data; After the verification is passed, the smart home appliance will establish a socket to communicate with the App and the second port, and return a response data packet to the App to send the smart home appliance's own information and configuration to the App.
5. A method for discovering and communicating between smart home appliances in a local area network according to any one of claims 1 to 4, characterized in that: The discovery and communication method also includes: The user starts the smart appliance and automatically creates a WiFi hotspot; The user installs the customized App and uses the App to search for the WiFi hotspot created by the smart home appliance, and configures the network for the smart home appliance after connecting; The smart home appliance disconnects from the App and connects to the current LAN.
6. A method for discovering and communicating between smart home appliances in a local area network according to claim 5, characterized in that: The user starts the smart home appliance and automatically creates a WiFi hotspot, specifically: The smart home appliance has the ability to connect to WiFi and create a WiFi hotspot. The smart home appliance assigns itself a first IP address and opens a TCP server socket to listen to the first port.
7. The method for discovering and communicating between smart home appliances in a local area network according to claim 5, characterized in that: The user installs a customized App and uses the App to search for the WiFi hotspot created by the smart home appliance, and configures the network for the smart home appliance after connecting. The specific method includes: The user uses a customized App installed on the mobile phone to search for nearby WiFi hotspots, add and connect to the WiFi hotspot created by the smart home appliance. At this time, the IP address of the App is assigned by the WiFi hotspot wireless network created by the smart home appliance; The App establishes a TCP connection with the first IP address and the first port assigned to it by the smart home appliance. After the connection is established, the App requires the user to enter the LAN network name and login password; The App sends the network name and login password of the LAN to the smart home appliance through the established TCP connection. After receiving the network name and login password, the smart home appliance replies to the App that it has received the password.
8. The method for discovering and communicating between smart home appliances in a local area network according to claim 7, characterized in that: The smart home appliance disconnects from the App and connects to the current local area network. The specific method includes: When the smart home appliance receives the LAN network name and login password from the App, it shuts down the WiFi hotspot created by itself and disconnects from the App. And join the current LAN by receiving the network name and login password of the LAN. At this time, the second IP address of the smart home appliance is reallocated by the router in the LAN, so that the smart home appliance has the ability to communicate with the external network and starts to connect to the LAN. After the connection is successful, the network configuration of the smart home appliance is completed.
9. A method for discovering and communicating between smart home appliances in a local area network according to claim 8, characterized in that: The smart home appliance disconnects from the App and connects to the current local area network. The specific method also includes: The smart home appliance records the network name and login password of the LAN in the built-in storage. Each time it is started, it reads the network name and password of the LAN in the storage and connects to the LAN. After the smart home appliance is connected to the LAN, a UPD server subscribed to port 5353 is created to receive multicast data.
10. A discovery and communication system between smart home appliances in a local area network, characterized in that: The system is constructed based on the mDNS protocol and is used to implement a discovery and communication method between smart appliances in a local area network as described in any one of claims 1 to 4, including an APP, several smart appliances and a router, wherein the router provides a local area network connection, the smart appliances have the ability to connect to WiFi and create WiFi hotspots, and the several smart appliances in the system are in a low coupling state.
