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 RuleStatus
Utility method which getsRuleStatus
of the specifiedRule
.@Nullable RuleStatusInfo
getStatusInfo
(String ruleUID) This method getsRuleStatusInfo
of the specifiedRule
.@Nullable Boolean
This method gets enabledRuleStatus
for aRule
.void
The method skips the triggers and the conditions and directly executes the actions of the rule.void
Same asrunNow(String)
with the additional option to enable/disable evaluation of conditions defined in the target rule.void
setEnabled
(String uid, boolean isEnabled) This method is used for changing enabled state of theRule
.
-
Method Details
-
isEnabled
This method gets enabledRuleStatus
for aRule
. The enabled rule statuses areRuleStatus.UNINITIALIZED
,RuleStatus.IDLE
andRuleStatus.RUNNING
. The disabled rule status isRuleStatusDetail.DISABLED
.- Parameters:
ruleUID
- UID of theRule
- Returns:
true
when theRuleStatus
is one of theRuleStatus.UNINITIALIZED
,RuleStatus.IDLE
andRuleStatus.RUNNING
,false
when it isRuleStatusDetail.DISABLED
andnull
when it is not available.
-
setEnabled
This method is used for changing enabled state of theRule
. The enabled rule statuses areRuleStatus.UNINITIALIZED
,RuleStatus.IDLE
andRuleStatus.RUNNING
. The disabled rule status isRuleStatusDetail.DISABLED
. -
getStatusInfo
This method getsRuleStatusInfo
of the specifiedRule
.- Parameters:
ruleUID
- UID of theRule
- Returns:
RuleStatusInfo
object containing status of the lookingRule
or null when a rule with specified UID does not exist.
-
getStatus
Utility method which getsRuleStatus
of the specifiedRule
.- Parameters:
ruleUID
- UID of theRule
- Returns:
RuleStatus
object containing status of the lookingRule
or 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
- iftrue
the conditions of the rule will be checked.context
- the context that is passed to the conditions and the actions of the rule.
-