Bosch IoT Device Management

Command and control - one-way

One-way commands are sent from a connected business solution through the Bosch IoT Things and Bosch IoT Hub to a connected device. This type of command is neither confirmed nor answered by the device.

Schematic view



Create command subscriber

Download the server certificate for MQTT TLS encryption

curl -o iothub.crt

Start and subscribe to MQTT command topic with Mosquitto MQTT client

mosquitto_sub -d -h -p 8883 -u <authId>@<tenantId> -P <your-password> --cafile iothub.crt -k 30 -t command///req/#

Make sure you replace all parameters correctly:

  • <authId> the ID of the credential that was created during device provisioning

  • <tenantId> the ID of your tenant

  • <your-password> the password that was registered with the credential.

    Note on the password

    Use the password as you have created it during the device provisioning (credential registration) in plain text.
    Do not use it hashed or base64 encoded, when sending messages.

    The data transfer is secured by TLS encryption.

  • The -k parameter is to overwrite the default keep alive period. Here we set the keep alive period to 30 seconds.
    If no data flows over an open connection for longer than 30 seconds then the client will generate a PINGREQ to indicate the server that the device is still active.

  • The -t parameter is the name of the MQTT topic to subscribe to.
    In this example the topic command///req/# is defined using the MQTT topic wildcard format, to subscribe to all possible commands.

The MQTT client is now subscribed to the Bosch IoT Hub and is ready to receive commands.

Update the feature of the thing

  • Authorize with a fresh Suite OAuth token.

  • Feature resource

    • Navigate to PUT /things/{thingId}/features.

    • Click Try it out to access the entry fields.

    • Set the thingID that was created during device provisioning.

    • Set the Request body.

      "temperature": {
      "properties": {
      "configuration": {
      "target": "21.0"
    • Click Execute.

You have updated the feature of the digital twin.

This emits a twin event "twin modified" with a respective payload which is sent via Bosch IoT Hub as a command message to the device.

Receive a one-way command

You should see the command message printed out on the command line:

Client mosq/7EqsKGFb69CxB2liZu received PUBLISH (d0, q0, r0, m0, 'command///req/0240aaceac3-f08a-4fcc-aef6-076f5adc0271replies/modified', ... (692 bytes))
"headers": {

That shows that the device has received the command message.