Scene management method, electronic device and computer-readable storage medium
By implementing the scene management method in electronic devices and servers, detecting and avoiding scene loop execution, the problem of waste of computing resources caused by scene loop execution in the prior art is solved, and the user experience is improved.
Patent Information
- Application Number
- CN202311137962.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-01
- Publication Date
- 2025-03-04
- Estimated Expiration
- 2043-09-01
AI Technical Summary
The prior art is difficult to effectively detect and avoid scene cyclical execution in electronic devices, resulting in waste of computing resources.
By implementing the scene management method in electronic devices and servers, scene cyclic execution is detected and avoided. The specific methods include building a scene sequence during scene creation and during execution, determining whether there is a scene that is executed cyclically, and preventing the scene from cycling if necessary.
It effectively avoids scene cyclical execution, saves computing resources of electronic devices and servers, and improves user experience.
Smart Images

Figure CN118445055B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of terminals, and in particular to a scene management method, an electronic device and a computer-readable storage medium. Background Art
[0002] In order to meet the user's needs for using electronic devices in different scenarios, the electronic device can automatically perform one or more actions when certain conditions are met, and the above conditions and corresponding actions can be preset by the user. In this way, when the conditions of the scene are met, the user can quickly use one or more functions of the electronic device without performing cumbersome operations. Summary of the invention
[0003] The present application provides a scene management method, an electronic device, and a computer-readable storage medium. The electronic device can provide one or more scenes, and when the conditions of the scene are triggered, the electronic device can perform the action corresponding to the scene. When creating a scene, and during the scene creation process, the electronic device and the server can also detect whether there is a scene that is executed cyclically to avoid wasting computing resources due to the cyclic execution of the scene.
[0004] In a first aspect, the present application provides a scene management method, which is applied to an electronic device, in which trigger conditions and execution actions of one or more scenes are stored, and the one or more scenes include a first scene and a second scene. The method includes: the electronic device determines that a first trigger condition of a first scene is met, and executes a first execution action of the first scene; the electronic device determines that a second trigger condition of a second scene is met, and executes a second execution action of the second scene, the second trigger condition is caused by the first execution action, and the second execution action is used to cause the first trigger condition; when the first trigger condition is met again, the electronic device does not execute the first execution action.
[0005] In combination with the first aspect, in some embodiments, the first execution action is used to control the first smart home, and the electronic device does not execute the first execution action, specifically including: the electronic device does not send an instruction for executing the first execution action to the first smart home.
[0006] There may be one or more scenes between the first scene and the second scene. The second trigger condition is caused by the first execution action, which means that the first execution action triggers one or more scenes to be executed successively, thereby causing the second trigger condition to be satisfied. Fig.6ITaking scene D, scene E and scene F in the illustrated embodiment as an example, scene E can be referred to as the first scene, scene D as the second scene, the first trigger condition refers to "turn on the air conditioner", the first execution action is "turn on the TV", the second trigger condition is "turn on the desk lamp", and the second execution action can be "turn on the air conditioner". The first execution action can cause scene F to be triggered, and then the electronic device can execute the execution action of scene F "turn on the desk lamp", and the desk lamp is turned on to cause scene D to be triggered, that is, the second trigger condition is met. Similarly, the second execution action "turn on the air conditioner" can also trigger the first trigger condition. The electronic device can judge this situation. When the first trigger condition is met again, the electronic device may not execute the first execution action, that is, when the electronic device receives the message that the air conditioner is turned on again, the electronic device may not send an instruction to turn on the TV. In this way, it is possible to avoid the waste of computing resources of electronic devices caused by scene cycle resources.
[0007] In combination with the first aspect, in some embodiments, before the electronic device determines that the first trigger condition is satisfied again, the method also includes: the electronic device determines that execution actions of k scenes are executed in a first time period, and k exceeds a first threshold, and k is a positive integer; the electronic device constructs a first scene sequence based on the m scenes executed in a second time period before the first trigger condition is satisfied again, the first scene sequence includes multiple scenes associated in sequence, the trigger condition of the previous scene in the first scene sequence is the execution action of the next scene, or the execution action of the previous scene in the first scene sequence is the trigger condition of the next scene, and the electronic device determines that the same scene exists in the first scene sequence.
[0008] by Fig. 8A For example, the first time period may be Fig. 8A The preset time length shown, k scenes can be scenes E2 to E3, and when the electronic device determines that k exceeds the first threshold, it can detect whether a cyclically executed scene occurs. When the electronic device can construct a first scene sequence based on m scenes in the second time period, for example, it can be Fig. 8A From scene F1 to scene F2, or from scene F2 to scene F3, the electronic device can store a directed graph consisting of scene execution records in a list, and the first scene sequence can be a list used to represent the directed graph.
[0009] In combination with the first aspect, in some embodiments, the first scene sequence is selected by the electronic device from execution records of one or more scenes, and the execution records of one or more scenes are used to indicate the time sequence of execution of the one or more scenes.
[0010] The electronic device can select multiple scenes from the execution records of one or more scenes, and then construct a first scene sequence. The first scene sequence can be used to represent a directed graph, and the first scene sequence can store the sequential relationship of the execution of multiple scenes. Among them, the trigger condition of the previous scene can be the execution action of the next scene, that is, the trigger condition of the scene corresponding to the parent node in the directed graph can be the execution action of the scene corresponding to the child node, or the execution action of the previous scene is the trigger condition of the next scene, that is, the execution action of the scene corresponding to the parent node in the directed graph can be the trigger condition of the scene corresponding to the child node. The electronic device can determine whether there are multiple graph nodes corresponding to the same scene in the directed graph, and then determine whether there is a scene of cyclic execution.
[0011] In combination with the first aspect, in some embodiments, the first scene sequence includes a scene between two adjacent first scenes executed by the electronic device.
[0012] refer to Fig. 8A In the embodiment shown, the first scene here may be scene F3, and the electronic device may select scenes between two adjacent first scenes (for example, scene F1 to scene F2 or scene F2 to F3) to construct a first scene sequence, that is, the electronic device constructs scene F1 to scene F2 (or scene F2 to F3) into a directed graph.
[0013] In combination with the first aspect, in some embodiments, the first scene sequence includes scenes that cause the first trigger condition within the second time period.
[0014] The scenario causing the first trigger condition may be multiple scenarios executed in sequence. Fig. 10B In the embodiment shown, the second time period may be Fig. 10B In the preset time period shown, the first scene may be scene D3, and the electronic device may obtain multiple scenes causing the first trigger condition from the preset time period, including scene F3, scene D2, and scene F2. That is to say, the electronic device does not need to select all scenes for loop detection, but only needs to select some scenes for loop detection, so that it can save the amount of calculation while detecting whether a loop execution scene occurs.
[0015] In combination with the first aspect, in some embodiments, one or more scenes include a third scene, the third scene includes a third trigger condition and a third execution action, and the method also includes: the electronic device receives an operation by a user to create a fourth scene, and the fourth scene includes a fourth trigger condition and a fourth execution action; the electronic device determines that the third execution action will cause the fourth trigger condition, and the fourth execution action will cause the third trigger condition; the electronic device displays a first prompt message, and the first prompt message is used to prompt the user that the fourth scene cannot be created.
[0016] by Figure 4MFor example, the third trigger condition of the third scene is: click the scene card of scene C, and the third execution action is: execute scene B. The electronic device can receive the user's operation of creating a fourth scene, where the user's operation of creating the fourth scene can be Figure 4R The user creates scene A and clicks the save button 482. Here, the fourth trigger condition is clicking the scene card of scene A. The fourth execution action of scene A can be to execute scene C. The electronic device can determine that the third execution action is to trigger the execution of the execution action of scene B, and the execution of the execution action of scene B will cause the execution of scene A, that is, the third execution action will trigger the fourth trigger condition. Similarly, the fourth execution action will also trigger the third trigger condition, so that the electronic device can display the first prompt information. The first prompt information can be Figure 4S The prompt information in the prompt dialog box 485 shown. In this way, the electronic device can prompt the user that the fourth scene cannot be created, so as to avoid the user scene from being executed in a loop.
[0017] That is to say, the electronic device can detect whether there is a scene that is executed in a loop during the scene creation phase, so as to avoid the scene loop execution affecting the user experience during the subsequent scene execution process.
[0018] In combination with the first aspect, in some embodiments, the triggering conditions of one or more scenes include one or more of the following: controlling a smart home, a time schedule, a system function of the electronic device, and manually clicking on a scene card.
[0019] In combination with the first aspect, in some embodiments, the execution action of one or more scenes includes one or more of the following: controlling the system functions of a smart home or electronic device, and controlling one or more scenes.
[0020] In a second aspect, the present application provides a communication system, which includes an electronic device and a server, wherein the server stores trigger conditions and execution actions of one or more scenarios, and the one or more scenarios include a first scene and a second scene, wherein the server is used to determine whether a first trigger condition of the first scene is met, and instruct the electronic device to execute the first execution action of the first scene; the server is also used to determine whether a second trigger condition of the second scene is met, and instruct the electronic device to execute a second execution action of the second scene, the second trigger condition is caused by the first execution action, and the second execution action is used to cause the first trigger condition; when the first trigger condition is met again, the server does not instruct the electronic device to execute the first execution action.
[0021] In combination with the second aspect, in some embodiments, before the server determines that the first trigger condition is satisfied again, the server is also used to determine that execution actions of k scenes are executed in the first time period, and k exceeds a first threshold value, and k is a positive integer; the server is also used to construct a first scene sequence based on m scenes executed in the second time period before the first trigger condition is satisfied again, and the first scene sequence includes multiple scenes associated in sequence, and the trigger condition of the previous scene in the first scene sequence is the execution action of the next scene, or the execution action of the previous scene in the first scene sequence is the trigger condition of the next scene; the server is also used to determine whether the same scene exists in the first scene sequence.
[0022] In combination with the second aspect, in some embodiments, the first scene sequence includes the server instructing the electronic device to execute a scene between two adjacent first scenes.
[0023] In conjunction with the second aspect, in some embodiments, the first scene sequence includes scenes that cause the first trigger condition within a third time period.
[0024] In combination with the second aspect, in some embodiments, one or more scenarios include a third scene, the third scene includes a third trigger condition and a third execution action, the electronic device is also used to receive an operation by the user to create a fourth scene, and the fourth scene includes a fourth trigger condition and a fourth execution action; the server is also used to receive the fourth trigger condition and the fourth execution action of the fourth scene sent by the electronic device; the server is also used to determine that the third execution action will cause the fourth trigger condition, and the fourth execution action will cause the third trigger condition; the server is also used to send a first detection result to the electronic device, the first detection result indicating that the third scene and the fourth scene are executed in a loop; the electronic device is also used to display a first prompt message based on the first detection result, and the first prompt message is used to prompt the user that the fourth scene cannot be created.
[0025] In combination with the second aspect, in some embodiments, the electronic device includes but is not limited to smart home devices, smart wearable devices, and mobile phones.
[0026] In a third aspect, the present application provides an electronic device, the electronic device comprising: a display screen, a memory, and a processor coupled to the memory. The display screen is used to display an interface, and the memory stores computer executable instructions. When the processor executes the computer executable instructions, the electronic device implements any possible implementation of the first aspect.
[0027] In a fourth aspect, the present application provides a computer-readable storage medium. The computer-readable storage medium includes instructions. When the instructions are executed on an electronic device, the electronic device implements any possible implementation of the first aspect.
[0028] In a fifth aspect, an embodiment of the present application provides a chip. The chip is applied to an electronic device. The chip includes one or more processors. The processor is used to call a computer instruction so that the electronic device executes any possible implementation of the first aspect.
[0029] In a sixth aspect, an embodiment of the present application provides a computer program product comprising instructions, which, when the computer program product is run on a device, enables the electronic device to execute any possible implementation method in the first aspect.
[0030] It can be understood that the solutions provided in the second to sixth aspects are used to implement or cooperate with the method provided corresponding to the first aspect above, and therefore can achieve the same or corresponding beneficial effects as the corresponding method in the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 This is an example diagram of a multiple scene loop execution provided by an embodiment of the present application;
[0032] Figure 2 is an example diagram of a communication system 10 provided in an embodiment of the present application;
[0033] Figure 3 is a structural example diagram of an electronic device provided in an embodiment of the present application;
[0034] Figure 4A-4S It is a schematic diagram of user interaction in which a server according to an embodiment of the present application detects whether there is a loop execution when creating a scene;
[0035] Figure 5A It is an example diagram of a timing diagram of a scene that a server detects a cyclic execution in a scene creation phase provided by an embodiment of the present application;
[0036] Figure 5B It is a flow chart of a method for detecting a cycle in a scene creation phase by a server 105 provided in an embodiment of the present application;
[0037] Figure 6A-6M is a schematic diagram of user interaction in which a server detects a scene loop execution during a scene execution process provided by an embodiment of the present application;
[0038] Figure 7 It is an example diagram of a timing diagram of a server detecting a scene cycle in a scene execution phase provided by an embodiment of the present application;
[0039] Fig. 8A This is an example diagram of a method for the server 105 to select a scene for loop detection provided in an embodiment of the present application;
[0040] Figure 8BIt is a flow chart of a method for the server 105 to construct a directed graph based on a scenario execution log provided in an embodiment of the present application;
[0041] Figure 8C It is an example diagram of a server converting a scenario execution record into a graph node provided by an embodiment of the present application;
[0042] Fig.8D is an example diagram of an in-degree table and an out-degree table provided in an embodiment of the present application;
[0043] Fig. 8E is an example diagram of a directed graph constructed by a server provided in an embodiment of the present application;
[0044] Fig. 9 It is a flow chart of a method for determining whether there is a scenario of cyclic execution based on a directed graph provided by an embodiment of the present application;
[0045] Fig. 10A It is a flowchart of another method for a server to construct a directed graph during a scenario execution process provided by an embodiment of the present application;
[0046] Fig. 10B This is another flowchart of a server constructing a directed graph during a scenario execution process provided by an embodiment of the present application. DETAILED DESCRIPTION
[0047] The terms used in the following embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to be used as limitations to the present application. As used in the specification and appended claims of the present application, the singular expressions "one", "a kind of", "said", "above", "the" and "this" are intended to also include plural expressions, unless there is a clear indication to the contrary in the context. It should also be understood that the term "and / or" used in the present application refers to and includes any or all possible combinations of one or more listed items.
[0048] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as suggesting or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features, and in the description of the embodiments of the present application, unless otherwise specified, "plurality" means two or more.
[0049] Users usually have different usage requirements for different electronic devices in different scenarios. The server can receive the scenario data of one or more scenarios set by the user, where the scenario data of each scenario can include one or more trigger conditions of the scenario and one or more actions performed by the electronic device. When the trigger conditions of the scenario are met, the server can instruct the electronic device to perform one or more actions corresponding to the scenario. The actions performed in some scenarios may meet the trigger conditions of other scenarios, thereby triggering the execution of actions in other scenarios.
[0050] When users set up scenes, multiple scenes may be executed in a loop. Figure 1 This is an example diagram of a multiple scene loop execution provided by an embodiment of the present application.
[0051] like Figure 1 As shown, Figure 1 Three scenarios are shown: scenario 1, scenario 2, and scenario 3. The triggering condition for scenario 1 is: electronic device A opens application A, and the execution action of scenario 1 is: execute scenario 2. The triggering condition for scenario 2 is: electronic device A receives the operation of the user clicking on the scene card of scenario 2, and the execution action of scenario 2 is: execute scenario 3. The triggering condition for scenario 3 is: electronic device A receives the operation of the user clicking on the scene card of scenario 3, and the execution action of scenario 3 is: execute scenario 1. For the introduction of the scene cards, please refer to the subsequent embodiments, which will not be expanded here.
[0052] When electronic device A opens application A, the server can determine that the trigger condition of scene 1 is met, and then the server searches for the execution action of scene 1. The execution action of scene 1 is to execute scene 2, and the server can continue to search for the execution action of scene 2. At this time, the trigger condition of scene 2 is deemed to be met. The execution action of scene 2 is to execute scene 3, and the server can execute the execution action of scene 3. The server finds that the execution action of scene 3 is to execute scene 1, and the server will execute scene 1. After the server executes scene 1, it will then execute scene 2. In this way, the server will execute scenes 1, 2, and 3 in a loop, wasting the resources of the electronic device and the server.
[0053] In order to solve this problem, the embodiment of the present application provides a scene management method, which can detect whether there is a scene that is executed cyclically when the scene is created and during the scene execution process. In this way, the server can avoid the situation where the scene is executed cyclically.
[0054] The following first introduces the communication system provided by the embodiment of the present application.
[0055] Figure 2 A communication system 10 provided in an embodiment of the present application is shown.
[0056] like Figure 2 As shown, the communication system 10 includes a plurality of electronic devices, which may include Figure 2 The mobile phone 101, the television (also known as a smart screen, a large screen, etc.) 102, the air conditioner 103, the desk lamp 104 and the server 105 shown in FIG. Figure 2 The above-mentioned devices shown, the communication system 10 may also include other types of electronic devices, such as personal computers (PC), desktop computers, laptop computers, handheld computers, augmented reality (AR) devices, virtual reality (VR) devices, artificial intelligence (AI) devices, car machines, game consoles, treadmills, cloud hosts / cloud servers, other smart wearable devices, etc., and may also include Internet of Things (IOT) devices or other smart home devices such as water heaters, weight scales, etc. This application does not impose any restrictions on the type of devices. The above-mentioned smart wearable devices and smart home devices may also be referred to as smart devices.
[0057] Each electronic device in the communication system 10 can be connected to the server 105 via a wired connection and / or a wireless connection, wherein the wired connection may be, for example, a universal serial bus (USB) connection, a high definition multimedia interface (HDMI) connection, a display port (DP) connection, etc. The wireless connection may be, for example, a Bluetooth (BT) connection, a wireless fidelity (Wi-Fi) connection, a hotspot connection, a near field communication (NFC), ZigBee, etc., and the embodiment of the present application does not limit the way in which the electronic device is connected to the server 105.
[0058] Each electronic device in the communication system 10 may be equipped with system, system, The operating systems of the terminal devices in the communication system 10 may be the same or different, and this application does not impose any restrictions on this.
[0059] In some embodiments, in the communication system 10, the mobile phone 101 can receive the user's operation on one or more scene settings, and send the scene data of the scene set by the user to the server 105. The scene data may include, but is not limited to: scene identification, trigger conditions of the scene, and execution actions of the scene. After the server 105 obtains the scene data created by the user, it can determine whether there is a cyclic scene. When one or more scenes created by the user contain a cyclically executed scene, the server 105 can prompt the user through the mobile phone 101.
[0060] In some embodiments, the server 105 may obtain a scenario execution log during the execution of the scenario, which may include data such as the execution time of the scenario, the triggering condition of the scenario, and the execution action of the scenario. The server 105 may then determine whether there is a cyclically executed scenario based on the scenario execution log.
[0061] It should be noted that Figure 2 The communication system 10 shown is only used to assist in describing the technical solutions provided by the embodiments of the present application, and does not limit other embodiments of the present application. In actual business scenarios, the communication system 10 may include more or fewer electronic devices, and the present application does not impose any restrictions on the types of electronic devices, the number of electronic devices, the connection methods, etc. in the communication system 10.
[0062] The electronic device provided by the embodiments of the present application is introduced below.
[0063] Figure 3 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0064] The electronic device may be Figure 2 The mobile phone 101, television 102, air conditioner 103, desk lamp 104, etc. are shown. It should be understood that the electronic device may have more than Figure 3 More or fewer components may be shown, two or more components may be combined, or there may be a different configuration of components. Figure 3 The various components shown in the EMBODIMENTS 2000 may be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and / or application specific integrated circuits.
[0065] The electronic device may include: a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, an acceleration sensor 180D, a distance sensor 180E, a proximity light sensor 180F, a fingerprint sensor 180G, a temperature sensor 180H, a touch sensor 180I, an ambient light sensor 180J, etc.
[0066] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0067] The controller can be the nerve center and command center of the electronic device. The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of fetching and executing instructions.
[0068] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0069] The charging management module 140 is used to receive charging input from a charger, where the charger can be a wireless charger or a wired charger.
[0070] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140 to power the processor 110, the internal memory 121, the external memory, the display screen 194, the camera 193, and the wireless communication module 160.
[0071] The wireless communication function of the electronic device can be implemented through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor.
[0072] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the electronic device can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of the antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0073] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to electronic devices. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1.
[0074] The modem processor may include a modulator and a demodulator. The modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 170A, a receiver 170B, etc.), or displays an image or video through a display screen 194.
[0075] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to electronic devices. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
[0076] In some embodiments, the antenna 1 of the electronic device is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology. The GNSS may include global positioning system (GPS), global navigation satellite system (GLONASS), Beidou navigation satellite system (BDS), quasi-zenith satellite system (QZSS) and / or satellite based augmentation system (SBAS).
[0077] The electronic device implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
[0078] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light emitting diode or an active-matrix organic light emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device may include 1 or N display screens 194, where N is a positive integer greater than 1.
[0079] ISP is used to process the data fed back by camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to ISP for processing and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on the noise, brightness, and color of the image. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, ISP can be set in camera 193.
[0080] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element converts the optical signal into an electrical signal, which is then transmitted to the ISP for conversion into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device may include 1 or N cameras 193, where N is a positive integer greater than 1.
[0081] Digital signal processors are used to process digital signals. In addition to processing digital image signals, they can also process other digital signals. For example, when an electronic device selects a frequency point, a digital signal processor is used to perform Fourier transform on the frequency point energy.
[0082] Video codecs are used to compress or decompress digital videos. Electronic devices can support one or more video codecs. In this way, electronic devices can play or record videos in multiple encoding formats.
[0083] NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and continuously self-learn. NPU can realize applications such as intelligent cognition of electronic devices, such as image recognition, face recognition, voice recognition, text understanding, etc.
[0084] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function.
[0085] The internal memory 121 can be used to store computer executable program codes, which include instructions. The processor 110 executes various functional applications and data processing of the electronic device by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a face recognition function, a fingerprint recognition function, a mobile payment function, etc.), etc. The data storage area may store data created during the use of the electronic device (such as face information template data, fingerprint information template, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.
[0086] The electronic device can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.
[0087] The audio module 170 is used to convert digital audio information into analog audio signal output, and also used to convert analog audio input into digital audio signal. The audio module 170 can also be used to encode and decode audio signals.
[0088] The speaker 170A, also called a "speaker", is used to convert an audio electrical signal into a sound signal. The electronic device can listen to music or listen to a hands-free call through the speaker 170A.
[0089] The receiver 170B, also called a "earpiece", is used to convert audio electrical signals into sound signals. When the electronic device receives a call or voice message, the voice can be received by placing the receiver 170B close to the human ear.
[0090] Microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals. The user can make a sound by putting his mouth close to microphone 170C to input the sound signal into microphone 170C. The electronic device can be provided with at least one microphone 170C. In other embodiments, the electronic device can be provided with two microphones 170C, which can not only collect sound signals but also realize noise reduction function. In other embodiments, the electronic device can also be provided with three, four or more microphones 170C to realize the collection of sound signals, noise reduction, identification of sound sources, realization of directional recording function, etc.
[0091] The earphone interface 170D is used to connect a wired earphone and can be a USB interface 130 or a 3.5 mm open mobile terminal platform (OMTP) standard interface or a cellular telecommunications industry association of the USA (CTIA) standard interface.
[0092] The pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A can be set on the display screen 194. When a touch operation is applied to the display screen 194, the electronic device detects the touch operation intensity according to the pressure sensor 180A. The electronic device can also calculate the touch position according to the detection signal of the pressure sensor 180A. In some embodiments, touch operations acting on the same touch position of the pressure sensor 180A but with different touch operation intensities can correspond to different operation instructions.
[0093] The gyro sensor 180B can be used to determine the motion posture of the electronic device. In some embodiments, the angular velocity of the electronic device around three axes (i.e., x, y, and z axes) can be determined by the gyro sensor 180B. The gyro sensor 180B can be used for anti-shake shooting. The gyro sensor 180B can also be used for navigation and somatosensory game scenes.
[0094] The air pressure sensor 180C is used to measure air pressure. In some embodiments, the electronic device calculates the altitude through the air pressure value measured by the air pressure sensor 180C to assist positioning and navigation.
[0095] The acceleration sensor 180D can detect the magnitude of the acceleration of the electronic device in all directions (generally three axes). When the electronic device is stationary, it can detect the magnitude and direction of gravity. It can also be used to identify the posture of the electronic device and is applied to applications such as horizontal and vertical screen switching and pedometers.
[0096] The distance sensor 180E is used to measure the distance. The electronic device can measure the distance by infrared or laser. In some embodiments, when shooting a scene, the electronic device can use the distance sensor 180E to measure the distance to achieve fast focusing.
[0097] The proximity light sensor 180F may include, for example, a light emitting diode (LED) and a light detector, such as a photodiode. The light emitting diode may be an infrared light emitting diode. The electronic device emits infrared light outward through the light emitting diode. The electronic device uses the photodiode to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device. When insufficient reflected light is detected, the electronic device can determine that there is no object near the electronic device.
[0098] The ambient light sensor 180J is used to sense the brightness of the ambient light. The electronic device can adaptively adjust the brightness of the display screen 194 according to the perceived brightness of the ambient light. The ambient light sensor 180J can also be used to automatically adjust the white balance when taking pictures.
[0099] The fingerprint sensor 180G is used to collect fingerprints. The electronic device can use the collected fingerprint characteristics to achieve fingerprint unlocking, access application locks, fingerprint photography, fingerprint call answering, etc.
[0100] The temperature sensor 180H is used to detect temperature. In some embodiments, the electronic device uses the temperature detected by the temperature sensor 180H to execute a temperature processing strategy. For example, when the temperature reported by the temperature sensor 180H exceeds a threshold, the electronic device reduces the performance of a processor located near the temperature sensor 180H to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is lower than another threshold, the electronic device heats the battery 142 to avoid abnormal shutdown of the electronic device due to low temperature. In other embodiments, when the temperature is lower than another threshold, the electronic device performs a boost on the output voltage of the battery 142 to avoid abnormal shutdown due to low temperature.
[0101] The touch sensor 180I is also called a "touch panel". The touch sensor 180I can be set on the display screen 194, and the touch sensor 180I and the display screen 194 form a touch screen, also called a "touch screen". The touch sensor 180I is used to detect a touch operation acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194.
[0102] The key 190 includes a power key, a volume key, etc. The key 190 can be a mechanical key or a touch key. The electronic device can receive key input and generate key signal input related to user settings and function control of the electronic device.
[0103] Motor 191 can generate vibration prompts. Motor 191 can be used for vibration prompts or for touch vibration feedback.
[0104] The indicator 192 may be an indicator light, which may be used to indicate the charging status, power changes, messages, missed calls, notifications, etc.
[0105] The SIM card interface 195 is used to connect a SIM card. The SIM card can be inserted into or removed from the SIM card interface 195 to achieve contact and separation with the electronic device. The electronic device can interact with the network through the SIM card to achieve functions such as calls and data communications.
[0106] In the embodiment of the present application, the mobile phone 101 can provide the user with an entry for setting scenes through the smart space application. It is not limited to the smart space application, but can also be other applications, which are not limited in the embodiment of the present application.
[0107] In order to facilitate the description of the scene management method provided in the embodiment of the present application, several triggering conditions and execution actions of the scene are briefly introduced here.
[0108] The trigger conditions of the scene can mainly include the following categories:
[0109] 1. Manually click on the scene card
[0110] When the mobile phone 101 receives and responds to the user's operation of creating a scene and then creates a new scene, the mobile phone 101 can display the scene card of the scene. When the trigger condition of the scene is manually clicking on the scene card, the mobile phone 101 receives the user clicking on the scene card of the scene, which is considered to meet the trigger condition of the scene.
[0111] 2. Schedule
[0112] Here, the time schedule can be the time of the server 105 or the time of the mobile phone 101. For example, the trigger condition of the scene can be "5:00 am every day", so that the scene can be triggered when the time of the server 105 or the mobile phone 101 reaches 5:00 every day. When the trigger condition of the scene is the time schedule, the scene can be called an automatically executed scene, that is, the scene does not need to receive the user's operation to be triggered.
[0113] 3. Status or action of smart devices
[0114] Among them, the smart device may include a smart wearable device and a smart home device. The state or action of the smart device may be, for example, "turn on the desk lamp".
[0115] 4. System functions provided by the mobile phone
[0116] The system functions provided by the mobile phone may be one or more functions provided by the software system of the mobile phone 101, for example, may include "turn on Bluetooth", "turn on Do Not Disturb", etc.
[0117] The execution actions of the scene can mainly include the following categories:
[0118] 1. Actions of smart devices
[0119] 2. System functions provided by the mobile phone
[0120] 3. Control the scene
[0121] The control scene may include executing another scene, or pausing the execution of another scene, etc. When the execution action of a scene is to execute another scene, the action of the scene may be directly executed without considering the triggering condition of the other scene.
[0122] The trigger conditions and execution actions of the above-mentioned scenarios are only examples and are not intended to limit the embodiments of the present application. In some embodiments, the trigger conditions of the scenario may also include the geographical location of the mobile phone (such as the mobile phone is located at a certain location), and the execution actions of the scenario may also include one or more functions provided by the application, etc.
[0123] In some embodiments, a scene may contain multiple trigger conditions, and the multiple trigger conditions may be in an "and" relationship, that is, the scene will be triggered only when the multiple trigger conditions are met at the same time; the multiple trigger conditions may also be in an "or" relationship, that is, as long as one of the trigger conditions is met, the scene is considered to be triggered. Optionally, the multiple trigger conditions of a scene may contain both an "and" relationship and an "or" relationship.
[0124] In some embodiments, the server 105 can detect whether there is a looping scene when creating a scene. The following describes a method for the server 105 to detect a looping scene when creating a scene.
[0125] Figure 4A-4S It is a schematic diagram of a server provided in an embodiment of the present application detecting whether there is a user interaction (user interface, UI) that is executed in a loop when a scene is created.
[0126] 1. Create a new scene.
[0127] like Figure 4A As shown, the mobile phone 101 can display the home screen interface 400. Figure 4A As shown, the home screen interface may include desktop icons of one or more application programs, which may include a desktop icon 401 of a smart space application. The mobile phone 101 may receive an operation of a user clicking on the desktop icon 401 of the smart space application, and in response to the operation, the mobile phone 101 may display the following Figure 4B The home page interface 410 of the smart space application is shown. The home page interface 410 may include cards of one or more devices and a tab bar 411.
[0128] The cards of one or more devices can be used to preview the information of the smart devices connected to the mobile phone 101 through the server 105, and provide the user with an entry to control one or more smart devices through the mobile phone 101. The cards of one or more devices may include a desk lamp card 412, an air conditioner card 413, and a TV card 414. Among them, the desk lamp card 412 corresponds to the desk lamp 104, the air conditioner card 413 corresponds to the air conditioner 103, and the TV card 414 corresponds to the TV 102. Taking the desk lamp card 412 as an example, the desk lamp card 412 can display the connection status of the desk lamp 104 and the mobile phone 101. Among them, the desk lamp 104 is connected to the mobile phone 101 through the server 105. When the desk lamp 104 is connected to the mobile phone 101, the mobile phone 101 can provide the user with an entry to control the desk lamp 104 through the desk lamp card 412. Figure 4A The table lamp card 412 , the air conditioner card 413 and the TV card 414 all display “connected”, which indicates that the table lamp 104 , the air conditioner 103 and the TV 102 have been connected to the mobile phone 101 through the server 105 .
[0129] The tab bar 411 may include one or more tabs, wherein the tabs may be used to switch the user interface of the smart space application. The tab bar 411 may include a home tab 411A and a scene tab 411B. The home tab 411A is currently selected, and the corresponding smart space application is displayed as follows: Figure 4A Home page interface 410 is shown.
[0130] The mobile phone 101 may receive an operation of the user clicking on the scene label 411B, and in response to the operation, the mobile phone 101 may display the following Figure 4C The scene setting interface 420 shown in FIG. The scene setting interface 420 can provide a user with an entry for managing one or more scenes through the mobile phone 101. Figure 4C As shown, the scene setting interface 420 may include: an add button 421 and one or more scene cards.
[0131] Add button 421 may be used to create a new scene.
[0132] A scene card may correspond to a scene, and the scene card may display the scene name, the triggering conditions of the scene, and the execution actions of the scene for easy viewing by users. Figure 4CThe scene cards in the example may include: scene card 422 of scene A and scene card 423 of scene B. Taking scene card 422 of scene A as an example, the scene card of scene A may display the scene name ("scene A"), the trigger condition of scene A: click the scene card, and the execution action of scene A: turn on the air conditioner. That is, when the mobile phone 101 receives the user clicking the scene card 422 of scene A, scene A is triggered, and then the server 105 may instruct the air conditioner 103 to start.
[0133] The mobile phone 101 may receive an operation of the user clicking the add button 421, and in response to the operation, the mobile phone 101 may display the following Figure 4D The scene creation interface 430 is shown. The scene creation interface 430 is used to create a new scene. The scene creation interface 430 may include: a scene name edit box 431, a condition button 432, an action button 433, and a save button 434.
[0134] The scene name edit box 431 is used to edit and display the scene name. The condition button 432 is used to add a trigger condition for the scene. The action button 433 is used to add an execution action for the scene. The save button 434 is used to save the scene data and send the scene data to the server 105.
[0135] The mobile phone 101 may receive an operation of the user clicking the scene name edit box 431. In response to the operation, the mobile phone 101 may display the scene creation interface 430 as shown in FIG. Figure 4E The soft keyboard 435 shown. The soft keyboard 435 can receive the operation of the user inputting the scene name, and then the scene name edit box 431 can display the scene name input by the user. The soft keyboard 435 can include a hide button 435A, and the hide button is used to hide the soft keyboard 435.
[0136] like Figure 4E As shown, the scene name edit box 431 displays "Scene C", and "Scene C" can be obtained after the mobile phone 101 receives the user's operation on the soft keyboard 435. "Scene C" is the scene name of the new scene to be created. The mobile phone 101 can receive the user's operation of clicking the hidden button 435A in the soft keyboard 435. In response to this operation, the mobile phone 101 can hide the soft keyboard 435.
[0137] 2. Add trigger conditions to the scene.
[0138] like Figure 4F As shown, the mobile phone 101 receives the operation of the user clicking the condition button 432, and in response to the operation, the mobile phone 101 can display the following Figure 4G The condition adding interface 440 is shown, and the condition adding interface 440 is used to add trigger conditions for the scene to be created.
[0139] The condition adding interface 440 may include buttons corresponding to one or more trigger condition type options, and the buttons corresponding to one or more trigger condition type options may include a manual click button 441 , a time travel button 442 , a smart device button 443 and a system function 444 .
[0140] Among them, the manual click button 441 can be used to add a trigger condition of manually clicking a scene card to the scene to be created. The time schedule button 542 is used to add a trigger event of the time schedule type to the scene to be created. The smart device button 443 is used to create a trigger condition caused by the state or action of the smart device (for example, turning on the desk lamp). The system function button 544 is used to create a trigger condition caused by the system function of the mobile phone 101 (for example, turning on Bluetooth).
[0141] like Figure 4G As shown, the mobile phone 101 receives the operation of the user clicking the manual click button 441. In response to this operation, the mobile phone 101 can add a trigger condition of manually clicking the scene card for the scene to be created. It should be noted that when the scene is created, the scene card of the scene can be displayed in the scene setting interface 420. In this way, when the mobile phone 101 receives the user clicking the scene card of the scene, it can be considered that the scene is triggered. Furthermore, the mobile phone 101 can also display the following Figure 4H The scene creation interface 430 shown, wherein the condition button 432 can display the added trigger condition ("manually click on the scene card"), and the condition button 432 can also modify the trigger condition. The scene creation interface 430 can also display the additional condition button 436, which is used to add a new trigger condition to the scene to be created.
[0142] 3. Add actions to the scene.
[0143] like Figure 4H As shown, the mobile phone 101 can receive the operation of the user clicking the action button 433, and in response to the operation, the mobile phone 101 can display the following Fig. 4I The action adding interface 450 is shown. The action adding interface 450 is used to add an execution action to the scene to be created.
[0144] The condition adding interface 440 may include one or more buttons corresponding to the type options of executing the action, and the one or more buttons corresponding to the type options of executing the action may include: a smart device button 451 , a system function button 452 , and a control scene button 453 .
[0145] Among them, the smart device button 451 can be used to create an execution action of the smart device action type; the system function button 452 can be used to create an execution action of the mobile phone 101 system function type; the control scene button 453 can be used to create an execution action for controlling the execution progress of another scene, for example, it may include executing another scene, stopping the execution of another scene (execution action), etc.
[0146] like Fig. 4I As shown, the mobile phone 101 can receive the operation of the user clicking the control scene button 453, and in response to the operation, the mobile phone 101 can display Figure 4J The control scene setting interface 460 shown. The control scene setting interface 460 may include buttons corresponding to one or more options for controlling the execution progress of another scene, which may include an execute scene button 461. The execute scene button is used to execute the execution action of another scene. In some embodiments, the control scene button 453 can only be selected when the trigger condition of the scene includes "manually clicking on the scene card", that is, only when the trigger condition of the scene includes "manually clicking on the scene card" can the scene control the execution of another scene.
[0147] The mobile phone 101 may receive an operation of the user clicking the execution scene button 461, and in response to the operation, the mobile phone 101 may display a Figure 4K The scene selection interface 470 is shown. The scene selection interface 470 is used to select the scene option to be executed in the execution action of the scene to be added. The scene selection interface 470 may include a button 471 corresponding to the scene A option and a button 472 corresponding to the scene B option. When the scene option is selected, the execution action of the selected scene can be executed after the scene to be added is triggered.
[0148] After mobile phone 101 receives the user's click on button 472 corresponding to option Scene B, in response to the operation, mobile phone 101 can generate data for the scene, including the scene name of the scene (Scene C), the triggering conditions of the scene (clicking the scene card), and the execution action of the scene (executing Scene B). Mobile phone 101 can send the scene data to server 105, and server 105 can determine whether there is a scene that is executed in a loop based on the scenes that have been created (for example, including Scene A and Scene B) and the scene data of Scene C. After server 105 determines that there is no scene that is executed in a loop, it can store the scene data of Scene C and send the result of the judgment back to mobile phone 101. After mobile phone 101 determines that Scene C is successfully created, it can display the following: Figure 4L The scene setting interface 420 shown. Figure 4L As shown, a scene card 424 of scene C will be added to the scene setting interface 420. The mobile phone 101 can receive the user's upward sliding operation, and respond to the operation, such as Figure 4MAs shown, the mobile phone 101 can fully display the scene card 424 of the partially hidden scene C. The scene card 424 of scene C can display the scene name of scene C (click on the scene card) and the execution action of the scene (execute scene B).
[0149] 4. Execute the newly added scene C.
[0150] like Figure 4M As shown, the mobile phone 101 can receive an operation of the user clicking on the scene card 424 of scene C. In response to the operation, the trigger condition of scene C is met, and the mobile phone 101 can execute the execution action of scene C (execute scene B). Figure 4N As shown, after the execution of scene C is completed, the scene card 424 of scene C may display an "executed" mark. Mobile phone 101 can continue to execute the execution action of scene B, and the scene card 423 of scene B may display an "executing" mark. Mobile phone 101 can execute the execution action of scene B (execute scene A). Fig.4O As shown, after scene B is executed, the scene card 423 of scene B will display an "executed" mark, and the scene card 422 of scene A will display an "executing" mark, and the server 105 can instruct the air conditioner 103 to start. During the scene execution process, the mobile phone 101 can also send a record of the scene execution to the server 105, which may include the scene identifier, the start time of the scene execution, the end time of the scene execution, etc.
[0151] That is to say, when scene C is triggered, the execution order of scene A, scene B, and scene C is: scene C, scene B, scene A.
[0152] 5. Edit the execution action of scene A.
[0153] like Figure 4P As shown, the scene card 422 of scene A may include an expansion button 422A, and the expansion button 422A is used to edit the triggering condition and execution action of scene A. The mobile phone 101 may receive an operation of the user clicking the expansion button 422A, and in response to the operation, the mobile phone 101 may display the following Figure 4Q The scene editing interface 480 shown is used to view and edit the triggering conditions and execution actions of scene A. The scene editing interface 480 may include an add action button 481, a save button 482, and an action button 483. The add action button 481 is used to add a new execution action for scene A. The save button 482 is used to save the scene data such as the triggering conditions and execution actions of scene A displayed in the scene editing interface 480. The action button 483 can be used to edit and display an execution action (turn on the air conditioner) when scene A is triggered.
[0154] The mobile phone 101 may receive an operation of the user clicking the add action button 481 , and then the mobile phone 101 may receive and respond to the user operation to add a new execution task to the scene A.
[0155] like Figure 4R As shown, a newly added action button 484 for executing an action may be displayed below the action button 483 in the scene editing interface 480. The action button 484 may be used to display and edit the newly added execution action (execution scene C) of scene A. The method for mobile phone 101 to receive user operation to add an execution action to scene A may refer to Figure 4H to Figure 4K The embodiments shown will not be described in detail here.
[0156] Thus, when scene A is triggered, two actions are executed: turning on the air conditioner and executing scene C. Mobile phone 101 can receive the operation of the user clicking the save button 482. In response to the operation, mobile phone 101 can send the scene data of the changed scene A to server 105, and server 105 will determine whether there is a scene that is executed in a loop. Since scene A, scene B, and scene C form a scene that is executed in a loop, server 105 will send a message to mobile phone 101 that the scene is in a loop, and mobile phone 101 can then display the following information: Figure 4S The prompt dialog box 485 shown may display the text “The scene is looping”, which is used to prompt the user that a looping scene exists.
[0157] Here Figure 4A-Figure 4R The scenes A, B and C shown are used as examples to introduce a method for the server to detect the scenes to be executed cyclically during the scene creation phase.
[0158] Figure 5A 1 is an example diagram of a timing diagram of a scene detected by a server during a scene creation phase in an embodiment of the present application. Figure 5A As shown in the figure, the timing diagram includes the following steps:
[0159] S501. Mobile phone 101 receives an operation from a user to save scene data of scene C, wherein no cyclically executed scene exists when scene C is triggered.
[0160] The mobile phone 101 may receive an operation of the user to save the scene data of scene C, and the scene data of scene C may include the scene name of scene C (scene C), the triggering condition of scene C, and the execution action of scene C. When scene C is triggered, there may be no cyclically executed scene.
[0161] refer to Figure 4C-Figure 4KIn the embodiment shown, the triggering condition of scene C is manually clicking the scene card of scene C, and the execution action of scene C is executing scene B. The triggering condition of scene A stored in server 105 is: clicking the scene card, and the execution action of scene B is: turning on the air conditioner. The triggering condition of scene B is: clicking the scene card, and the execution action of scene B is: executing scene A. At this time, when scene C is triggered, there will be no situation where the scene is executed cyclically.
[0162] S502 . The mobile phone 101 sends the scene data of the scene C to be stored to the server 105 .
[0163] S503. The server 105 determines that there is no scene that is executed in a loop based on the scene data of scene C, and stores the scene data of scene C.
[0164] S504 , the server 105 returns a determination result A to the mobile phone 101 , where the determination result A indicates that there is no loop execution scenario.
[0165] S505. The mobile phone 101 sends a prompt message A based on the judgment result A, and the prompt message A indicates that the scene C is stored successfully.
[0166] After the mobile phone 101 generates the scene data of the scene C, the scene data of the scene C can be sent to the server 105. The server 105 can store the scene data of one or more scenes that have been successfully created. Figure 4C Taking the embodiment shown as an example, the server 105 may store scene data of scene A and scene data of scene B. The execution action of scene A is "turn on the air conditioner", and the execution action of scene B is "execute scene A".
[0167] After receiving the data of scene C, the server 105 can determine that there is no scene that is executed in a loop based on the scene data of the successfully created scenes and the scene data of scene C. Since scenes A, B, and C will not be executed in a loop during execution, the server 105 can store the scene data of scene C and return the judgment result A to the mobile phone 101.
[0168] After receiving the judgment result A sent by the server 105, the mobile phone 101 can send a prompt message A based on the judgment result A. Figure 4L , Figure 4M Taking the illustrated embodiment as an example, the prompt information A may be a scene card 424 displaying scene C in the scene setting interface 420 .
[0169] The server 105 may construct a directed graph based on the scenario data, and then determine whether there is a scenario of cyclic execution.
[0170] Optionally, the server 105 may determine whether there is a loop execution scenario by using a coloring method. For an introduction to the coloring method, please refer to the introduction to subsequent embodiments, which will not be expanded here.
[0171] S506. The mobile phone 101 receives an operation from the user to save scene data of scene A, wherein there is a scene that is executed cyclically when scene A is triggered.
[0172] S507 . The mobile phone 101 sends the scene data of the scene A to be stored to the server 105 .
[0173] The mobile phone 101 may receive an operation by a user to set a trigger condition and / or an execution action for scene A, and then save the scene data of scene A. Figure 4P-Figure 4Q In the embodiment shown, the operation of the user saving the scene data of scene A may be an operation of the user adding an execution action of scene A received by the mobile phone 101. The operation of the user saving the scene data of scene A received by the mobile phone 101 may be as follows: Figure 4R The user is shown clicking the save button 482 .
[0174] In response to a user's operation of saving the scene data of scene A, the mobile phone 101 may send the scene data of scene A to the server 105 .
[0175] S508. The server 105 determines, based on the scene data of scene A, that there is a scene that is executed in a loop.
[0176] S509 , the server 105 returns a determination result B to the mobile phone 101 , where the determination result B indicates that there is a scenario that is executed in a loop if the scenario A is created.
[0177] S510. The mobile phone 101 displays prompt information B based on the judgment result B.
[0178] The server 105 may receive the scene data of scene A sent by the mobile phone 101, and then determine whether there is a loop based on the scene data of scene A and the stored scene data of scene B and scene C. Figure 4R Taking the illustrated embodiment as an example, when scene A is triggered, scene C is executed; when scene C is triggered, scene B is executed; and when scene B is triggered, scene A is executed. That is to say, scenes A, C, and B are executed in a loop.
[0179] After determining that there is a looping scenario, the server 105 can return a judgment result B to the mobile phone 101, indicating that if scenario A is created, there is a looping scenario. After receiving the judgment result B, the mobile phone 101 can display a prompt message B based on the judgment result B. The prompt message B can be used to prompt the user that since the creation of scenario A will cause the scenario to be looped, the user needs to modify the execution action of scenario A. For example, the prompt message B can be as follows: Figure 4S The text "Scene exists in loop" in the prompt dialog box 485 is shown.
[0180] In the above embodiment, scene A, scene B, and scene C are only examples, and the server 105 can obtain more or fewer scenes, and each scene can also have different trigger conditions and execution actions. The method for the server 105 to determine whether there is a loop in other scenes of the same type can refer to the method for determining whether there is a loop in scene A, scene B, and scene C, which will not be repeated here.
[0181] Figure 5A The timing diagram shown is only an example and does not constitute a limitation on the timing of the server management scenario in the embodiment of the present application. Figure 5A This application is not limited to the above-mentioned steps, which may be more or less than the steps shown.
[0182] Here, a method is introduced in which the server 105 performs cyclic detection on multiple scenes in the scene creation phase, and this method may also be called a coloring method.
[0183] Figure 5B This is a flow chart of a method for detecting a loop in a scene creation phase by a server 105 provided in an embodiment of the present application. The method may include but is not limited to the following steps:
[0184] S511. Obtain scene data of scenes to be processed, and mark all scenes as C state.
[0185] The server 105 may obtain the scene data of the newly added scene sent by the mobile phone 101. The scene data of the newly added scene may be generated after the mobile phone 101 receives and responds to the user operation. The scene data of the scene may include the triggering condition and execution action of the scene.
[0186] S512: Push the scene to be processed into a stack.
[0187] The server 105 can construct a graph node based on the scene data of the scene to be processed, and push the graph node corresponding to the scene to be processed into a stack. A stack is a first-in, last-out data structure. For example, when the sequence of scene A, scene B, and scene C is pushed into the stack, the sequence of popping out is scene C, scene B, and scene A.
[0188] S513: Determine the status of the scene to be processed.
[0189] The server 105 may determine the state of the scene to be processed, and when the state of the scene to be processed is state A, execute step S522 to determine whether there is a scene to be executed cyclically. When the state of the scene to be processed is state C, execute step S514.
[0190] S514: Mark the scene to be processed as state A.
[0191] The server 105 may mark the scene to be processed as state A, and then execute step S515.
[0192] S515: Determine whether the execution action of the scene to be processed will trigger the execution of another scene that is not in the B state.
[0193] The execution action of the scene to be processed may be one or more. When the server 105 determines that one or more execution actions of the scene to be processed will trigger the execution of another scene that is not in the B state, step S516 may be executed. If the execution action of the scene to be processed does not trigger another scene, or the triggered another scene is not in the B state, the server 105 may execute step S517.
[0194] S516: The executed scene is used as a scene to be processed.
[0195] When the server determines that the execution action of the to-be-processed scene includes executing another scene that is not in state B, the executed scene can be used as the to-be-processed scene. Then, the server 105 can execute step S512.
[0196] S517: Mark the scene to be processed as state B.
[0197] S518: Pop the scene to be processed from the stack.
[0198] S519: Determine whether the stack is empty.
[0199] When the server 105 determines that the stack is empty, step S521 may be executed to determine a scenario without loop execution. When the server 105 determines that the stack is not empty, step S520 may be executed.
[0200] S520: Take the top scene in the stack as the scene to be processed.
[0201] After executing step S520, the server 105 may continue to execute step S515.
[0202] S521: Determine a scenario without loop execution.
[0203] S522: Determine whether there is a loop execution scenario.
[0204] The following takes scene A (trigger condition: click the scene card, execute action: turn on the air conditioner, execute action C), scene B (trigger condition: click the scene card, execute action: execute scene A) and scene C (trigger condition: click the scene card, execute action: execute scene B) as examples to introduce Figure 5B The method shown.
[0205] by Figure 4R Taking the embodiment shown as an example, after receiving the operation of the user clicking the save button 482 in the scene editing interface, the mobile phone 101 can send the scene data of scene A to the server 105. The server 105 can use scene A as a scene to be processed. At the same time, the server 105 also stores the scene data of scene B and scene C.
[0206] The server 105 first takes scene A as a scene to be processed, and identifies all scenes as being in the C state. The server 105 may push the scene to be processed (scene A) into a stack. Since scene A is in the C state, the server 105 may identify the scene to be processed as being in the A state. Then, the server 105 determines that the execution action of scene A includes executing scene C, and scene C is not in the B state, then the server 105 may immediately take scene C as a scene to be processed, and push scene C into the stack. At this time, the stack includes, from the bottom to the top, scene A and scene C.
[0207] Then the server 105 can determine the state of scene C. If scene C is also in state C, the server 105 can mark scene C as state A. Then the server 105 determines that the execution scene of scene C includes execution scene B, and scene B is not in state B. Then the server 105 can take scene B as a scene to be processed and push scene B into the stack. At this time, the stack includes scene A, scene C, and scene B from the bottom to the top.
[0208] The server 105 continues to determine the state of scene B. If scene B is in state C, the server 105 may identify scene B as state A and determine whether the execution action of scene B includes executing another scene that is not in state B. The execution action of scene B includes executing scene A. If scene A is in state A, the server 105 may treat scene A as a pending scene and push scene A into the stack again. At this time, the server 105 determines that the state of scene A is state A, indicating that there is a looped execution scene.
[0209] in, Figure 5B The server 105 shown operates on the scene, which can actually be regarded as an operation on the graph node corresponding to the scene. The server can store the directed graph in the form of a list, each graph node corresponds to a scene, and the child node of the graph node corresponding to the scene can be the scene triggered by the execution action of the scene. The list of directed graphs stored in the server can also be called the first scene sequence.
[0210] In some embodiments, the mobile phone 101 may also detect whether there is a scene of loop execution during the scene creation stage. The method for the mobile phone 101 to detect the scene may refer to the method for the server to detect whether there is a scene of loop execution, which will not be repeated here.
[0211] In some embodiments, the server 105 may also detect whether there is a looping scene when the scene is executed. The following takes a scene of a smart device type as an example to introduce a method for the server 105 to detect a looping scene when the scene is executed.
[0212] Figure 6A-6M It is a schematic diagram of user interaction (user interface, UI) in which a server detects a scene loop execution during a scene execution process provided by an embodiment of the present application.
[0213] like Fig. 6A As shown, the mobile phone 101 can display the scene setting interface 420, and the scene setting interface 420 can display the scene card 601 of scene D and the scene card 602 of scene E. The scene card 601 of scene D can display the triggering condition of scene D (turn on the desk lamp) and the execution action of scene D (turn on the air conditioner), and the scene card 602 of scene E can display the triggering condition of scene E (turn on the air conditioner) and the execution action of scene E (turn on the TV).
[0214] The mobile phone 101 may receive an operation of the user clicking the add button 421, and in response to the operation, the mobile phone 101 may display the following Figure 6B A scene creation interface 430 is shown.
[0215] The scene name edit box 431 in the scene creation interface 430 may display scene F, that is, the scene name of the scene to be created is scene F. The mobile phone 101 may receive an operation of the user clicking the condition button 432, and in response to the operation, the mobile phone 101 may display the following information: Figure 6C A condition adding interface 440 is shown.
[0216] Then, the mobile phone 101 can receive the operation of the user clicking the smart device button 443, and in response to the operation, the mobile phone 101 can display the following Fig.6D The smart device selection interface 610 shown is used to select a smart device connected to the mobile phone 101 through the server 105. Fig.6D As shown, the smart device selection interface 610 may include buttons corresponding to the smart device options, which may include a desk lamp option button 611, an air conditioning option button 612 and a TV option button 613. The above buttons are used to select the corresponding smart device, and then add a trigger condition with the smart device as the main body to scene F.
[0217] like Fig.6D As shown, the mobile phone 101 can receive an operation of the user clicking the TV option button 613, wherein the TV option corresponds to the TV 102. In response to this operation, the mobile phone 101 can display the following Fig. 6E The action selection interface 620 shown is used to select an action that can be executed by the television 102, and then use the action as a trigger condition for the scene F. Fig. 6E The action selection interface 620 shown may include a check button 621 corresponding to turning on the TV and a check button 622 corresponding to turning off the TV, and the check buttons are used to select an action to be performed by the TV.
[0218] like Fig. 6E As shown, the mobile phone 101 receives the operation of the user clicking the check button 621 corresponding to turning on the TV. In response to the operation, the mobile phone 101 can use the start of the TV 102 as the trigger condition of the scene F. Then the mobile phone 101 can display the following Fig. 6F In the scene creation interface 430 shown in FIG. 1 , the condition button 432 may display the added trigger condition: turn on the TV (i.e., turn on the TV 102). The mobile phone 101 may also receive the user's operation of clicking the action button 433, thereby adding an execution action to the scene F. For example, the mobile phone may receive the user's operation of adding the execution action of turning on the desk lamp for the scene F, such as Figure 6G As shown, the action button 433 can display the execution action when the scene F is triggered: turn on the desk lamp (ie, turn on the desk lamp 104).
[0219] The mobile phone 101 may receive an operation of the user clicking the save button 434 , and in response to the operation, the mobile phone 101 may send the scene data of the scene F to the server 105 .
[0220] In some embodiments, the server 105 can determine whether there are multiple scenes that are executed in a loop after the scene F is created based on the scene data of the scene F, and send the determination result to the mobile phone 101. If there are multiple scenes that can be executed in a loop, the server 105 can indicate to the user through the mobile phone 101 that the execution action of the scene F needs to be changed to avoid the occurrence of a scene that is executed in a loop. The method for the server 105 to determine whether there is a scene that is executed in a loop during the scene creation phase can refer to the introduction of the aforementioned embodiment, which will not be repeated here.
[0221] Since it takes time for the server 105 to determine whether there is a scenario that is executed in a loop, in some embodiments, the server 105 can determine whether there is a scenario that is executed in a loop when executing the scenario, thereby reducing the waiting time for the user when creating a scene.
[0222] In response to the user clicking the save button 434, the mobile phone 101 may display the following Figure 6HIn the scene setting interface 420 shown in FIG. 4 , in addition to the scene card 601 of scene D and the scene card 602 of scene E, the scene setting interface 420 also includes a scene card 603 of a newly added scene F. The mobile phone 101 may receive an operation of the user sliding the scene setting interface 420 upward, and in response to the operation, the mobile phone 101 may display part of the hidden content of the scene card 603 of scene F. Fig.6I As shown, the scene card 603 of scene F can display the triggering condition of scene F (turn on the TV) and the execution action of scene F (turn on the desk lamp).
[0223] When the air conditioner 103 is started, the air conditioner 103 will send a startup message to the server 105. The server 105 determines that the scene E is triggered based on the startup message of the air conditioner 103, and then can execute the execution action of the scene E. The execution action of scene E is: turn on the TV, and the server 105 can send a message to the TV 102 to start the TV 102. When the TV 102 is started, the TV 102 can send a startup message to the server 105, and the server 105 can determine that the scene E has been executed. The server 105 can determine that the scene F is triggered by turning on the TV, and then the server 105 can instruct the desk lamp 104 to start. The server 105 can send the scene execution status to the mobile phone 101, so that the user can view the progress of the scene execution through the mobile phone 101. For example, the server 105 can send a message that the scene E is completed and a message that the scene F is being executed to the mobile phone 101, and the mobile phone 101 can display the status of the scene execution based on the above messages. Figure 6J As shown, the scene card 602 of scene E will display an "executed" mark, indicating that scene E has been executed; the scene card 603 of scene F will display an "executing" mark, indicating that scene F is being executed.
[0224] When the desk lamp 104 is turned on, the desk lamp 104 can send a message that it has been turned on to the server 105, and the server 105 determines that the execution of scene F is completed. The server 105 can also determine that scene D is triggered based on the action that the desk lamp has been turned on, where scene D includes two execution actions when it is triggered: turning on the air conditioner and turning on the TV. The server 105 can execute the execution action of scene D, that is, the server 105 can send messages to the air conditioner 103 and the TV 102 respectively, instructing the air conditioner 103 and the TV 102 to start. The server 105 can send the status of the scene execution to the mobile phone 101, such as Figure 6K As shown, the scene card 601 of scene D in the mobile phone 101 can display an "executing" mark, indicating that scene D is being executed; the scene card 603 of scene F can display an "executed" mark, indicating that scene F has been executed.
[0225] The server 105 may receive a message that the air conditioner 103 and the TV 102 have been started, and then the server 105 determines that the execution of scene D is completed. After receiving the message that the air conditioner 103 and the TV 102 have been started, the server 105 may execute scenes E and F, and display the execution status of the scenes through the mobile phone 101, such as Figure 6L As shown, scene card 601 of scene D displays the "executed" indication, and scene card 602 of scene E and scene card 603 of scene F display the "executing" indication.
[0226] The server 105 will execute scenes D, E, and F in a loop. When the server 105 detects that the number of scenes executed within a certain period of time exceeds a certain threshold, the execution of the scenes can be suspended to avoid unlimited loop execution of the scenes. The server 105 can then obtain the logs of scene execution within a preset time period, and determine whether there are scenes that are executed in a loop based on the logs. The server 105 can send a message to the mobile phone 101 that the scene execution is suspended. When the server 105 detects that there are scenes that are executed in a loop based on the logs of scene execution, it can no longer perform the corresponding action when the scene is triggered. Figure 6M As shown, the mobile phone 101 can receive the message of the existence of the looping scene sent by the server 105, and then display a prompt message to prompt the user. For example, the prompt dialog box 604 can display "A looping scene has been detected, and the scene execution has been terminated."
[0227] Here Figure 6A-6M The scenarios D, E and F shown are used as examples to introduce a method for the server to detect the scenarios that are executed cyclically during the scenario execution phase.
[0228] In some embodiments, the server 105 may detect whether there are any looping scenarios when the number of scenarios executed within a preset time length exceeds a preset number.
[0229] Figure 7 This is an example diagram of a timing diagram for detecting a scene cycle in a scene execution phase provided by an embodiment of the present application.
[0230] like Figure 7 As shown in the figure, the timing diagram includes the following steps:
[0231] S701. Mobile phone 101 receives a setting operation of scene F by a user.
[0232] S702 . Mobile phone 101 sends scene data of scene F to server 105 .
[0233] S703. Server 105 stores scene data of scene F.
[0234] The mobile phone 101 can receive the user's setting operation of the trigger condition and the execution action of the scene F, referring to Figure 6B-6G When the mobile phone 101 receives the user's operation of saving the scene data of the scene F, the mobile phone 101 can send the scene data of the scene F to the server 105. The above-mentioned operation of the user saving the scene data of the scene F can be as follows: Figure 6G The user clicks the save button 434.
[0235] S704, the air conditioner 103 is turned on.
[0236] S705 , the air conditioner 103 returns a message indicating that the air conditioner is turned on to the server 105 .
[0237] S706. The server 105 determines that scene E is triggered and executes the execution action of scene E.
[0238] S707 , the server 105 sends a message to the TV 102 to turn on the TV.
[0239] S708 . The server 105 returns the execution status of the scenario E to the mobile phone 101 .
[0240] S709 . The mobile phone 101 displays the execution status of scene E.
[0241] After the air conditioner 103 is turned on, the air conditioner 103 can return a message to the server 105, and the message is used to inform the server 105 that the air conditioner 103 has been turned on. Since the trigger condition of scene E is that the air conditioner 103 is turned on (that is, the server 105 receives the message that it has been turned on from the air conditioner 103), the server 105 can determine that scene E is triggered after receiving the message, and then execute the execution action of scene E. Among them, the execution action of scene E is to turn on the TV 102, then the server 105 can send a message to the TV 102, and the message is used to instruct the TV 102 to start. Among them, the scene data of scene E can be stored after the server 105 receives the user's setting operation for scene E. The server 105 can return the execution status of scene E to the mobile phone 101, prompting the user that scene E is being executed.
[0242] S710, the TV 102 is turned on.
[0243] S711. The TV 102 returns a message to the server 105 indicating that the TV has been turned on.
[0244] S712. The server 105 determines that scene F is triggered, and executes the execution action of scene F.
[0245] S713. The server 105 sends a message to the desk lamp 104 to turn on the desk lamp.
[0246] S714. The server 105 returns the execution status of scene E and scene F to the mobile phone 101.
[0247] S715. Mobile phone 101 displays the execution status of scene E and scene F.
[0248] The television 102 may be turned on in response to the message for turning on the television sent by the server 105 in step S707 , and then the television 102 may return a message to the server 105 , which is used to inform the server 105 that the television 102 has been turned on.
[0249] The server 105 can return the execution status of scene E and scene F to the mobile phone 101, so that the mobile phone can display the execution status of scene E and scene F for the user to view. Figure 6J As shown, the scene card 602 of scene E can display an "executed" mark, and the scene card 603 of scene F can display an "executing" mark. The above marks are the execution status of scene E and scene F displayed on the mobile phone 101.
[0250] S716, the desk lamp 104 is turned on.
[0251] S717. The desk lamp 104 returns a message to the server 105 indicating that the desk lamp 104 has been turned on.
[0252] S718. The server 105 determines that scene D is triggered.
[0253] S719. The server 105 sends a message to the air conditioner 103 to turn on the air conditioner.
[0254] S720. The server 105 sends a message to the TV 102 to turn on the TV.
[0255] The desk lamp 104 can be started in response to the message of turning on the desk lamp sent by the server 105 in S713, and then the desk lamp 104 can return a message to the server 105 that the desk lamp 104 has been turned on. The triggering condition of scene D is that the desk lamp is turned on (that is, the server 105 receives the message that the desk lamp 104 has been turned on). After receiving the message that the desk lamp 104 is turned on, the server can determine that scene D is triggered, and then execute the execution action of scene D. The execution actions of scene D include: turning on the air conditioner and turning on the TV. The server 105 can instruct the air conditioner 103 and the TV 102 to start respectively. The air conditioner 103 will return a message to the server 105 that the air conditioner 103 has been started, and the TV 102 will return a message to the server 105 that the TV 102 has been started. After receiving the above message, the server 105 will continue to execute scenes E and F. In this way, the server 105 will execute scenes D, E and F in a loop.
[0256] S721. The server 105 determines that the number of scenarios executed within a preset time exceeds a preset number.
[0257] S722: The server 105 determines that there is a scenario that is executed in a loop, and stops executing corresponding actions when the scenario is triggered.
[0258] S723. The server 105 returns a message to the mobile phone 101 indicating that there is a scenario in which a loop is executed.
[0259] S724. The mobile phone 101 displays a prompt message indicating that a loop scene exists.
[0260] When there is no loop in the scene, the frequency of scene execution is usually low. The server 105 can record the execution time of each scene, and when the number of scenes executed within the preset time exceeds the preset number, the scene to be executed is paused, and then the detection of whether there is a scene that is executed in a loop is started. Among them, the server 105 can construct a directed graph to determine whether there is a scene that is executed in a loop. The method for the server 105 to determine whether a scene is executed in a loop can refer to the introduction of the subsequent embodiments, which will not be expanded here.
[0261] After server 105 determines that there is a looping scenario, it can stop executing the scenario and return a message to mobile phone 101, which is used to prompt mobile phone 101 that there is a looping scenario. Mobile phone 101 can display a prompt message indicating that there is a looping scenario based on the received message. For example, the prompt message can be Figure 6M The prompt dialog box 604 shown is “A looping scene has been detected, and the scene execution has stopped”.
[0262] If the server 105 determines that there is no scene to be executed in a loop, the server 105 may continue to execute the scene that was paused in step S721.
[0263] The method for the server 105 to determine whether there is a loop execution scenario can be referred to the introduction of the subsequent embodiments, which will not be expanded here.
[0264] In the above embodiment, scene D, scene E, and scene F are only examples of a scene being executed in a loop. The method for server 105 to determine whether there is a loop in other scenes of the same type can refer to the method for determining whether there is a loop in scene D, scene E, and scene F, which will not be repeated here. The detection method of server 105 for other types of scenes can refer to the detection method for smart device type scenes such as scene D, scene E, and scene F, which will not be repeated here.
[0265] Figure 7 The timing diagram shown is only an example and does not constitute a limitation on the timing of the server management scenario in the embodiment of the present application. In addition, the server may include more or fewer steps than the diagram when managing the scenario, and the present application does not limit it here.
[0266] In some embodiments, the server 105 may also detect whether there is a cyclically executed scene after each scene is triggered. If the server 105 determines that there is no cyclically executed scene, it will execute the execution action of the scene. If the server 105 determines that there is a cyclically executed scene, it will stop executing the execution action corresponding to the scene when the scene is triggered.
[0267] In some embodiments, the server 105 may also detect whether there is a cyclically executed scene at intervals of a preset time during the scene execution process.
[0268] In some embodiments, the mobile phone 101 may also detect the scenario of cyclic execution. The method for the mobile phone 101 to detect the scenario of cyclic execution may refer to the method for the server to detect the scenario of cyclic execution, which will not be repeated here.
[0269] The server 105 can construct a directed graph based on the scenario execution log, and then determine whether there is a scenario of cyclic execution based on the directed graph. The following specifically describes a method in which the server 105 detects whether there is a scenario of cyclic execution by constructing a directed graph.
[0270] Here Figure 6I-6M The following examples show two methods for server 105 to determine the cyclic scenario.
[0271] Method 1:
[0272] Here, the method in which the server 105 selects a scene from the scene execution log for loop detection is first introduced.
[0273] Fig. 8A This is an example diagram of a method for the server 105 to select a scene for loop detection provided in an embodiment of the present application.
[0274] like Fig. 8A As shown, the method for the server 105 to select a scene for loop detection may include the following steps:
[0275] 1. Before executing a scene, the server determines that the number of scenes executed within a preset time length exceeds the scene quantity threshold, and suspends the execution of the scene.
[0276] like Fig. 8AAs shown, the order of scene execution can be scene E1, scene F1, scene D1, scene E2, scene F2, scene D2, scene E3, and scene F3. Among them, scene E1, scene E2, and scene E3 are scenes E executed at different times; scene D1 and scene D2 are scenes D executed at different times; scene F1, scene F2, and scene F3 are scenes F executed at different times. During the scene execution process, the server 105 can determine whether the number of scenes executed within the preset time exceeds the preset scene number threshold before executing each scene. When the server 105 determines that the number of scenes executed within the preset time exceeds the scene number threshold, the execution of the scene can be suspended. The execution of the scene here means that the server 105 determines that the triggering condition of the scene is met and executes the execution action of the scene.
[0277] Taking the preset time as 1 second and the scene number threshold as 4 as an example, the server 105 receives a message from the TV that the TV is turned on, and determines that the trigger condition of scene F3 is met. The server 105 can determine whether the number of scenes executed within the preset time (1 second) exceeds the preset scene number threshold (4). Since 5 scenes are executed within 1 second, exceeding the preset scene number threshold, the server 105 can suspend the execution of scene F3. The above preset time and scene number threshold are only examples and do not constitute limitations of the embodiments of the present application.
[0278] 2. The server searches the scene execution log for the execution record of the scene to be executed.
[0279] The server 105 can determine multiple execution records of the scene to be executed within a preset time period from the scene execution log based on the triggering condition of the scene. For example, if the scene to be executed is scene F3, the server 105 can select the scene execution log within two seconds and query the scene F from the scene execution log within two seconds. Fig. 8A As shown, the server 105 determines multiple scenarios F from the scenario execution log: scenario F1, scenario F2, and scenario F3.
[0280] 3. The server takes out the execution records of multiple scenarios from the scenario execution log for loop detection.
[0281] The server 105 may retrieve the scene between two adjacent scenes to be executed from the scene execution log and perform a loop detection. Fig. 8A As shown, after the server 105 determines the execution records of multiple scenarios F in the second step, it can select the execution records of multiple scenarios between two adjacent execution records of scenarios F from the scenario execution log, for example, it can include the scene execution record between scene F1 and scene F2, and the scene execution record between scene F2 and scene F3.
[0282] Figure 8B1 is a flow chart of a method for constructing a directed graph based on a scenario execution log by the server 105 provided in an embodiment of the present application. Figure 8B As shown, the method for the server 105 to construct a directed graph based on the execution records of multiple scenarios may include but is not limited to the following steps:
[0283] S801. Obtain execution records of multiple scenarios to be loop-checked from a scenario execution log.
[0284] The server 105 may obtain execution records of multiple scenarios from the scenario execution log for loop detection. The method for the server 105 to select a scenario from the scenario execution log for loop detection may refer to Fig. 8A The embodiments shown will not be described in detail here.
[0285] S802: Convert execution records of multiple scenarios into graph nodes.
[0286] The server 105 may first convert the execution records of multiple scenarios taken out from the scenario execution log into graph nodes. The scenario execution log may include a trigger condition log and an execution action log, which may be associated through a scenario identifier. Taking scenario F1 as an example, the trigger condition of scenario F1 is to turn on the TV, and the execution action is to turn on the desk lamp. The trigger condition log may store the identifier of scenario F1 and the trigger condition of scenario F1 (turn on the TV), and the execution action log may store the identifier of scenario F1 and the execution action of scenario F1 (turn on the desk lamp).
[0287] Figure 8C This is an example diagram of a server converting a scene execution record into a graph node provided by an embodiment of the present application. Figure 8C As shown, the server 105 can obtain the execution records of scene F1, scene D1, scene E2, and scene F2, wherein the execution record of scene F1 is converted into graph node 1, the execution record of scene E2 is converted into graph node 4, and the execution record of scene F2 is converted into graph node 5. When scene D1 is executed, it contains two execution actions, each of which corresponds to a graph node, so that scene D1 can be converted into two graph nodes (graph node 2 and graph node 3), wherein the content stored in graph node 2 may include: the identification of scene D1, the triggering condition of scene D1: turn on the desk lamp, and one of the execution actions of scene D1: turn on the air conditioner; the content stored in graph node 3 may include: the identification of scene D1, the triggering condition of scene D1: turn on the desk lamp, and another execution action of scene D1: turn on the TV.
[0288] S803: Determine whether there are graph nodes to be processed.
[0289] The graph nodes to be processed refer to the graph nodes whose parent-child relationship has not been confirmed. In a directed graph, between two graph nodes with a pointing relationship, the graph node that is the starting point pointing to the other graph node can be called the parent node, and the graph node being pointed to can be called the child node.
[0290] When the server 105 determines that there are graph nodes to be processed, step S804 may be executed.
[0291] When the server 105 determines that there are no graph nodes to be processed, it indicates that the parent-child relationships of all graph nodes have been determined, that is, the directed graph has been constructed. In this way, the server 105 can determine whether there are cyclic graph nodes in the directed graph. The method for the server 105 to determine whether there are cyclic graph nodes in the directed graph can be referred to the introduction of the subsequent embodiments, which will not be expanded here. Optionally, the server 105 can store the directed graph in the form of a table.
[0292] S804: Obtain graph nodes to be processed.
[0293] The server 105 may obtain the graph nodes to be processed and then construct them into a directed graph. The server 105 may construct the graph nodes into a directed graph by executing steps S805-S808 and steps S809-S812.
[0294] S805: Update the in-degree table based on the triggering condition of the scene corresponding to the graph node, where the in-degree table is used to store the triggering condition of the scene.
[0295] S806: Query the degree table based on the trigger condition of the scene corresponding to the graph node.
[0296] S807: Determine whether there is another graph node corresponding to a scene whose execution action is equal to the trigger condition of the scene corresponding to the graph node, and the execution time of the scene corresponding to the other graph node is earlier than the execution time of the scene corresponding to the graph node.
[0297] S808: Use another graph node found in the search as the parent node of the graph node.
[0298] S809: Update the out-degree table based on the execution action of the scene corresponding to the graph node, where the out-degree table is used to store the execution action of the scene.
[0299] S810: Query the in-degree table based on the execution action of the scene corresponding to the graph node.
[0300] S811. Determine whether there is another graph node corresponding to a scene whose triggering condition is equal to the execution action of the scene corresponding to the graph node, and the execution time of the scene corresponding to the other graph node is later than the execution time of the scene corresponding to the graph node.
[0301] S812: Use another graph node found in the search as a child node of the graph node.
[0302] The server 105 can construct an in-degree table and an out-degree table, wherein the in-degree table is used to store the trigger conditions of the scene, and the out-degree table is used to store the execution actions of the scene. After the server 105 obtains the trigger condition of the graph node for the scene, if the trigger condition already exists in the in-degree table, the server 105 can associate the graph node with the trigger condition in the in-degree table. If the trigger condition is not in the in-degree table, the server 105 can add the trigger condition of the scene corresponding to the graph node in the in-degree table, and associate the trigger condition with the graph node. The method for the server 105 to execute step S809 can refer to the method for the server 105 to process the in-degree table mentioned above, which will not be repeated here.
[0303] Furthermore, the server 105 can query whether there is a trigger condition for the scene corresponding to the graph node in the out-degree table, and the server 105 can also query whether there is an execution action for the scene corresponding to the graph node in the in-degree table. If the server 105 determines that the condition is met in S807 or S811, the parent-child relationship between the graph node and another graph node can be constructed. Among them, when the trigger condition of the scene is manually clicking on the scene card, the corresponding search execution action can be to execute another scene. For example, the trigger condition of scene 4 is to manually click on the scene card, and the execution action of scene 5 is to execute scene 4. When scene 5 is triggered, it is regarded as clicking on the scene card of scene 4. In this way, when the out-degree table is queried with the trigger condition of scene 4, the corresponding execution action in the out-degree table is "execute scene 4".
[0304] If the server 105 determines that there is no execution action of the corresponding scenario of another graph node in the out-degree table that is equal to the trigger condition of the corresponding scenario of the graph node, and there is no trigger condition of the corresponding scenario of another graph node in the in-degree table that is equal to the execution action of the corresponding scenario of the graph node, then the server 105 can execute step S803 to process the next graph node.
[0305] Taking the server 105 performing a cyclic detection on scene F1-scene F2 as an example, the server 105 constructs Figure 8C After the graph nodes are shown, steps S805-S808 and steps S809-S812 can be performed on each graph node, thereby sequentially constructing the graph nodes into a directed graph.
[0306] Server 105 can first construct an empty in-degree table and out-degree table. Then server 105 can obtain graph node 1 corresponding to scene F1. The trigger condition of scene F1 is to turn on the TV, and the execution action is to turn on the desk lamp. Server 105 can add the trigger condition of scene F1 to the in-degree table, and add the execution action of scene F1 to the out-degree table. Since the in-degree table only stores the trigger condition of scene F1, and the out-degree table only stores the execution action of scene F1, server 105 cannot find another graph node corresponding to the scene whose execution action is equal to the trigger condition of scene F1 in steps S806 and S810, nor can it find another graph node corresponding to the scene whose trigger condition is equal to the execution action of scene F1. Then server 105 can continue to process the next graph node.
[0307] Server 105 then processes graph node 2, which corresponds to a branch of scene D1: the trigger condition is to turn on the desk lamp, and the execution action is to turn on the air conditioner. Server 105 can store the trigger condition of graph node 2 (turn on the desk lamp) in the in-degree table, and then query the out-degree table to see if there is another graph node in the out-degree table whose execution action corresponding to the scene is equal to the trigger condition of graph node 2 (turn on the desk lamp). Server 105 queries the out-degree table and finds that there is an execution action of "turn on the desk lamp", which corresponds to graph node 1. In addition, if the execution time of scene F1 corresponding to graph node 1 is earlier than the execution time of scene D1 corresponding to graph node 2, server 105 can use graph node 1 as the parent node of graph node 2.
[0308] Server 105 can continue to process graph node 3, which corresponds to another branch of scene D1: the trigger condition is to turn on the desk lamp, and the execution action is to turn on the TV. Since the trigger condition "turn on the desk lamp" already exists in the in-degree table, server 105 can associate "turn on the desk lamp" in the in-degree table with graph node 3. Server 105 can search in the out-degree table whether "turn on the desk lamp" exists, and then server 105 can also use graph node 1 as the parent node of graph node 3. Server 105 can also add the execution action "turn on the TV" in the out-degree table when executing step S809.
[0309] Server 105 processes graph node 4. Server 105 first updates the trigger condition "turn on the air conditioner" in the in-degree table. Then, server 105 can search in the out-degree table whether there is a trigger condition "turn on the air conditioner". The "turn on the air conditioner" stored in the out-degree table can be added to the out-degree table by server 105 when processing graph node 2. If the execution time of scene D1 corresponding to graph node 2 is earlier than the execution time of scene E2 corresponding to graph node 4, server 105 can use graph node 2 as the parent node of scene E2.
[0310] Finally, server 105 can process graph node 5 corresponding to scene F2. First, server 105 determines that the trigger condition "turn on the TV" of scene F2 corresponding to graph node 5 is already included in the in-degree table, then server 105 can associate "turn on the TV" in the in-degree table with graph node 5, so that when server 105 searches for the trigger condition "turn on the TV", graph node 5 can be determined. Similarly, server 105 can also associate "turn on the desk lamp" with graph node 5 in the out-degree table. Then server 105 can query in the out-degree table whether there is a trigger condition "turn on the TV" for scene F2 corresponding to graph node 5, and then server 105 can search for graph node 3 associated with "turn on the TV" in the out-degree table. Since the execution time of the scene corresponding to graph node 3 is earlier than the execution time of the scene corresponding to graph node 5, server 105 can use graph node 3 as the parent node of graph node 5.
[0311] like Fig.8D Shown is an example diagram of the in-degree table and out-degree table provided in an embodiment of the present application. The in-degree table may include: turning on the TV, turning on the desk lamp, and turning on the air conditioner, and the out-degree table may include: turning on the desk lamp, turning on the air conditioner, and turning on the TV. When the server 105 processes graph node 1, it may add "turn on the TV" to the in-degree table and add "turn on the desk lamp" to the out-degree table. When the server 105 processes graph node 2, it may add "turn on the desk lamp" to the in-degree table and add "turn on the air conditioner" to the out-degree table. When the server 105 processes graph node 3, it may associate "turn on the desk lamp" in the in-degree table with graph node 3, and then add "turn on the TV" to the out-degree table. When the server 105 processes graph node 4, it may add "turn on the air conditioner" to the in-degree table and associate "turn on the desk lamp" in the out-degree table with graph node 4. When the server 105 processes graph node 5, it may associate "turn on the TV" in the in-degree table with graph node 5, and associate "turn on the desk lamp" in the out-degree table with graph node 5. After the server 105 processes graph nodes 1-5 in sequence, it can obtain Fig.8D The in-degree table and out-degree table are shown.
[0312] The server 105 processes the graph nodes 1 to 5 in sequence to confirm the parent node and child node of each graph node, so that a directed graph can be constructed. Fig. 8E The example diagram of the directed graph constructed by the server provided in the embodiment of the present application is shown. The server 105 may store the directed graph in the form of a list. Fig. 8E As shown, graph node 1 is the parent node of graph node 2 and graph node 3, and the arrows starting from graph node 1 point to graph node 2 and graph node 3 respectively. Graph node 2 is the parent node of graph node 4, and the arrow starting from graph node 2 points to graph node 4. Graph node 3 is the parent node of graph node 5, and the arrow starting from graph node 3 points to graph node 5. Fig. 8EThe directed graph shown contains two paths: graph node 1-graph node 2-graph node 4 and graph node 1-graph node 3-graph node 5.
[0313] The server 105 can then be based on Fig. 8E The method for the server 105 to determine whether there is a loop execution scenario based on the directed graph can refer to the introduction of the subsequent embodiments, which will not be expanded here.
[0314] Fig. 9 This is a flow chart of a method for determining whether there is a loop execution scenario based on a directed graph provided by an embodiment of the present application. The method may include but is not limited to the following steps:
[0315] S901. Use the graph node corresponding to the scenario to be executed during the subsequent execution as the target node, and use the graph node corresponding to the record of the scenario to be executed during the previous execution as the graph node to be processed.
[0316] S902: Push the graph nodes to be processed into a stack.
[0317] S903: Determine whether the graph node to be processed and the target node are the same graph node.
[0318] When the server determines that the graph node to be processed and the target node are not the same graph node, step S904 may be executed.
[0319] S904: Determine whether the graph node to be processed has any unmarked child nodes.
[0320] When the server determines that the graph node to be processed has an unmarked child node, step S905 may be executed, and when the server determines that the graph node to be processed does not have an unmarked child node, step S907 may be executed. Initially, all graph nodes are in an unmarked state.
[0321] S905: Take the child node as a node to be processed and push the node to be processed into a stack.
[0322] S906: Determine whether the graph node to be processed and the target node are the same graph node.
[0323] When the server determines that the graph node to be processed and the target node are the same graph node, step S911 may be executed to determine that a loop exists in the scenario; otherwise, the server may execute step S904.
[0324] S907 , mark the graph nodes to be processed, and pop the graph nodes to be processed from the stack.
[0325] S908: Determine whether the stack is empty.
[0326] When the server determines that the stack is empty, step S909 may be executed to determine that there is no loop execution scenario. When the server determines that there is a graph node in the stack, step S910 may be executed.
[0327] S910. Take the top graph node of the stack as the graph node to be processed.
[0328] After executing S910, the server may continue to execute step S904.
[0329] S911. Determine whether a scene loop exists.
[0330] by Fig. 8E Taking the directed graph shown as an example, the server 105 first uses the graph node 5 corresponding to the later executed scene F2 as the target node, and then uses the graph node 1 corresponding to the previously executed scene F1 as the node to be processed. Then the server 105 determines that graph node 1 and graph node 5 are not the same graph node, and can push the node to be processed (graph node 1 at this time) into the stack. Then there is an unmarked child node in graph node 1: graph node 2. The server 105 can execute step S905 to use graph node 2 as the node to be processed and push graph node 2 into the stack. At this time, the order from the bottom to the top of the stack is: graph node 1, graph node 2.
[0331] The server 105 determines that the graph node to be processed (graph node 2) and the target node (graph node 5) are not the same graph node, and then continues to determine whether graph node 2 has an unmarked child node. Then the server 105 obtains graph node 4 and pushes graph node 4 into the stack. Graph node 4 and graph node 5 are not the same graph node either, and the server 105 continues to execute step S904 to determine whether graph node 4 has an unmarked child node.
[0332] Since graph node 4 does not contain unmarked child nodes, server 105 can execute step S907, mark graph node 4, and pop graph node 4 out of the stack. At this time, the stack includes graph node 1 and graph node 2. Server 105 determines that the stack is not empty, executes step S910, takes graph node 2 at the top of the stack as the graph node to be processed, and then executes step S904.
[0333] Since graph node 4, the only child node of graph node 2, has been marked, and graph node 2 does not contain unmarked child nodes, server 105 can also mark graph node 2 and pop graph node 2 out of the stack. Server 105 determines that graph node 1 still exists in the stack, then server 105 can use graph node 1 as a to-be-processed graph node to determine whether graph node 1 has any unmarked child nodes. Server 105 determines that graph node 1 also has an unmarked child node: graph node 3, then server 105 can push graph node 3 into the stack, and then search for graph node 5, the child node of graph node 3. Since graph node 5 and graph node 5 are the same graph node, this indicates that there is a loop in the scene.
[0334] Method 2:
[0335] Fig. 10A is a flowchart of another method for constructing a directed graph by a server during a scenario execution process provided by an embodiment of the present application, such as Fig. 10A The method may include but is not limited to the following steps:
[0336] S1001. Determine the triggering condition of the scene to be executed.
[0337] S1002: Search the scene execution log for a scene that has executed the triggering condition of the scene to be executed.
[0338] Before executing a scenario, the server 105 may first determine the triggering condition of the scenario to be executed. Fig. 10B As shown, when the server 105 determines that the scene D3 is triggered, it can determine the triggering condition of the scene D3, wherein the triggering condition of the scene D3 is "turn on the desk lamp".
[0339] Furthermore, the server 105 can determine multiple scenes that trigger the scene D3 within the preset time period from the scene execution log. Here, for example, scenes E2, F2, D2, F3, E3, and D3 are executed in the preset time period. In the preset time period, scenes F2 and F3 are executed to turn on the desk lamp. Thus, the server 105 can determine scenes F2 and F3.
[0340] S1003: construct the execution record of the scenario found in the scenario execution log into a graph node, and use the graph node as the graph node to be processed.
[0341] The graph nodes to be processed here refer to the graph nodes whose parent-child relationships have not yet been determined. Fig. 10B Taking the embodiment shown as an example, in step S1003, the server 105 determines the scene F2 and the scene F3, and the server 105 can construct the graph node based on the execution records of the two scenes respectively. Taking the scene F3 as an example, the server 105 can construct the execution record of the scene F3 as the graph node to be processed.
[0342] S1004. Search the scene execution log for the preceding scene that triggers the scene corresponding to the graph node to be processed.
[0343] S1005: Determine whether the execution time of the preceding scene is within a preset time period.
[0344] The server 105 can search based on the triggering conditions of the scene corresponding to the graph node to be processed, and then determine the preceding scene that triggers the scene corresponding to the graph node to be processed. The preceding scene refers to a scene in which the triggering conditions of a certain scene are executed, and the execution time is before the execution time of the scene corresponding to the graph node to be processed. For example, the server can determine the preceding scene (scene D2) that triggers scene F3 based on the triggering condition "turn on the TV" of scene F3, and when the server 105 determines that the execution time of the preceding scene is still within the preset time period, step S1006 can be executed.
[0345] S1006: Construct the scene execution record of the preceding scene as a child node of the graph node to be processed.
[0346] S1007: Use the graph node corresponding to the previous scene as the graph node to be processed.
[0347] The server 105 can construct the scene execution record of the preceding scene as a graph node and use it as a child node of the graph node to be processed. For example, the server 105 can construct the execution record of the scene D2 as a graph node and use it as a child node of the graph node corresponding to the scene F3 to be processed.
[0348] The server may take the graph node corresponding to the preceding scene as the graph node to be processed and then execute step S1004. The server 105 may search for the preceding scenes in sequence until the preceding scene of the scene corresponding to the graph node to be processed in step S1005 exceeds the preset time period, indicating that the directed graph construction is completed.
[0349] like Fig. 10B As shown in step 1, the server 105 first determines the triggering condition of the scene D3 to be executed, and then Fig. 10B In step 2, the scene (scene F3) that triggers scene D3 within the preset time period is determined from the scene log. The server 105 can trace back the execution of scene F3 based on the scene execution log of the preset time period and construct a directed graph. In this way, the server 105 can sequentially find scene D2 based on scene F3, and find scene F2 based on scene D2, and finally construct the following: Fig. 10B As shown in step 3, scene F3 points to scene D2, and scene D2 points to the directed graph of scene F2.
[0350] In some embodiments, the server 105 can traverse the directed graph based on a depth-first traversal algorithm to determine the number of executions of each scenario. When the number of executions of a scenario exceeds a preset number, it indicates that a cyclic execution scenario has occurred. This method is not limited to other methods for determining cycles based on directed graphs, and the embodiments of the present application do not limit this.
[0351] In some embodiments, the mobile phone 101 may also determine whether there is a loop execution scenario based on the directed graph. The method for the mobile phone 101 to determine whether there is a loop execution scenario can refer to the method for the server to determine whether there is a loop execution scenario, which will not be repeated here.
[0352] In some embodiments, when the triggering condition of a scene can be determined by the mobile phone 101 whether it is satisfied, and the execution action of the scene can be completed by the mobile phone 101 itself without controlling other smart devices, the mobile phone 101 can detect whether there is a scene of cyclic execution. For example, when the triggering condition and the execution action of the scene are both system functions provided by the mobile phone 101, the mobile phone 101 can perform a cyclic detection. The method for the mobile phone 101 to detect the scene of cyclic execution of the scene can refer to the method for the server 105 to detect the scene, which will not be repeated here. Optionally, when the triggering conditions and execution actions of multiple scenes are all actions of smart devices, the server 105 can detect whether there is a scene of cyclic execution. In other words, for different types of scenes, different electronic devices or servers can be used for detection.
[0353] In some embodiments, when the trigger conditions and execution actions of multiple scenarios are system functions provided by the mobile phone 101, the mobile phone 101 and the server 105 can also jointly perform loop detection based on the execution records of the scenarios.
[0354] As described above, 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 scope of the technical solutions of the embodiments of the present application.
[0355] As used in the above embodiments, the term "when..." may be interpreted to mean "if..." or "after..." or "in response to determining..." or "in response to detecting...", depending on the context. Similarly, the phrases "upon determining..." or "if (the stated condition or event) is detected" may be interpreted to mean "if determining..." or "in response to determining..." or "upon detecting (the stated condition or event)" or "in response to detecting (the stated condition or event)", depending on the context.
[0356] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that contains one or more available media integration. The available medium can be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk), etc.
[0357] Those skilled in the art can understand that to implement all or part of the processes in the above-mentioned embodiments, the processes can be completed by computer programs to instruct related hardware, and the programs can be stored in computer-readable storage media. When the programs are executed, they can include the processes of the above-mentioned method embodiments. The aforementioned storage media include: ROM or random access memory RAM, magnetic disk or optical disk and other media that can store program codes.
Claims
1. A scene management method, characterized in that: The method is applied to an electronic device, wherein the triggering conditions and execution actions of one or more scenes are stored in the electronic device, wherein the one or more scenes include a first scene and a second scene, and the method includes: The electronic device determines that a first trigger condition of the first scenario is satisfied, and executes a first execution action of the first scenario; The electronic device determines that a second trigger condition of the second scenario is satisfied, and executes a second execution action of the second scenario, wherein the second trigger condition is caused by the first execution action, and the second execution action is used to cause the first trigger condition; The electronic device determines that k scenes are executed in a first time period, and k exceeds a first threshold value, where k is a positive integer; The electronic device constructs a first scene sequence based on m scenes executed before the first trigger condition is satisfied again, the first scene sequence includes a plurality of scenes associated in sequence, the trigger condition of a previous scene in the first scene sequence is an execution action of a subsequent scene, or the execution action of a previous scene in the first scene sequence is a trigger condition of a subsequent scene, and the first trigger condition is satisfied again due to the second execution action; The electronic device determines that the same scene exists in the first scene sequence; When the first trigger condition is met again, the electronic device does not execute the first execution action.
2. The method according to claim 1, characterized in that The first scene sequence includes scenes between two adjacent executions of the first scenes by the electronic device.
3. The method according to claim 1, characterized in that: The first scene sequence includes scenes that cause the first trigger condition within a third time period.
4. The method according to any one of claims 1 to 3, characterized in that The first execution action is used to control the first smart home, and the electronic device does not execute the first execution action, specifically including: The electronic device does not send an instruction for executing the first execution action to the first smart home.
5. The method according to any one of claims 1 to 3, characterized in that: The one or more scenarios include a third scenario, the third scenario includes a third trigger condition and a third execution action, and the method further includes: The electronic device receives an operation by a user to create a fourth scene, where the fourth scene includes a fourth trigger condition and a fourth execution action; The electronic device determines that the third execution action will cause the fourth trigger condition, and the fourth execution action will cause the third trigger condition; The electronic device displays a first prompt message, where the first prompt message is used to prompt the user that the fourth scene cannot be created.
6. The method according to any one of claims 1 to 3, characterized in that The triggering conditions of the one or more scenes include one or more of the following: controlling a smart home, a time schedule, a system function of the electronic device, and manually clicking on a scene card.
7. The method according to any one of claims 1 to 3, characterized in that The execution actions of the one or more scenes include one or more of the following: controlling a smart home, a system function of the electronic device, and controlling the one or more scenes.
8. An electronic device, characterized in that: The electronic device comprises: a display screen, a memory, and a processor coupled to the memory; the display screen is used to display an interface, the memory stores a computer program, and when the processor executes the computer program, the electronic device implements the method as described in any one of claims 1 to 7.
9. A computer-readable storage medium comprising computer instructions, characterized in that: When the computer instructions are executed on an electronic device, the electronic device is caused to execute the method as claimed in any one of claims 1 to 7.
Citation Information
Patent Citations
Linkage rule testing method and device
CN111381582A