Skip navigation links

Package com.bosch.iot.dm.groovy.di

This is tha main Scripting API of IoT Manager and provides functionality for working with Devices.
The most commonly used binding provided by this service is the one with alias "target" and is an object of type Device.

See: Description

Package com.bosch.iot.dm.groovy.di Description

This is tha main Scripting API of IoT Manager and provides functionality for working with Devices.
The most commonly used binding provided by this service is the one with alias "target" and is an object of type Device. These "target" objects are available when scripts are executed in Device Scope (not System Scope, please check manual for details). In Device Scope, the script is run once for every device in the scope and the "target" binding holds representation of that Device.
Example usage:
The "target" binging is available not only in a) the Task/Rule action, but also in b) the groovy scripts used for scope filtering condition and c) in the Rule trigger condition if the trigger event fires the Rule for a concrete device.

Another possibility to use this Scripting API is via its root binding of type DeviceInventory that can be accessed with the following aliases: "di" and "deviceInventory".
Example:

Dynamic methods and fields of Features:
This scripting API provides also ability to access the properties and operations of a Feature in two ways - generic and dynamic.
Suppose that you have a Feature with id "MyFeature" that has a property "sensorValue" and an operation "switchOn". You can access this property and invoke this operation in the following equivalent ways:
def myFeature = target.feature('MyFeature') // first access the feature, this is common for all examples

Generic Way Dynamic Way
Access Property def value = myFeature.property('sensorValue') myFeature.sensorValue
Invoke Operation def value = myFeature.exec('switchOn', someArgs) myFeature.switchOn(someArgs)
Skip navigation links