Device control method, device, electronic device, and storage medium
Through the local storage scene and parent-child gateway architecture of the ZigBee gateway, device information is received and the target scene is determined, which solves the control problem of device control when the network is abnormal, realizes efficient management of multiple devices, and improves the user experience.
Patent Information
- Application Number
- CN202210295076.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-23
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2042-03-23
AI Technical Summary
Existing device control methods cannot achieve device control when the network is abnormal, and cannot effectively manage the control of multiple devices, resulting in a poor user experience.
Through the local storage scene of the ZigBee gateway, the device information uploaded by the sub-gateway is received, the target scene is determined and the corresponding device is controlled. The distributed architecture of the parent-sub gateway is used to realize device control and improve the ability to manage the number of devices.
Devices can still be controlled when the network is abnormal, and the number of controllable devices can be significantly increased, improving user experience.
Smart Images

Figure CN114745813B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of smart home technology, and more specifically, to a device control method, apparatus, electronic device, and storage medium. Background Art
[0002] With the development of science and technology, the use of smart homes has become more and more widespread. It has become an indispensable part of most homes, and it can realize more and more functions, becoming one of the necessities in people's daily lives. At present, there are certain defects in the automatic control methods of devices, resulting in poor user experience. Summary of the Invention
[0003] In view of the above problems, the present application proposes a device control method, apparatus, electronic device and storage medium to solve the above problems.
[0004] In a first aspect, an embodiment of the present application provides a device control method, which is applied to a ZigBee gateway, wherein the ZigBee gateway is connected to at least one sub-gateway, and each of the at least one sub-gateways is connected to a device. The method includes: receiving first device information uploaded by a first target sub-gateway in the at least one sub-gateway, wherein the first device information is uploaded by a first target device connected to the first target sub-gateway; based on the first device information, determining a first target scene from multiple scenes locally stored in the ZigBee gateway; based on the first target scene, determining a second target device from the devices connected to each of the at least one sub-gateways; and sending first control information to a second target sub-gateway to which the second target device is connected, to instruct the second target sub-gateway to control the second target device based on the first control information.
[0005] In a second aspect, an embodiment of the present application provides a device control device, which is applied to a ZigBee gateway, wherein the ZigBee gateway is connected to at least one sub-gateway, and each of the at least one sub-gateways is connected to a device. The device includes: a first device information receiving module, used to receive first device information uploaded by a first target sub-gateway in the at least one sub-gateway, wherein the first device information is uploaded by a first target device connected to the first target sub-gateway; a target scene determination module, used to determine a first target scene from multiple scenes locally stored in the ZigBee gateway based on the first device information; a second target device determination module, used to determine a second target device from the devices connected to each of the at least one sub-gateways based on the first target scene; and a target device control module, used to send first control information to a second target sub-gateway to which the second target device is connected, to instruct the second target sub-gateway to control the second target device based on the first control information.
[0006] In a third aspect, an embodiment of the present application provides an electronic device, comprising a memory and a processor, wherein the memory is coupled to the processor, the memory stores instructions, and when the instructions are executed by the processor, the processor executes the above method.
[0007] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which program code is stored, and the program code can be called by a processor to execute the above method.
[0008] The device control method, apparatus, electronic device, and storage medium provided in the embodiments of the present application receive first device information uploaded by a first target sub-gateway in at least one sub-gateway, determine a first target scenario from multiple scenarios stored locally in the ZigBee gateway based on the first device information, determine a second target device from devices connected to each of the at least one sub-gateway based on the first target scenario, and send first control information to a second target sub-gateway connected to the second target device to instruct the second target sub-gateway to control the second target device based on the first control information. This allows the device to be controlled when a network anomaly occurs by storing multiple scenarios locally in the ZigBee gateway, and greatly increases the number of controllable devices through the distributed architecture of the parent-child gateway. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] 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 those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0010] Figure 1 A schematic diagram showing a first application environment of the device control method provided in an embodiment of the present application is shown;
[0011] Figure 2 A schematic diagram showing a second application environment of the device control method provided in an embodiment of the present application is shown;
[0012] Figure 3 A schematic diagram of a flow chart of a device control method provided in an embodiment of the present application is shown;
[0013] Figure 4 A schematic diagram of a flow chart of a device control method provided in an embodiment of the present application is shown;
[0014] Figure 5 A schematic diagram of a flow chart of a device control method provided in an embodiment of the present application is shown;
[0015] Figure 6 A schematic diagram of a flow chart of a device control method provided in an embodiment of the present application is shown;
[0016] Figure 7 A schematic diagram of a flow chart of a device control method provided in an embodiment of the present application is shown;
[0017] Figure 8 A schematic diagram of a flow chart of a device control method provided in an embodiment of the present application is shown;
[0018] Figure 9 A schematic diagram of a flow chart of a device control method provided in an embodiment of the present application is shown;
[0019] Figure 10 A module block diagram of a device control device provided in an embodiment of the present application is shown;
[0020] Figure 11 A block diagram of an electronic device for executing a device control method according to an embodiment of the present application is shown;
[0021] Figure 12 A storage unit for storing or carrying program codes for implementing the device control method according to an embodiment of the present application is shown. DETAILED DESCRIPTION
[0022] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.
[0023] In the application of home scenes, the current device control method controls the device by sending the scene data controlled by the device to the cloud through the application (Application, App), and the cloud stores them in the server. When the network of the home scene environment is abnormal, the device cannot be controlled. In addition, the existing device control method can control a small number of devices. When there are many devices in the home scene, it is impossible to control multiple devices.
[0024] To address the above issues, the inventors, after long-term research, have discovered and proposed the device control method, apparatus, server, and storage medium provided in the embodiments of this application. The ZigBee gateway (mother gateway) stores local scenarios, obtains device information through multiple children to determine the scenario, and controls the devices corresponding to the determined scenario. This allows for device control when network anomalies occur, and greatly increases the number of controllable devices through the distributed architecture of the child and mother gateways. The specific device control method is described in detail in the subsequent embodiments.
[0025] See also Figure 1 , Figure 1 The first application environment diagram of the device control method provided in the embodiment of the present application is shown. The application environment includes a ZigBee gateway 100, a sub-gateway 110, and a device 200. The ZigBee gateway 100 can be connected to the sub-gateway 110 to enable data exchange between the ZigBee gateway 100 and the sub-gateway 110. The ZigBee gateway 100 and the sub-gateway 110 can be connected via Ethernet and WIFI, which are not limited here. The sub-gateway 110 can be connected to the device 200 to enable data exchange between the sub-gateway 110 and the device 200. The sub-gateway 110 and the device 200 can be connected via ZigBee, which are not limited here.
[0026] In some embodiments, the ZigBee gateway 100 may be directly connected to the device 200 to implement data interaction between the ZigBee gateway 100 and the device 200. The ZigBee gateway 100 and the device 200 may be connected via ZigBee, which is not limited herein.
[0027] In some embodiments, the device 200 may include but is not limited to door sensors, sensors, and ZigBee smart home devices.
[0028] In some cases, the device 200 may include a sensor, wherein the sensor may include a human infrared sensor, a light sensor, a door and window sensor, and the like, which are not limited here.
[0029] In some cases, the device 200 may include ZigBee smart home devices, wherein the ZigBee smart home devices may include smart switches, smart lights, smart air conditioners, smart curtains, smart TVs, smart refrigerators, smart fans and other ZigBee smart home devices, which are not limited here.
[0030] The number of sub-gateways 110 may be one or more, and the number of devices 200 may be one or more, which is not limited here.
[0031] The ZigBee gateway is connected to the cloud, which is used to connect to the terminal device
[0032] See also Figure 2 , Figure 2The second application environment diagram of the device control method provided in the embodiment of the present application is shown. The application environment includes a ZigBee gateway 100, a cloud 300, and a terminal device 400, wherein the ZigBee gateway 100 can be connected to the cloud 300 to realize data interaction between the ZigBee gateway 100 and the cloud 300. The ZigBee gateway 100 and the cloud 300 can be connected via ZigBee, which is not limited here. The terminal device 400 is connected to the ZigBee gateway 100 through the cloud 300 to realize data interaction between the cloud 300 and the terminal device 400. The cloud 300 and the sub-terminal device 400 can be connected via WIFI, ZigBee, 2G / 3G / 4G / 5G, which is not limited here.
[0033] The number of terminal devices 400 may be one or more, which is not limited here.
[0034] See also Figure 3 , Figure 3 The flow chart of the device control method provided by the embodiment of the present application is shown in FIG. Figure 10 The device control device 500 and the electronic device 100 equipped with the device control device 500 ( Figure 11 ), wherein the electronic device may include a ZigBee gateway, which is not limited here. The following will take the electronic device as an example to illustrate the specific process of this embodiment. Figure 3 The process shown is described in detail, and the device control method may specifically include the following steps:
[0035] Step S101: receiving first device information uploaded by a first target sub-gateway among the at least one sub-gateway, wherein the first device information is uploaded by a first target device connected to the first target sub-gateway.
[0036] In some embodiments, the first device information is uploaded by the first target device connected to the first target sub-gateway. The first device information may include one or more pieces of device information, without limitation. The first device information may also include device status information and device time information, without limitation. In one embodiment, when the state of the first target device changes, the first target device uploads the first device information to the first target sub-gateway. For example, if the first target device is a smart switch, the first device information is uploaded to the first target sub-gateway when the smart switch changes from off to on. Alternatively, the ZigBee gateway may pre-set and store a preset upload time. When the state of the first target device changes and the preset upload time is met, the first device information is uploaded to the first target sub-gateway. For example, if the first target device is a human infrared sensor, the preset upload time is 8:00 AM to 10:00 PM. When the human infrared sensor detects a person and the current time is 1:00 PM, the first device information is uploaded to the first target sub-gateway. When the human infrared sensor detects a person and the current time is 11:00 PM, the first device information is not uploaded to the first target sub-gateway.
[0037] In some embodiments, the ZigBee gateway may receive first device information uploaded by a first target sub-gateway in at least one sub-gateway, wherein the number of first target sub-gateways may be one or more, which is not limited herein. As one approach, when the first device information in the first target gateway changes, the ZigBee gateway receives the first device information uploaded by the first target sub-gateway in at least one sub-gateway. For example, the first target information is the off state of a smart switch. When the smart switch changes to the off state, the ZigBee gateway receives the first device information uploaded by the first target sub-gateway. As another approach, the ZigBee gateway may be connected to a human infrared sensor. When the human infrared sensor detects that there is someone indoors, the ZigBee gateway receives the first device information uploaded by the first target sub-gateway in at least one sub-gateway; when the human infrared sensor detects that there is no one indoors, the ZigBee gateway does not receive the first device information uploaded by the first target sub-gateway in at least one sub-gateway.
[0038] Step S102: Based on the first device information, determine a first target scene from a plurality of scenes stored locally in the ZigBee gateway.
[0039] In this embodiment, the first target scene can be determined from multiple scenes stored locally on the ZigBee gateway based on the first device information. It is understood that the ZigBee gateway stores multiple scenes locally, where the multiple scenes can include single scenes and multiple scenes, which are not limited here. A single scene is a scene with a single condition, and a multiple scene is a scene with multiple conditions.
[0040] In some embodiments, multiple scenes stored locally in the ZigBee gateway can be encoded, and the first device information can also be numbered. When the number of the first device information is the same as the scene number, the scene is determined to be the first target scene from the multiple scenes stored locally in the ZigBee gateway. For example, the scene is to turn on the hall light when the smart switch is turned on, and the code of this scene is 1. The scene is to turn on the corridor light when the door sensor detects that the door is open, and the code of this scene is 2. The first device information is the smart switch on state. When the first device information is encoded, the code of the smart switch on state is 1. If the first device information and the scene code are both 1, the scene of turning on the hall light when the smart switch is turned on is determined as the first target scene.
[0041] Step S103: Based on the first target scenario, determine a second target device from the devices to which the at least one sub-gateway is respectively connected.
[0042] In this embodiment, a second target device can be determined from the devices connected to at least one sub-gateway based on the first target scenario. The number of devices connected to at least one sub-gateway can be one or more, and is not limited here. For example, if sub-gateway 1 is connected to a hall light and sub-gateway 2 is connected to a smart TV, and the first target scenario is that the hall light turns on when the smart switch is turned on, then the hall light connected to sub-gateway 1 is determined to be the second target device.
[0043] Step S104: Sending first control information to a second target sub-gateway to which the second target device is connected, to instruct the second target sub-gateway to control the second target device based on the first control information.
[0044] In this embodiment, first control information is sent to a second target sub-gateway connected to a second target device to instruct the second target sub-gateway to control the second target device based on the first control information. The first control information is used to control only the second target sub-gateway. For example, the first control information is to turn on a smart TV. This command is sent to the second target sub-gateway connected to the smart TV, and the second target sub-gateway controls the smart TV to turn on.
[0045] In some embodiments, the second target sub-gateway may receive the current state of the second target device. When the first control information is different from the current state of the second target device, the first control information is sent to the second target sub-gateway connected to the second target device. When the first control information is repeated with the current state of the second target device, the first control information is not sent to the second target sub-gateway connected to the second target device. For example, the first control information is to turn on a smart TV. When the current state of the smart TV is off, turning on the smart TV is different from the turned-on state of the smart TV, and the first control information is sent to the second target sub-gateway connected to the second target device. When the current state of the smart TV is on, turning on the smart TV is repeated with the turned-on state of the smart TV, and the first control information is not sent to the second target sub-gateway connected to the second target device.
[0046] The device control method, apparatus, electronic device, and storage medium provided in the embodiments of the present application receive first device information uploaded by a first target sub-gateway in at least one sub-gateway, determine a first target scenario from multiple scenarios stored locally in the ZigBee gateway based on the first device information, determine a second target device from devices connected to each of the at least one sub-gateway based on the first target scenario, and send first control information to a second target sub-gateway connected to the second target device to instruct the second target sub-gateway to control the second target device based on the first control information. This allows the device to be controlled when a network anomaly occurs by storing multiple scenarios locally in the ZigBee gateway, and greatly increases the number of controllable devices through the distributed architecture of the parent-child gateway.
[0047] See also Figure 4 , Figure 4 The flow chart of the device control method provided by the embodiment of the present application is shown. In a specific embodiment, the ZigBee gateway is connected to the cloud, and the cloud is used to connect to the terminal device. Figure 4 The process shown is described in detail, and the device control method may specifically include the following steps:
[0048] Step S201: receiving a plurality of scenes sent from the cloud, wherein the plurality of scenes are uploaded to the cloud by the terminal device.
[0049] In this embodiment, the user can set scene data of multiple scenes in the terminal device and send the multiple scenes to the cloud. The ZigBee gateway can receive the multiple scenes sent from the cloud, where the scene data may include but is not limited to trigger conditions and control information of the control device.
[0050] In some implementations, the ZigBee gateway can receive multiple scenarios sent from the cloud. As one approach, each time a user completes the setup of a scenario through the app on their terminal device, the scenario is sent to the ZigBee gateway via the cloud. Alternatively, the user can complete the setup of multiple scenarios on their terminal device, notify the app of the completion, and then send the multiple scenarios to the ZigBee gateway via the cloud. Methods for notifying the app of the completion of setup include clicking "Finish setup" and voice inputting "Finish setup," and are not limited here.
[0051] Step S202: Save the multiple scenes locally.
[0052] In this embodiment, the terminal device packages multiple scenes and sends them to the ZigBee gateway through the cloud. The ZigBee gateway stores the multiple scenes in a fixed format in the Flash chip of the ZigBee gateway.
[0053] Step S203: receiving first device information uploaded by a first target sub-gateway among the at least one sub-gateway, wherein the first device information is uploaded by a first target device connected to the first target sub-gateway.
[0054] The detailed description of step S203 can be found in step S101 and will not be repeated here.
[0055] Step S204: Compare the first device information with the multiple scenarios respectively.
[0056] In this embodiment, the first device information is compared with multiple scenes to determine the target scene. For example, scene 1 is to turn on the hallway light when the door sensor is in the open state, and scene 2 is to turn on the corridor light when the human infrared sensor detects a person. The first device information is that the door sensor is in the open state. The open state of the door sensor is compared with scenes 1 and 2 to determine the first target scene.
[0057] Step S205: When the first device information satisfies a single-scenario condition and the first device information satisfies any scenario among the multiple scenarios, a scenario satisfied by the first device information is determined as the first target scenario.
[0058] In this embodiment, when the first device information satisfies both a single-scenario condition and any of multiple scenarios, the scenario satisfied by the first device information is determined as the first target scenario. It should be noted that a single scenario is a scenario that includes one trigger condition. For example, multiple scenarios include Scenario 1: Turning on the smart TV when the hall light switch is on; Scenario 2: Turning on the smart TV when the corridor light switch is on; and Scenario 3: Turning off the smart air conditioner when the window sensor detects that the window is open. If the first device information indicates that the hall light switch is on, the first device information satisfies both the single-scenario condition and Scenario 1, and therefore Scenario 1 is determined as the first target scenario.
[0059] In some embodiments, when the first device information satisfies a single-scene condition and satisfies any one of multiple scenes, the scene satisfied by the first device information is determined as the first target scene. In other words, when the first device information satisfies the triggering condition of any one of the multiple scenes, the scene satisfied by the first device information is determined as the first target scene. For example, if the triggering condition for scene 1 is that the human infrared sensor detects a human body and the door sensor is in the open state, and the control device's instruction is to turn on the hallway light, scene 1 will be determined as the first target scene as long as the first device information satisfies either the human infrared sensor detects a human body or the door sensor is in the open state.
[0060] Step S206: When the first device information satisfies a single scenario condition and the first device information satisfies at least two scenarios among the multiple scenarios, obtaining priorities corresponding to the at least two scenarios.
[0061] In this embodiment, when the first device information satisfies the single-scenario condition and satisfies at least two of the multiple scenarios, the priorities corresponding to the at least two scenarios are obtained. For example, the multiple scenarios include Scenario 1: Turning on the smart TV when the hall light switch is on, with a priority of 1; Scenario 2: Turning on the smart air conditioner when the hall light switch is on, with a priority of 2; and Scenario 3: Turning off the smart air conditioner when the window sensor detects that the window is open, with a priority of 3. If the first device information indicates that the hall light switch is on, the first device information satisfies the single-scenario condition and satisfies both Scenario 1 and Scenario 2. The obtained priorities for Scenario 1 are 1, and Scenario 2 are 2.
[0062] Step S207: Based on the priorities corresponding to the at least two scenes, determine the scene with the highest priority from the at least two scenes as the first target scene.
[0063] In this embodiment, based on the priorities corresponding to at least two scenes, the scene with the highest priority is determined from at least two scenes as the first target scene. For example, the scene with a smaller priority number has a higher priority. The priority of scene 1 is 1, and the priority of scene 2 is 2. Scene 1 has the highest priority, so scene 1 is used as the first target scene.
[0064] As a method, the priority of a scene can be determined based on a code. The code can include numbers, uppercase letters, and lowercase letters, which are not limited here. For example, the priority of scene 1 is 1, the priority of scene 2 is 2, and the priority of scene 3 is 3; the priority of scene 1 is A, the priority of scene 2 is B, and the priority of scene 3 is C; the priority of scene 1 is a, the priority of scene 2 is b, and the priority of scene 3 is c. The priority level can be determined by the size of the number or by the order of the letters, which are not limited here.
[0065] As another approach, the priority of scenes can be determined based on the order in which the user completes the scene settings in the terminal device app. It is understood that the earlier the scene settings are completed in the terminal device app, the higher the priority. For example, if the user completes the scene settings in the terminal device app in the order of scene 1, scene 2, and scene 3, the priority order from high to low is scene 1, scene 2, and scene 3.
[0066] Alternatively, the priority of scenes can be determined based on the order in which they are stored in the ZigBee gateway. Scenes stored earlier in the ZigBee gateway have higher priority, while scenes stored later in the ZigBee gateway have lower priority. For example, if scene 1 is stored in the ZigBee gateway before scene 2, scene 1 will have higher priority than scene 2.
[0067] Step S208: When the first device information satisfies a multi-scenario condition and the first device information satisfies at least two scenarios among the multiple scenarios, the at least two scenarios satisfied by the first device information are determined as the first target scenario.
[0068] Among them, steps S205, S206 and S208 are not in the same order.
[0069] In this embodiment, when the first device information satisfies multiple scene conditions and the first device information satisfies at least two scenes among the multiple scenes, the at least two scenes satisfied by the first device information are determined as the first target scene. That is, when the information included in the first device information satisfies the triggering conditions of at least two scenes among the multiple scenes, the scene satisfied by the first device information is determined as the first target scene. For example, assuming that the triggering condition of scene 1 is that the human infrared sensor detects a human body and the door magnet is in the on state, and the instruction of the control device is to turn on the hallway light, the first device information can be that the human infrared sensor detects a human body and the door magnet is in the on state. Figure 5 As shown, the first device information is that the human infrared sensor detects a human body. The ZigBee gateway compares the human body detected by the human infrared sensor with multiple scenes. When the human infrared sensor detects that the human body meets multiple scene conditions and the human infrared sensor detects that the human body meets at least two scenes in the multiple scenes, the at least two scenes detected by the human infrared sensor are determined as the first target scene, that is, scene 1 is used as the first target scene. Figure 6 As shown, the first device information is that the state of the door sensor is in the open state. In the ZigBee gateway, the state of the door sensor in the open state is compared with multiple scenes. When the state of the door sensor in the open state meets the conditions of multiple scenes and the state of the door sensor in the open state meets the trigger conditions of at least two scenes in the multiple scenes, the at least two scenes that the state of the door sensor in the open state meets are determined as the first target scene, that is, scene 1 is used as the first target scene.
[0070] Step S209: Based on the first target scenario, determine a second target device from the devices to which the at least one sub-gateway is respectively connected.
[0071] Step S210: Sending first control information to a second target sub-gateway to which the second target device is connected, to instruct the second target sub-gateway to control the second target device based on the first control information.
[0072] The detailed description of steps S209 to S210 can be found in steps S103 to S104 and will not be repeated here.
[0073] Compared with the device control method provided by an embodiment of the present application, Figure 3 The device control method shown can determine the first target scenario based on the conditions satisfied by the first device information, determine the second target device from the devices connected to at least one sub-gateway based on the first target scenario, and control the second target device based on the first control information, thereby determining a combination of multiple scenario conditions through the first device information to achieve control of the device under complex scenario conditions.
[0074] See also Figure 7 , Figure 7 The flowchart of the device control method provided by the embodiment of the present application is shown. In a specific embodiment, the at least two scenarios include a first scenario and a second scenario. Figure 7 The process shown is described in detail, and the device control method may specifically include the following steps:
[0075] Step S301: receiving first device information uploaded by a first target sub-gateway among the at least one sub-gateway, wherein the first device information is uploaded by a first target device connected to the first target sub-gateway.
[0076] The detailed description of step S301 can be found in step S101 and will not be repeated here.
[0077] Step S302: Compare the first device information with the first scenario to obtain a first comparison result.
[0078] In this embodiment, the first device information is compared with the first scenario to obtain a first comparison result, which is used to determine the target scenario. For example, if the first device information indicates that the door sensor is in the open state, and the first scenario is to turn on the hallway light when the door sensor is in the open state, the first comparison result obtained by comparing the door sensor in the open state with the first scenario indicates that the first device information satisfies the first scenario.
[0079] Step S303: When the first comparison result indicates that the first device information meets the first scenario, the second device information is compared with the second scenario to obtain a second comparison result, wherein the second device information is uploaded by a third target device connected to the first target sub-gateway.
[0080] In this embodiment, the second device information is uploaded by the third target device connected to the first target sub-gateway. When the first comparison result indicates that the first device information satisfies the first scenario, the second device information is compared with the second scenario to obtain a second comparison result. For example, assuming that the first scenario is to turn on the hallway light when the door sensor is in the open state, and the second scenario is to turn on the corridor light when the light attribute of the light sensor is less than 200, when the first result indicates that the first device information (the door sensor state is open) satisfies the first scenario, the second device information (the light attribute of the light sensor is less than the preset attribute) is compared with the second scenario to obtain a second comparison result.
[0081] Step S304: When the second comparison result indicates that the second device information satisfies the second scenario, the first scenario and the second scenario are determined as the first target scenario.
[0082] In this embodiment, when the second comparison result indicates that the second device information satisfies the second scenario, the first scenario and the second scenario are determined as the first target scenario.
[0083] For example, see Figure 8 , Figure 8 This figure shows a flow chart of the device control method provided by an embodiment of the present application. The first and second scenarios are first target scenarios. In the first scenario, when the human infrared sensor detects a person, the hallway light is turned on. In the second scenario, when the light attribute of the light intensity sensor is less than a preset attribute, the corridor light is turned on.
[0084] Step S305: Based on the first target scenario, determine a second target device from the devices to which the at least one sub-gateway is respectively connected.
[0085] Step S306: Sending first control information to a second target sub-gateway to which the second target device is connected, to instruct the second target sub-gateway to control the second target device based on the first control information.
[0086] The detailed description of steps S305 to S306 can be found in steps S103 to S104 and will not be repeated here.
[0087] Compared with the device control method provided by an embodiment of the present application, Figure 3 The device control method shown can compare the first device information with the first scene and the second device information with the second scene, determine the first target scene and the second target device based on the first comparison results and the second comparison, and control the second target device, thereby realizing a method of controlling the device with multi-layer logic through nesting of scenes, and being able to achieve high-requirement device control in complex application scenarios.
[0088] See also Figure 9 , Figure 9 The flowchart of the device control method provided by the embodiment of the present application is shown. In a specific embodiment, the at least two scenarios include a first scenario and a second scenario. Figure 9 The process shown is described in detail, and the device control method may specifically include the following steps:
[0089] Step S401: receiving first device information uploaded by a first target sub-gateway among the at least one sub-gateway, wherein the first device information is uploaded by a first target device connected to the first target sub-gateway.
[0090] Step S402: Based on the first device information, determine a first target scene from a plurality of scenes stored locally in the ZigBee gateway.
[0091] Step S403: Based on the first target scenario, determine a second target device from the devices to which the at least one sub-gateway is respectively connected.
[0092] Step S404: Sending first control information to a second target sub-gateway to which the second target device is connected, to instruct the second target sub-gateway to control the second target device based on the first control information.
[0093] For the detailed description of steps S401 to S404 , please refer to steps S101 to S104 , which will not be repeated here.
[0094] Step S405: receiving the third device information uploaded by the second target sub-gateway, wherein the third device information is uploaded by the second target device when the state information changes.
[0095] In some embodiments, the third device information is uploaded to the second target sub-gateway when the status information of the second target device changes. For example, if the second target device is a smart switch, the third device information is the status information of the smart switch. When the smart switch changes from an off state to an on state, the on state of the smart switch is uploaded to the second target sub-gateway. The third device information can include information about a single device or multiple devices, without limitation. The third device information can include device status information and device time information, without limitation.
[0096] In some embodiments, the ZigBee gateway may receive third device information uploaded by a second target sub-gateway, where the number of second target sub-gateways may be one or more, and is not limited herein. As one approach, when the third device information in the second target gateway changes, the ZigBee gateway receives the third device information uploaded by the second target sub-gateway in at least one sub-gateway. For example, if the third target information is the on state of a smart switch, and the state of the smart switch changes from on to off, the ZigBee gateway receives the third device information uploaded by the second target sub-gateway.
[0097] Step S406: Based on the third device information, determine a second target scene from a plurality of scenes stored locally in the ZigBee gateway.
[0098] In this embodiment, the second target scene can be determined from multiple scenes stored locally in the ZigBee gateway based on the third device information. It can be understood that the ZigBee gateway stores multiple scenes locally, where the multiple scenes can include single scenes and multiple scenes, which are not limited here.
[0099] In some embodiments, multiple scenes stored locally in the ZigBee gateway can be encoded, and the third device information can also be numbered. When the number of the third device information is the same as the scene number, the scene is determined to be the second target scene from the multiple scenes stored locally in the ZigBee gateway. For example, assuming that scene 1 is to close the curtains when the smart TV is turned on, the code of scene 1 is 1, and scene 2 is to turn on the corridor lights when the door sensor detects that the door is open, the code of scene 2 is 2. When the third device information is that the door sensor detects that the door is open, the information that the door sensor detects that the door is open is encoded as 2. That is, the code of the third device information is 2, and the code of the third device information and the code of scene 2 are both 2, and scene 2 is determined as the second target scene.
[0100] Step S407: Based on the second target scenario, determine a fourth target device from the devices to which the at least one sub-gateway is respectively connected.
[0101] In this embodiment, a fourth target device can be determined from the devices connected to at least one sub-gateway based on the second target scenario. The number of devices connected to at least one sub-gateway can be one or more, and is not limited here. For example, if sub-gateway 1 is connected to smart curtains and sub-gateway 2 is connected to a smart air conditioner, and the second target scenario is that the smart air conditioner turns on when a person is detected by the human infrared sensor, the smart air conditioner connected to sub-gateway 2 is determined to be the fourth target device.
[0102] Step S408: Sending second control information to the third target sub-gateway to which the fourth target device is connected, to instruct the third target sub-gateway to control the fourth target device based on the second control information.
[0103] In this embodiment, second control information is sent to a third target sub-gateway connected to a fourth target device to instruct the third target sub-gateway to control the fourth target device based on the second control information. The second control information is used to instruct the third target sub-gateway to control the fourth target device. For example, the second control information is to turn on a smart TV. If the second control information is sent to the third target sub-gateway connected to the smart TV, the third target sub-gateway will control the smart TV to turn on.
[0104] In some embodiments, the third target sub-gateway may receive the current state of the second target device. When the second control information is different from the current state of the third target device, the second control information is sent to the third target sub-gateway connected to the third target device; when the second control information is the same as the current state of the third target device, the second control information is not sent to the third target sub-gateway connected to the fourth target device. For example, the second control information is to turn on a smart TV. When the current state of the smart TV is off, turning on the smart TV is different from turning on the smart TV, and the second control information is sent to the third target sub-gateway connected to the fourth target device; when the current state of the smart TV is on, turning on the smart TV is the same as turning on the smart TV, and the second control information is not sent to the third target sub-gateway connected to the fourth target device.
[0105] Compared with the device control method provided by an embodiment of the present application, Figure 3 The device control method shown can enable the second target device to upload a value to the second target sub-gateway when the status information changes. ZigBee can receive the third device information uploaded by the second target sub-gateway, determine the second target scene and the fourth target device based on the third device information, and send the second control information based on the second target scene to control the fourth target device, thereby achieving more intelligent device control. After completing the device control of one scene, the device control of the next scene can also be completed according to the status of the device, reducing the user's manual operation, making the user's life more convenient, and improving the user experience.
[0106] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and modules can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0107] See also Figure 10 , Figure 10 The module block diagram of the device control device provided by the embodiment of the present application is shown. The device control device 500 is applied to the above electronic equipment. Figure 10 As illustrated in the block diagram, the device control apparatus 500 includes: a first device information receiving module 510, a target scene determining module 520, a second target device determining module 530, and a target device control module 540, wherein:
[0108] The first device information receiving module 510 is configured to receive first device information uploaded by a first target sub-gateway in the at least one sub-gateway, wherein the first device information is uploaded by a first target device connected to the first target sub-gateway.
[0109] Furthermore, the device control apparatus 500 further includes: a scene receiving module and a local storage module, wherein:
[0110] A scene receiving module, configured to receive a plurality of scenes sent by the cloud, wherein the plurality of scenes are uploaded to the cloud by the terminal device;
[0111] The local storage module is used to store the multiple scenes locally.
[0112] The first target scene determination module 520 is configured to determine a first target scene from a plurality of scenes stored locally in the ZigBee gateway based on the first device information.
[0113] Furthermore, the target scene determination module 520 includes: a first scene comparison submodule and a first target scene determination submodule, wherein:
[0114] The first scenario comparison submodule is configured to compare the first device information with the multiple scenarios respectively.
[0115] The target scene determination submodule is configured to determine a scene satisfied by the first device information as the first target scene when the first device information satisfies a single scene condition and the first device information satisfies any scene among the multiple scenes.
[0116] Furthermore, the target scene determination module 520 further includes: a priority acquisition submodule and a second target scene determination submodule, wherein:
[0117] The priority acquisition submodule is configured to, when the first device information satisfies a single scenario condition and the first device information satisfies at least two scenarios among the multiple scenarios, acquire the priorities corresponding to the at least two scenarios.
[0118] The second target scene determination submodule is configured to determine, based on the priorities corresponding to the at least two scenes, a scene with the highest priority from the at least two scenes as the first target scene.
[0119] Furthermore, the first target scene determination module 520 further includes: a third target scene determination submodule, wherein:
[0120] The third target scene determination submodule is configured to, when the first device information satisfies a multi-scene condition and the first device information satisfies at least two scenes among the multiple scenes, determine the at least two scenes satisfied by the first device information as the first target scene.
[0121] Furthermore, the third target scene submodule includes: a first comparison result acquisition unit, a second comparison result acquisition unit and a fourth target scene determination unit, wherein:
[0122] The first comparison result obtaining unit is configured to compare the first device information with the first scenario to obtain a first comparison result.
[0123] A second comparison result obtaining unit is configured to compare the second device information with the second scenario to obtain a second comparison result when the first comparison result indicates that the first device information satisfies the first scenario, wherein the second device information is uploaded by a third target device connected to the first target sub-gateway.
[0124] The fourth target scene determining unit is configured to determine the first scene and the second scene as the first target scene when the second comparison result indicates that the second device information satisfies the second scene.
[0125] The second target device determining module 530 is configured to determine a second target device from the devices connected to each of the at least one sub-gateway based on the first target scenario.
[0126] The target device control module 540 is configured to send first control information to a second target sub-gateway to which the second target device is connected, to instruct the second target sub-gateway to control the second target device based on the first control information.
[0127] Furthermore, the device control apparatus 500 further includes: a second device information receiving module, a fifth target scene determining module, a third target device determining module, and a third target device control module, wherein:
[0128] The second device information receiving module is configured to receive third device information uploaded by the second target sub-gateway, wherein the third device information is uploaded by the second target device when state information changes.
[0129] A fifth target scene determination module is configured to determine a second target scene from a plurality of scenes stored locally in the ZigBee gateway based on the second device information.
[0130] The third target device determining module is configured to determine a fourth target device from the devices connected to each of the at least one sub-gateways based on the second target scenario.
[0131] The third target device control module is configured to send second control information to a third target sub-gateway connected to the fourth target device, so as to instruct the third target sub-gateway to control the fourth target device based on the second control information.
[0132] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and modules can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0133] In several embodiments provided in this application, the coupling between modules may be electrical, mechanical or other forms of coupling.
[0134] In addition, the functional modules in the various embodiments of the present application may be integrated into a processing module, or each module may exist physically separately, or two or more modules may be integrated into a single module. The above-mentioned integrated modules may be implemented in the form of hardware or software functional modules.
[0135] See also Figure 11 , which shows a structural block diagram of an electronic device 100 provided in an embodiment of the present application. The electronic device 100 can be an electronic device capable of running applications, such as a ZigBee gateway, a smart phone, a tablet computer, an e-book, etc. The electronic device 100 in the present application may include one or more of the following components: a processor 110, a memory 120, a touch screen 130, and one or more applications, wherein the one or more applications may be stored in the memory 120 and configured to be executed by one or more processors 110, and the one or more programs are configured to execute the method described in the aforementioned method embodiment.
[0136] The processor 110 may include one or more processing cores. The processor 110 utilizes various interfaces and circuits to connect various components within the electronic device 100. It executes instructions, programs, code sets, or instruction sets stored in the memory 120, and accesses data stored in the memory 120 to perform various functions and process data within the electronic device 100. Optionally, the processor 110 may be implemented using at least one of the following hardware forms: a digital signal processing (DSP), a field-programmable gate array (FPGA), or a programmable logic array (PLA). The processor 110 may integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. The CPU primarily processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing displayed content; and the modem handles wireless communications. It is understood that the modem may not be integrated into the processor 110 and may be implemented separately via a communication chip.
[0137] The memory 120 may include a random access memory (RAM) or a read-only memory (ROM). The memory 120 may be used to store instructions, programs, codes, code sets, or instruction sets. The memory 120 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the following various method embodiments, etc. The data storage area may also store data created by the terminal 100 during use (such as a phone book, audio and video data, chat record data), etc.
[0138] The touch screen 130 is used to display information input by the user, information provided to the user, and various graphical user interfaces of the electronic device 100. These graphical user interfaces can be composed of graphics, text, icons, numbers, videos, and any combination thereof. In one embodiment, the touch screen 130 can be a liquid crystal display (LCD) or an organic light-emitting diode (OLED), which is not limited here.
[0139] See also Figure 12 , which shows a block diagram of a computer-readable storage medium provided in an embodiment of the present application. The computer-readable medium 600 stores program code, which can be called by a processor to execute the method described in the above method embodiment.
[0140] The computer-readable storage medium 600 can be an electronic memory such as a flash memory, an EEPROM (Electrically Erasable Programmable Read-Only Memory), an EPROM, a hard disk, or a ROM. Alternatively, the computer-readable storage medium 600 includes a non-transitory computer-readable storage medium. The computer-readable storage medium 600 has storage space for program code 610 for executing any of the method steps described above. These program codes can be read from or written to one or more computer program products. The program code 610 can be compressed, for example, in a suitable form.
[0141] In summary, the device control method, apparatus, electronic device, and storage medium provided in the embodiments of the present application receive first device information uploaded by a first target sub-gateway in at least one sub-gateway, determine a first target scene from multiple scenes stored locally in the ZigBee gateway based on the first device information, determine a second target device from the devices connected to each of the at least one sub-gateway based on the first target scene, and send first control information to the second target sub-gateway connected to the second target device to instruct the second target sub-gateway to control the second target device based on the first control information, thereby storing multiple scenes locally in the ZigBee gateway to achieve control of the device when an abnormality occurs in the network, and greatly increase the number of controllable devices through the distributed architecture of the parent-child gateway.
[0142] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A device control method, characterized in that: Applied to a ZigBee gateway, the ZigBee gateway is connected to at least one sub-gateway, each of the at least one sub-gateway is connected to a device, the ZigBee gateway locally stores multiple scenes, the multiple scenes include a nested first scene and a nested second scene, the method comprising: receiving first device information uploaded by a first target sub-gateway among the at least one sub-gateway, wherein the first device information is uploaded by a first target device connected to the first target sub-gateway; Comparing the first device information with the first scenario to obtain a first comparison result; When the first comparison result indicates that the first device information satisfies the first scenario, comparing the second device information with the second scenario to obtain a second comparison result, wherein the second device information is uploaded by a third target device connected to the first target sub-gateway; When the second comparison result indicates that the second device information satisfies the second scenario, determining the first scenario and the second scenario as a first target scenario; Based on the first target scenario, determining a second target device from the devices connected to each of the at least one sub-gateway; The first control information is sent to the second target sub-gateway to which the second target device is connected, so as to instruct the second target sub-gateway to control the second target device based on the first control information.
2. The method according to claim 1, characterized in that The ZigBee gateway is connected to a cloud, and the cloud is used to connect to a terminal device. Before receiving the first device information uploaded by the first target sub-gateway in the at least one sub-gateway, the method further includes: Receiving multiple scenes sent by the cloud, wherein the multiple scenes are uploaded to the cloud by the terminal device; The multiple scenes are saved locally.
3. The method according to claim 1 or 2, characterized in that After sending the first control information to the second target sub-gateway connected to the second target device to instruct the second target sub-gateway to control the second target device based on the first control information, the method further includes: receiving third device information uploaded by the second target sub-gateway, wherein the third device information is uploaded by the second target device when state information changes; Determining a second target scene from a plurality of scenes stored locally in the ZigBee gateway based on the third device information; Based on the second target scenario, determining a fourth target device from the devices connected to each of the at least one sub-gateway; Second control information is sent to a third target sub-gateway to which the fourth target device is connected, to instruct the third target sub-gateway to control the fourth target device based on the second control information.
4. A device control device, characterized in that: Applied to a ZigBee gateway, the ZigBee gateway is connected to at least one sub-gateway, each of the at least one sub-gateway is connected to a device, the ZigBee gateway locally stores multiple scenes, the multiple scenes include a nested first scene and a nested second scene, and the apparatus includes: A first device information receiving module is configured to receive first device information uploaded by a first target sub-gateway among the at least one sub-gateway, wherein the first device information is uploaded by a first target device connected to the first target sub-gateway; a target scenario determination module, configured to compare the first device information with the first scenario to obtain a first comparison result; when the first comparison result indicates that the first device information satisfies the first scenario, compare the second device information with the second scenario to obtain a second comparison result, wherein the second device information is uploaded by a third target device connected to the first target sub-gateway; and when the second comparison result indicates that the second device information satisfies the second scenario, determine the first scenario and the second scenario as a first target scenario; A second target device determining module, configured to determine a second target device from devices connected to each of the at least one sub-gateway based on the first target scenario; The target device control module is configured to send first control information to a second target sub-gateway to which the second target device is connected, so as to instruct the second target sub-gateway to control the second target device based on the first control information.
5. An electronic device, characterized in that: The method comprises a memory and a processor, wherein the memory is coupled to the processor and stores instructions. When the instructions are executed by the processor, the processor performs the method according to any one of claims 1 to 3.
6. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program code, which can be called by a processor to execute the method according to any one of claims 1 to 3.
Citation Information
Patent Citations
Networking system of multiple intelligent gateways of Internet of Things, and device control method
CN108366121A
Scene linkage control method and system, gateway equipment and storage medium
CN109936489A
Scene pushing method, apparatus and system, and electronic device and storage medium
CN113412457A