The Event Command is a command that fires OSGi events. It is used to notify third parties when a HAM condition is satisfied.
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 Event Command is used to notify third parties when a HAM condition is satisfied.
TheOSGi Event Admin, provides a service for handling events that can be listened by different applications (both OSGi and non-OSGi). The Event Command is a command that publishes events through this service. For each command instance you have to set a unique event topic. You can also add some additional event properties. Any interested application can then subscribe to the topic and be notified when the command is executed (its related condition is satisfied).
Managing Event 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 an event command which, when executed, fires an event under the topic.name with one property with key property_key and value property_value.
<config name="EventCommand">
<property key="id_gen" value="1" type="long"/>
<config name="EventCommand1">
<property key="topic" value="topic.name" type="string"/>
<config name="properties">
<property key="property_key" value="property_value" type="string"/>
</config>
</config>
</config>