Step 1 - Register your Octopus with the cloud service

Before the Octopus can upload its data into the Bosch IoT Suite, you will need to register it.

Bosch IoT Suite service subscription

We assume you have already a valid subscription on Bosch IoT Suite for Asset Communication, otherwise please get yourself a free instance.

See Subscribe a package instance

Copy the credentials and the service instance ID to a local file, as you will need to use them in the course of the tutorial.

Service configuration - connection and namespace

At your Service Subscriptions page click Go to Dashboard


images/confluence/download/attachments/894255247/subscriptions-dashboard.png

images/confluence/download/attachments/894255247/Things-Connections-UI.png


  • Get access to Manage your connections.
    In case you work with the package, a connection between Bosch IoT Hub and Bosch IoT Things is already set and ready-to-use.

  • Define a Namespace.
    In our example we want the octopus to be registered as "my.namespace:octo-01" thus we set the namespace "my.namespace".
    However, you will need to use your own namespace.

Suite OAuth client configuration

Open a new browser tab and navigate to https://www.bosch-iot-suite.com/

At your accounts page https://accounts.bosch-iot-suite.com/oauth2-clients/ create a new OAuth2 client.

images/confluence/download/attachments/894255247/suite-auth-client.png

  • Set a client name.
    In our example we have created a octo-connect-auth client.

  • Select both instances (the Hub and the Things)

  • Confirm with Create.

  • Henceforth, this client can issue a valid OAuth 2 token for your upcoming solutions to build.
    The test token will expire after 60 min. Feel free to just issue a new one whenever you need one.

Starting from the list of clients for all your subscriptions, click the Use button to request a token.
images/confluence/download/attachments/894255247/create-bearer-token-use.png

Create such a token, and copy it to your clipboard, as you will need it for the next request.

The test token will expire after 60 minutes. Feel free to just issue a new one whenever you need one.

Device provisioning request

Open a new browser tab and navigate to

https://apidocs.bosch-iot-suite.com - Device Provisioning

Authorize with the Bearer token created in the previous step.

images/confluence/download/attachments/894255247/auth-things-api.png

Click Try it out, to get access to the entry fields.

Set the service-instance-id which you have copied with the credentials.

The body part could follow the pattern as given in this example.

{
"id": "<your-namespace>:<your-octopus-name>",
"hub": {
"device": {
"enabled": true
},
"credentials": {
"type": "hashed-password",
"secrets": [
{
"password": "<your-password>"
}
]
}
},
"things": {
"thing": {
"attributes": {
"info": "my first steps with the octopus"
},
"features": {
"acceleration": {
"definition": [
"com.ipso.smartobjects:Accelerometer:1.1.0"
]
},
"ambient_temperature": {
"definition": [
"com.ipso.smartobjects:Temperature:1.1.0"
]
},
"orientation": {
"definition": [
"com.ipso.smartobjects:Multiple_Axis_Joystick:1.1.0"
]
},
"linear_acceleration": {
"definition": [
"com.ipso.smartobjects:Accelerometer:1.1.0"
]
},
"magnetometer": {
"definition": [
"com.ipso.smartobjects:Magnetometer:1.1.0"
]
},
"gravity": {
"definition": [
"com.ipso.smartobjects:Accelerometer:1.1.0"
]
},
"temperature": {
"definition": [
"com.ipso.smartobjects:Temperature:1.1.0"
]
},
"humidity": {
"definition": [
"com.ipso.smartobjects:Humidity:1.1.0"
]
},
"pressure": {
"definition": [
"com.ipso.smartobjects:Barometer:1.1.0"
]
},
"angular_velocity": {
"definition": [
"com.ipso.smartobjects:Gyrometer:1.1.0"
]
},
"voltage": {
"definition": [
"com.ipso.smartobjects:Voltage:1.1.0"
]
}
}
}
}
}

Result

Upon success the Octopus has been registered and a policy has been created.

You can download the response and open the JSON file locally.

As you can see the Hub has registered the device and its credentials, and Things skeleton has been created.

Furthermore, the DEFAULT policy entry allows the suite-auth client to read and write all resources,
while the DEVICE policy entry, with the authorization subject of type "iot-things-integration" (which is also listed in the connection) is only empowered to write thing features.

{
"id": "<your-namespace>:<your-octopus-name>",
"hub": {
"credentials": {
"tenantId": "xxx_hub",
"deviceId": "<your-namespace>:<your-octopus-name>",
"type": "hashed-password",
"authId": "<your-namespace>_<your-octopus-name>",
"enabled": true,
"secrets": [
{
"password": "<your-password>"
}
],
"adapters": [
{
"type": "http",
"uri": "https://http.bosch-iot-hub.com",
"host": "http.bosch-iot-hub.com",
"port": 443
},
{
"type": "gateway-software",
"uri": "https://gateway-software.bosch-iot-hub.com/httptrprt",
"host": "gateway-software.bosch-iot-hub.com",
"port": 443
},
{
"type": "mqtt",
"uri": "mqtts://mqtt.bosch-iot-hub.com",
"host": "mqtt.bosch-iot-hub.com",
"port": 8883
}
]
},
"device": {
"deviceId": "<your-namespace>:<your-device-id>"
}
},
"things": {
"thing": {
"attributes": {
"info": "My first steps with the octopus"
},
"thingId": "<your-namespace>:<your-device-id>",
"policyId": "<your-namespace>:<your-device-id>",
"_policy": {
...
}
}
}
}