Christoph's Blog about Digital Stuff

Preparing the Bosch IoT Suite

2020-08-25 10:13:00 +0200

This is the third part of a multi-part blog post. You might want to start from the beginning with the first post.

I assume you already have logged in to the Bosch IoT Suite Console, if you haven’t done this yet, you can follow this link to sign up.

I am going to use several features in the Bosch IoT Suite for facilitating the automatic distribution of the firmware build using GitHub Actions (The continuous delivery aspect). We are using tags to create a subparition of the device fleet for devices that should receive firmware updates from the CI/CD pipeline. The devices itself communicate with the Bosch IoT Suite using MQTTS, the firmware images are downloaded using a CDN with HTTPS.

We will need to setup and configure a few specific things in the IoT Suite services.

Booking the Device Management Package

After account creation and confirmation let’s head to the Subscriptions page, if you have a newly created account you probably don’t have a subscription yet, and your screen will look similar to the following screenshot:

3 Subscriptions after login Empty subscriptions overiew after login

4 Subscription Creation Create new subscription view

5 Subscription Creation DMP Select the subscription plan (at the moment only free plans are available)

6 DMP Creation Last Step Confirm the subscription creation

The provisioning might take a few minutes. Afterwards you will have Bosch IoT Things, Bosch IoT Rollouts, Bosch IoT Hub and Bosch IoT Manager booked.

7 Subscription Overview with DMP provisioning DMP subscription after creation in provisioning state

8 Subscriptions with DMP provisioned DMP subscription after provisioning

When clicking on “Access Credentials” you can retrieve endpoints and credentials information for the various services of the Device Management Package. Please extract the information for IoT Rollouts (Tenant, Username, Password) we are going to need them later.

8 1 DMP Subscription Credentials DMP subscription credentials after provisioning

8 2 DMP Subscription Credentials Rollouts DMP subscription credentials after provisioning, rollouts section

Let’s click on “Go to Dashboard”, this will open up the IoT Manager web ui. From there click on “Things Dashboard” in the upper right corner to bring up the web ui for configuring Bosch IoT Things.

9 IoT Manager dashboard The IoT Manager Dashboard, with the various sections. Please also take a look at the corner on the top right. There you can find shortcuts to jump into IoT Rollouts and IoT Things.

Configure Namespace in IoT Things

Before we can register our device and create the device shadow in IoT Things, we need to register a namespace in IoT Things. Each Thing in IoT Things belongs to a namespace, this way the things with the same serial numbers belonging to different solutions can be differentiated.

11 things dashboard overview The IoT Things dashboard after login

Please head over to “Namespace” and register your namespace. In my example I am using the namespace “de.cgrotz.testnamespace”. In the IoT Suite, thing IDs consist of a leading namespace and for example the device ID, e.g. de.cgrotz.testnamespace:device_123.

12 things namespace configuration The registered namespace

Create new Device

Let’s go back to the IoT Manager and register our first device. After device registration IoT Manager provides a JSON config file to you, that contains everything the device needs to connect to the Bosch IoT Suite.

13 iot manager device management empty The device managemnt section of IoT Manager without any devices

15 iot manager new device filled Registering a new device

16 iot manager new device result After creating a device you are presented with a JSON data structure that contains the necessary information for connecting the device

Create Rollouts tag

If we later want to be able to select common devices, for example devices belonging to our beta fleet. In order to do so, the Device Managment Package has the concept of tags. Tags need to be created in IoT Manager first, and can then be assigned to devices. Tags can be queried in IoT Rollouts Target Filters for selecting Deployment Targets that for example fulfill certain requirements (e.g. the Beta Tag we just created).

19 iot manager dm grouping dropdown The grouping section in IoT Manager, dropdown with grouping options opened

20 iot manager dm grouping tags The grouping section, with Tags selected

21 iot manager dm grouping tags new tag Create a new tag, please keep in mind that the tag ID also needs to lead with the namespace we previously created in IoT Things

Now let’s head back to the device management section and select the device we previously created

24 iot manager dm device selected scrolled to tags When scrolling down in the device details, you can see tags assigned to the device

Assign the tag we just created to your device.

25 iot manager dm device selected assign tag The assign tag menu

26 iot manager dm device selected tag assigned The device with assigned tag

In the IoT Things dashboard you can see the change to the device shadow, that reflects the assigned tag.

29 iot things thing details 2 The device shadow in IoT Things, now with Beta tag assigned

30 iot rollouts overview The beta tag in IoT Rollouts with the device as update target

Configure IoT Rollouts

In order for the auto rollout to work without hickups (especially when testing), I needed to “allow parallel distribution of multiple distribution set assignments and rollouts”. The non hacky approach would be to cancel distribution set assignments on the targets before updating the auto assignment in the target filter.

31 iot rollouts system configuration The options in IoT Rollouts system configuration. You will need to scroll down to the end of the page for the save button.

Create Rollouts Target Filter

Next let’s create a target filter. Target filters allow to group update targets using a filter criteria. You can assign distribution sets to target filters for automatic assignment. This means when a target matching the criteria is added it will (with some delay) automatically get’s the distribution set assigned and the update process will start.

My target filter is filtering on Beta tags with the following syntax tag==Beta. In a production scenario I would also add a device type since we are building firmware for different target devices.

33 iot rollouts target filters The empty target filters overview

34 iot rollouts new target filter Creating a new target filter

If you followed this steps, you should now have succesfully setuped everything you need in the Bosch IoT Suite to now connect our device.

You can go ahead with Part 4 - Uploading and distributing the firmware using Bosch IoT Rollouts