Task execution method and device based on rule engine, terminal and medium
By introducing methods such as target rule acquisition, rule node deployment and environmental information processing in the rule engine, the shortcomings of the existing rule engine in complex logic and large-scale application scenarios are solved, and effective support for the intelligent office environment and device linkage control are achieved.
Patent Information
- Application Number
- CN202411790848.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-06
- Publication Date
- 2025-04-18
- Estimated Expiration
- 2044-12-06
AI Technical Summary
The existing rule engines seem unscrupulous when dealing with complex logic and large-scale application scenarios, and cannot meet the actual needs of intelligent office environments such as large offices.
A task execution method based on a rule engine is provided, by acquiring target rules, deploying rule nodes, acquiring environment information, and instructing the device to perform actions according to trigger conditions. This method supports rule delay execution, range time execution, timing execution, and enhanced rule configuration, and can handle complex logic and multi-rule combinations.
It realizes effective support for complex logic and large-scale application scenarios, can meet the needs of an intelligent office environment, improves the flexibility and accuracy of equipment linkage control, and brings convenience and energy-saving effects.
Smart Images

Figure CN119847012A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of Internet of Things, and in particular to a task execution method, device, terminal and medium based on a rule engine. Background Art
[0002] In the current intelligent office environment, rule engines, as the core components of automated control systems, play a vital role. However, existing rule engines have certain limitations in terms of functions and application scope. They only support parsing simple rules and then executing them serially or in parallel. They are particularly incapable of dealing with complex logic and large-scale application scenarios, and cannot meet the actual needs of intelligent office environments such as large offices. Therefore, there is an urgent need for an enhanced rule engine that can flexibly configure rules to meet the growing demand for intelligent offices.
[0003] Therefore, the prior art still needs to be improved and enhanced. Summary of the invention
[0004] The main purpose of the present invention is to provide a task execution method, device, terminal and medium based on a rule engine, aiming to solve the problem that the rule engine in the prior art only supports simple rules and cannot be used in complex application scenarios.
[0005] In order to achieve the above object, the first aspect of the present invention provides a task execution method based on a rule engine, wherein the task execution method based on a rule engine comprises:
[0006] Obtain target rules, and obtain the number and location of nodes, target trigger conditions, and rule execution logic based on the target rules;
[0007] Deploy rule nodes based on the number and location of the nodes, where the rule nodes are one or more;
[0008] Acquire target environment information based on the rule node;
[0009] When the target environment information meets the target trigger condition, the target device is instructed to perform the target action.
[0010] In one implementation, the target rule includes:
[0011] The rule delayed execution function is used to delay instructing the target device to execute the target action according to a preset delay time when the target environment information meets the target trigger condition.
[0012] In one implementation, the target rule further includes:
[0013] A range time execution function is used to set a time range for the rule to take effect, so that the target device executes the target action within a target time range corresponding to the target rule.
[0014] In one implementation, the target rule further includes:
[0015] The scheduled execution function is used to set the time point when the rule takes effect, so that the target device sets the start execution time of the target rule according to the month, week or Cron expression.
[0016] In one implementation, the target rule further includes:
[0017] Enhanced rules, wherein the enhanced rules support complex logic configuration of multiple rules, including but not limited to the combination of logical "or", logical "and" and logical "not".
[0018] In one implementation, the rule engine-based task execution method further includes:
[0019] Report the execution results to the cloud or local management system for energy consumption statistics, troubleshooting or other management purposes.
[0020] In one implementation, the rule engine-based task execution method further includes:
[0021] The usage status of the language plug-in in the device is detected at intervals of a first preset time, and if it is detected that the target language plug-in has not been used for more than a second preset time, the target language plug-in is automatically uninstalled.
[0022] A second aspect of the present invention is a task execution device based on a rule engine, comprising:
[0023] A logic configuration module, used to obtain target rules, and based on the target rules, obtain the number and location of nodes, target trigger conditions, and rule execution logic;
[0024] A node deployment module, used to deploy rule nodes based on the number and location of the nodes, where the rule nodes are one or more;
[0025] An environment information acquisition module, used to acquire target environment information based on the rule node;
[0026] The judgment module is used to instruct the target device to execute the target action when the target environment information meets the target trigger condition.
[0027] According to a third aspect of the present invention, a terminal is provided, wherein the terminal comprises: a memory, a processor, and a task execution program based on a rule engine stored in the memory and executable on the processor, wherein the task execution program based on the rule engine implements the steps of the task execution method based on the rule engine as described above when the task execution program based on the rule engine is executed by the processor.
[0028] A fourth aspect of the present invention provides a computer-readable storage medium, wherein the computer storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps of any of the above-mentioned rule engine-based task execution methods.
[0029] Beneficial effects: Compared with the prior art, the present invention provides a task execution method, device, terminal and medium based on a rule engine. In the task execution method based on a rule engine provided by the present invention, when it is necessary to execute a rule task, the target rule given by the user is first obtained, the number and position of nodes, the target trigger condition and the rule execution logic are obtained based on the target rule, and then the rule node is deployed based on the number and position of nodes, and the rule node is one or more. After that, the target environment information is obtained based on the rule node, and when the target environment information meets the target trigger condition, the target device is instructed to execute the target action. The present invention provides a task execution method based on a rule engine for users, which solves the problem that the rule engine in the prior art only supports simple rules and cannot be used in complex application scenarios. In the present invention, node configuration and logic execution are performed by analyzing the rules given by the user, and it no longer only supports parsing simple rules, but makes judgments based on the trigger conditions and rule execution logic combined with environmental information to instruct the target device to execute related actions, which can meet the linkage control of terminal devices in various complex scenarios, and bring great convenience and energy saving effects to people's lives and work. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 A flowchart of an embodiment of a task execution method based on a rule engine provided by the present invention;
[0031] Figure 2 A structural principle diagram of an embodiment of a task execution device based on a rule engine provided by the present invention;
[0032] Figure 3 A schematic diagram of an operating environment of an embodiment of a terminal provided by the present invention. DETAILED DESCRIPTION
[0033] In order to make the purpose, technical solution and effect of the present invention clearer and more specific, the present invention is further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0034] It will be understood by those skilled in the art that, unless expressly stated, the singular forms "one", "said", and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of the present invention refers to the presence of the features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof. It should be understood that when we refer to an element as being "connected" or "coupled" to another element, it may be directly connected or coupled to the other element, or there may be intermediate elements. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The term "and / or" used herein includes all or any unit and all combinations of one or more associated listed items.
[0035] It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as generally understood by those skilled in the art in the art to which the present invention belongs. It should also be understood that terms such as those defined in general dictionaries should be understood to have meanings consistent with the meanings in the context of the prior art, and will not be interpreted with idealized or overly formal meanings unless specifically defined as herein.
[0036] A task execution method based on a rule engine provided by the present invention can be applied to a terminal with computing capabilities, and the terminal can execute the task execution method based on a rule engine provided by the present invention to perform linkage control of devices.
[0037] Embodiment 1
[0038] In the current intelligent office environment, rule engines, as the core components of automated control systems, play a vital role. However, existing rule engines have certain limitations in terms of functions and application scope, especially when dealing with complex logic and large-scale application scenarios.
[0039] Take large offices as an example. These places usually have many workstations, and in order to improve the comfort and energy saving of the office environment, human sensors are widely deployed in the office area. These sensors can monitor the activities of people in the office area in real time, thereby providing key environmental information for the automation control system. However, when dealing with such complex application scenarios, existing rule engines can only support the parsing and execution of simple rules, such as the trigger condition judgment of a single sensor and the control instruction sending of a single device.
[0040] Specifically, when it is necessary to implement the complex logic of "turn on the lights and air conditioner when any human body sensor senses someone, and turn off the lights and air conditioner when all human body sensors sense no one", the existing rule engines are stretched. This is because they can usually only execute simple preset rules in serial or parallel, and cannot make dynamic logical judgments and decisions based on the real-time status of multiple sensors. This limitation makes it impossible for existing rule engines to effectively integrate and utilize information from multiple sensors, and thus cannot achieve refined environmental control and energy saving effects.
[0041] In addition, existing rule engines are also unable to cope with large-scale application scenarios. In large offices, due to the large number of human body sensors and their wide distribution, the rule engine needs to have efficient data processing capabilities and flexible rule configuration capabilities. However, existing rule engines often encounter performance bottlenecks when processing large amounts of data, and the rule configuration process is cumbersome and complex, making it difficult to adapt to rapidly changing application needs.
[0042] In summary, the existing rule engines have obvious limitations in processing complex logic and large-scale application scenarios, and cannot meet the actual needs of intelligent office environments such as large offices. Therefore, there is an urgent need for an enhanced rule engine that can support complex logical judgment, efficient data processing, and flexible rule configuration to meet the growing needs of intelligent office.
[0043] Specifically, Figure 1 As shown, the task execution method based on the rule engine provided in this embodiment includes the steps of:
[0044] S100, obtaining target rules, and obtaining the number and location of nodes, target triggering conditions and rule execution logic based on the target rules.
[0045] Specifically, the user configures multiple rules through a graphical interface or a programming interface, each rule includes at least one rule node as the rule node, each rule node is associated with at least one sensor or device, and defines the triggering condition and execution action of the rule node. In this embodiment, the task execution method is implemented based on the target rule given by the user.
[0046] Obtaining the target rule is the first step of the entire process, which usually means selecting a specific rule from a preset rule library or a dynamically generated rule set as the operating benchmark. The target rule defines in detail the key information required for subsequent steps, including but not limited to the number and location of nodes, the target trigger condition, and the rule execution logic.
[0047] In this embodiment, specific rule tasks are executed based on an enhanced rule engine system. The enhanced rule engine system includes a deployment module, an environment information acquisition module, a logic judgment module, an action execution module, a rule management module, and a cloud communication module. Through efficient data transmission and collaborative working mechanisms between the modules, precise control and energy consumption management of multiple devices in an intelligent environment are achieved.
[0048] The deployment module is responsible for deploying one or more sensors as the rule nodes in the scene according to the number and location of nodes specified in the target rule. Each rule node can perform actions such as reading temperature, determining whether there is someone, and compare the execution result with the preset condition to set the node status to true or false.
[0049] The environment information acquisition module acquires target environment information in real time through the rule node, including but not limited to temperature, humidity, light intensity, human presence status, etc. Such information provides necessary input data for the logic judgment module.
[0050] As one of the core components, the logic judgment module judges the status of all the rule nodes in turn according to the target trigger condition and the rule execution logic. The logic judgment module will trigger the execution of subsequent actions only when all nodes meet their respective trigger conditions. In addition, the logic judgment module also supports complex logic configurations, including but not limited to the combination of logic "or" and logic "and", as well as more complex nested logic judgments.
[0051] The action execution module is responsible for executing actions such as turning off lights, turning off air conditioners, adjusting curtains, etc. after the logic judgment module confirms that all conditions are met. The action execution module interacts with the communication interface of other smart devices to achieve precise control of multiple devices in the intelligent environment.
[0052] The rule management module provides comprehensive management functions for rules. It supports the setting of delayed execution of rules, set time to take effect, complex logic configuration, and scheduled execution. Users can easily create, modify, and delete rules through the rule management module to adapt to different application scenarios and needs.
[0053] The cloud communication module is responsible for reporting the triggering event and related environmental information to the cloud after the rule is executed. The cloud can count, analyze and store the reported data for energy consumption statistics, environmental analysis and further intelligent decision-making. In addition, the cloud communication module also supports remote management of the device and firmware upgrades.
[0054] Specifically, the user configures the target rule to the enhanced rule engine system through a graphical interface or a programming interface.
[0055] After receiving the target rule, the enhanced rule engine system obtains the number and location of nodes, target triggering conditions and rule execution logic based on the target rule.
[0056] Specifically, firstly, the rule execution logic is generated by parsing the rules configured by the user, and the rule execution logic is stored in the rule database to obtain the number and location of nodes, target trigger conditions and rule execution logic.
[0057] Specifically, the target rules include:
[0058] The rule delayed execution function is used to delay instructing the target device to execute the target action according to a preset delay time when the target environment information meets the target trigger condition.
[0059] The rule delay execution function is an advanced automation control mechanism that is flexible and practical, and is designed to precisely control the timing of device operations according to specific conditions. The core of this function is its ability to monitor the information status of the target environment. Once this information meets the preset trigger conditions, it will not immediately trigger the device's action execution, but will wait according to the pre-set delay time, and then instruct the target device to perform the corresponding target action. This design allows the system to control the operation sequence more finely to adapt to various complex application scenarios, such as in smart homes, industrial automation, security monitoring and other fields.
[0060] Taking the smart home system as an example, a rule delay execution function is set to optimize the home lighting system. Specifically, the rule is set as follows: when the system detects through the sensor that the light intensity in the living room is lower than the target brightness threshold, that is, when the environment becomes darker and the conditions for turning on the lights are met, and at this time the human motion sensor in the living room detects human activity, that is, "someone" is detected, it is determined that the target trigger condition is met, and generally, the lights will be turned on immediately. However, if the rule delay execution function is set, the lights in the living room will not be turned on immediately, but will wait for a preset delay time, such as 5 seconds as the preset delay time.
[0061] This short delay can effectively prevent the lights from being accidentally activated due to a brief passage of people or a brief fluctuation in light, thereby improving the user experience and reducing unnecessary energy consumption.
[0062] During this 5-second delay, the system will continue to monitor environmental information to ensure that the triggering conditions are still met. If during this period, the light intensity returns to a sufficiently bright state or the human motion sensor no longer detects activity, the previously set light-on instruction will be canceled. Conversely, if the conditions are still met after 5 seconds, the system will instruct the living room lighting equipment to perform the turn-on action, thereby achieving more intelligent and energy-saving lighting control.
[0063] In this way, the delayed execution of rules not only improves the flexibility and accuracy of the automation system, but also helps to optimize resource usage, reduce unnecessary operations, and provide users with a more intimate and efficient smart life experience.
[0064] In this embodiment, the target rule also includes:
[0065] A range time execution function is used to set a time range for the rule to take effect, so that the target device executes the target action within a target time range corresponding to the target rule.
[0066] The scoped time execution feature is a powerful time management feature that allows users or system administrators to set a clear time frame for specific automation rules, ensuring that these rules are only effective during the specified time period. The core value of this feature lies in its ability to precisely control when the target device executes the target action based on these rules, thereby meeting various complex business needs and life scenarios.
[0067] Specifically, the range time execution function allows users to define the start time and end time of the rule to form an effective time window. Within this time window, if other conditions of the target rule (such as environmental detection, state change, etc.) are also met, the target device will perform the corresponding action as instructed by the rule. Once the time exceeds this range, even if other conditions are met, the rule will not trigger the device's action execution.
[0068] Take the temperature control system in the home automation system as an example, set a range time execution function to optimize energy use. Suppose the user wants to automatically start the heating system to increase the room temperature if the indoor temperature is lower than the set comfort temperature (such as 18 degrees Celsius) between 10 pm and 6 am every day. This rule contains a clear time range, that is, 10 pm to 6 am, and a temperature-based target condition.
[0069] In this example, the range time execution function ensures that the heating system automatically operates according to temperature conditions only at night when people are usually at rest. This not only keeps the bedroom warm and comfortable, but also effectively avoids unnecessary energy consumption during the day or when people are out, thereby achieving the goal of energy saving and emission reduction.
[0070] In addition, the range time execution function can be combined with other automation rules to create more complex and sophisticated control strategies. For example, combined with light sensors and human motion detectors, the rules can be further refined to automatically adjust the heating or cooling system according to temperature conditions only in rooms with people at night.
[0071] In general, the range time execution function provides powerful time management capabilities for the automation control system, enabling the system to flexibly adjust the operation timing of the equipment according to actual needs, thereby optimizing resource utilization and improving user experience.
[0072] In this embodiment, the target rule also includes:
[0073] The scheduled execution function is used to set the time point when the rule takes effect, so that the target device sets the start execution time of the target rule according to the month, week or Cron expression.
[0074] The scheduled execution function is also a highly flexible and powerful automatic control feature. It allows users or system administrators to set precise execution time points for specific rules, ensuring that the target device can accurately execute the corresponding actions at the preset time. The core of this function is that it can define the specific time when the rules take effect based on complex time scheduling mechanisms such as months, weeks or Cron expressions, thereby meeting various complex business needs and life scenarios.
[0075] Specifically, the scheduled execution function supports multiple time setting methods. Among them, the monthly time setting allows users to specify a certain day or days in a month as the execution day for the rule; the weekly time setting allows users to select a certain day or days in a week, as well as a specific time period in a day as the execution time; and the Cron expression provides a more flexible and powerful time setting method, which allows users to define complex execution plans through a specific string format, including time conditions in multiple dimensions such as minutes, hours, days, months, and days of the week.
[0076] For example, the smart irrigation system in the home automation system can be used to optimize the water management of plants using the scheduled execution function. Suppose the user wants to automatically start the irrigation system at 6 am on Monday, Wednesday and Friday every week to water the garden. This rule can be set using the scheduled execution function. Specifically, the user can choose the weekly time setting method, and then specify Monday, Wednesday and Friday as the execution days, and 6 am as the execution time.
[0077] In this example, the scheduled execution function ensures that the irrigation system can automatically run at a fixed time every week to provide the garden with the right amount of water. This not only keeps the plants growing healthy, but also avoids plant damage caused by forgetting to water or watering at the wrong time.
[0078] In addition, the timed execution function can be combined with other automation rules to create more complex and sophisticated control strategies. For example, combining soil moisture sensors and weather forecast data can further refine the rules to start the irrigation system at a specified time only when the soil moisture is below a certain threshold and there is no rainfall forecast in the next few days.
[0079] In general, the scheduled execution function provides a powerful time scheduling capability for the automation control system, allowing the system to flexibly adjust the operation timing of the equipment according to actual needs, thereby optimizing resource utilization and improving user experience. Whether it is home automation, industrial automation or other fields, the scheduled execution function plays a vital role.
[0080] In this embodiment, the target rule also includes:
[0081] Enhanced rules, wherein the enhanced rules support complex logic configuration of multiple rules, including but not limited to the combination of logical "or", logical "and" and logical "not".
[0082] Enhanced rules can expand the flexibility and complexity of rule configuration. By supporting complex logic configuration of multiple rules, enhanced rules allow users or system administrators to create combination rules containing multiple logical operations such as logical "OR", logical "AND" and logical "NOT". The combination of these logical operators enables the system to implement more sophisticated and complex control logic based on multiple conditions and variables.
[0083] Logical "OR" allows the rule to trigger an action when any one condition is met, while logical "AND" requires all conditions to be met at the same time to trigger an action. Logical "NOT" is used to invert the state of a condition, that is, trigger an action when the condition is not met, or not trigger an action when the condition is met. By combining these logical operators, users can create rules that can handle a variety of complex scenarios.
[0084] Taking the smart home system as an example, in this embodiment, an enhanced rule is used to design a complex lighting control strategy. Specifically, if you want to automatically turn on the lights in the living room in any of the following situations: 1) the light intensity in the living room is lower than a certain threshold; 2) the human motion sensor in the living room detects human activity; 3) the TV in the living room is turned on. This rule can be implemented through logical "or". As long as any of the above three conditions is met, the lights in the living room will be automatically turned on.
[0085] Furthermore, more conditions can be added to this rule, and the control logic can be refined using logical "and" and logical "not". For example, an additional condition can be set: if the curtains in the living room are closed, the light will not turn on immediately even if any of the above three conditions are met. This additional condition can be implemented by logical "and" and logical "not", that is, the light will turn on only when the curtains are open (logical "not" curtain closed state) and any of the above three conditions are met.
[0086] Through such enhanced rule configuration, the smart home system can more accurately understand the needs of users and provide intelligent services in various complex scenarios. Whether it is home automation, industrial automation or other fields, enhanced rules provide users with more powerful control capabilities and more flexible configuration options, allowing the automation control system to better adapt to various practical application scenarios.
[0087] After obtaining the number and location of nodes, the following steps are also included:
[0088] S200. Deploy rule nodes based on the number and location of the nodes, where the rule nodes are one or more.
[0089] Each of the rule nodes is an independent unit for executing the target rule, and is used to determine whether the target trigger condition is met based on feedback from a local sensor.
[0090] Specifically, each of the rule nodes plays the role of an indispensable and highly autonomous independent unit in the process of executing the target rule. They are not only relay stations for data flow or signal processing, but also a key link in intelligent decision-making. The rule nodes can directly receive and parse instant feedback data from local sensors, which usually covers environmental parameters, device status, user behavior patterns and other information.
[0091] Based on these detailed and real-time local sensor data, the rule node can quickly and accurately determine whether the current environment or device status has reached the trigger condition preset in the target rule. This process often involves complex logical operations and condition matching, but thanks to advanced algorithm optimization and hardware support, these judgments can be completed within milliseconds, ensuring the timeliness and accuracy of the system response.
[0092] Specifically, after obtaining the number and location of nodes of the target rule, the corresponding rule nodes are deployed in the system based on the number and location information of nodes provided in the target rule. These rule nodes can be logic judgment points at the software level or sensors or actuators at the hardware level. The number may be one or more, depending on the complexity and coverage of the rules. Continuing with the example of smart home security rules, one or more sensor nodes (such as door and window sensors) need to be deployed to monitor the window status, as well as one or more logic judgment nodes (possibly in the smart hub) to process the combination logic of the unmanned state and the window status.
[0093] Specifically, for complex logic scenarios, multiple sensors are deployed in the scenario, and each sensor is used as a rule node. Each rule node can perform actions independently, such as reading the temperature and determining whether there is someone. After the action is executed, it is judged against the preset conditions, and if the conditions are met, the node state is set to true. Other nodes are judged in turn according to this requirement, and when all nodes meet the conditions, subsequent actions are executed, such as turning off lights and air conditioners.
[0094] S300, acquiring target environment information based on the rule node;
[0095] After deploying the rule nodes, the system will start to collect information about the environment where these nodes are located, that is, the target environment information. This includes data on whether the windows are closed, whether there are people at home (which may be determined by cameras, human motion sensors, or mobile phone GPS positioning), etc. This information is the basis for determining whether subsequent actions need to be performed.
[0096] S400: When the target environment information meets the target trigger condition, instruct the target device to execute the target action.
[0097] When the target environment information monitored by the system meets the target trigger condition, that is, no one is at home and at least one window is not closed, the system will immediately instruct the target device to perform the preset target action. In this example, the target action may be to activate the home alarm system, sound and / or send an emergency notification to the user's mobile phone to remind the user that there may be safety hazards at home.
[0098] In this embodiment, the rule node is independent, can process data, and can independently decide whether to initiate or terminate the execution of an action. In other words, even in the case of network delay or temporary loss of connection with the central control system, the rule node can still make reasonable decisions based on local data and preset rules, thereby maintaining the stable operation and security of the system.
[0099] Taking the smart home system as an example, a rule node responsible for monitoring the status of bedroom windows can receive the switch status information sent by the window sensor in real time. Once it detects that the window is accidentally opened during a preset time period (such as at night), and at the same time the human activity sensor in the bedroom area does not detect the presence of anyone (that is, it is judged that no one is at home and the window is not closed), the rule node will immediately trigger the alarm system, alert the user of possible intrusion through sound and light signals, and may automatically send an emergency notification to the user's mobile phone.
[0100] In one application example:
[0101] Taking a large office area as an example, the present invention can deploy multiple human body sensors as rule nodes. When a user enters the office area, any human body sensor that senses someone can trigger the logic judgment module to turn on the lights and air conditioner. When all sensors sense that there is no one, the logic judgment module will trigger the action execution module to turn off the lights and air conditioner. In addition, users can also set functions such as delayed execution of rules, set time to take effect, and scheduled execution through the rule management module to adapt to different office needs and energy-saving goals.
[0102] Furthermore, in this embodiment, the task execution method based on the rule engine also includes:
[0103] Report the execution results to the cloud or local management system for energy consumption statistics, troubleshooting or other management purposes.
[0104] Specifically, when the rule node judges and executes the corresponding action based on the feedback from the local sensor, such as turning on or off a device, triggering an alarm, etc., the execution result will be recorded immediately. Subsequently, the system will report these execution result data to the cloud server or local management center through a secure and efficient data transmission channel. Cloud servers usually have more powerful data processing and storage capabilities, and can support real-time analysis and long-term storage of large-scale data, facilitating energy consumption statistics, energy efficiency evaluation, and system performance optimization across time periods.
[0105] Furthermore, in this embodiment, a network disconnection and reconnection strategy is also included:
[0106] During the rule execution process, if the device is disconnected due to network problems, when it reconnects to the network within the effective time period of the rule and meets the triggering conditions, the system can automatically recover and continue to execute the rule, and report the event normally. If the disconnection and reconnection span the effective time period of the rule, the system will no longer report the event, but ensure that the action on the device can be executed normally. This disconnection and reconnection strategy ensures the stability and reliability of the system.
[0107] It can be seen that in this embodiment, by introducing advanced logic judgment, flexible rule configuration, delayed execution of rules, setting time to take effect, scheduled execution and cloud communication functions, accurate control and energy consumption management of multiple devices in the intelligent environment are achieved. The task execution method based on the rule engine provided in this embodiment has the advantages of powerful functions, high flexibility, easy configuration and expansion, etc., and can be widely used in smart home, smart office and Internet of Things and other fields, bringing great convenience and energy saving effect to people's life and work.
[0108] In summary, this embodiment provides a task execution method based on a rule engine. When it is necessary to execute a rule task, the target rule given by the user is first obtained, and the number and position of nodes, the target trigger condition and the rule execution logic are obtained based on the target rule. Then, the rule node is deployed based on the number and position of the nodes. The rule node is one or more. After that, the target environment information is obtained based on the rule node. When the target environment information meets the target trigger condition, the target device is instructed to execute the target action. This embodiment provides users with a task execution method based on a rule engine, which solves the problem that the rule engine in the prior art only supports simple rules and cannot be used in complex application scenarios. In this embodiment, node configuration and logic execution are performed by analyzing the rules given by the user. It no longer only supports parsing simple rules, but makes judgments based on the trigger conditions and rule execution logic combined with environmental information to instruct the target device to execute related actions. It can meet the linkage control of terminal devices in various complex scenarios, and brings great convenience and energy saving effects to people's lives and work.
[0109] It should be understood that, although the various steps in the flowcharts given in the accompanying drawings of the present invention are displayed in sequence according to the indications of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear description in this article, the execution of the steps in the present invention is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps of the present invention may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.
[0110] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by signaling related hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided by the present invention can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0111] Embodiment 2
[0112] Based on the above embodiments, the present invention further provides a task execution device based on a rule engine, and a functional module diagram thereof is shown in FIG. Figure 2 As shown, the task execution device based on the rule engine includes:
[0113] A logic configuration module, used to obtain target rules, and obtain the number and location of nodes, target trigger conditions and rule execution logic based on the target rules, as described in the first embodiment;
[0114] A node deployment module, used to deploy rule nodes based on the number and location of the nodes, where the rule nodes are one or more, as described in the first embodiment;
[0115] An environment information acquisition module, used to acquire target environment information based on the rule node, as described in the first embodiment;
[0116] The judgment module is used to instruct the target device to execute the target action when the target environment information meets the target trigger condition, as described in the first embodiment.
[0117] Embodiment 3
[0118] like Figure 3As shown, based on the above-mentioned task execution method based on the rule engine, the present invention also provides a terminal accordingly, and the terminal includes a processor 10, a memory 20 and a display 30. Figure 3 Only some components of the terminal are shown, but it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.
[0119] In some embodiments, the memory 20 may be an internal storage unit of the terminal, such as a hard disk or memory of the terminal. In other embodiments, the memory 20 may also be an external storage device of the terminal, such as a plug-in hard disk, a smart memory card (SmartMediaCard, SMC), a secure digital (SecureDigital, SD) card, a flash card (FlashCard), etc. equipped on the terminal. Further, the memory 20 may also include both an internal storage unit of the terminal and an external storage device. The memory 20 is used to store application software and various types of data installed in the terminal, such as the program code of the installation terminal. The memory 20 may also be used to temporarily store data that has been output or is to be output. In one embodiment, a task execution program 40 based on a rule engine is stored on the memory 20, and the task execution program 40 based on the rule engine can be executed by the processor 10, thereby realizing the task execution method based on the rule engine in the present application.
[0120] In some embodiments, the processor 10 may be a central processing unit (CPU), a microprocessor or other data processing chip, used to run the program code or process data stored in the memory 20, such as executing the task execution method based on the rule engine.
[0121] In some embodiments, the display 30 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, etc. The display 30 is used to display information on the terminal and to display a visual user interface. The components 10-30 of the terminal communicate with each other via a device bus.
[0122] In one embodiment, when the processor 10 executes the rule engine-based task execution program 40 in the memory 20, the following steps are implemented:
[0123] Obtain target rules, and obtain the number and location of nodes, target trigger conditions, and rule execution logic based on the target rules;
[0124] Deploy rule nodes based on the number and location of the nodes, where the rule nodes are one or more;
[0125] Acquire target environment information based on the rule node;
[0126] When the target environment information meets the target trigger condition, the target device is instructed to perform the target action.
[0127] Each of the rule nodes is an independent unit for executing the target rule, and is used to determine whether the target trigger condition is met based on feedback from a local sensor.
[0128] The target rules include:
[0129] The rule delayed execution function is used to delay instructing the target device to execute the target action according to a preset delay time when the target environment information meets the target trigger condition.
[0130] The target rules also include:
[0131] A range time execution function is used to set a time range for the rule to take effect, so that the target device executes the target action within a target time range corresponding to the target rule.
[0132] The target rules also include:
[0133] The scheduled execution function is used to set the time point when the rule takes effect, so that the target device sets the start execution time of the target rule according to the month, week or Cron expression.
[0134] The target rules also include:
[0135] Enhanced rules, wherein the enhanced rules support complex logic configuration of multiple rules, including but not limited to the combination of logical "or", logical "and" and logical "not".
[0136] The task execution method based on the rule engine further includes:
[0137] Report the execution results to the cloud or local management system for energy consumption statistics, troubleshooting or other management purposes.
[0138] Embodiment 4
[0139] The present invention also provides a computer-readable storage medium on which one or more programs are stored. The one or more programs can be executed by one or more processors to implement the steps of the task execution method based on the rule engine described in the above embodiment.
[0140] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention 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 deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A task execution method based on a rule engine, characterized in that: The task execution method based on the rule engine includes: Obtain target rules, and obtain the number and location of nodes, target trigger conditions, and rule execution logic based on the target rules; Deploy rule nodes based on the number and location of the nodes, where the rule nodes are one or more; Acquire target environment information based on the rule node; When the target environment information meets the target trigger condition, the target device is instructed to perform the target action.
2. The task execution method based on rule engine according to claim 1, characterized in that: Each of the rule nodes is an independent unit for executing the target rule, and is used to determine whether the target trigger condition is met based on feedback from a local sensor.
3. The task execution method based on rule engine according to claim 1, characterized in that: The target rules include: The rule delayed execution function is used to instruct the target device to execute the target action by delaying according to a preset delay time when the target environment information meets the target trigger condition.
4. The task execution method based on rule engine according to claim 1, characterized in that: The target rules also include: A range time execution function is used to set a time range for the rule to take effect, so that the target device executes the target action within a target time range corresponding to the target rule.
5. The task execution method based on rule engine according to claim 1, characterized in that: The target rules also include: The scheduled execution function is used to set the time point when the rule takes effect, so that the target device sets the start execution time of the target rule according to the month, week or Cron expression.
6. The task execution method based on rule engine according to claim 1, characterized in that: The target rules also include: Enhanced rules, wherein the enhanced rules support complex logical configuration of multiple rules, including but not limited to the combination of logical "or", logical "and" and logical "not".
7. The task execution method based on rule engine according to claim 1, characterized in that: The task execution method based on the rule engine also includes: Report the execution results to the cloud or local management system for energy consumption statistics, troubleshooting or other management purposes.
8. A task execution device based on a rule engine, characterized in that: The device comprises: A logic configuration module, used to obtain target rules, and based on the target rules, obtain the number and location of nodes, target trigger conditions, and rule execution logic; A node deployment module, used to deploy rule nodes based on the number and location of the nodes, where the rule nodes are one or more; An environment information acquisition module, used to acquire target environment information based on the rule node; The judgment module is used to instruct the target device to execute the target action when the target environment information meets the target trigger condition.
9. An intelligent terminal, characterized in that: The intelligent terminal includes a memory, a processor, and a task execution program based on a rule engine stored in the memory and executable on the processor. When the task execution program based on the rule engine is executed by the processor, the steps of the task execution method based on the rule engine as described in any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a task execution program based on a rule engine, and when the task execution program based on the rule engine is executed by a processor, the steps of the task execution method based on the rule engine as described in any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Linkage control method of Internet of Things equipment, terminal, gateway equipment and system
CN113419439A
Implementation method and device of graphical rule engine, equipment and storage medium
CN118605853A
Rules-based task allocation for edge networks
US20240338244A1