Bosch IoT Device Management - will be discontinued by mid 2024

Manage features via Hub HTTP API

In this step, you will try to achieve the results of Manage features via Bosch IoT Suite UI, by simulating the device sends it.

Recap

If you managed the attribute change, you have learned already the basics:

  • You need to authenticate like the device.

    • The Username is composed with the pattern <namespace>_<device-name>@<hub-tenant-ID>

    • The Password is as set by yourself at the provisioning time

  • The message needs to follow the Eclipse Ditto protocol, because of the managed connection between Bosch IoT Hub and Bosch IoT Things.

    • The topic is composed in a similar manner "<namespace>/<device-name>/things/twin/commands/modify" or "<namespace>/<device-name>/things/twin/commands/merge"

    • The path describes how the thing looks like. In this case, instead of "/attributes/<attribute-key>/" you will need to set "/features/<feature-ID>/properties"

    • The value holds all the payload, which can be nested, and needs to be a valid JSON object.

Goal

Let's assume your device already has the temperature feature and only wants to replace the value of "currentMeasured" to 30 degrees.

Procedure

Navigate to the API docs

Bosch IoT Hub > HTTP Adapter > telemetry.

Authorize

The pop-up offers basic authentication.

In this example, you will mimic the hello-world-device.
Therefore, please authenticate with:

  • the username auth-ID@Hub-tenant-ID and

  • the password

as you have set them at the start, in the provisioning.

You can copy the Username from the Bosch IoT Suite console.

images/confluence/download/attachments/1634788021/hello-world-hub-username.png

Navigate Things > hello world > Device > Credentials, from there you can copy the Username to the clipboard and use it in the Authorization pop-up at the HTTP API docs.


images/confluence/download/attachments/1634788021/hub-basic-auth.png

Close the popup.

Publish telemetry data

  • Navigate to POST /telemetry.

  • Click Try it out - to get access to the input fields.

  • Setting the QoS-Level (Quality of Service) for publishing telemetry messages is optional and can stay empty.

  • Setting the hono-ttd (time ‘til disconnect) is optional and can stay empty.

  • Set the Request body.

    • The type must be application/json.

    • The content must respect the thing's notation.
      In our case, the request body looks like this:

      {
      "topic": "xxx-add-your-namespace-xxx/hello-world-device-01/things/twin/commands/modify",
      "path": "/features/temperature/properties/status/value/currentMeasured",
      "value": "30"
      }

      For the logic on how your thing actually looks like: look up the JSON view in the Bosch IoT Suite Console.
      For the JSON syntax: use https://jsonlint.com/ to check if your content is valid JSON.

  • Click Execute.

Result

The response code 202 shows success. The changes are forwarded via managed connection to the digital twin layer.

Check your work

The easiest way to see if setting a new temperature setting succeeded is to open the Features section in Bosch IoT Suite UI.

In case of failures see the tips given in the previous section Manage attributes via Hub HTTP API.