A rule engine-based task execution method and device, a terminal and a medium

By adopting a task execution method based on a rule engine, the performance bottleneck of rule engines in complex logic and large-scale application scenarios in existing technologies is solved. It achieves efficient data processing and flexible rule configuration, meets the needs of intelligent environments such as large offices, and provides precise control and energy-saving effects.

CN119847012BActive Publication Date: 2025-12-30深圳开鸿数字产业发展有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411790848.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-06
Publication Date
2025-12-30
Estimated Expiration
2044-12-06

AI Technical Summary

Technical Problem

Existing rule engines are inadequate in handling complex logic and large-scale application scenarios, failing to meet the actual needs of intelligent office environments such as large offices, especially in terms of performance bottlenecks in data processing and rule configuration.

Method used

This paper provides a task execution method based on a rule engine. By acquiring target rules, deploying rule nodes, obtaining environmental information, and instructing devices to perform actions based on trigger conditions, it supports delayed execution, time-range execution, scheduled execution, and complex logic configuration, including combinations of logical "OR", "AND", and "NOT", thereby achieving efficient data processing and flexible rule configuration.

Benefits of technology

It enables precise control and energy management of multiple devices in an intelligent environment, improves user experience, adapts to the linkage control of terminal devices in various complex scenarios, and provides convenience and energy-saving effects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119847012B_ABST
    Figure CN119847012B_ABST
Patent Text Reader

Abstract

The application discloses a task execution method and device based on a rule engine, a terminal and a medium. The method comprises the following steps: obtaining a target rule, obtaining the number and position of nodes, a target trigger condition and rule execution logic based on the target rule; deploying rule nodes based on the number and position of the nodes, wherein the rule nodes are one or more; obtaining target environment information based on the rule nodes; and instructing a target device to perform a target action when the target environment information meets the target trigger condition. The application can solve the problem that the rule engine in the prior art only supports simple rules and cannot be used in complex application scenarios. The application can make a judgment based on the trigger condition, the rule execution logic and the environment information to instruct the target device to perform a related action, meet the linkage control of terminal devices in various complex scenarios, and bring great convenience and energy-saving effect to people's life and work.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of Internet of Things (IoT) technology, and in particular to a task execution method, apparatus, terminal, and medium based on a rule engine. Background Technology

[0002] In today's intelligent office environments, rule engines, as core components of automated control systems, play a crucial role. However, existing rule engines have limitations in functionality and application scope, supporting only the parsing of simple rules and their sequential or parallel execution. They fall short, particularly when dealing with complex logic and large-scale application scenarios, failing to meet the actual needs of intelligent office environments such as large offices. Therefore, there is an urgent need for an enhanced rule engine with flexible rule configuration to address the growing demands of intelligent offices.

[0003] Therefore, existing technologies still need to be improved and enhanced. Summary of the Invention

[0004] The main objective of this invention is to provide a task execution method, apparatus, terminal, and medium based on a rule engine, aiming to solve the problem that existing rule engines only support simple rules and cannot be used in complex application scenarios.

[0005] To achieve the aforementioned objective, a 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 includes:

[0006] Obtain the target rule, and based on the target rule, obtain the number and location of nodes, the target triggering conditions, and the rule execution logic;

[0007] Based on the number and location of the nodes, rule nodes are deployed, and there are one or more rule nodes;

[0008] Obtain target environment information based on the rule nodes;

[0009] When the target environment information meets the target triggering conditions, 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 instruct the target device to perform the target action after a delay based on a preset delay time when the target environment information meets the target triggering conditions.

[0012] In one implementation, the target rule further includes:

[0013] The range-time execution function is used to set the time range in which the rule takes effect, so that the target device executes the target action within the 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 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, which support complex logical configurations for multiple rules, including but not limited to combinations of logical "OR", logical "AND" and logical "NOT".

[0018] In one implementation, the rule engine-based task execution method further includes:

[0019] The execution results are reported 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 device detects the usage status of the language plugin at a first preset time interval. If the target language plugin is detected to have been unused for more than a second preset time, the target language plugin is automatically uninstalled.

[0022] A second aspect of the present invention provides a task execution device based on a rule engine, comprising:

[0023] The logic configuration module is used to obtain target rules, and based on the target rules, obtain the number and location of nodes, target triggering conditions, and rule execution logic;

[0024] A node deployment module is used to deploy rule nodes based on the number and location of the nodes, wherein the rule nodes are one or more;

[0025] The environmental information acquisition module is used to acquire target environmental information based on the rule nodes;

[0026] The judgment module is used to instruct the target device to perform the target action when the target environment information meets the target triggering conditions.

[0027] A third aspect of the present invention provides a terminal, wherein the terminal includes: a memory, a processor, and a rule engine-based task execution program stored in the memory and executable on the processor, wherein the rule engine-based task execution program, when executed by the processor, implements the steps of the rule engine-based task execution method as described above.

[0028] In a fourth aspect, the present invention provides a computer-readable storage medium, wherein the computer storage medium stores one or more programs that can be executed by one or more processors to implement the steps of the task execution method based on the rule engine described in any of the preceding claims.

[0029] Beneficial Effects: Compared with existing technologies, this 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 this invention, when a rule task needs to be executed, the target rule given by the user is first obtained. Based on the target rule, the number and location of nodes, target triggering conditions, and rule execution logic are obtained. Then, rule nodes are deployed based on the number and location of the nodes. There can be one or more rule nodes. Afterwards, target environmental information is obtained based on the rule nodes. When the target environmental information meets the target triggering conditions, the target device is instructed to execute the target action. This invention provides users with a task execution method based on a rule engine, solving the problem that existing rule engines only support simple rules and cannot be used in complex application scenarios. In this invention, node configuration and logic execution are performed by analyzing the rules given by the user. It no longer only supports parsing simple rules but also makes judgments based on triggering conditions and rule execution logic combined with environmental information to instruct the target device to execute relevant actions. This can meet the linkage control of terminal devices in various complex scenarios, bringing great convenience and energy-saving effects to people's lives and work. Attached Figure Description

[0030] Figure 1 A flowchart illustrating an embodiment of the task execution method based on a rule engine provided by the present invention;

[0031] Figure 2 A structural schematic diagram of an embodiment of the rule engine-based task execution device provided by the present invention;

[0032] Figure 3 A schematic diagram of the operating environment of an embodiment of the terminal provided by the present invention. Detailed Implementation

[0033] To make the objectives, technical solutions, and effects of this invention clearer and more explicit, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.

[0034] Those skilled in the art will understand that, unless specifically stated otherwise, the singular forms “a,” “an,” “the,” and “the” used herein may also include the plural forms. It should be further understood that the term “comprising” as used in this specification means the presence of the stated 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 say an element is “connected” or “coupled” to another element, it can be directly connected or coupled to the other element, or there may be intermediate elements. Furthermore, “connected” or “coupled” as used herein can include wireless connections or wireless coupling. The term “and / or” as used herein includes all or any units 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 used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. It should also be understood that terms such as those defined in general dictionaries should be understood to have the same meaning as in the context of the prior art, and should not be interpreted in an idealized or overly formal sense unless specifically defined as herein.

[0036] The present invention provides a task execution method based on a rule engine, which can be applied to terminals with computing capabilities. The terminal can execute the task execution method based on the rule engine provided by the present invention to perform device linkage control.

[0037] Example 1

[0038] In today's intelligent office environment, rule engines, as a core component of automated control systems, play a crucial role. However, existing rule engines have certain limitations in terms of functionality and application scope, especially when dealing with complex logic and large-scale application scenarios.

[0039] Taking large offices as an example, these spaces typically have numerous workstations, and to improve comfort and energy efficiency, human body sensors are widely deployed throughout the office area. These sensors can monitor the activities of people in the office area in real time, thus providing crucial environmental information for automated control systems. However, existing rule engines, when dealing with such complex application scenarios, often only support parsing and executing simple rules, such as determining trigger conditions for a single sensor and sending control commands to a single device.

[0040] Specifically, existing rule engines fall short when implementing complex logic such as "turning on lights and air conditioning when any human body sensor detects someone, and turning off lights and air conditioning only when all human body sensors detect no one." This is because they can typically only execute pre-set simple rules sequentially or in parallel, and cannot make dynamic logical judgments and decisions based on the real-time status of multiple sensors. This limitation prevents existing rule engines from effectively integrating and utilizing information from multiple sensors, thus hindering the achievement of refined environmental control and energy-saving effects.

[0041] Furthermore, existing rule engines struggle to handle large-scale application scenarios. In large offices, the sheer number and wide distribution of human body sensors necessitate rule engines with efficient data processing capabilities and flexible rule configuration. However, existing rule engines often encounter performance bottlenecks when processing large amounts of data, and their rule configuration processes are cumbersome and complex, making it difficult to adapt to rapidly changing application needs.

[0042] In summary, existing rule engines have significant limitations in handling complex logic and large-scale application scenarios, failing to meet the actual needs of intelligent office environments such as large offices. Therefore, there is an urgent need for an enhanced rule engine capable of supporting complex logical judgments, efficient data processing, and flexible rule configuration to address the growing demands of intelligent office environments.

[0043] Specifically, such as Figure 1 As shown, the task execution method based on a rule engine provided in this embodiment includes the following steps:

[0044] S100. Obtain the target rule, and based on the target rule, obtain the number and location of nodes, the target triggering conditions, and the rule execution logic.

[0045] Specifically, users configure multiple rules through a graphical interface or programming interface. Each rule contains at least one rule node, and each rule node is associated with at least one sensor or device. The triggering conditions and execution actions of each rule node are defined. In this embodiment, the task execution method is based on the target rules provided by the user.

[0046] Obtaining the target rule is the first step in the entire process, which typically means selecting a specific rule from a pre-defined rule base or a dynamically generated rule set as the operational benchmark. The target rule defines in detail the key information required for subsequent steps, including but not limited to the number and location of the nodes, the target triggering conditions, and the rule execution logic.

[0047] In this embodiment, an enhanced rule engine system is used to execute specific rule tasks. This enhanced rule engine system includes a deployment module, an environmental 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, these modules achieve precise control and energy management of multiple devices in the intelligent environment.

[0048] The deployment module is responsible for deploying one or more sensors as rule nodes in the scene according to the number and location of nodes specified in the target rules. Each rule node can perform actions such as reading temperature and determining whether there are people, and compare the execution results with preset conditions to set the node's state to true or false.

[0049] The environmental information acquisition module obtains target environmental information in real time through the rule nodes, including but not limited to temperature, humidity, light intensity, and the presence of human beings. This information provides the necessary input data for the logic judgment module.

[0050] The logic judgment module, as one of the core components, sequentially judges the state of all rule nodes based on the target triggering condition and the rule execution logic. The logic judgment module will only trigger the execution of subsequent actions if and only if all nodes satisfy their respective triggering conditions. Furthermore, the logic judgment module supports complex logic configurations, including but not limited to combinations of logical "OR" and logical "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 conditioning, and adjusting curtains after the logic judgment module confirms that all conditions are met. The action execution module interacts with other smart devices through communication interfaces, enabling precise control of multiple devices in the intelligent environment.

[0052] The rules management module provides comprehensive management capabilities for rules. It supports features such as delayed execution, setting time for rules to take effect, complex logic configuration, and scheduled execution. Users can easily create, modify, and delete rules through the rules management module to adapt to different application scenarios and needs.

[0053] The cloud communication module is responsible for reporting the triggered events and related environmental information to the cloud after the rules are executed. The cloud can then statistically 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 device management and firmware upgrades.

[0054] Specifically, users configure the target rules 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, the first step is to parse the rules configured by the user, generate the rule execution logic, and store the rule execution logic in the rule database to obtain the number and location of nodes, target triggering conditions, and rule execution logic.

[0057] Specifically, the target rules include:

[0058] The rule-delayed execution function is used to instruct the target device to perform the target action after a delay based on a preset delay time when the target environment information meets the target triggering conditions.

[0059] The rule-delayed execution function is an advanced automated control mechanism that is flexible and practical, designed to precisely control the timing of device operations based on specific conditions. The core of this function lies in its ability to monitor the information status of the target environment. Once this information meets preset trigger conditions, it does not immediately trigger the device's action but waits for a pre-set delay before instructing the target device to execute the corresponding target action. This design allows the system to more finely control the operation sequence to adapt to various complex application scenarios, such as smart homes, industrial automation, and security monitoring.

[0060] Taking a smart home system as an example, a rule-based delayed execution function can be set to optimize the home lighting system. Specifically, the rule is set as follows: When the system detects through sensors that the light intensity in the living room is lower than the target brightness threshold, that is, when the environment darkens and the conditions for turning on the lights are met, and at the same time, the human motion sensor in the living room detects human activity, that is, "someone is detected," this is considered to have met the target trigger condition, and under normal circumstances, the lights would turn on immediately. However, if the rule-based delayed execution function is set, the living room lights will not turn on immediately, but will first wait for a preset delay time, such as 5 seconds.

[0061] This brief delay effectively prevents lights from malfunctioning due to brief foot traffic or short-term light fluctuations, thereby improving the user experience and reducing unnecessary energy consumption.

[0062] During this 5-second delay, the system continuously monitors environmental information to ensure the triggering conditions are still met. If, within this time, the light intensity returns to a sufficiently bright state or the human motion sensor stops detecting activity, the previously set light-on command will be canceled. Conversely, if the conditions are still met after 5 seconds, the system will instruct the living room lighting fixtures to turn on, thus achieving more intelligent and energy-efficient lighting control.

[0063] In this way, the rule-delayed execution function not only improves the flexibility and accuracy of the automation system, but also helps to optimize resource use, reduce unnecessary operations, and provide users with a more considerate and efficient smart life experience.

[0064] In this embodiment, the target rule further includes:

[0065] The range-time execution function is used to set the time range in which the rule takes effect, so that the target device executes the target action within the target time range corresponding to the target rule.

[0066] The time-scoped execution feature is a powerful time management capability that allows users or system administrators to set a specific time frame for automation rules, ensuring that these rules are only effective within the specified time period. The core value of this feature lies in its ability to precisely control when target devices execute target actions based on these rules, thereby meeting various complex business needs and everyday scenarios.

[0067] Specifically, the range-based time execution function allows users to define the start and end times for a rule to take effect, forming a valid time window. Within this time window, if other conditions for the target rule (such as environmental detection, state changes, etc.) are also met, the target device will execute the corresponding action as instructed by the rule. However, once the time exceeds this range, even if other conditions are met, the rule will not trigger the device's action.

[0068] Take a home automation system's temperature control system as an example, where a time-range execution function can be set to optimize energy use. Suppose a user wants the heating system to automatically activate to raise the room temperature between 10 PM and 6 AM the following morning if the indoor temperature is lower than a set comfortable temperature (e.g., 18 degrees Celsius). This rule includes a clearly defined time range, 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 only operates automatically based on temperature conditions at night when people are typically resting. This not only keeps the bedroom warm and comfortable but also effectively avoids unnecessary energy consumption during the day or when people are out, thus achieving the goal of energy conservation and emission reduction.

[0070] Furthermore, the range-time execution function can be combined with other automation rules to create more complex and refined control strategies. For example, by combining light sensors and human motion detectors, rules can be further refined to automatically adjust the heating or cooling system based on temperature conditions only in rooms where people are active at night.

[0071] In summary, the range-time execution function provides powerful time management capabilities for automated control systems, enabling the system to flexibly adjust the timing of equipment operation according to actual needs, thereby optimizing resource utilization and improving user experience.

[0072] In this embodiment, the target rule further 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 time of the target rule according to the month, week or Cron expression.

[0074] Scheduled execution is also a highly flexible and powerful automation control feature. It allows users or system administrators to set precise execution times for specific rules, ensuring that target devices can accurately perform the corresponding actions at the preset time. The core of this function lies in its ability to define the specific time when rules take effect based on complex time scheduling mechanisms such as monthly, weekly, 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 month-based time setting allows users to specify a day or several days in a month as the execution day for the rule; the week-based time setting allows users to select a day or several days in a week, as well as a specific time period within a day, as the execution time; while Cron expressions provide a more flexible and powerful time setting method, allowing users to define complex execution plans through specific string formats, including multiple time conditions such as minutes, hours, days, months, and days of the week.

[0076] Taking a smart irrigation system within a home automation system as an example, the scheduled execution function can be used to optimize plant water management. Suppose a user wants the irrigation system to automatically start watering the garden at 6:00 AM every Monday, Wednesday, and Friday. This rule can be set using the scheduled execution function. Specifically, the user can choose a week-based time setting, then specify Monday, Wednesday, and Friday as the execution days, and 6:00 AM as the execution time.

[0077] In this example, the scheduled execution function ensures that the irrigation system runs automatically at fixed times each week, providing the garden with the right amount of water. This not only maintains the healthy growth of the plants but also prevents damage caused by forgetting to water or watering at the wrong time.

[0078] Furthermore, the timed execution function can be combined with other automation rules to create more complex and refined control strategies. For example, by combining soil moisture sensor data and weather forecast data, the rules can be further refined to activate the irrigation system only at a specified time when the soil moisture is below a certain threshold and no rainfall is forecast for the next few days.

[0079] In summary, the timed execution function provides powerful time scheduling capabilities for automated control systems, enabling the system to flexibly adjust the timing of equipment operation according to actual needs, thereby optimizing resource utilization and improving user experience. Whether in home automation, industrial automation, or other fields, the timed execution function plays a crucial role.

[0080] In this embodiment, the target rule further includes:

[0081] Enhanced rules, which support complex logical configurations for multiple rules, including but not limited to combinations of logical "OR", logical "AND" and logical "NOT".

[0082] Enhanced rules can expand the flexibility and complexity of rule configuration. By supporting complex logic configurations for multiple rules, enhanced rules allow users or system administrators to create combined rules that include various logical operations such as OR, AND, and NOT. The combined use of these logical operators enables the system to implement more refined and complex control logic based on multiple conditions and variables.

[0083] The logical "OR" operator allows a rule to trigger an action when either condition is met, while the logical "AND" operator requires all conditions to be met simultaneously to trigger an action. The logical "NOT" operator is used to reverse the state of a condition, triggering an action when the condition is not met, or not triggering 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 a smart home system as an example, this embodiment uses enhanced rules to design a complex lighting control strategy. Specifically, if we want to automatically turn on the living room lights under any of the following conditions: 1) the light intensity in the living room is below a certain threshold; 2) the human motion sensor in the living room detects human activity; 3) the television in the living room is turned on, this rule can be implemented using a logical "OR" statement. As long as any one of the above three conditions is met, the living room lights will automatically turn on.

[0085] Furthermore, more conditions can be added to this rule, and the control logic can be refined using logical AND and NOT operators. For example, an additional condition can be set: if the living room curtains are closed, the lights will not turn on immediately even if any one of the three conditions mentioned above is met. This additional condition can be implemented using logical AND and NOT operators; that is, the lights will only turn on when the curtains are open (logical NOT: curtains closed) and any one of the three conditions mentioned above is met.

[0086] Through such enhanced rule configuration, smart home systems can more accurately understand user needs and provide intelligent services in various complex scenarios. Whether in home automation, industrial automation, or other fields, enhanced rules provide users with stronger control capabilities and more flexible configuration options, enabling automated control systems 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, wherein there are one or more rule nodes.

[0089] Each rule node is an independent unit for executing the target rule, used to determine whether the target triggering condition is met based on feedback from local sensors.

[0090] Specifically, each rule node plays an indispensable and highly autonomous independent unit role in the execution of the target rule. They are not merely relay stations for data flow or signal processing, but also a crucial link in intelligent decision-making. The rule nodes can directly receive and parse real-time feedback data from local sensors, which typically covers information on environmental parameters, device status, user behavior patterns, and other aspects.

[0091] Based on this detailed and real-time local sensor data, rule nodes can quickly and accurately determine whether the current environment or device state has met the preset trigger conditions 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 in milliseconds, ensuring the timeliness and accuracy of the system response.

[0092] Specifically, after obtaining the number and location of the target rule acquisition nodes, corresponding rule nodes are deployed in the system based on the node number and location information provided in the target rule. These rule nodes can be logical judgment points at the software level or sensors or actuators at the hardware level. The number may be one or multiple, depending on the complexity and coverage of the rule. Continuing with the smart home security rule as an example, one or more sensor nodes (such as door and window sensors) need to be deployed to monitor the window status, and one or more logical judgment nodes (possibly within the smart hub) need to handle the combined logic of the unattended state and the window status.

[0093] Specifically, for complex logic scenarios, multiple sensors are deployed within the scenario, with each sensor serving as a rule node. Each rule node can independently perform an action, such as reading the temperature or determining if someone is present. After executing the action, it is compared with preset conditions; if the conditions are met, the node's state is set to true. This process is repeated for other nodes in sequence. Once all nodes meet the conditions, subsequent actions are executed, such as turning off lights or air conditioning.

[0094] S300. Obtain target environment information based on the rule nodes;

[0095] After the rule nodes are deployed, the system begins collecting information about the environment in which these nodes reside, i.e., target environment information. This includes data on whether windows are closed and whether anyone is home (possibly determined through cameras, motion sensors, or mobile phone GPS location). This information forms the basis for determining whether subsequent actions need to be taken.

[0096] S400: When the target environment information meets the target triggering conditions, instruct the target device to perform the target action.

[0097] When the system detects that the target environment meets the target triggering conditions—that is, no one is home and at least one window is open—the system will immediately instruct the target device to perform a preset target action. In this example, the target action might be to activate the home alarm system, emit an sound, and / or send an emergency notification to the user's mobile phone to alert the user to potential security risks in their home.

[0098] In this embodiment, the rule node is independent; it can process data and autonomously decide whether to initiate or suspend the execution of an action. That is, even in the event of network latency or a temporary loss of connection to 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 a smart home system as an example, a rule node responsible for monitoring the status of bedroom windows can receive real-time opening and closing status information sent by window sensors. Once it detects that a window is unexpectedly opened within a preset time period (such as at night), and at the same time, the human activity sensors in the bedroom area do not detect the presence of anyone (i.e., it is determined that no one is home and the window is open), the rule node will immediately trigger the alarm system, alerting the user to the 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, this invention can deploy multiple human body sensors as rule nodes. When a user enters the office area, any human body sensor that detects someone will trigger the logic judgment module to turn on the lights and air conditioning. Only when all sensors detect no one will the logic judgment module trigger the action execution module to turn off the lights and air conditioning. In addition, users can also set rules with delayed execution, set time for activation, 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 further includes:

[0103] The execution results are reported to the cloud or local management system for energy consumption statistics, troubleshooting or other management purposes.

[0104] Specifically, when the rule node determines and executes a corresponding action based on feedback from local sensors, such as turning a device on or off or triggering an alarm, the execution result is immediately recorded. Subsequently, the system reports this execution result data to a cloud server or local management center via a secure and efficient data transmission channel. Cloud servers typically possess more powerful data processing and storage capabilities, supporting real-time analysis and long-term storage of large-scale data, facilitating energy consumption statistics, energy efficiency assessments, and system performance optimization across different time periods.

[0105] Furthermore, this embodiment also includes a network disconnection reconnection strategy:

[0106] If a device disconnects due to network issues during rule execution, and then reconnects within the rule's valid time period and meets the triggering conditions, the system can automatically resume rule execution and report the event normally. If the network disconnection and reconnection spans the rule's valid time period, the system will no longer report the event, but will still ensure that the device's actions can be executed normally. This network disconnection and reconnection strategy ensures the system's stability and reliability.

[0107] As can be seen, this embodiment achieves precise control and energy management of multiple devices in an intelligent environment by introducing advanced logic judgment, flexible rule configuration, rule delayed execution, time-based activation, scheduled execution, and cloud communication. The rule engine-based task execution method provided in this embodiment has advantages such as powerful functionality, high flexibility, ease of configuration and expansion, and can be widely applied in smart homes, smart offices, and the Internet of Things, bringing great convenience and energy-saving effects to people's lives and work.

[0108] In summary, this embodiment provides a task execution method based on a rule engine. When a rule-based task needs to be executed, the method first obtains the target rule provided by the user. Based on the target rule, it obtains the number and location of nodes, target triggering conditions, and rule execution logic. Then, it deploys rule nodes based on the number and location of the nodes. There can be one or more rule nodes. Next, it obtains target environmental information based on the rule nodes. When the target environmental information meets the target triggering conditions, it instructs the target device to perform the target action. This embodiment provides users with a task execution method based on a rule engine, solving the problem that existing rule engines only support simple rules and cannot be used in complex application scenarios. In this embodiment, by analyzing the rules provided by the user for node configuration and logic execution, it no longer only supports parsing simple rules but also makes judgments based on triggering conditions, rule execution logic, and environmental information to instruct the target device to perform relevant actions. This can meet the linkage control of terminal devices in various complex scenarios, bringing great convenience and energy-saving effects to people's lives and work.

[0109] It should be understood that although the steps in the flowcharts shown in the accompanying drawings are displayed sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of the steps in this invention, and these steps can be executed in other orders. Moreover, at least a portion of the steps in this invention may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least a portion of the sub-steps or stages of other steps.

[0110] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program using signal-related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided by this 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. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.

[0111] Example 2

[0112] Based on the above embodiments, the present invention also provides a task execution device based on a rule engine, the functional module of which is shown in the figure below. Figure 2 As shown, the rule engine-based task execution device includes:

[0113] The logic configuration module is used to obtain target rules, and based on the target rules, obtain the number and location of nodes, target triggering conditions, and rule execution logic, as described in Embodiment 1.

[0114] The node deployment module is used to deploy rule nodes based on the number and location of the nodes. The rule nodes can be one or more, as described in Embodiment 1.

[0115] The environmental information acquisition module is used to acquire target environmental information based on the rule nodes, as described in Embodiment 1.

[0116] The judgment module is used to instruct the target device to perform the target action when the target environment information meets the target triggering conditions, as described in Embodiment 1.

[0117] Example 3

[0118] like Figure 3As shown, based on the above-described task execution method based on a rule engine, the present invention also provides a terminal, which includes a processor 10, a memory 20, and a display 30. Figure 3 Only some of the terminal components are shown; however, 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. In other embodiments, the memory 20 may be an external storage device of the terminal, such as a plug-in hard disk, SmartMediaCard (SMC), SecureDigital (SD) card, or FlashCard. Furthermore, the memory 20 may include both internal and external storage devices. The memory 20 is used to store application software and various types of data installed on the terminal, such as the program code installed on the terminal. The memory 20 can also be used to temporarily store data that has been output or will be output. In one embodiment, the memory 20 stores a rule-engine-based task execution program 40, which can be executed by the processor 10 to implement the rule-engine-based task execution method of this 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 program code stored in the memory 20 or process data, 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, or an OLED (Organic Light-Emitting Diode) touchscreen. 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 executor 40 in the memory 20, the following steps are performed:

[0123] Obtain the target rule, and based on the target rule, obtain the number and location of nodes, the target triggering conditions, and the rule execution logic;

[0124] Based on the number and location of the nodes, rule nodes are deployed, and there are one or more rule nodes;

[0125] Obtain target environment information based on the rule nodes;

[0126] When the target environment information meets the target triggering conditions, the target device is instructed to perform the target action.

[0127] Each rule node is an independent unit for executing the target rule, used to determine whether the target triggering condition is met based on feedback from local sensors.

[0128] The target rules include:

[0129] The rule-delayed execution function is used to instruct the target device to perform the target action after a delay based on a preset delay time when the target environment information meets the target triggering conditions.

[0130] The target rules also include:

[0131] The range-time execution function is used to set the time range in which the rule takes effect, so that the target device executes the target action within the 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 time of the target rule according to the month, week or Cron expression.

[0134] The target rules also include:

[0135] Enhanced rules, which support complex logical configurations for multiple rules, including but not limited to combinations of logical "OR", logical "AND" and logical "NOT".

[0136] The task execution method based on the rule engine further includes:

[0137] The execution results are reported to the cloud or local management system for energy consumption statistics, troubleshooting or other management purposes.

[0138] Example 4

[0139] The present invention also provides a computer-readable storage medium having stored thereon one or more programs that can be executed by one or more processors to implement the steps of the rule engine-based task execution method described in the above embodiments.

[0140] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A rule engine based task execution method, characterized in that, The rule engine-based task execution method comprises: acquiring a target rule, and acquiring a node quantity and position, a target trigger condition, and rule execution logic based on the target rule; deploying rule nodes based on the node quantity and position, the rule nodes being one or more; acquiring target environment information based on the rule nodes; when the target environment information meets the target trigger condition, instructing a target device to perform a target action; each rule node is an independent unit for performing the target rule, and is configured to judge whether the target trigger condition is met based on feedback of a local sensor; the target rule comprises: a rule delay execution function, which is configured to delay instructing the target device to perform the target action according to a preset delay time when the target environment information meets the target trigger condition; the target rule further comprises: a range time execution function, which is configured to set a time range for which a rule is valid, so that the target device performs the target action within a target time range corresponding to the target rule; the target rule further comprises: a timing execution function, which is configured to set a time point for which a rule is valid, so that the target device sets a start execution time of the target rule according to a month, a week, or a Cron expression.

2. The rule engine based task execution method of claim 1, wherein, the target rule further comprises: an enhanced rule, which supports complex logic configuration of multiple rules, including combinations of logical "or", logical "and", and logical "not".

3. The rule engine based task execution method of claim 1, wherein, The rule engine-based task execution method further comprises: reporting an execution result to a cloud or a local management system for energy consumption statistics and fault diagnosis.

4. A rule engine based task execution apparatus, characterized by, The rule engine-based task execution device is configured to implement the rule engine-based task execution method according to any one of claims 1-3, and comprises: a logic configuration module configured to acquire a target rule, and acquire a node quantity and position, a target trigger condition, and rule execution logic based on the target rule; a node deployment module configured to deploy rule nodes based on the node quantity and position, the rule nodes being one or more; an environment information acquisition module configured to acquire target environment information based on the rule nodes; a judgment module configured to, when the target environment information meets the target trigger condition, instruct a target device to perform a target action; each rule node is an independent unit for performing the target rule, and is configured to judge whether the target trigger condition is met based on feedback of a local sensor; the target rule comprises: a rule delay execution function, which is configured to delay instructing the target device to perform the target action according to a preset delay time when the target environment information meets the target trigger condition; the target rule further comprises: a range time execution function, which is configured to set a time range for which a rule is valid, so that the target device performs the target action within a target time range corresponding to the target rule; the target rule further comprises: The timing execution function is used to set a time point at which a rule takes effect, so that the target device sets a start execution time of the target rule according to a month, a week or a Cron expression.

5. A smart terminal, characterized by The intelligent terminal comprises a memory, a processor, and a rule engine-based task execution program stored in the memory and executable on the processor, and the rule engine-based task execution program, when executed by the processor, implements the steps of the rule engine-based task execution method according to any one of claims 1-3.

6. A computer readable storage medium characterized by The computer readable storage medium stores a rule engine-based task execution program, and the rule engine-based task execution program, when executed by a processor, implements the steps of the rule engine-based task execution method according to any one of claims 1-3.

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