Problems adding a device using MQTTbox with a trial cumulocity account

Hi Cumulocity Team,

I have created a trial account at :

https:// ‘company name’ .eu-latest.cumulocity.com

I’ve also successfully tested the iPhone app to register my first device, this all works fine.

I’m now trying to register a device via the MQTTbox Windows app.

I struggled with the client connection settings initially until I found a reference to the user ‘management/devicebootstrap’ in this forum.

With this particular user the application does successfully connect. however when I try to register a device, the feedback on the s/e subscription says :

“50,100,Error on device creation, message: Error on device creation, message: User ‘devicebootstrap’ has insufficient privileges”

So, I have a few areas where your help would be greatly appreciated:

  1. How do I create a user with sufficient privileges to register/add devices via MQTT ?

  2. The MQTTbox client connection settings applicable in my use case, as the ‘Hello MQTT’ example is not clear.

  3. Workflow for adding devices via MQTT, i.e. can this work like the iPhone app or do you need to add the device first via the cumulocity IoT device management ?

  4. Example command to register a device into my cumulocity database.

Hope you can help.

Best Regards

David

Hi David,

the management/bootstrapuser can only be used to check if the device has been registered in any tenant.
The whole process is described here: https://cumulocity.com/guides/device-sdk/mqtt/#device-integration

This is the important part:

  • When you take a new device into use, you enter this unique ID into Device registration in the Device Management application in Cumulocity IoT, and start the device.
  • The device will use this ID as part of the MQTT ClientId and static user credentials that can be enquired from support.
  • The device subscribes to the topic s/dcr.
  • The device starts publishing continuous empty messages on the topic s/ucr to notify the server that it is ready to retrieve credentials.
  • Next, you must accept the connection from the device in the Device Registration page.
  • When the device sends the next empty message it should receive credentials in the format 70,<tenantID>,<username>,<password>

Also of course you can create a new user in “Administration” assign the “devices” role to it and authenticate with that user.
The user should always contain the TenantID (can be found when clicking on your user within Cumulocity) and the username separated with a “/”. Example: t213123/deviceUser
The MQTT Client ID must be unique like an Serial Number or MAC Address.

As soon you send any MQTT message the device will be created within the tenant it is registered.

Hi Stefan,

Firstly, thank you for replying to my post, much appreciated!

I had reviewed the device integration documents and the ‘hello mqtt’ guides but I still have the problems outlined in my original post.

The really important thing is what values do I enter into the MQTTBox application fields for a connection with an account that I have created ? (I did at least learn to day how to add the ‘devices’ role to an account today).

So within Cumulocity I created a user called ‘support’ with many associated roles including ‘devices’.
Under the user icon within the web app I see:

Tenant ID: MyCompanyName
Backend: 1006.11.0
UI: 1006.11.0

FWI, my cumulocity cockpit is located at : https://MyCompanyName.eu-latest.cumulocity.com

So, what do I put into the host field of MQTTBox ?

I have tried the following:



mqtt.MyCompanyName.eu-latest.cumulocity.com
MyCompanyName.eu-latest.cumulocity.com/mqtt

What goes into the user field of MQTTbox ?
I’ve tried the following:
MyCompanyName/Support
t1006.11.0/Support
t1006110/Support

Any help appreciated.

Best Regards

David

Hi,

So think I’ve found some of the key issues not covered in the online documents:

The host field needs to be: mqtt.eu-latest.cumulocity.com

The user field is : MyCompanyName/user

Where, in my case, the web app shows my tenant id as my company name which is what I entered when creating the trial account.

There is no identifier within the Cumulocity web app in the format ‘t number’, not that i could find anyway!

The other important issue I found was that I was trying to connect from MQTTbox with a 'user 'that was created from the Administration section of this URL :

mycompanyname.mycloud-eu-central-1.softwareag.cloud

…even though it had access to Cumulocity and ‘devices’ as a role.

If I used a user created from within the Cumulocity cockpit then the mqtt connection works fine :slight_smile:

Best Regards

David