Bosch IoT Device Management - will be discontinued by mid 2024

Manage your device fleet in bulk

images/confluence/download/attachments/2230549137/06-task.png

To enable bulk operations on multiple devices at once you can create and manage tasks and rules.

Executions allows you to monitor this process.


Let us assume you want to make sure all devices have a manufacturer attribute.

Tasks are simple actions which can be instantly launched on a device or a set of devices.

  • The scope element of a task defines the targets on which the action will be executed.

  • The action element of a task is a Groovy script which defines the effect which the task is intended to produce.

If you want to express setting an attribute in Groovy, the script would look like in the following snippet.

import groovy.json.JsonSlurper
 
def value = '{"name": "ACME demo corp.","location": "Berlin"}'
 
Attribute attribute = new Attribute();
attribute.setId("manufacturer");
attribute.setValue(new JsonSlurper().parseText(value));
 
target.setAttribute(attribute);


Create a Task

  • Open the Tasks UI feature

  • Click the plus icon to create a new task

    images/confluence/download/attachments/2230549137/first-task.png
  • Fill in the Settings

    1. A Name is required. Set for example set-manufacturer-attr.

    2. Define the Scope. If you want it to work for all devices, just don't filter by any of the options.

    3. Define the Execution options. If you don't run into concurrency issues and don't need time constrains, just don't use the entry fields.

    4. Continue with Next.

      images/confluence/download/attachments/2230549137/task-manufacturer-settings.png
  • Fill in the Action - Copy / paste the script from above.

    If you need help with the Groovy API for other actions, click on the upper bar and the help will be displayed in a new column at the right

    You can copy the signatures of several methods which you might need. To store them as a comment just prepend // in the script field.

    If you enter text in the action editor, you will directly get helpful proposals.

    images/confluence/download/attachments/2230549137/task-groovy.png

  • Confirm with Finish.


A task is executed instantly and only once.
If you want to trigger it again, activate the Retry execution button

However, if you need more logic, or need other triggers, e.g. time based, or bind the execution on other conditions - try creating a rule instead.

images/confluence/download/attachments/2230549137/task-manaufacturer-result.png




Further concepts

Rules

Rule

A rule is the automated execution of a mass management task or a series of such tasks upon the occurrence of a defined trigger, which consists of an event and condition.

When the relevant event occurs, the rule is fired and this leads to evaluation of its condition. If the condition is satisfied, the rule is triggered, i.e. a new task is launched and the execution of the defined action script is started. One triggering of the rule launches one new task.

images/confluence/download/attachments/1740779671/mme_rule_lifecycle.png

In addition, rules provide a number of ways in which this automation can be tailored to the needs of the use case.

See Rules

Creating a rule is very similar to creating a task.
Find more details, especially about the creation of manual, time- or event-based triggers at Create a rule.

Executions

The Executions UI feature lists all tasks and rules executions. There you can track the progress and monitor the state.

images/confluence/download/attachments/2230549137/task-execution-view.png


If you want to see only the executions for a specific device the easy way is to navigate from the device's details.

images/confluence/download/attachments/2230549137/device-details-executions.png

Check the outcome

Navigate to Devices > your device > Attributes and see if the manufacturer attribute is now available.