Smart home equipment and cloud platform communication method, controller, smart home equipment, smart home system and computer readable storage medium
By setting up a gateway device election mechanism in smart home devices and using the intranet to transmit data, the single point of failure of smart home devices during network failure is solved, and network communication stability and communication efficiency are improved.
Patent Information
- Application Number
- CN202411453506.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-17
- Publication Date
- 2025-02-18
AI Technical Summary
Existing smart home devices are prone to single point failure when the network is faulty or unstable, resulting in the cloud platform being unable to issue instructions and the smart home devices being unable to report status, seriously affecting the user experience.
By implementing the gateway device election mechanism in smart home devices, smart home devices in the intranet transmit data through the intranet, ensuring that when the network is unstable, intranet devices can communicate with each other to achieve the purpose of communication with the cloud platform.
It enhances the stability of network communication between smart home devices, improves the communication success rate and efficiency between cloud platforms and smart home devices, and reduces the impact of network failures on user experience.
Smart Images

Figure CN119484185A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of smart homes, and in particular to a method for communicating between a smart home device and a cloud platform, a controller, a smart home device, a smart home system, and a computer-readable storage medium. Background Art
[0002] The existing cloud platform and smart home devices communicate mainly through the Internet of Things platform. After the smart home device completes registration, authentication and initial connection with the cloud platform on the Internet of Things platform, the smart home device establishes a long connection with the cloud platform through the heartbeat packet. Then the cloud platform and the smart home device can communicate. The specific steps are as follows: Figure 1 As shown: 1.1. When the app sends a control command to a smart home device on the control interface, the command is first sent to the cloud platform via HTTPS. The cloud platform calls the Pub API interface based on the HTTPS protocol, sends the command to the Topic, and sends the data to the IoT platform. The IoT platform uses the Publish method to send the data (specifying the Topic and Payload) to the smart home device via the MQTT protocol. 1.2. After receiving instructions from the cloud platform, smart home devices must report their status to the app after executing their functions. Specifically, the smart home devices first report data to the IoT platform through the MQTT protocol (publishing topics and payloads through publish). The IoT platform then transfers the smart home device message stream to the cloud platform through the AMQP consumer group. The cloud platform then notifies the app through message push to update the status of the smart home device on the app control interface.
[0003] In the solution, both the IoT platform and the cloud platform adopt a distributed design, eliminating the risk of single points of failure. Since the app is operated by the user terminal, even if a failure occurs, it is relatively easy to troubleshoot. However, on the smart home device side, each smart home device (such as each smart toilet, each smart bathtub, each smart towel rack, etc.) exists as a single point. Furthermore, the network signal transceiver module of its WiFi module may be worn or aged differently. Furthermore, the WiFi module may be installed in different locations within different product models, and the smart home devices may be placed in different locations within the space. All of these factors may cause network failures in individual smart home devices. Therefore, the existing technical solution has the following defects: 2.1. Single point failures are prone to occur on smart home devices: When the network of a smart home device fails, the cloud platform cannot send instructions to the smart home device, and the smart home device cannot report its status to the cloud platform. 2.2. Network instability can cause smart home devices to fail: When the network of smart home devices is unstable, the communication between the cloud platform and smart home devices will be delayed or even command loss, seriously affecting the user experience.
[0004] During the entire process of using the smart home system, smart home devices are in direct contact with users. The timeliness of the response of smart home devices determines the good or bad evaluation of users on a product or a brand, and the bridge for users to communicate with smart home devices is realized through the network. The delayed responsiveness or loss rate of smart home devices to network responses will have a profound impact on users. For example: in a smart scene, when the user starts the bathroom scene function, the toilet needs to complete pre-toilet preparations in advance, and the bathroom heater needs to be run in advance, etc. If a smart home device has a network signal that is severely reduced due to severe wear and aging of the network signal transceiver module of the WiFi module, the location of the WiFi module installed inside the product, or the location of the smart home device itself in the space, the network connection between the smart home device and the cloud server will be unstable or even disconnected, which will make it unable to execute related functions according to the steps of the scene. This experience is very bad. Summary of the Invention
[0005] In order to solve the above technical problems or at least partially solve the above technical problems, the present application proposes a method for communication between a smart home device and a cloud platform.
[0006] According to a first aspect of the present application, a method for communicating between a smart home device and a cloud platform is provided, which is used for the smart home device and includes: Receive control instructions; Determine whether the control instruction comes from the intranet or the extranet; Parsing the control instruction to determine whether the smart home device is a control target of the control instruction; If the control instruction comes from the intranet and the smart home device is the control object of the control instruction, determining whether the control instruction has been executed by the smart home device, if so, discarding the control instruction, and if not, executing the control instruction; If the control instruction comes from the external network, determining whether the smart home device is a gateway device or a non-gateway device; If the smart home device is not the control target of the control instruction and the smart home device is the non-gateway device, discarding the control instruction; if the smart home device is not the control target of the control instruction and the smart home device is the gateway device, obtaining the target control target of the control instruction and sending the control instruction to the target control target, wherein the smart home device and the target control target transmit data through the intranet; If the smart home device is the control object of the control instruction and the smart home device is the gateway device, the smart home device executes the control instruction; if the smart home device is the control object of the control instruction and the smart home device is the non-gateway device, the smart home device determines whether the control instruction has been executed by itself, and if so, discards the control instruction; if not, executes the control instruction; The gateway device is the smart home device with the shortest response time in the intranet, and the response time is the total time consumed by the smart home device to complete a two-way communication with the cloud platform through the external network.
[0007] In one embodiment, determining whether the smart home device is the gateway device or the non-gateway device specifically includes: The gateway device election list is queried to determine whether the smart home device is the gateway device or the non-gateway device, wherein the gateway device election list records information of the gateway device and the non-gateway device.
[0008] In one embodiment, the method for generating the gateway device election list includes: Obtaining and broadcasting the response time of the smart home device; Receiving the response time broadcasted by other smart home devices in the intranet; comparing the response time of the smart home device and the response time of other smart home devices in the intranet; The smart home device with the shortest response time is marked as the gateway device, and the smart home device with a response time that is not the shortest is marked as the non-gateway device, and the marking result is stored.
[0009] In one embodiment, the method for communicating between the smart home device and the cloud platform further includes regularly updating the gateway device election list.
[0010] In one embodiment, the method further includes: after the smart home device executes the control instruction, reporting its own status information to the cloud platform.
[0011] In one embodiment, the method for the smart home device to communicate with the cloud platform also includes: if the smart home device is the non-gateway device, then after the smart home device executes the control instruction, it also sends its own status information to the gateway device through the intranet.
[0012] In one embodiment, the method for the smart home device to communicate with the cloud platform further includes: if the smart home device is the gateway device, when the smart home device receives status information of other smart home devices, reporting it to the cloud platform.
[0013] According to a second aspect of the present invention, a controller is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method for communication between a smart home device and a cloud platform provided in the first aspect of the present invention is implemented.
[0014] According to a third aspect of the present invention, a smart home device is provided, wherein the smart home device includes the controller according to the second aspect of the present invention.
[0015] According to a fourth aspect of the present invention, a smart home system is provided, wherein the smart home system comprises a plurality of smart home devices as described in the third aspect of the present invention, and the plurality of smart home devices form an intranet system.
[0016] According to a fifth aspect of the present invention, a computer-readable storage medium is provided, wherein the storage medium stores at least one program code, and the at least one program code is used to be executed by a processor to implement the method for communication between a smart home device and a cloud platform as described in the first aspect of the present invention.
[0017] Through the technical solution of the present invention, when the network connection between a single smart home device and the cloud platform is unstable or disconnected, other smart home devices in the intranet can send messages to it to achieve the purpose of communicating with the cloud platform, thereby enhancing the stability of the network communication of smart home devices. In addition, for non-gateway devices, the response time of its communication with the cloud platform may be relatively long, but due to the characteristics of intranet communication, its communication efficiency with the gateway device is relatively much higher, and the gateway device has the shortest response time among the smart home devices in the intranet. Therefore, in the technical solution of the present invention, for non-gateway devices, when receiving control instructions, they are received through two paths at the same time. One is to directly receive the control instructions issued by the cloud platform through the external network, and the other is to receive the control instructions forwarded by the gateway device through the intranet with the help of the forwarding of the gateway device in the intranet. For the same control instruction, the first one received is executed, and the later one is discarded. When reporting its own status information after executing the control instruction, it is also through two paths. One is to report the status information directly to the cloud platform through the external network, and the other is to send the status information to the gateway device, and report the status information to the cloud platform through the external network with the help of the gateway device. In this way, the communication success rate and communication efficiency between the cloud platform and smart home devices are enhanced.
[0018] The aforementioned "directly" means that forwarding does not need to be done through a gateway device in the intranet, and does not mean that non-gateway devices can communicate directly with the cloud platform without the help of any intermediate media. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The drawings that constitute a part of this application are used to provide further understanding of this application. The illustrative embodiments of this application and their descriptions are used to explain this application and do not constitute improper limitations on this application.
[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. 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 any creative work.
[0021] Figure 1 A flowchart of a method for communicating between a smart home device and a cloud platform is provided for one embodiment of the present application. DETAILED DESCRIPTION
[0022] To make the above-mentioned objects, features, and advantages of the present invention more readily apparent, specific embodiments of the present invention are described in detail below with reference to the accompanying drawings. The following description sets forth numerous specific details to facilitate a full understanding of the present invention. However, the present invention can be implemented in many other ways than those described herein, and those skilled in the art may make similar modifications without departing from the scope of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.
[0023] The terms "including," "having," and any variations thereof mentioned in the description of this application are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or terminal device that includes a series of steps or modules is not limited to the listed steps or modules, but may optionally include other steps or modules not listed, or may optionally include other steps or modules inherent to the process, method, product, or terminal device.
[0024] In the embodiments of the present application, the term "plurality" includes two or more.
[0025] Additionally, in the embodiments of this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described in this application as "exemplary" or "for example" should not be construed as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "for example" is intended to present concepts in a concrete manner.
[0026] like Figure 1 As shown, an embodiment of the present application provides a method for communication between a smart home device and a cloud platform, which is applied to the smart home device, and the method includes: Receive control instructions; Determine whether the control instruction comes from the intranet or the extranet; Parsing the control instruction to determine whether the smart home device is a control target of the control instruction; If the control instruction comes from the intranet and the smart home device is the control object of the control instruction, determining whether the control instruction has been executed by the smart home device, if so, discarding the control instruction, and if not, executing the control instruction; If the control instruction comes from the external network, determining whether the smart home device is a gateway device or a non-gateway device; If the smart home device is not the control target of the control instruction and the smart home device is the non-gateway device, discarding the control instruction; if the smart home device is not the control target of the control instruction and the smart home device is the gateway device, obtaining the target control target of the control instruction and sending the control instruction to the target control target, wherein the smart home device and the target control target transmit data through the intranet; If the smart home device is the control object of the control instruction and the smart home device is the gateway device, the smart home device executes the control instruction; if the smart home device is the control object of the control instruction and the smart home device is the non-gateway device, the smart home device determines whether the control instruction has been executed by itself, and if so, discards the control instruction; if not, executes the control instruction; The gateway device is the smart home device with the shortest response time in the intranet, and the response time is the total time consumed by the smart home device to complete a two-way communication with the cloud platform through the external network.
[0027] An intranet is a private computer network used within an organization. It's not directly exposed to the internet and isn't publicly available. It's typically located within an organization's buildings. The extranet, or the Internet, is a global computer network system that connects computers and network devices around the world, allowing them to exchange data and communicate. Intranets are typically faster than extranets because they don't require the routing and congestion of the public internet.
[0028] In this embodiment, when the network connection between a single smart home device and the cloud platform is unstable or disconnected, other smart home devices in the intranet can send messages to it to achieve the purpose of communicating with the cloud platform, thereby enhancing the stability of the network communication of smart home devices. In addition, for non-gateway devices, the response time of its communication with the cloud platform may be relatively long, but due to the characteristics of intranet communication, its communication efficiency with the gateway device is relatively much higher, and the gateway device has the shortest response time among the smart home devices in the intranet. Therefore, in the technical solution of the present invention, for non-gateway devices, when receiving control instructions, they are received through two paths at the same time. One is to directly receive the control instructions issued by the cloud platform through the external network, and the other is to receive the control instructions forwarded by the gateway device through the intranet with the help of the forwarding of the gateway device in the intranet. For the same control instruction, the first one received is executed, and the later one is discarded. When reporting its own status information after executing the control instruction, it is also through two paths. One is to report the status information directly to the cloud platform through the external network, and the other is to send the status information to the gateway device, and report the status information to the cloud platform through the external network with the help of the gateway device. In this way, the communication success rate and communication efficiency between the cloud platform and smart home devices are enhanced.
[0029] There are many methods to determine whether a control instruction comes from the intranet or the extranet, such as: checking whether the source IP address of the instruction belongs to the private IP address range; checking the path that the data packet takes to reach the device; checking the port: setting certain ports to be used only in the intranet. If the instruction is received through these ports, then the instruction is from the intranet; checking the protocol: setting different communication protocols for intranet communication and extranet communication, and judging whether the instruction is from the intranet or the extranet by judging which protocol the instruction is sent and received through, such as setting the intranet to communicate using the UDP protocol and the extranet to communicate using HTTP and MQTT protocols, and judging whether the instruction is from the intranet or the extranet by judging which protocol the instruction is sent and received through; this embodiment does not make specific limitations.
[0030] The two-way communication referred to in this embodiment means that the cloud platform sends instructions to the smart home device, and the smart home device executes the instructions and feeds back the execution results to the cloud platform.
[0031] In this embodiment, "the smart home device completes two-way communication with the cloud platform only once through the external network" means that the forwarding of the gateway device in the internal network is not used, that is, the internal network is not involved in the communication process.
[0032] There are many ways to determine whether a smart home device has executed a control instruction, such as: By timestamp: When the smart home device receives a control command, it records the timestamp of the control command. If the timestamp of the control command received is the same as the timestamp it has recorded, it means that the control command has been executed.
[0033] By querying the execution record: Smart home devices usually have an execution record list, and you can determine whether the instruction has been executed by querying the execution record list.
[0034] Ensure instruction uniqueness: encapsulate a unique identifier (such as a command ID) into the instruction, and use this identifier to determine whether the instruction has been executed.
[0035] This embodiment does not impose any specific limitation.
[0036] In some embodiments, the intranet is set to communicate using UDP and BLE protocols, and the external network is set to communicate using HTTP and MQTT protocols. When the response time of the non-gateway device is less than a predetermined threshold, it communicates with other smart home devices in the intranet through the UDP protocol. When the response time of the non-gateway device is greater than the predetermined threshold, it communicates with other smart home devices in the intranet through the BLE protocol.
[0037] When the response time of a non-gateway device is greater than a predetermined threshold, it indicates that the non-gateway device may be in an offline state. However, Bluetooth communication can realize data transmission between it and other smart home devices in the intranet in an offline state. The introduction of BLE in this embodiment enables the smart home device to still send data to the gateway device in the intranet when it is offline, and with the help of the gateway device, it can receive control instructions through the intranet or send status information after executing control instructions.
[0038] In some embodiments, determining whether the smart home device is the gateway device or the non-gateway device specifically includes: The gateway device election list is queried to determine whether the smart home device is the gateway device or the non-gateway device, wherein the gateway device election list records information of the gateway device and the non-gateway device.
[0039] In some embodiments, the method for generating the gateway device election list includes: Obtaining and broadcasting the response time of the smart home device; Receiving the response time broadcasted by other smart home devices in the intranet; comparing the response time of the smart home device and the response time of other smart home devices in the intranet; The smart home device with the shortest response time is marked as the gateway device, and the smart home device with a response time that is not the shortest is marked as the non-gateway device, and the marking result is stored.
[0040] In some embodiments, the method for communicating between the smart home device and the cloud platform further includes periodically updating the gateway device election list.
[0041] The update period can be set according to actual conditions, such as one minute, two minutes, etc., which is not specifically limited in this embodiment. In this embodiment, the gateway device election list is updated regularly to ensure that the response time of the gateway device is the best among all smart home devices in the intranet.
[0042] In some embodiments, the method for communicating between the smart home device and the cloud platform further includes: after the smart home device executes the control instruction, reporting its own status information to the cloud platform.
[0043] In some embodiments, the method for the smart home device to communicate with the cloud platform also includes: if the smart home device is the non-gateway device, then after the smart home device executes the control instruction, it also sends its own status information to the gateway device through the intranet.
[0044] In some embodiments, the method for communicating between the smart home device and the cloud platform further includes: if the smart home device is the gateway device, when the smart home device receives status information of other smart home devices, reporting it to the cloud platform.
[0045] One embodiment of the present invention provides a controller, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements a method for communication between a smart home device and a cloud platform as provided in any of the above embodiments.
[0046] An embodiment of the present invention provides a smart home device, which includes the controller described in the above embodiment.
[0047] An embodiment of the present invention provides a smart home system, which includes a plurality of smart home devices as described in the above embodiments, and the plurality of smart home devices form an intranet system.
[0048] One embodiment of the present invention provides a computer-readable storage medium, which stores at least one program code, and the at least one program code is used to be executed by a processor to implement the method for communication between a smart home device and a cloud platform as described in any of the above embodiments.
[0049] In this embodiment, the computer-readable storage medium may include: ROM, RAM, solid state drives (SSDs), or optical disks, etc. Among them, RAM may include resistance random access memory (ReRAM) and dynamic random access memory (DRAM).
[0050] Those 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 a program to instruct the relevant hardware, and the program may be stored in a computer-readable storage medium, which may be a read-only memory, a disk, or an optical disk, etc.
[0051] The above description is merely an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.
Claims
1. A method for communicating between a smart home device and a cloud platform, used for smart home devices, characterized in that: include: Receive control instructions; Determine whether the control instruction comes from the intranet or the extranet; Parsing the control instruction to determine whether the smart home device is a control object of the control instruction; If the control instruction comes from the intranet, and the smart home device is the control object of the control instruction, then determine whether the control instruction has been executed by itself, if so, discard the control instruction, if not, execute the control instruction; If the control instruction comes from the external network, determining whether the smart home device is a gateway device or a non-gateway device; If the smart home device is not the control object of the control instruction and the smart home device is the non-gateway device, the control instruction is discarded; if the smart home device is not the control object of the control instruction and the smart home device is the gateway device, the target control object of the control instruction is obtained, and the control instruction is sent to the target control object, wherein the smart home device and the target control object transmit data through the intranet; If the smart home device is the control object of the control instruction and the smart home device is the gateway device, the smart home device executes the control instruction; if the smart home device is the control object of the control instruction and the smart home device is the non-gateway device, the smart home device determines whether the control instruction has been executed by itself, and if so, discards the control instruction; if not, executes the control instruction; The gateway device is the smart home device with the shortest response time in the intranet, and the response time is the total time taken by the smart home device to complete a two-way communication with the cloud platform only through the external network.
2. A method for communication between a smart home device and a cloud platform according to claim 1, characterized in that: The determining whether the smart home device is the gateway device or the non-gateway device specifically includes: The gateway device election list is queried to determine whether the smart home device is the gateway device or the non-gateway device, wherein the gateway device election list records information of the gateway device and the non-gateway device.
3. The method for communicating between a smart home device and a cloud platform according to claim 2, characterized in that: The method for generating the gateway device election list includes: Obtaining the response time of the smart home device and broadcasting it; Receiving the response time broadcasted by other smart home devices in the intranet; Comparing the response time of the smart home device and the response time of other smart home devices in the intranet; The smart home device with the shortest response time is marked as the gateway device, and the smart home device with a response time that is not the shortest is marked as the non-gateway device, and the marking result is stored.
4. A method for communication between a smart home device and a cloud platform according to claim 3, characterized in that: The method further includes periodically updating the gateway device election list.
5. The method for communication between a smart home device and a cloud platform according to claim 1, characterized in that: The method also includes that after the smart home device executes the control instruction, the smart home device reports its own status information to the cloud platform.
6. A method for communication between a smart home device and a cloud platform according to claim 5, characterized in that: If the smart home device is the non-gateway device, after the smart home device executes the control instruction, it also sends its own status information to the gateway device through the intranet.
7. A method for communication between a smart home device and a cloud platform according to claim 6, characterized in that: If the smart home device is the gateway device, when the smart home device receives status information of other smart home devices, it reports it to the cloud platform.
8. A controller, characterized in that: The controller includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the method for communication between a smart home device and a cloud platform as described in any one of claims 1 to 7 is implemented.
9. A smart home device, characterized in that: The smart home device includes the controller as described in claim 8.
10. A computer-readable storage medium storing at least one program code, characterized in that: The at least one program code is used to be executed by a processor to implement the method for communication between a smart home device and a cloud platform as described in any one of claims 1 to 7.