Bosch IoT Device Management

Telemetry example - HTTP

Via telemetry you can send messages from your device to your application. There are no acknowledgement messages whether the messages really arrive at their target.

Schematic view

images/confluence/download/attachments/2012280469/telemetry-example.png

Prerequisites

At this point we assume that you went through all steps described at Getting started and have already a device and its thing.

{
"thingId": "<your.namespace>:<your-device-name>",
"policyId": "<your.namespace>:<your-device-name>",
"attributes": {
"manufacturer": "Robert Bosch GmbH"
}
}


Let us assume, as soon as the device is instantiated, it needs to add a featureZ.

Such a command can be simulated via an HTTP API call.

If you want to try out the example several times, use private browser tabs: one for authenticating for the Hub APIs, and another one to use the Things API (or the Things UI).

Telemetry request

https://apidocs.bosch-iot-suite.com > Bosch IoT Hub - HTTP Adapter > telemetry/post_telemetry

  • Authorize

    • Set authId@tenantID - as the username.
      Tip:
      If you have access to the Bosch IoT Suite Console, you can copy it from there.

      images/confluence/download/attachments/2012280469/copy-device-username.png
    • Set the password.

    • Click Authorize and Close the dialog.

  • Execute first with the default body part as shown in the API docs UI, just to try it out.
    If the response code is 202, at least the authorization is correct.
    Note: If your browser opens a Certificate Selection Popup Dialog, please cancel it and continue.

  • If you have activated the ConnectionStatus for your connection (see Reflect device connectivity status in thing) set additionally the hono-ttd .

  • As the Request body part was just valid JSON but not conforming the Bosch IoT Things protocol, there will be no effect on the thing entity.
    Now try the "real" body part which is applicable to your thing.

    Replace <your.namespace> and <your-device-name> with the real values of your thing.

    {"topic":"<your.namespace>/<your-device-name>/things/twin/commands/modify","path":"/features/featureZ","value":{"properties":{"temperature":5}}}
  • Response - 202 is ok.
    This time, we expect that the request really has an impact on the thing.

Update the thing

This part happens automatically within the Bosch IoT Things service.

Given that the thing policy allows to apply the change, the thing is enriched with featureZ and with a new temperature value.

Potential listeners with read permission would additionally get an event.

Request the thing

Here we want to check that Bosch IoT Things has processed the command.

Additionally, the solution subscribing for events of this thing should have received an event respectively.

Tip: If you have access to the Bosch IoT Suite Console, you can open the thing and its features there.

images/confluence/download/attachments/2012280469/featureZ.png

Alternatively, if you want to use the plain Things HTTP API find details in the collapsed section.


Congratulations,
you have just executed successfully your first twin command.