Instruction execution method and device, electronic equipment and readable storage medium

By hierarchical storage according to the instruction execution frequency of smart home device scenarios, the problem of insufficient performance when the home host executes complex instructions is solved, and the instruction execution speed and storage efficiency are improved.

CN119987860APending Publication Date: 2025-05-13GREE ELECTRIC APPLIANCE INC OF ZHUHAI +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411883901.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-19
Publication Date
2025-05-13

AI Technical Summary

Technical Problem

Due to limited hardware performance, home hosts are difficult to effectively execute large amounts of instructions to store and interact data, resulting in a large gap between the execution effect of smart device scenarios and theories.

Method used

By determining the level according to the execution frequency of the instruction data in each scenario, the instruction data of the high-frequency scenario is stored on the main server and the instruction data of the low-frequency scenario is stored on the cloud server, thereby optimizing the storage and execution strategy.

Benefits of technology

It improves the instruction execution speed of the main server, reduces the consumption of limited storage space, and improves the response speed of frequent use scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119987860A_ABST
    Figure CN119987860A_ABST
Patent Text Reader

Abstract

The invention discloses an instruction execution method and device, electronic equipment and a readable storage medium, and the method comprises the steps: determining a grade corresponding to each scene according to the execution frequency of each instruction data in each scene in a first time period; storing the instruction data in the first-level scene in a main server; storing the instruction data in the second-level scene in a cloud server; under the condition that the execution condition of the target instruction data is met, reading the target instruction data from a target server corresponding to a target scene to which the target instruction data belongs; sending the target instruction data to the target equipment to enable the target equipment to execute the target instruction data; and after the target instruction data is executed, updating the execution frequency of the target instruction data. Scenes are graded, different storage schemes are adopted for instruction data in different grades of scenes, consumption of limited storage space of a main server is reduced, and the instruction execution speed of the main server is increased.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to an instruction execution method, device, electronic device and readable storage medium. Background Art

[0002] With the development of smart homes, more and more home devices are becoming smart. When a user triggers a condition, a message is sent to the cloud service. After receiving the message, the cloud service sends a unified command to the devices in the user's home, and the devices execute the command after receiving it. The whole process takes some time and is also affected by network fluctuations, resulting in failure to send the command. So the home host appeared. The home host assumes part of the functions of the cloud service, connects to various smart devices in the home through the user's home wireless network, and stores user-defined scenes and other data. The whole process is carried out under the home wireless network, which greatly shortens the network link, greatly reduces network fluctuations, greatly improves execution speed, and provides a better user experience.

[0003] However, the home host is different from the server. It is an edge-side smart home device with limited hardware performance. It needs to store and interact with too much data and the commands it executes are too complex, which will be affected by the limitation of computing resources. Therefore, when there are too many smart devices in the home, the actual effect of the scene execution based on the home host is far from the theory. Summary of the invention

[0004] The embodiment of the present application provides a command execution method, which can improve the server response speed and improve the command execution speed.

[0005] In a first aspect, an embodiment of the present application discloses an instruction execution method, the method comprising:

[0006] The method comprises:

[0007] Determine the level corresponding to each scenario according to the execution frequency of each instruction data under each scenario in the first time period;

[0008] storing the instruction data in the first level scenario in the main server;

[0009] Storing the instruction data in the second level scenario in the cloud server;

[0010] When the execution condition of the target instruction data is met, reading the target instruction data from the target server corresponding to the target scenario to which the target instruction data belongs;

[0011] Sending the target instruction data to a target device so that the target device executes the target instruction data;

[0012] After the target instruction data is executed, the execution frequency of the target instruction data is updated.

[0013] Optionally, when an execution condition of the target instruction data is met, reading the target instruction data from a target server corresponding to a target scenario to which the target instruction data belongs includes:

[0014] Receive scene trigger instructions;

[0015] Determining a target scene triggered by the scene triggering instruction according to a mapping relationship between the scene triggering instruction and the target instruction data;

[0016] The target instruction data corresponding to the scene trigger instruction is read from the target server corresponding to the target scene.

[0017] Optionally, the reading target instruction data corresponding to the scene trigger instruction from the target server corresponding to the target scene includes:

[0018] When the level corresponding to the target scene is the first level, reading target instruction data corresponding to the scene trigger instruction from the main server;

[0019] When the level corresponding to the target scene is the second level, sending the scene trigger instruction to the cloud server;

[0020] Receive target instruction data corresponding to the scene trigger instruction returned by the cloud server.

[0021] Optionally, sending the target instruction data to a target device so that the target device executes the target instruction data includes:

[0022] Determining a data transmission protocol between the host server and the target device;

[0023] encoding the target instruction data according to the data transmission protocol;

[0024] The encoded target instruction data is sent to the target device so that the target device executes the encoded target instruction data.

[0025] Optionally, before sending the target instruction data to a target device so that the target device executes the target instruction data, the method further includes:

[0026] Matching the device parameters carried by the target instruction data with the registration information corresponding to each device in a preset database; the preset database is used to record the registration information of each device;

[0027] When the registration information corresponding to the first device matches the device parameters successfully, the first device is determined as the target device.

[0028] Optionally, determining the level corresponding to each scenario according to the execution frequency of each instruction data in each scenario within the first time period includes:

[0029] When the execution frequency of each instruction data in the first scenario is greater than or equal to the first preset frequency, determining that the level corresponding to the first scenario is the first level; the first scenario is one of the scenarios;

[0030] When the execution frequency of each instruction data in the first scenario is less than the first preset frequency and greater than or equal to the second preset frequency, it is determined that the level corresponding to the first scenario is the second level.

[0031] Optionally, the method further comprises:

[0032] storing description data corresponding to the second level scene in the main server;

[0033] The description data is sent to a client, so that the client generates scene items on a user interface based on the description data for user selection.

[0034] In a second aspect, an embodiment of the present application discloses an instruction execution device, the device comprising:

[0035] A determination module, used to determine the level corresponding to each scenario according to the execution frequency of each instruction data under each scenario in the first time period;

[0036] A first storage module, used for storing instruction data in a first level scenario in the main server;

[0037] A second storage module, used for storing the instruction data in the second level scenario in the cloud server;

[0038] A reading module, configured to read the target instruction data from a target server corresponding to a target scenario to which the target instruction data belongs, when an execution condition of the target instruction data is met;

[0039] A sending module, used for sending the target instruction data to a target device so that the target device executes the target instruction data;

[0040] The updating module is used to update the execution frequency of the target instruction data after the execution of the target instruction data is completed.

[0041] In a third aspect, an embodiment of the present application discloses an electronic device, which includes a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other through the communication bus; the memory is used to store executable instructions, and the executable instructions enable the processor to execute the instruction execution method as described above.

[0042] In a fourth aspect, an embodiment of the present application discloses a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the instruction execution method as described above is implemented.

[0043] The embodiments of the present application include the following advantages:

[0044] According to the execution frequency of each instruction data in each scenario in the first time period, the level corresponding to each scenario is determined; the instruction data in the first level scenario is stored in the main server; the instruction data in the second level scenario is stored in the cloud server. By grading the scenarios, different storage schemes are adopted for the instruction data in different levels of scenarios, which reduces the consumption of the limited storage space of the main server and improves the instruction execution speed of the main server. When the execution conditions of the target instruction data are met, the target instruction data is read from the target server corresponding to the target scenario to which the target instruction data belongs; the target instruction data is sent to the target device so that the target device executes the target instruction data; after the execution of the target instruction data is completed, the execution frequency of the target instruction data is updated, the levels corresponding to each scenario are adjusted in time, and the instruction data corresponding to the scenario with high execution frequency is stored in the main server, so as to improve the instruction execution speed of the frequently executed scenario. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.

[0046] Figure 1 is a flowchart of a method for executing instructions provided by the present application;

[0047] Figure 2 It is a schematic diagram of a single-family smart home system based on a home host provided by the present application;

[0048] Figure 3 This is a schematic diagram of a smart central control scene list page provided by this application;

[0049] Figure 4It is a structural block diagram of an instruction execution device of the present invention;

[0050] Figure 5 It is a structural block diagram of an electronic device provided by an example of the present invention. DETAILED DESCRIPTION

[0051] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0052] The terms "first", "second", etc. in the specification and claims of the present invention are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present invention can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, the term "and / or" in the specification and claims is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character "" generally indicates that the objects associated before and after are in an "or" relationship. In the embodiments of the present invention, the term "multiple" refers to two or more, and other quantifiers are similar.

[0053] Method Embodiment

[0054] The following is a detailed description of the instruction execution method provided in the embodiment of the present application through specific embodiments and their application scenarios in conjunction with the accompanying drawings.

[0055] Reference Figure 1 , shows a flowchart of the steps of an instruction execution method embodiment of the present application, such as Figure 1 As shown, the method specifically comprises the following steps:

[0056] Step 101: Determine the level corresponding to each scenario according to the execution frequency of each instruction data in each scenario in the first time period;

[0057] Step 102: store the instruction data in the first level scenario in the main server;

[0058] Step 103: store the instruction data in the second level scenario in the cloud server;

[0059] Step 104: when the execution condition of the target instruction data is met, read the target instruction data from the target server corresponding to the target scenario to which the target instruction data belongs;

[0060] Step 105: Send the target instruction data to the target device so that the target device executes the target instruction data;

[0061] Step 106: After the target instruction data is executed, update the execution frequency of the target instruction data.

[0062] The instruction execution method provided in this application can be applied to intelligent digital control fields such as smart home, smart office, and smart logistics. For example, there are various devices in the office, such as lights, air conditioners, curtains, projectors, etc., and various devices in the office are controlled by sending control instructions to each device to realize the automation and intelligence of the office environment. The status of conference room equipment can be automatically adjusted, such as adjusting lighting and air conditioning according to the number of participants, and conference rooms and equipment can be reserved through the client. In the field of smart home, there are various devices in the home, such as air conditioners, living room lights, sweepers, washing machines, fresh air fans and other equipment. By sending control instructions to each device to control each device in the home, the lights in the whole house can be turned on, and the temperature of the air conditioner can be adjusted at a specified time.

[0063] Optionally, the instruction execution method provided in this application can be applied to Figure 2 In the environment shown, which is composed of a home host, terminal devices, cloud servers, and smart central control, the home host is connected to the terminal devices through the network, and a database can be set up on the home host or independently of the home host to provide data storage services for the home host. The terminal devices may not be limited to smart air conditioners, smart range hoods, smart refrigerators, smart ovens, smart washing machines, etc. The smart central control is a device that integrates multiple control functions. It uses computers, networks, communications, and automatic control technologies to uniformly manage various smart home devices, security equipment, lighting equipment, environmental control equipment, etc. The smart central control can be a mobile phone, tablet, computer, or other electronic device.

[0064] It should be noted that a scene refers to a situation in which at least one device receives a control instruction to execute a corresponding function under certain execution conditions. For example, the "turn off lights in the whole house" scene includes all the lighting devices in the house, which can be used when you are away from home; the "turn on lights in the living room" scene includes the lighting devices in the living room, which can be triggered when the door is opened.

[0065] A scene can refer to a single scene that performs a function, or a composite scene that performs multiple functions at the same time. A composite scene can be implemented by controlling at least two single scenes at the same time. For example, the "temperature control" scene refers to adjusting the indoor temperature by intelligently controlling the air-conditioning temperature; the "living room lights on" scene includes the lighting equipment in the living room; and the "home mode" scene refers to turning on the indoor lights and the air-conditioning when returning home.

[0066] It should be noted that according to the triggering method of the scene, the scene can be divided into automatic scene and manual scene. The triggering method of manual scene is manual triggering, which requires manual operation by the user to trigger. The scene triggering operation is detected by the panel of the triggering device or other detection components on the triggering device, usually involving the use of switches, voice commands, remote controls, and mobile applications to control smart devices. Automatic scenes are automatically triggered by sensors or smart devices. No manual operation by the user is required. The corresponding devices will be automatically controlled to perform actions according to preset conditions (such as time, device status changes, etc.). When the triggering method is manual triggering, the triggering end and the execution end can be the same device or different devices. For example Figure 3 The smart scene list page shown shows various scenes. The manual scene needs to be triggered by clicking the switch button. After clicking the enable button of the automatic scene, when the execution conditions of the instruction data are met, the control instruction is automatically sent to the device to execute the action.

[0067] In an embodiment of the present application, the execution frequency of each instruction data in each scene is obtained by setting a tracking point in the trigger device or the execution device. When the tracking point is triggered, the data will be reported through the long whisker corresponding to the tracking point. For manual scenes, a tracking point can be set in the trigger device. When the user selects a specified scene on the panel of the trigger device, the execution frequency of each instruction data in the specified scene is recorded, and the execution frequency is reported to the main server; for automatic scenes, a tracking point can be set in the execution device. When the execution device executes the instruction, the execution frequency of each instruction data in the specified scene is recorded, and the execution frequency is reported to the main server.

[0068] In an embodiment of the present application, the level corresponding to each scene is determined according to the interval in which the execution frequency of each instruction in each scene is located, and each level corresponds to an execution frequency interval. Specifically, the level corresponding to the scene is determined according to the execution frequency corresponding to the instruction data with the lowest execution frequency in each scene. Exemplarily, there are three scenes, namely "turn on the living room light", "turn on the lights in the whole house", and "turn on the air conditioner". If the usage frequency of the "turn on the living room light" scene is very high in the first time period, the usage frequencies of "turn on the lights in the whole house" and "turn on the air conditioner" are 0. Since there are overlapping devices in the two scenes of "turn on the living room light" and "turn on the lights in the whole house", which are lighting devices in the living room, the execution frequency of the instruction data corresponding to the overlapping devices cannot represent the usage frequency of the entire scene. Therefore, the level corresponding to the scene is determined according to the execution frequency corresponding to the instruction data with the lowest execution frequency in the entire scene, that is, the level corresponding to the scene is determined according to the frequency interval in which the execution frequency corresponding to the instruction data with the lowest execution frequency is located.

[0069] It should be noted that when each terminal device is used for the first time, the default level of each scene is the same. After a period of time, according to the actual needs and usage habits of users, some scenes are rarely used or never used by users, and the execution frequency of command data in these scenes will be relatively low; some scenes are used frequently by users, and the execution frequency of command data in these scenes will be correspondingly higher.

[0070] Among them, the scenarios can be divided into at least two levels. When there are two levels, the execution frequency of each instruction data in the first level scenario is greater than the execution frequency of each instruction data in the second level scenario.

[0071] Optionally, the scene level can be dynamically adjusted to adapt to changing usage requirements and environmental conditions. For example, if the execution frequency of the first scene decreases to below the first preset frequency, the system can reduce its level to the second level or other levels.

[0072] It should be noted that the execution conditions may include the following: time conditions, environmental conditions, user behavior, device status, external information, etc. Time-based conditions mean that users can set smart home devices to execute instructions at a specific time period, such as automatically opening the curtains at 7 o'clock every morning. Environmental-based conditions mean that the opening and closing of curtains or the brightness of lights are automatically adjusted according to the indoor light intensity, humidity, etc.; the human body sensor is used to detect whether there is someone in the room, so as to automatically turn on and off the lights, adjust the air conditioning temperature, etc. The execution condition based on user behavior can be that the user can issue a voice command through a voice assistant, and the smart home device performs the corresponding operation according to the voice command. The user can manually control the device through a mobile phone APP, smart panel, etc., and issue an instant command. Smart home devices can be interconnected to achieve linkage, and the state change of the first device can be used as the execution condition of the second device. For example, when the smart door lock is unlocked, the entrance light and the living room air conditioner can be automatically turned on. The execution condition can also be a user-defined condition. The user can set complex logical conditions to trigger the execution of the instruction according to their needs. For example, when the indoor light intensity is lower than the preset value and someone moves, the light is automatically turned on.

[0073] In an embodiment of the present application, the level corresponding to each scenario is determined based on the execution frequency of each instruction data under each scenario within a first time period; the instruction data under the first level scenario is stored in the main server; and the instruction data under the second level scenario is stored in the cloud server. By grading the scenarios, different storage schemes are adopted for instruction data under different levels of scenarios, thereby reducing the consumption of limited storage space on the main server and improving the instruction execution speed of the main server. When the execution conditions of the target instruction data are met, the target instruction data is read from the target server corresponding to the target scenario to which the target instruction data belongs; the target instruction data is sent to the target device so that the target device executes the target instruction data; after the execution of the target instruction data is completed, the execution frequency of the target instruction data is updated, the levels corresponding to each scenario are adjusted in time, and the instruction data corresponding to the scenario with high execution frequency is stored in the main server, thereby improving the instruction execution speed of the frequently executed scenario.

[0074] Optionally, when an execution condition of the target instruction data is met, reading the target instruction data from a target server corresponding to a target scenario to which the target instruction data belongs includes:

[0075] Step 11: receiving a scene trigger instruction;

[0076] Step 12: determining the target scene triggered by the scene triggering instruction according to the mapping relationship between the scene triggering instruction and the target instruction data;

[0077] Step 13: Read target instruction data corresponding to the scene trigger instruction from the target server corresponding to the target scene.

[0078] The scene trigger instruction is used to indicate the parameters of the target instruction data to be executed or the device parameters of the target device to be executed. Specifically, the scene trigger instruction may include a target device identifier, a target instruction data identifier or the target instruction data itself.

[0079] It should be noted that when the triggering methods corresponding to the scenes are different, the issuing devices of the scene triggering instructions may be different. For example, the user can manually set the scene triggering instructions through the smart home APP, control panel or voice assistant. The scene triggering instructions can also be issued by smart sensors. Sensors are one of the important data sources in the smart home system. The human body sensor can detect the movement of people and trigger the corresponding scenes; the light sensor can automatically adjust the opening and closing of the curtains and the brightness of the lights according to the indoor light intensity. The data collected by these sensors can be used as one of the sources of scene triggering instructions. Other smart devices in the smart home system can also be used as devices for issuing scene triggering instructions. For example, when the smart door lock is opened, the security system can be triggered to start recording video; when the smart refrigerator detects a shortage of food, it can trigger the generation of a shopping list, etc.

[0080] Optionally, the scene trigger instruction may also carry a target scene identifier. For example, the smart home APP or control panel displays various scenes in the smart home to the user. The user can directly select the target scene on the smart home or control panel. The smart home APP or control panel sends a scene trigger instruction carrying the target scene identifier to the main server, determines the level of the target scene, and reads the target instruction data corresponding to the scene trigger instruction from the target server corresponding to the target scene.

[0081] In an embodiment of the present application, a scene trigger instruction is received; a target scene triggered by the scene trigger instruction is determined based on a mapping relationship between the scene trigger instruction and the target instruction data; and target instruction data corresponding to the scene trigger instruction is read from a target server corresponding to the target scene to increase the speed of determining the target scene, thereby increasing the speed of executing instruction data under the scene.

[0082] Optionally, the reading target instruction data corresponding to the scene trigger instruction from the target server corresponding to the target scene includes:

[0083] Step 21: when the level corresponding to the target scene is the first level, read the target instruction data corresponding to the scene trigger instruction from the main server;

[0084] Step 22: When the level corresponding to the target scene is the second level, sending the scene trigger instruction to the cloud server;

[0085] Step 23: Receive target instruction data corresponding to the scene trigger instruction returned by the cloud server.

[0086] In the embodiment of the present application, different levels of scenes correspond to different storage methods, and the storage locations of instruction data under different levels of scenes are different. Therefore, when the user needs to use the scene, the execution method of the instruction data under the scene is different.

[0087] It should be noted that the instruction data for each scene of the first level is stored in the hard disk of the main server or other storage device; when it is determined that the level corresponding to the target scene is the first level, the target instruction data corresponding to the scene trigger instruction is read from the storage device in the main server. The cloud server is used to store the instruction data for each scene of the second level. When it is determined that the level corresponding to the target scene is the second level, the scene trigger instruction is sent to the cloud server. The cloud server determines the target instruction data corresponding to the scene trigger instruction and returns it. The main server receives the target instruction data corresponding to the scene trigger instruction returned by the cloud server.

[0088] In the embodiment of the present application, when the level corresponding to the target scene is the first level, the target instruction data corresponding to the scene trigger instruction is read from the main server; when the level corresponding to the target scene is the second level, the scene trigger instruction is sent to the cloud server; and the target instruction data corresponding to the scene trigger instruction returned by the cloud server is received. By storing instruction data under scenes of different levels in different locations, the consumption of storage space on the main server is reduced, and the execution speed of instruction data under the scene is improved.

[0089] Optionally, sending the target instruction data to a target device so that the target device executes the target instruction data includes:

[0090] Step 31, determining a data transmission protocol between the main server and the target device;

[0091] Step 32: Encode the target instruction data according to the data transmission protocol;

[0092] Step 33: Send the encoded target instruction data to the target device, so that the target device executes the encoded target instruction data.

[0093] Among them, the data transmission protocol refers to a set of communication rules and agreements established in the network to ensure that data can be transmitted and received according to established rules, formats and sequences.

[0094] For example, in the field of smart home, the data transmission protocol between the server and the terminal device can be Bluetooth, ZigBee, Z-Wave, Wireless LAN (Wireless fidelity, Wi-Fi), Message Queuing Telemetry Transport (Message Queuing Telemetry Transport, MQTT), etc. Among them, ZigBee can be used for communication between various sensors, control devices and home automation modules in smart homes. Z-Wave is a dedicated wireless communication protocol designed for home automation scenarios. The Z-Wave network is easy to expand, and each device in the Z-Wave network can be used as a signal relay point to effectively improve the coverage of the network. Wi-Fi is one of the most common wireless network protocols. It uses the IEEE802.11 standard and provides high-speed data transmission capabilities. It is suitable for scenarios such as video surveillance and music playback that require high data transmission speeds. In smart home systems, Wi-Fi is often used for high-power consumption devices such as smart speakers, cameras, and smart TVs. These devices are usually connected to the home wireless network via Wi-Fi to achieve remote control and Internet access. MQTT is a lightweight publish / subscribe messaging protocol suitable for communication between IoT devices. It can simplify communication between small devices and achieve efficient transmission under low bandwidth and unstable networks. Through the MQTT protocol, smart home devices can achieve real-time data communication and control.

[0095] It should be noted that, since different data transmission protocols correspond to different communication modes and characteristics, the data transmission protocol between the main server and the target device can be determined through network packet capture analysis, port number identification and other technologies.

[0096] After determining the type of data transmission protocol, you need to understand the data structure, field definition, encoding method, etc. corresponding to the data transmission protocol used. Determine the instruction data structure based on the application scenario and requirements. The instruction data structure should contain all necessary information, such as instruction type, operation parameters, target address, etc. Select the appropriate encoding method according to the requirements of the data transmission protocol. Common encoding methods include ASCII encoding, UTF-8 encoding, Base64 encoding, etc. The selection of encoding method should consider the efficiency and security of data transmission. Generally, for text data, common encoding methods include UTF-8, ISO-8859-1, ASCII, etc. For binary data, a specific serialization format or a custom encoding method may be required. Encode the instruction data in the format specified by the data transmission protocol. It usually involves converting the instruction data into a binary stream and organizing it according to the field order and length specified by the protocol. After the instruction data is encoded, verify the encoding result to ensure that the encoding result meets the requirements of the data transmission protocol.

[0097] In the embodiment of the present application, a data transmission protocol between the main server and the target device is determined; the target instruction data is encoded according to the data transmission protocol; and the encoded target instruction data is sent to the target device so that the target device executes the encoded target instruction data. Different transmission protocols have different characteristics and optimization strategies to reduce data storage space and transmission time, and further improve data transmission efficiency.

[0098] Optionally, if the protocol requires data compression, a compression algorithm such as gzip, deflate, etc. may be selected; a strong encryption algorithm may be used to encrypt the instruction data.

[0099] Optionally, before sending the target instruction data to a target device so that the target device executes the target instruction data, the method further includes:

[0100] Step 41, matching the device parameters carried by the target instruction data with the registration information corresponding to each device in a preset database; the preset database is used to record the registration information of each device;

[0101] Step 42: When the registration information corresponding to the first device and the device parameters match successfully, the first device is determined as a target device.

[0102] The preset database stores the registration information of each device, which usually includes the unique identifier of the device (such as model, serial number, etc.), device name, user, registration time, status, etc. The target device corresponding to the target instruction data is determined by extracting device parameters from the target instruction data and matching the device parameters with the registration information of each device in the preset database.

[0103] Exemplarily, device parameters are extracted from the target instruction data. Device parameters may include information that uniquely identifies the device, such as the device model, serial number, Media Access Control Address (MAC address), Internet Protocol Address (IP address), etc. The device parameters extracted from the target instruction data are cleaned to remove invalid characters, spaces, special symbols, etc. to ensure the accuracy and consistency of the data. According to the characteristics of the device parameters and the information stored in the preset database, a suitable matching field is selected. For example, if the device parameters contain the serial number of the device, the serial number can be selected as the matching field. A query statement is written using a database query language to match the device parameters in the target instruction data with the device registration information in the preset database. The database query statement may involve the use of a WHERE clause to specify the matching condition, such as "WHERE device serial number = 'serial number in the target instruction'". After executing the query statement, the matching result is obtained from the database, and the matching result may include detailed information of the device that matches the device parameters in the target instruction data.

[0104] In an embodiment of the present application, the device parameters carried by the target instruction data are matched with the registration information corresponding to each device in a preset database; the preset database is used to record the registration information of each device; when the registration information and device parameters corresponding to the first device match successfully, the first device is determined as the target device, thereby increasing the speed of determining the target device, thereby increasing the speed of transmitting the instruction data to the target device.

[0105] Optionally, determining the level corresponding to each scenario according to the execution frequency of each instruction data in each scenario within the first time period includes:

[0106] Step 51: When the execution frequency of each instruction data in the first scenario is greater than or equal to the first preset frequency, determine that the level corresponding to the first scenario is the first level; the first scenario is one of the scenarios;

[0107] Step 52: When the execution frequency of each instruction data in the first scenario is less than the first preset frequency and greater than or equal to the second preset frequency, determine that the level corresponding to the first scenario is the second level.

[0108] Among them, the execution frequency of each instruction data in the first scenario can be determined by recording the execution timestamp of each instruction data and counting the number of executions within a certain period of time. The user can set a first preset frequency for the first scenario according to actual needs. This frequency is a threshold value used to determine whether the execution of the first scenario is frequent enough to determine the level corresponding to the first scenario as the first level. According to a preset period (such as every minute, every hour, etc.), the actual execution frequency of each instruction in the first scenario is compared with the first preset frequency and the second preset frequency, and the level corresponding to the first scenario is updated in time. If the execution frequency of each instruction data in the first scenario is greater than or equal to the first preset frequency, the level of the first scenario is determined to be the first level, and the level of the first scenario is the first level, which means that the first scenario is a scene that is frequently executed within a period of time. If the execution frequency of each instruction data in the first scenario is less than the first preset frequency and greater than or equal to the second preset frequency, the level of the first scenario is determined to be the second level.

[0109] Optionally, a third preset frequency may be set, and when the execution frequency of each instruction data in the first scenario is less than the second preset frequency and greater than or equal to the third preset frequency, the level corresponding to the first scenario is determined to be the third level. It is understandable that the number of preset frequencies set is the same as the number of corresponding levels.

[0110] In the embodiment of the present application, when the execution frequency of each instruction data in the first scenario is greater than or equal to the first preset frequency, the level corresponding to the first scenario is determined to be the first level; when the execution frequency of each instruction data in the first scenario is less than the first preset frequency and greater than or equal to the second preset frequency, the level corresponding to the first scenario is determined to be the second level. Different storage schemes are adopted for the scenario data corresponding to scenarios with different execution times, so as to reduce the consumption of the storage space of the main server and improve the response speed of scenarios frequently used by users.

[0111] Optionally, the method further comprises:

[0112] Step 61: Store the description data corresponding to the second level scene in the main server;

[0113] Step 62: Send the description data to the client, so that the client generates scene items on the user interface based on the description data for user selection.

[0114] It should be noted that the scene data corresponding to each scene may include description data, condition data, and instruction data. The description data is used to describe the scene information, the condition data is used to indicate the execution conditions corresponding to each instruction in the scene, and the instruction data is used to control each device in the scene. The description data may be in the form of scene identification, scene name, scene picture, etc. The condition data may include: time conditions, environmental conditions, action conditions, among which the environmental conditions may include temperature conditions and humidity conditions; the action conditions may be user behavior or device state changes. The instruction data may include device identification, control instructions, device keys, and device locations.

[0115] In an embodiment of the present application, the execution frequency of each instruction data under the first-level scenario is greater than the execution frequency of each instruction data under the second-level scenario. The scene data corresponding to the first-level scenario is stored in the main server; the description data corresponding to the second-level scenario is stored in the main server, and the instruction data and condition data are stored in the cloud server. The description data corresponding to the first-level scenario and the description data corresponding to the second-level scenario are sent to the client, so that the client generates scene items in the user interface based on the description data for user selection. The client forms a scene list based on the description data corresponding to multiple scenes, generates a scene item in the list based on the description data corresponding to each scene, and sorts the scene items in the scene list according to the execution frequency corresponding to each instruction under each scene. The higher the execution frequency of each instruction under the scene, the higher the sorting in the scene list, and the easier it is to appear in the user's field of view for user selection.

[0116] It should be noted that the user interface on the client can also provide browsing controls and enabling controls. By clicking the browsing controls, you can jump to the details page to preview the scene details. The scene details refer to the execution conditions corresponding to each instruction data under the scene and the corresponding scene; by clicking the enabling control, you can send an execution request to the main server. The main server can determine the execution frequency of the instruction data under each scene based on the number of execution requests corresponding to each scene received, and then determine the level corresponding to each scene. Among them, for the first level scene, when the browsing control corresponding to the scene is clicked in the user interface, the details data corresponding to the scene is obtained from the main server and displayed on the details page; for the second level scene, when the browsing control corresponding to the scene is clicked in the user interface, the details data corresponding to the scene is obtained from the cloud server and displayed on the details page.

[0117] Optionally, in the case of a third-level scenario, the execution frequency of each instruction in the third-level scenario is less than the execution frequency of each instruction in the second-level scenario, and the scenario data corresponding to the third-level scenario is stored in the cloud server. The description data corresponding to the third-level scenario is not displayed in the user interface, and the description data corresponding to the third-level scenario can be obtained from the cloud server and displayed in the user interface by clicking the drop-down arrow in the scenario list.

[0118] In the embodiment of the present application, the description data corresponding to the second-level scene is stored in the main server; the description data is sent to the client, so that the client generates scene items in the user interface based on the description data for the user to select. Each scene is graded, the scene data corresponding to the frequently used scenes is stored locally on the main server, the description data corresponding to the scenes with less frequency of use is stored in the main server, and the other data is stored in the cloud server, and obtained from the cloud server when needed, which can reduce the consumption of the limited storage space of the home host, improve the response speed of the main server, and enhance the user experience.

[0119] In summary, the instruction execution method provided in the embodiment of the present application can determine the level corresponding to each scene according to the execution frequency of each instruction data in each scene within the first time period; store the instruction data in the first level scene in the main server; and store the instruction data in the second level scene in the cloud server. By grading the scenes, different storage schemes are adopted for the instruction data in different levels of scenes, thereby reducing the consumption of the limited storage space of the main server and improving the instruction execution speed of the main server. When the execution conditions of the target instruction data are met, the target instruction data is read from the target server corresponding to the target scene to which the target instruction data belongs; the target instruction data is sent to the target device so that the target device executes the target instruction data; after the execution of the target instruction data is completed, the execution frequency of the target instruction data is updated, the levels corresponding to each scene are adjusted in time, and the instruction data corresponding to the scene with high execution frequency is stored in the main server, thereby improving the instruction execution speed of the frequently executed scenes.

[0120] Device Embodiment

[0121] like Figure 4 As shown, Figure 4 A logic block diagram of an instruction execution device provided in an embodiment of the present application is shown, and the device may include:

[0122] A determination module 410, configured to determine a level corresponding to each scenario according to the execution frequency of each instruction data under each scenario in the first time period;

[0123] A first storage module 420, configured to store instruction data in a first level scenario in the main server;

[0124] The second storage module 430 is used to store the instruction data in the second level scenario in the cloud server;

[0125] A reading module 440 is used to read the target instruction data from a target server corresponding to the target scenario to which the target instruction data belongs when an execution condition of the target instruction data is met;

[0126] A sending module 450, configured to send the target instruction data to a target device so that the target device executes the target instruction data;

[0127] The updating module 460 is used to update the execution frequency of the target instruction data after the execution of the target instruction data is completed.

[0128] Optionally, the reading module includes:

[0129] A receiving module, used for receiving a scene triggering instruction;

[0130] A first determination submodule, configured to determine a target scene triggered by the scene triggering instruction according to a mapping relationship between the scene triggering instruction and the target instruction data;

[0131] The first reading submodule is used to read the target instruction data corresponding to the scene triggering instruction from the target server corresponding to the target scene.

[0132] Optionally, the reading submodule includes:

[0133] a reading unit, configured to read target instruction data corresponding to the scene trigger instruction from the main server when the level corresponding to the target scene is the first level;

[0134] a sending submodule, configured to send the scene trigger instruction to the cloud server when the level corresponding to the target scene is the second level;

[0135] The receiving module is used to receive the target instruction data corresponding to the scene trigger instruction returned by the cloud server.

[0136] Optionally, the sending submodule includes:

[0137] A first determining unit, configured to determine a data transmission protocol between the main server and the target device;

[0138] an encoding unit, configured to encode the target instruction data according to the data transmission protocol;

[0139] The sending unit is used to send the encoded target instruction data to the target device so that the target device executes the encoded target instruction data.

[0140] Optionally, the device further comprises:

[0141] A matching module, used to match the device parameters carried by the target instruction data with the registration information corresponding to each device in a preset database; the preset database is used to record the registration information of each device;

[0142] The second determination module is configured to determine the first device as a target device if the registration information corresponding to the first device matches the device parameters successfully.

[0143] Optionally, the first determining module includes:

[0144] A second determining submodule is used to determine that the level corresponding to the first scenario is a first level when the execution frequency of each instruction data in the first scenario is greater than or equal to the first preset frequency; the first scenario is one of the scenarios;

[0145] The third determining submodule is used to determine that the level corresponding to the first scenario is the second level when the execution frequency of each instruction data in the first scenario is less than the first preset frequency and greater than or equal to the second preset frequency.

[0146] Optionally, the method further comprises:

[0147] A third storage module, used to store description data corresponding to the second level scene in the main server;

[0148] The second sending module is used to send the description data to the client, so that the client generates scene items on the user interface based on the description data for user selection.

[0149] In summary, the instruction execution device provided in the embodiment of the present application can determine the level corresponding to each scene according to the execution frequency of each instruction data in each scene within the first time period; store the instruction data in the first level scene in the main server; and store the instruction data in the second level scene in the cloud server. By grading the scenes, different storage schemes are adopted for the instruction data in different levels of scenes, thereby reducing the consumption of the limited storage space of the main server and improving the instruction execution speed of the main server. When the execution conditions of the target instruction data are met, the target instruction data is read from the target server corresponding to the target scene to which the target instruction data belongs; the target instruction data is sent to the target device so that the target device executes the target instruction data; after the execution of the target instruction data is completed, the execution frequency of the target instruction data is updated, the levels corresponding to each scene are adjusted in time, and the instruction data corresponding to the scene with high execution frequency is stored in the main server, thereby improving the instruction execution speed of the frequently executed scenes.

[0150] The instruction execution device in the embodiment of the present application can be an electronic device, or a component in the electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal, or it can be other devices other than a terminal. Exemplarily, the electronic device can be a GPU BOX, a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted electronic device, a mobile Internet device (Mobile Internet Device, MID), an augmented reality (augmented reality, AR) / virtual reality (virtual reality, VR) device, a robot, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant, PDA), etc., and can also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.

[0151] The instruction execution device provided in the embodiment of the present application can realize Figure 1 To avoid repetition, the various processes implemented by the method embodiment are not described here.

[0152] Alternatively, if Figure 5 As shown, an embodiment of the present application also provides an electronic device, including a processor and a memory, wherein the memory stores programs or instructions that can be run on the processor, and when the program or instructions are executed by the processor, the various steps of the above-mentioned instruction execution method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, they are not described here.

[0153] In an embodiment of the present application, the memory may be used to store software programs and various data. The memory may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, an application program or instructions required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory may include a volatile memory or a non-volatile memory, or the memory may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDRSDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synchronous link dynamic random access memory (SLDRAM) and a direct memory bus random access memory (DRRAM). The memory in the embodiments of the present application includes but is not limited to these and any other suitable types of memory.

[0154] The processor may include one or more processing units; optionally, the processor integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to the operating system, user interface, and application programs, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It is understandable that the modem processor may not be integrated into the processor.

[0155] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the various processes of the above-mentioned instruction execution method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0156] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.

[0157] An embodiment of the present application provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the above-mentioned instruction execution method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0158] It should be noted that, in this article, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises one..." does not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted or combined. In addition, the features described with reference to certain examples may be combined in other examples.

[0159] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the relevant technology, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0160] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.

Claims

1. A method for executing an instruction, characterized in that: Applied to the main server, the method comprises: Determine the level corresponding to each scenario according to the execution frequency of each instruction data under each scenario in the first time period; storing the instruction data in the first level scenario in the main server; Storing the instruction data in the second level scenario in the cloud server; When the execution condition of the target instruction data is met, reading the target instruction data from the target server corresponding to the target scenario to which the target instruction data belongs; Sending the target instruction data to a target device so that the target device executes the target instruction data; After the target instruction data is executed, the execution frequency of the target instruction data is updated.

2. The method according to claim 1, characterized in that The step of reading the target instruction data from a target server corresponding to a target scenario to which the target instruction data belongs, when an execution condition of the target instruction data is met, comprises: Receive scene trigger instructions; Determining a target scene triggered by the scene triggering instruction according to a mapping relationship between the scene triggering instruction and the target instruction data; The target instruction data corresponding to the scene trigger instruction is read from the target server corresponding to the target scene.

3. The method according to claim 2, characterized in that The step of reading target instruction data corresponding to the scene trigger instruction from the target server corresponding to the target scene includes: When the level corresponding to the target scene is the first level, reading target instruction data corresponding to the scene trigger instruction from the main server; When the level corresponding to the target scene is the second level, sending the scene trigger instruction to the cloud server; Receive target instruction data corresponding to the scene trigger instruction returned by the cloud server.

4. The method according to claim 1, characterized in that The step of sending the target instruction data to a target device so that the target device executes the target instruction data includes: Determining a data transmission protocol between the host server and the target device; encoding the target instruction data according to the data transmission protocol; The encoded target instruction data is sent to the target device so that the target device executes the encoded target instruction data.

5. The method according to claim 1, characterized in that Before sending the target instruction data to the target device so that the target device executes the target instruction data, the method further includes: Matching the device parameters carried by the target instruction data with the registration information corresponding to each device in a preset database; the preset database is used to record the registration information of each device; When the registration information corresponding to the first device matches the device parameters successfully, the first device is determined as the target device.

6. The method according to claim 1, characterized in that Determining the level corresponding to each scenario according to the execution frequency of each instruction data in each scenario within the first time period includes: When the execution frequency of each instruction data in the first scenario is greater than or equal to the first preset frequency, determining that the level corresponding to the first scenario is the first level; the first scenario is one of the scenarios; When the execution frequency of each instruction data in the first scenario is less than the first preset frequency and greater than or equal to the second preset frequency, it is determined that the level corresponding to the first scenario is the second level.

7. The method according to claim 1, characterized in that The method further comprises: storing description data corresponding to the second level scene in the main server; The description data is sent to a client, so that the client generates scene items on a user interface based on the description data for user selection.

8. An instruction execution device, characterized in that: The device comprises: A first determination module, used to determine the level corresponding to each scenario according to the execution frequency of each instruction data in each scenario within a first time period; A first storage module, used for storing instruction data in a first level scenario in the main server; A second storage module, used for storing the instruction data in the second level scenario in the cloud server; A reading module, configured to read the target instruction data from a target server corresponding to a target scenario to which the target instruction data belongs, when an execution condition of the target instruction data is met; A first sending module, used for sending the target instruction data to a target device so that the target device executes the target instruction data; The updating module is used to update the execution frequency of the target instruction data after the execution of the target instruction data is completed.

9. The device according to claim 8, characterized in that The reading module comprises: A receiving module, used for receiving a scene triggering instruction; A first determination submodule, configured to determine a target scene triggered by the scene triggering instruction according to a mapping relationship between the scene triggering instruction and the target instruction data; The first reading submodule is used to read the target instruction data corresponding to the scene triggering instruction from the target server corresponding to the target scene.

10. An electronic device, characterized in that: The electronic device comprises a processor, a memory, a communication interface and a communication bus, and the processor, the memory and the communication interface communicate with each other via the communication bus; The memory is used to store executable instructions, and the executable instructions enable the processor to execute the instruction execution method as described in any one of 1 to 7.

11. A readable storage medium, characterized in that: The readable storage medium stores a program or an instruction, and when the program or the instruction is executed by the processor, the instruction execution method according to any one of claims 1 to 7 is implemented.

12. A computer program product, characterized in that The method comprises instructions or transactions, which, when executed by a processor in an electronic device, cause the electronic device to execute the instruction execution method according to any one of claims 1 to 7.