Package org.openhab.core.automation
Interface ModuleHandlerCallback
- All Known Subinterfaces:
SimpleTriggerHandlerCallback,TriggerHandlerCallback
@NonNullByDefault
public interface ModuleHandlerCallback
This class is responsible to provide a
RegistryChangeListener logic. An instance of it is added to
RuleRegistry service, to listen for changes when a single Rule has been added, updated, enabled,
disabled or removed and to involve Rule Engine to process these changes. Also to send a run command
for a single Rule to the Rule Engine.- Author:
- Kai Kreuzer - Initial contribution
-
Method Summary
Modifier and TypeMethodDescription@Nullable RuleStatusUtility method which getsRuleStatusof the specifiedRule.@Nullable RuleStatusInfogetStatusInfo(String ruleUID) This method getsRuleStatusInfoof the specifiedRule.@Nullable BooleanThis method gets enabledRuleStatusfor aRule.voidThe method skips the triggers and the conditions and directly executes the actions of the rule.voidSame asrunNow(String)with the additional option to enable/disable evaluation of conditions defined in the target rule.voidsetEnabled(String uid, boolean isEnabled) This method is used for changing enabled state of theRule.
-
Method Details
-
isEnabled
This method gets enabledRuleStatusfor aRule. The enabled rule statuses areRuleStatus.UNINITIALIZED,RuleStatus.IDLEandRuleStatus.RUNNING. The disabled rule status isRuleStatusDetail.DISABLED.- Parameters:
ruleUID- UID of theRule- Returns:
truewhen theRuleStatusis one of theRuleStatus.UNINITIALIZED,RuleStatus.IDLEandRuleStatus.RUNNING,falsewhen it isRuleStatusDetail.DISABLEDandnullwhen it is not available.
-
setEnabled
This method is used for changing enabled state of theRule. The enabled rule statuses areRuleStatus.UNINITIALIZED,RuleStatus.IDLEandRuleStatus.RUNNING. The disabled rule status isRuleStatusDetail.DISABLED. -
getStatusInfo
This method getsRuleStatusInfoof the specifiedRule.- Parameters:
ruleUID- UID of theRule- Returns:
RuleStatusInfoobject containing status of the lookingRuleor null when a rule with specified UID does not exist.
-
getStatus
Utility method which getsRuleStatusof the specifiedRule.- Parameters:
ruleUID- UID of theRule- Returns:
RuleStatusobject containing status of the lookingRuleor null when a rule with specified UID does not exist.
-
runNow
The method skips the triggers and the conditions and directly executes the actions of the rule. This should always be possible unless an action has a mandatory input that is linked to a trigger. In that case the action is skipped and the rule engine continues execution of rest actions.- Parameters:
uid- id of the rule whose actions have to be executed.
-
runNow
Same asrunNow(String)with the additional option to enable/disable evaluation of conditions defined in the target rule. The context can be set here, too, but also might benull.- Parameters:
uid- id of the rule whose actions have to be executed.considerConditions- iftruethe conditions of the rule will be checked.context- the context that is passed to the conditions and the actions of the rule.
-