Previous Topic

Next Topic

Book Contents

Book Index

Rule State Command

The Rule State Command is a command that enables/disables a rule.

Required Bundles

To be able to create and manage automation components, you need the following bundles from the bundles folder active in the OSGi framework:

Overview

The rule state command allows you to dynamically enable and disable automation rules.

For each command instance you have to set a target rule (the one which is controlled by the command) and a target state for that rule (enabled or disabled). When the command is executed it detects the state of the rule and it changes it, if it is different from the target.

Managing Rule State Commands

Via Java API

After creating an instance of the command as described in Managing Commands you can configure it by using the following methods:

After configuring your command, call the save method. The Command Provider will save it in Config Tree.

Via ConfigTree

All commands are stored in Config Tree, which allows you to import/export or add/edit commands by modifying XML files. Refer to Configuring HAM via Config Tree.

The following snippet contains a Rule state command which activates a rule with an ID Rule1.

<config name="RuleStateCommand">

<config name="RuleStateCommand1">

  <property key="rule_id" value="Rule1" type="string"/>

  <property key="active_state" value="true" type="boolean"/>

</config>

</config>