Package org.openhab.core.automation
Interface Rule
- All Superinterfaces:
Identifiable<String>
- All Known Implementing Classes:
SimpleRule
An automation Rule is built from
Modules and consists of three parts:
- Triggers: a list of
Triggermodules. EachTriggerfrom this list can start the evaluation of the Rule. A Rule with an empty list ofTriggers can only be triggered through theRuleManager.runNow(String, boolean, java.util.Map)method, or directly executed with theRuleManager.runNow(String)method. - Conditions: a list of
Conditionmodules. When a Rule is triggered, the evaluation of the RuleConditions will determine if the Rule will be executed. A Rule will be executed only when all it'sConditions are satisfied. If theConditions list is empty, the Rule is considered satisfied. - Actions: a list of
Actionmodules. These modules determine the actions that will be performed when a Rule is executed.
tags - non-hierarchical keywords or terms for describing them.
They can help the user to classify or label the Rules, and to filter and search them.- Author:
- Kai Kreuzer - Initial contribution, Ravi Nadahar - Added TemplateState
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumThis enum represent the different states a rule can have in respect to rule templates. -
Method Summary
Modifier and TypeMethodDescriptionThis method is used to get the actions participating inRule.This method is used to get the conditions participating inRule.This method is used to obtain theRule'sConfiguration.This method is used to obtain theListwithConfigDescriptionParameters defining meta info for configuration properties of theRule.@Nullable StringThis method is used to obtain the human-readable description of the purpose and consequences of theRule's execution.default @Nullable ModuleObtains the modules of theRule.@Nullable StringgetName()This method is used to obtain theRule's human-readable name.getTags()This method is used to obtain theRule's assigned tags.default Rule.TemplateStateThis method is used to track the template processing state by theRuleRegistry.@Nullable StringThis method is used to obtain theRuleTemplateidentifier of the template theRulewas created from.This method is used to get the triggers participating inRule.getUID()This method is used to obtain the identifier of the Rule.This method is used to obtain theRule'sVisibility.
-
Method Details
-
getUID
String getUID()This method is used to obtain the identifier of the Rule. It can be specified by theRule's creator, or randomly generated.- Specified by:
getUIDin interfaceIdentifiable<String>- Returns:
- an identifier of this
Rule. Can't benull.
-
getTemplateUID
@Nullable String getTemplateUID()This method is used to obtain theRuleTemplateidentifier of the template theRulewas created from. It will be used by theRuleRegistryto resolve theRule: to validate theRule's configuration, as well as to create and configure theRule's modules. If aRulehas not been created from a template, or has been successfully resolved by theRuleRegistry, this method will returnnull.- Returns:
- the identifier of the
Rule'sRuleTemplate, ornullif theRulehas not been created from a template, or has been successfully resolved by theRuleRegistry.
-
getTemplateState
This method is used to track the template processing state by theRuleRegistry. The default implementation doesn't support templates and must be overridden if theRuleimplementation supports templates.- Returns:
- the current template processing state.
-
getName
@Nullable String getName()This method is used to obtain theRule's human-readable name.- Returns:
- the
Rule's human-readable name, ornull.
-
getTags
This method is used to obtain theRule's assigned tags.- Returns:
- the
Rule's assigned tags.
-
getDescription
@Nullable String getDescription()This method is used to obtain the human-readable description of the purpose and consequences of theRule's execution.- Returns:
- the
Rule's human-readable description, ornull.
-
getVisibility
Visibility getVisibility()This method is used to obtain theRule'sVisibility.- Returns:
- the
Rule'sVisibilityvalue.
-
getConfiguration
Configuration getConfiguration()This method is used to obtain theRule'sConfiguration.- Returns:
- current configuration values, or an empty
Configuration.
-
getConfigurationDescriptions
List<ConfigDescriptionParameter> getConfigurationDescriptions()This method is used to obtain theListwithConfigDescriptionParameters defining meta info for configuration properties of theRule.- Returns:
- a
ListofConfigDescriptionParameters.
-
getConditions
This method is used to get the conditions participating inRule.- Returns:
- a list with the conditions that belong to this
Rule.
-
getActions
This method is used to get the actions participating inRule.- Returns:
- a list with the actions that belong to this
Rule.
-
getTriggers
This method is used to get the triggers participating inRule.- Returns:
- a list with the triggers that belong to this
Rule.
-
getModules
Obtains the modules of theRule. -
getModule
-