A command for simultaneous execution of a Device Class Object operation on all devices which have the same values for a set of device properties.
Managing Filter Device Class Object Operation Commands
The type of the command is stored in the TYPE constant of the com.prosyst.mbs.services.hdm.ham.command.FilterDCOOperationCommand interface.
Via Java API
To configure the command, use the following methods from the FilterDCOOperationCommand class:
Target Devices
The HAM retrieves all devices from the list.
Operation
When the command is executed the HAM invokes the operation on all target devices.
Asynchronous Execution
After you configure your command, call the save method. The Command Provider will save the command in Config Tree.
Via ConfigTree
All commands are stored in ConfigTree, which allows you to import/export them and to add/edit commands by modifying XML files.
You can create a command directly from ConfigTree by writing/generating an XML file, according to the following schema definitions:
Download Filter Device Class Object Operation Command Schema Definition
Download Common Datatypes Schema Definition
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- Include common types -->
<xs:include schemaLocation="HAMCommonTypes.xsd"/>
<!-- Global elements definitions -->
<xs:complexType name="filterDCOOperationCommand">
<xs:complexContent>
<xs:extension base="configNode">
<xs:all>
<xs:element name="property" type="propertyType" minOccurs="2" maxOccurs="unbounded">
<xs:alternative test="@key eq 'device_class' and @type eq 'string'" type="valueString"/>
<xs:alternative test="@key eq 'operation' and @type eq 'string'" type="valueString"/>
<xs:alternative test="@key eq 'match_devices' and @type eq 'string[]'" type="valueString"/>
<xs:alternative test="@key eq 'async' and @type eq 'boolean'" type="valueBoolean"/>
<xs:alternative test="@key eq 'ttl' and @type eq 'long'" type="valuePositiveLong"/>
<xs:alternative test="@key eq 'state' and @type eq 'int'" type="valueSceneState"/>
<xs:alternative test="@key eq 'usedInScenes' and @type eq 'string[]'" type="valueString"/>
<xs:alternative test="@key eq 'usedInRules' and @type eq 'string[]'" type="valueString"/>
<xs:alternative test="@key eq 'command_count' and @type eq 'int'" type="valuePositiveInt"/>
<xs:alternative test="@key eq 'command_id' and @type eq 'string'" type="valueString"/>
<xs:alternative test="@key eq 'command_type' and @type eq 'string'" type="valueString"/>
<xs:alternative test="@key eq 'name' and @type eq 'string'" type="valueString"/>
<xs:alternative test="@key eq 'application' and @type eq 'string'" type="valueString"/>
<xs:alternative test="@key eq 'internal' and @type eq 'boolean'" type="valueBoolean"/>
<xs:alternative type="xs:error"/>
</xs:element>
<xs:element name="config" type="configNode" minOccurs="1" maxOccurs="2">
<xs:alternative test="@name eq 'properties'" type="filterDeviceProperties"/>
<xs:alternative test="@name eq 'args'" type="commandOperationArguments"/>
<xs:alternative type="xs:error"/>
<xs:unique ref="uniqueProperties"/>
<xs:unique ref="uniqueConfigNodes"/>
</xs:element>
</xs:all>
<xs:assert test="count(property[@key='device_class']) eq 1"/>
<xs:assert test="count(property[@key='operation']) eq 1"/>
<xs:assert test="count(config[@name='properties']) eq 1"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="attributeFilterDCOOperationCommand">
<xs:attribute name="name" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="FilterDCOOperationCommand"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
<xs:complexType name="filterDCOOperationCommands">
<xs:complexContent>
<xs:extension base="attributeFilterDCOOperationCommand">
<xs:all>
<xs:element name="property" type="valueString" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="config" type="filterDCOOperationCommand" minOccurs="0" maxOccurs="unbounded">
<xs:unique ref="uniqueProperties"/>
<xs:unique ref="uniqueConfigNodes"/>
</xs:element>
</xs:all>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<!-- XML Schema definition -->
<xs:element name="config" type="filterDCOOperationCommands">
<xs:unique name="uniqueProperties">
<xs:selector xpath="property"/>
<xs:field xpath="@key"/>
</xs:unique>
<xs:unique name="uniqueConfigNodes">
<xs:selector xpath="config"/>
<xs:field xpath="@name"/>
</xs:unique>
</xs:element>
</xs:schema>
The following example contains a Filter Device Class Object Operation Command which executes the toggle operation on all devices which have the BinarySwitch Device Class Object.
Filter Device Class Object Operation Command Configuration
<config name="FilterDCOOperationCommand">
<config name="FilterDCOOperationCommand1">
<property key="operation" value="toggle" type="string"/>
<property key="device_class" value="com.prosyst.mbs.services.hdm.deviceclasses.BinarySwitch" type="string"/>
<property key="match_devices" value="Demo:Bath.lights, Demo:Floor1.lights, Demo:Garage.lights, Demo:MixedSwitch1, Demo:Room.lights, Demo:Floor2.lights" type="string[]"/>
<config name="properties">
<property key="device.classes" value="com.prosyst.mbs.services.hdm.deviceclasses.BinarySwitch" type="string"/>
</config>
</config>
</config>