mini-device-integration

In the course of this tutorial part you will create a thing and learn to appreciate the Java integration view on this little thing.

Estimated time to go through: 10 minutes

  1. Register for a Free service account How to book the service?
  2. Click Dashboard to get directed to the user interface Manage your solution
  3. Prepare a Keystore and a Truststore for your solution.
    In order to comply with high security standards a private/public-key based challenge-response mechanism is used.
    1. Find a step-by-step description at Manage your private and public key.
    2. Submit the public key to our service.
    3. The file things-client.jks holds also the private key. This one, you will need to add it to your things-client application
  4. Sign up for a free user account at Register a user.
    Tip: The Things service will use the technical user ID in your thing's policy.
  5. Set up your workspace according to section Set-up your IDE.

This is an example on how your config properties file could look like.

config.properties
## config.properties ##
## Find your value at the 'credentials' section after booking
endpoint_ws=wss://things.eu-1.bosch-iot-suite.com/ws/2
# for an instance on BIC this would be 
# endpoint_ws=wss://things.s-apps.de1.bosch-iot-cloud.com/ws/2
 
## Find your values at 'Manage your Solution'
solutionId=xxx
apiToken=xxx
namespace=xxx.xxx
 
## The client ID is composed at line 112 DeviceIntegration.java
## clientId=solutionId:connector
 
## Use your credentials from Bosch IoT Permissions
userid=xxx
username=xxx
password=xxx
tenantName=xxx
 
## Use your company proxy settings
#proxyHost=xxx
#proxyPort=xxx
#proxyUser=xxx
#proxyPwd=xxx
 
## Use your public and private key generated for this solution
keystoreLocation=things-client.jks
keystoreAlias=things
keystorePassword=xxx
keystoreAliasPassword=xxx
  1. Import the mini-device-integration Maven project to your workspace.
  2. Add resources at scr/main/resources:
    1. config.properties - needs to be added by you.
      This file contains all credentials needed (e.g. solution ID, API token, user, keystore, proxy etc.).
    2. logback.xml - is already provided and can be adjusted if you need another log level.
    3. things-client.jks - needs to be added by you.
      This is the public/private key pair.
      Your project would now look like in the following screenshot
  3. Run Maven clean and install mvn clean install
  4. Execute the new jar from the target mvn exec:java.
    Additionally to the thing, its policy, with the same name, will be created.

The Thing ID will be logged out at the console after the first run.
In order to avoid ambiguity, our service will prevent you from creating 2 Things with the completely same ID. Thus in each run you will create a new thing.


thing log

In Things notation this would look like in the following snippet

{
 "thingId": "<your.namespace>:<your-device-name>",
 "policyId": "<your.namespace>:<your-device-name>",
 "features": {
  "counter": {
    "properties": {
      "value": 42
    }
  }
 }
}

The user who's credentials were configured in config.properties will have permission to read, write and administrate the thing with the given ID.
Find details in the next tutorial section mini-webui.

Congratulations,
and hopefully you had fun integrating your first thing.