Intelligent equipment control method and device and readable storage medium
By using both wide area network (WAN) and local area network (LAN) to send control commands in parallel in the terminal device and merging the results, the stability problem caused by network anomalies during the control of intelligent devices is solved, and stable control is achieved under unstable network conditions.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SUZHOU OPPLE LIGHTING
- Filing Date
- 2024-10-15
- Publication Date
- 2026-04-17
AI Technical Summary
Control failures caused by unstable or abnormal internet connections during the control of intelligent devices affect control stability.
By sending control commands to the smart device via both wide area network and local area network through the terminal device, and receiving and merging the control results, the smart device can still be successfully controlled even in the event of network failure.
It improves the stability of smart device control, ensuring that smart devices can still be controlled normally even when the Internet connection is unstable or abnormal.
Smart Images

Figure CN121887564A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of intelligent system technology, and in particular to an intelligent device control method and apparatus, and a readable storage medium. Background Technology
[0002] Currently, terminal devices control smart devices bound to a smart system, such as smart lights, smart curtains, smart refrigerators, and air conditioners, via the internet. If the internet connection is unstable, or if any link in the internet control path malfunctions, the smart devices will not be able to be controlled properly.
[0003] Overcoming network anomalies in intelligent device control and improving the stability of intelligent device control are technical problems that need to be solved. Summary of the Invention
[0004] The purpose of this application is to provide a smart device control method and apparatus, and a readable storage medium, to solve the problem of network anomalies in smart device control.
[0005] To solve the above-mentioned technical problems, this specification is implemented as follows: Firstly, a smart device control method is provided, applied to a terminal device, the method comprising: In response to user input to the target smart device via a terminal device, control commands are sent to the target smart device via both a wide area network and a local area network. The control results of the control commands are received from both the wide area network and the local area network, respectively. The control result of the target intelligent device is determined based on the control result of the control instructions received from the wide area network and the local area network.
[0006] Optionally, the step of responding to user input to the target smart device via a terminal device and sending control commands to the target smart device via both a wide area network and a local area network includes: In response to the user's input to the target smart device bound to the target application on the terminal device, a transaction number for the control command is generated; The system sends HTTP control commands carrying the transaction number to the target smart device via the wide area network, and sends LAN control commands carrying the transaction number to the target smart device via the local area network; wherein, the transaction number is used by the target smart device to discard HTTP control commands or LAN control commands carrying the same transaction number received later within a preset time period.
[0007] Optionally, sending the HTTP control command carrying the transaction number to the target smart device via the wide area network includes: The server sends an HTTP request via the wide area network. The HTTP request carries the device identifier of the target smart device and the transaction number. The device identifier is used by the server to query the destination address of the target smart device. The server is used to send an HTTP control command carrying the transaction number to the destination address to control the target smart device to perform control operations.
[0008] Optionally, the local area network is a WiFi network, and the target smart device is a WiFi access device; or, The local area network is a Bluetooth network, and the target smart device is a Bluetooth device.
[0009] Optionally, sending the control command carrying the transaction number from the local area network to the target smart device via the local area network includes: Determine the destination address corresponding to the device identifier of the target smart device; The local area network (LAN) sends a control command carrying the transaction number to the destination address corresponding to the device identifier of the target smart device, thereby controlling the target smart device to perform control operations.
[0010] Optionally, the local area network includes a WiFi network and a Bluetooth network, and the target smart device is a Bluetooth device. The step of sending the local area network control command carrying the transaction number to the target smart device via the local area network includes: Obtain the topology of the local area network where the target smart device is located. The topology represents the hierarchical connection relationship between each device in the local area network, and each device includes Bluetooth devices and WiFi access devices. Based on the topology, the target smart device is identified as having Bluetooth and WiFi capabilities among its parent devices. The control command is sent to the target device via the WiFi network. The control command carries the transaction number and destination address, so that the target device sends the target address to the target smart device via the Bluetooth network.
[0011] Optionally, determining the control result of the target intelligent device based on the control result of the control instructions received from the wide area network and the local area network includes: Merge the control results corresponding to the HTTP control commands and LAN control commands that carry the same transaction number. The target control result that indicates the control command has been successfully executed in the merged control result is determined as the control result of the target intelligent device.
[0012] Optionally, before sending control commands to the target smart device via both a wide area network and a local area network in response to user input to the target smart device through a terminal device, the method further includes: Determine if a WiFi network is currently available; If so, a search command is sent to each device in the WiFi network. The search command is used to search for the device identifier and local area network IP address of the smart device. If the target device responds to the search command and returns the device identifier and local area network IP address of the target device, then a mapping relationship between the device identifier and the local area network IP address of the target device is established; The target device for establishing the mapping relationship is defined as the target intelligent device.
[0013] Optionally, the target smart device is a smart device belonging to a target group that includes multiple smart devices, and each smart device in the target group establishes a binding relationship with the group identifier of the target group through a local area network address; In response to the search command, the target device also returns its local area network address and group identifier. After sending the search command to each device within the local area network, the process further includes: Based on the group identifier returned by the target device, determine whether the target device belongs to the target group; If it belongs to the target group, then based on the local area network address returned by the target device, it is determined whether the target device has a binding relationship with the target group; If a binding relationship exists, a mapping relationship between the device identifier of the target device and the local area network IP address is established; The target device for establishing the mapping relationship is defined as the target intelligent device.
[0014] In a second aspect, a smart device control apparatus is provided, including a processor and a memory, the memory storing a program or instructions executable on the processor, the program or instructions, when executed by the processor, implementing the steps of the method described in the first aspect.
[0015] Thirdly, a readable storage medium is provided that stores a program or instructions which, when executed by a processor, implement the steps of the method described in the first aspect.
[0016] In this embodiment, the terminal device, in response to user input to the target smart device via the terminal device, sends control commands to the target smart device via both a wide area network (WAN) and a local area network (LAN); receives the control results of the control commands from both the WAN and LAN; and determines the control result of the target smart device based on the control results received from the WAN and LAN. This multi-path parallel control of the target smart device overcomes the problem of unstable internet connections or other abnormalities causing the smart device to malfunction, thereby improving the stability of smart device control. Attached Figure Description
[0017] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings: Figure 1 This is a flowchart illustrating the intelligent device control method according to an embodiment of this application.
[0018] Figure 2 This is a schematic diagram illustrating an application scenario of the intelligent device control method according to an embodiment of this application.
[0019] Figure 3 This is a schematic diagram of the binding process of a smart device according to an embodiment of this application.
[0020] Figure 4 This is an overall example flowchart of the intelligent device control method according to an embodiment of this application.
[0021] Figure 5 This is a structural block diagram of the intelligent device control device according to an embodiment of this application. Detailed Implementation
[0022] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application. The drawing numbers in this application are only used to distinguish the various steps in the solution and are not used to limit the execution order of the various steps. The specific execution order is subject to the description in the specification.
[0023] To address the problems existing in the prior art, embodiments of this application provide a smart device control method and apparatus, and a readable storage medium. In response to user input to a target smart device via a terminal device, control commands are sent to the target smart device via both a wide area network (WAN) and a local area network (LAN); control results from the control commands are received from both the WAN and LAN; and the control result of the target smart device is determined based on the control results received from the WAN and LAN. This multi-path parallel control of the target smart device overcomes the problem of unstable internet connections or other abnormalities causing the smart device to malfunction, thereby improving the stability of smart device control.
[0024] Figure 1 This is a flowchart illustrating an embodiment of the intelligent device control method of this application. The method is applied to a terminal device, such as... Figure 1 As shown, the method includes steps 102 to 106.
[0025] Step 102: In response to the user's input to the target smart device through the terminal device, control commands are sent to the target smart device through both the wide area network and the local area network.
[0026] Terminal devices can be, for example, mobile phones, tablets, laptops, handheld computers, in-vehicle electronic devices, mobile internet devices (MID), wearable devices, ultra-mobile personal computers (UMPC), netbooks, or personal digital assistants (PDAs), etc., and the embodiments of this application do not impose specific limitations.
[0027] The target smart devices are those that users can control via terminal devices, such as smart lights, smart curtains, smart sensors installed in a user's home, or smart controllers connected to and used for controlling smart lights or smart curtains, or other smart devices that users need to control. These smart devices can communicate with terminal devices via wide area networks (WANs), local area networks (LANs), or a combination of both.
[0028] In this embodiment, a user can provide input to control a target smart device by operating a terminal device. In response to the user's input on the terminal device, the terminal device sends control commands to the corresponding target smart device via both a wide area network (WAN) and a local area network (LAN).
[0029] Based on the solution provided in the above embodiments, optionally, in step 102 above, the step of sending control commands to the target smart device via a wide area network and a local area network in response to the user's input to the target smart device through a terminal device includes: generating a transaction number for the control command in response to the user's input to the target smart device bound to the target application on the terminal device; sending an HTTP control command carrying the transaction number to the target smart device through the wide area network, and sending a local area network control command carrying the transaction number to the target smart device through the local area network; wherein, the transaction number is used by the target smart device to discard HTTP control commands or local area network control commands carrying the same transaction number received later within a preset time period.
[0030] In the above embodiments, the terminal device has an application installed specifically for managing and controlling target smart devices. This application is bound to at least one smart device that the user needs to control. Thus, the user can manage and control the bound smart devices through the target application installed on the terminal device. For example, they can add new smart devices, delete bound smart devices, or group or create groups based on type or region. For instance, smart devices installed in region A can be grouped into one group, and smart devices installed in region B can be grouped into another group.
[0031] Users can select the target smart device to be controlled through the interface displayed by the target application, and enter the control operation items or types for the target smart device, such as controlling a smart light to turn on or off, etc.
[0032] After receiving input from the user for the target smart device, the terminal device generates a transaction number for the control command. The same control command has the same transaction number, while different control commands have different transaction numbers. For example, a control command used to turn on a smart light generates a transaction number of "1"; a control command used to turn off a smart light generates a transaction number of "0".
[0033] In this embodiment, the terminal device sends control commands to the target smart device via both a wide area network (WAN) and a local area network (LAN). A WAN, also known as an external network or public network, is a remote network connecting computers in different regional LANs or metropolitan area networks (MANs). Communication is achieved via the HTTP protocol. When the terminal device sends control commands via the WAN, HTTP protocol control commands are used. Correspondingly, when the terminal device sends control commands via the LAN, the corresponding LAN protocol control commands are used. LANs include WiFi networks and Bluetooth networks.
[0034] The same target smart device can receive the same control command through both wide area network and local area network. The transaction number carried by the control command can be used by the target smart device to identify the same control command received successively within a preset time period, and discard the HTTP control command or local area network control command received later with the same transaction number.
[0035] Specifically, sending an HTTP control command carrying the transaction number to the target smart device via the wide area network includes: sending an HTTP request to a server via the wide area network, the HTTP request carrying the device identifier of the target smart device and the transaction number, the device identifier being used by the server to query the destination address of the target smart device, and the server being used to send an HTTP control command carrying the transaction number to the destination address to control the target smart device to perform a control operation.
[0036] The device identifier of the target smart device is used to identify different smart devices, and different smart devices have different device identifiers.
[0037] Combination Figure 2 In the application scenario of the intelligent device control method shown in the embodiment, the terminal device 10 can first send control commands to the server 20 via the wide area network 1. The server 20 has a pre-recorded mapping table of different intelligent device identifiers and their corresponding destination addresses. After receiving an HTTP request, the server 20 queries the pre-recorded mapping table based on the device identifier carried in the HTTP request to determine the destination address corresponding to the device identifier of the target intelligent device. That is, the server 20 sends an HTTP control command carrying a transaction number to that destination address.
[0038] Server 20 can forward control commands to the target smart device at the corresponding destination address via router 30, such as smart gateway 22, WiFi access device 24, etc., to control the target smart device accordingly. Here, smart gateway 22 has the function of accessing WiFi for communication. Thus, terminal device 10 controls the target smart device through the communication path of wide area network 1.
[0039] As mentioned above, the terminal device also controls the target smart device via the local area network.
[0040] In one embodiment, optionally, the local area network is a WiFi network, and the target smart device is a WiFi access device. Alternatively, the local area network is a Bluetooth network, and the target smart device is a Bluetooth device.
[0041] Specifically, sending the control command carrying the transaction number to the target smart device through the local area network includes: determining the destination address corresponding to the device identifier of the target smart device; and sending the control command carrying the transaction number to the destination address corresponding to the device identifier of the target smart device through the local area network to control the target smart device to perform control operations.
[0042] In the above embodiments, the terminal device can directly send control commands corresponding to the local area network protocol to the target smart device through the local area network. The terminal device has a pre-recorded mapping table of device identifiers and destination addresses of different smart devices. After generating a transaction number in response to the user's input control command for the target smart device, the terminal device can query the pre-recorded mapping table according to the device identifier of the target smart device to determine the destination address corresponding to the device identifier of the target smart device. That is, the terminal device sends the local area network control command carrying the transaction number to the destination address.
[0043] Combination Figure 2 When the local area network is a WiFi network and the target smart device is a WiFi access device, the terminal device 10 can send WiFi control commands directly to the target smart device, such as the local area network IP address of the smart gateway 22 with WiFi communication function or the WiFi access device 24, through the WiFi network 2.
[0044] Combination Figure 2 When the local area network is a Bluetooth network and the target smart device is a Bluetooth device, the terminal device 10 can directly send Bluetooth control commands to the target smart device, such as the smart curtain 26 with Bluetooth communication function or the rail-mounted lamp controller 28, through the Bluetooth network 3. Here, the rail-mounted lamp controller 28 can also further control the corresponding connected rail-mounted lamp 29 through the Bluetooth network according to the control commands.
[0045] In one embodiment, the local area network may optionally include a WiFi network and a Bluetooth network, and the target smart device may be a Bluetooth device.
[0046] Sending the control command carrying the transaction number of the local area network to the target smart device via the local area network includes: obtaining the topology of the local area network where the target smart device is located, the topology representing the hierarchical connection relationship of each device in the local area network, each device including Bluetooth devices and WiFi access devices; determining the target device with Bluetooth and WiFi functions among the upstream devices of the target smart device based on the topology; sending the control command to the target device via the WiFi network, the control command carrying the transaction number and destination address, so that the target device sends the control command to the destination address of the target smart device via the Bluetooth network to control the target smart device to perform control operations.
[0047] A local area network (LAN) consists of various devices arranged in a specific topology, which represents the hierarchical connections between these devices. Devices in a LAN may include both Bluetooth devices and Wi-Fi access devices. Terminal devices can send control commands directly to either the Bluetooth or Wi-Fi access device (which is a smart device), or they can be forwarded to lower-level smart devices through a higher-level device with a hierarchical connection. Typically, the lower-level device is a Bluetooth device, while the higher-level device can be either a Bluetooth device or a Wi-Fi access device. A device with both Bluetooth and Wi-Fi capabilities can act as a higher-level device, relaying control commands received via the Wi-Fi network to the lower-level smart device with Bluetooth functionality.
[0048] Combination Figure 2 Assuming the target smart device is a Bluetooth-enabled rail-mounted lamp holder controller 28, which is connected to multiple rail-mounted lamp holders 29, the controller is used to control the lamp holders 29 according to received control commands. The corresponding devices in the local area network are as follows: Figure 2 As shown in the dashed box. For example, the hierarchical relationship from terminal device 10 to rail-mounted lamp holder 29 is: terminal device 10 - smart gateway 22 - rail-mounted lamp holder controller 28 - rail-mounted lamp holder 29, where smart gateway 22 has Bluetooth and WiFi functions, and rail-mounted lamp holder controller 28 has Bluetooth function.
[0049] Terminal device 10, by querying a pre-recorded mapping table using the device identifier of the rail-mounted lamp holder controller 28, can determine the destination address corresponding to the device identifier of the rail-mounted lamp holder controller 28. Through the topology, terminal device 10 can identify the smart gateway 22, which has Bluetooth and WiFi capabilities, as the upstream device of the rail-mounted lamp holder controller 28. Therefore, terminal device 10 first sends a control command carrying a transaction number and Bluetooth address to smart gateway 22 via the WiFi network, and then smart gateway 22 sends a control command carrying a transaction number and Bluetooth address to rail-mounted lamp holder controller 28, thereby enabling rail-mounted lamp holder controller 28 to control the rail-mounted lamp holder 29 to perform corresponding control operations. Thus, terminal device 10 controls the target smart device through a communication path including WiFi network 2 and Bluetooth network 3.
[0050] Step 104: Receive the control results of the control commands from both the wide area network (WAN) and the local area network (LAN).
[0051] After receiving control commands from the terminal device via both the wide area network (WAN) and local area network (LAN), the target smart device will execute the corresponding control operations according to the control commands and return a response to the control commands along the same WAN or LAN path from which the control commands were received.
[0052] Of course, when a terminal device sends control commands via a wide area network (WAN) or local area network (LAN), if the WAN network is unstable or a device in one link malfunctions, or if the LAN network is unstable or a device in one link malfunctions, the control command may not reach the target smart device, and no response will be received. Failure to receive a response within a predetermined waiting time is also a form of control result, indicating control failure on the target smart device. If the control command reaches the target smart device normally, the target smart device distinguishes between the same control command received sequentially within a preset time period based on the transaction number of the control command. It executes the control operation based on the first received control command and returns the response to the mobile terminal. Control commands with the same transaction number received later within the same preset time period are discarded, and the terminal device will also not receive a response to the later control command, indicating control failure on the target smart device for the later command. Here, the control result may carry information indicating whether control of the target smart device failed or succeeded.
[0053] Step 106: Determine the control result of the target intelligent device based on the control result of the control command received from the wide area network and the local area network.
[0054] Based on the solution provided in the above embodiments, optionally, in step 106 above, determining the control result of the target intelligent device according to the control result of the control instructions received from the wide area network and the local area network includes: merging the control results corresponding to the HTTP control instructions and the local area network control instructions carrying the same transaction number; and determining the target control result in the merged control result that indicates that the control instructions have been successfully executed as the control result of the target intelligent device.
[0055] In the above embodiments, the terminal device sends control commands to the target smart device from both the wide area network (WAN) and the local area network (LAN). However, the control results returned by the target smart device from the WAN and the LAN may be different.
[0056] After receiving control commands from both the HTTP and LAN networks, each carrying the same transaction number, the terminal device merges the control results returned from both networks. If one of the merged control results carries information indicating successful control of the target smart device, meaning the control operation was successfully executed, this result is recognized as the target smart device's control result. Conversely, if the other control result carries information indicating failed control of the target smart device, meaning the control operation was unsuccessful, this result is ignored.
[0057] Typically, terminal devices can send control commands and receive corresponding control results faster via a local area network (LAN). Therefore, compared to a wide area network (WAN), it can further improve the control speed of smart devices while ensuring the stability of smart device control.
[0058] In one embodiment, after the terminal device receives the control result through either a wide area network or a local area network, if the control result indicates that the control operation on the target smart device has not been successfully executed, it can continue to wait for the control result of the target smart device to be fed back by another network. After the subsequent received control result indicates that the control operation on the target smart device has been successfully executed, the subsequent received control result is used as the target smart device's response to the control command.
[0059] In one embodiment, before sending control commands to the target smart device via a wide area network and a local area network respectively in response to user input to the target smart device through a terminal device, the method further includes: determining whether a WiFi network exists; if so, sending a search command to each device in the WiFi network, the search command being used to search for the device identifier and local area network IP address of the smart device; if the target device responds to the search command and returns the device identifier and local area network IP address of the target device, then establishing a mapping relationship between the device identifier and the local area network IP address of the target device; and identifying the target device with the established mapping relationship as the target smart device.
[0060] In this embodiment, before the terminal device sends control commands to the target smart device through the local area network, it is necessary to first establish a mapping or binding between the device identifier of the target smart device and the local area network address within the local area network, so that when sending control commands to the target smart device later, the local area network address of the target smart device can be located as the destination address for sending control commands.
[0061] For a target smart device with WiFi capability, the system first determines whether a WiFi network exists in the current network environment. If it does, a search command is sent to each device within the WiFi network. This search command searches for the smart device's device identifier and local area network (LAN) IP address. WiFi access devices that do not belong to the specific smart device will not respond to the search command. For the specific smart device, it will respond with its corresponding device identifier and LAN IP address upon receiving the search command. For example, a specific smart device might be a smart device from a pre-defined brand, pre-configured to respond to received search commands and provide its device identifier and LAN IP address.
[0062] After receiving the device identifier and local area network (LAN) IP address from the smart device, the terminal device establishes a mapping relationship between the corresponding smart device identifier and LAN IP address. The smart device with the established mapping relationship can then be used as the target smart device, and the user can control it.
[0063] In one embodiment, the target smart device is a smart device belonging to a target group comprising multiple smart devices. Each smart device in the target group establishes a binding relationship with the group identifier of the target group through a local area network (LAN) address. In response to the search command, the target device also returns its LAN address and group identifier. After sending the search command to each device within the LAN, the method further includes: determining whether the target device belongs to the target group based on the group identifier returned by the target device; if it belongs to the target group, determining whether the target device has a binding relationship with the target group based on the LAN address returned by the target device; if a binding relationship exists, establishing a mapping relationship between the device identifier and the LAN IP address of the target device; and identifying the target device with the established mapping relationship as the target smart device.
[0064] In this embodiment, the target device that responds to the search command and returns its device identifier and local area network (LAN) IP address also returns the LAN address (e.g., MAC address) and group identifier of the group to which the device belongs. Further determination is needed based on the group identifier to determine whether the target device belongs to the target group selected by the user. If so, the LAN address is also used to determine whether the target device is within that target group. The terminal device pre-records the binding relationship between the group identifier of each group and the LAN address of the smart device. Multiple different smart device LAN addresses can be bound to a single group.
[0065] The terminal device, by combining the device identifier and the local area network address, determines whether the target device is still a member of the target group selected by the user. Then, it establishes a mapping relationship between the target device's device identifier and its local area network IP address, and the target device can be controlled as a target smart device. The terminal device adds the target device to the controllable device list, which records different smart devices with the aforementioned binding and mapping relationships.
[0066] Figure 3 A schematic diagram of the smart device binding process according to an embodiment of this application is provided, such as... Figure 3 As shown, it includes the following steps: Step 202: If the terminal device detects that the App installed for controlling smart devices has started, or the App is currently running in the foreground, or the current network has changed, then proceed to step 204. Step 204: Determine if the current network is a WiFi network. If yes, proceed to step 206; otherwise, proceed to step 220. Step 206: Send a search command as a broadcast packet within the local area network and wait for a preset duration, such as 10 seconds; Step 208: Receive the response packet returned by the search command after a preset time. Step 210: Determine whether the group identifier HostID in the return packet is the current family's group. If yes, proceed to step 212; otherwise, proceed to step 218. Step 212: Determine whether the MAC address in the return packet is still in the list of controllable devices established by the terminal device. If yes, proceed to step 214; otherwise, proceed to step 218. Step 214: Bind the mapping relationship between the device that returned the packet and the local area network IP address; Step 216: Add the device to the list of controllable devices; Step 218, discard the return packet; Step 220: End the process.
[0067] Below, in conjunction with Figure 4 An overall example of the intelligent device control method according to the embodiments of this application will be described.
[0068] like Figure 4 As shown, it includes the following steps: Step 302: The terminal device receives the control command for the target smart device input by the user; Step 304: Respond to user input to generate the transaction number of the control command; Step 306: Send control instructions via HTTP to the target smart device through the wide area network and wait for the control result callback; Step 308: Simultaneously determine whether the current network environment of the App is a WiFi network environment. If yes, proceed to step 310; otherwise, proceed to step 314. Step 310: Determine whether the target smart device is a sub-device, i.e., whether it is a smart device in the local area network topology that requires Bluetooth and WiFi functionality, for example... Figure 2 The intelligent gateway 22 relays control commands to lower-level devices, such as intelligent curtains 26 and track-type lamp controllers 28; if so, proceed to step 312; otherwise, proceed to step 314. Step 312: Obtain the device identifier vDeviceID of the primary device. The primary device is the smart device with Bluetooth and WiFi functions mentioned in step 310. Step 314: Obtain the target smart device's own device identifier, vDeviceID; Step 316: Successfully query the local IP of the target smart device based on the device identifier vDeviceID, that is, the local area network IP address of the target smart device; Step 318: Send a LAN control command to the local IP address and wait for a response; Step 320: Determine whether the control was successful based on the response; Step 322, LAN control successful; Step 324, LAN control failed; Step 326, obtain the local area network control result; Step 328: Receive the HTTP command callback via the wide area network to obtain the external network (i.e., wide area network) control result of the target smart device; Step 330: Merge the local area network control results and the external network control results. If the control results on either the local area network or the external network are successful, then the control of the target smart device is successful.
[0069] In this embodiment, the terminal device, in response to user input to the target smart device via the terminal device, sends control commands to the target smart device via both a wide area network (WAN) and a local area network (LAN); receives the control results of the control commands from both the WAN and LAN; and determines the control result of the target smart device based on the control results received from the WAN and LAN. This multi-path parallel control of the target smart device overcomes the problem of unstable internet connections or other abnormalities causing the smart device to malfunction, thereby improving the stability of smart device control.
[0070] Optionally, such as Figure 5 As shown in the figure, this application embodiment also provides an intelligent device control device 2000, including a processor 2400 and a memory 2200. The memory 2200 stores a program or instructions that can run on the processor 2400. When the program or instructions are executed by the processor 2400, they implement the various steps of the above-described intelligent device control method embodiment and can achieve the same technical effect. To avoid repetition, they will not be described again here.
[0071] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of any of the above-described intelligent device control method embodiments and achieve the same technical effects. To avoid repetition, further details are omitted here. The readable storage medium includes computer-readable storage media, such as read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0072] This application also provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program. The computer program is operable to enable a computer to execute various processes of any of the above-described intelligent device control method embodiments and achieve the same technical effect. To avoid repetition, it will not be described again here.
[0073] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0074] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, etc.) to execute the methods described in the various embodiments of this application.
[0075] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.
Claims
1. A method of controlling an intelligent device, the method comprising: Applied to a terminal device, the method includes: In response to user input to the target smart device via a terminal device, control commands are sent to the target smart device via both a wide area network and a local area network. The control results of the control commands are received from both the wide area network and the local area network, respectively. The control result of the target intelligent device is determined based on the control result of the control instructions received from the wide area network and the local area network.
2. The method of claim 1, wherein, The step of responding to user input to the target smart device via a terminal device by sending control commands to the target smart device via both a wide area network (WAN) and a local area network (LAN) includes: In response to the user's input to the target smart device bound to the target application on the terminal device, a transaction number for the control command is generated; Sending HTTP control commands carrying the transaction number to the target smart device via the wide area network, and sending LAN control commands carrying the transaction number to the target smart device via the local area network; The transaction number is used by the target smart device to discard HTTP control commands or local area network control commands that are received later within a preset time period and carry the same transaction number.
3. The method of claim 2, wherein, Sending HTTP control commands carrying the transaction number to the target smart device via the wide area network includes: The server sends an HTTP request via the wide area network. The HTTP request carries the device identifier of the target smart device and the transaction number. The device identifier is used by the server to query the destination address of the target smart device. The server is used to send an HTTP control command carrying the transaction number to the destination address to control the target smart device to perform control operations.
4. The method according to claim 2, characterized in that, The local area network is a WiFi network, and the target smart device is a WiFi access device; or... The local area network is a Bluetooth network, and the target smart device is a Bluetooth device.
5. The method of claim 4, wherein, The step of sending the local area network control command carrying the transaction number to the target smart device via the local area network includes: Determine the destination address corresponding to the device identifier of the target smart device; The local area network (LAN) sends a control command carrying the transaction number to the destination address corresponding to the device identifier of the target smart device, thereby controlling the target smart device to perform control operations.
6. The method of claim 2, wherein, The local area network includes a WiFi network and a Bluetooth network, and the target smart device is a Bluetooth device. The step of sending the local area network control command carrying the transaction number to the target smart device via the local area network includes: Obtain the topology of the local area network where the target smart device is located. The topology represents the hierarchical connection relationship between each device in the local area network, and each device includes Bluetooth devices and WiFi access devices. Based on the topology, the target smart device is identified as having Bluetooth and WiFi capabilities among its parent devices. The control command is sent to the target device via the WiFi network. The control command carries the transaction number and destination address, so that the target device sends the control command to the destination address of the target smart device via the Bluetooth network, thereby controlling the target smart device to perform control operations.
7. The method of claim 2, wherein, The step of determining the control result of the target intelligent device based on the control result of the control commands received from the wide area network and the local area network includes: Merge the control results corresponding to the HTTP control commands and LAN control commands that carry the same transaction number. The target control result that indicates the control command has been successfully executed in the merged control result is determined as the control result of the target intelligent device.
8. The method according to any one of claims 3, 5 and 6, characterized in that, Before sending control commands to the target smart device via both a wide area network and a local area network in response to user input to the target smart device through a terminal device, the method further includes: Determine if a WiFi network is currently available; If so, a search command is sent to each device in the WiFi network. The search command is used to search for the device identifier and local area network IP address of the smart device. If the target device responds to the search command and returns the device identifier and local area network IP address of the target device, then a mapping relationship between the device identifier and the local area network IP address of the target device is established; The target device for establishing the mapping relationship is defined as the target intelligent device.
9. The method according to claim 8, characterized in that, The target smart device is one of the smart devices belonging to a target group that includes multiple smart devices. Each smart device in the target group establishes a binding relationship with the group identifier of the target group through a local area network address. In response to the search command, the target device also returns its local area network address and group identifier. After sending the search command to each device within the local area network, the process further includes: Based on the group identifier returned by the target device, determine whether the target device belongs to the target group; If it belongs to the target group, then based on the local area network address returned by the target device, it is determined whether the target device has a binding relationship with the target group; If a binding relationship exists, a mapping relationship between the target device's device identifier and its local area network IP address is established; The target device for establishing the mapping relationship is defined as the target intelligent device.
10. A smart device control device, characterized in that, It includes a processor and a memory, the memory storing a program or instructions that can run on the processor, the program or instructions being executed by the processor to implement the steps of the method as described in any one of claims 1-9.
11. A readable storage medium, characterized in that, The readable storage medium stores a program or instructions that, when executed by a processor, implement the steps of the method as described in any one of claims 1-9.