cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

Using MQTT protocol in ThingWorx

ilopez
3-Visitor

Using MQTT protocol in ThingWorx

Hi everyone,

I am currently working in developing some IoT demos by connecting TI SensorTags (it contains 10 different kinds of sensors) to ThingWorx. I have already installed the MQTT broker (Mosquitto) and imported the MQTT extension on TW.

In order to model my SensorTag as a Thing, based on the imported MQTT ThingTemplate, and then represent all the properties on mashup, I would need to figure out all the specific steps required to correctly configure and validate the connection between the broker and mobile app.

I would appreciate any reference guide or detailed description related to my issue.

Thank you in advance,

Ivan

6 REPLIES 6

Hi Ankit,

Thanks for your hints: I have been able to configure the TW platform with the Mosquitto server on my laptop.

However, I am currently facing some communication issues as described below:

  • On the edge side: I have installed a MQTT Client Android app that, configured with Broker IP and port, communicates correctly with it. This has been just a trial, before connecting the TI SensorTag app, to figure out if the broker server was connectable or not.
  • On the platform side: ThingWorx is working correctly with the Mosquitto server and, putting some input values from Mosquitto, ThingWorx is able to receive them in real-time, and vice versa.

The facing issue relates to the fact that these two sides do not "speak" each other: sending some values from the MQTT Client mobile app to the Mosquitto server, they are not received by the TW platform. So, I am not able to figure if there is some connection configuration trouble.

Below the printscreen of the TW Log.

Thank you in advance,

Ivan

I have made a new trial and I guess the issue is the following:

"Error Handling Publish Arrived for [random/temp] : [Unable To Convert From java.lang.String to NUMBER]"

Could someone suggest me how to convert the input string-value, coming from the broker, into a number on the related mashup?

Appreciating your help,

Ivan

posipova
20-Turquoise
(To:ilopez)

Could you please show your service with input values/its types?  Perhaps you  could create an intermediate service that would extract the numbers from the string, possibly via json

ilopez
3-Visitor
(To:posipova)

Hi Polina,

I have not created the service yet, that is my concern. I am trying to understand which TW entities should I model in order to define this service.

What I am doing is the following: I am sending some number inputs from the MQTT Client mobile app to MQTT Mosquitto Broker on my laptop (this corrently works) but I am not able to report the sent data on TW dashboard.

On the Thingworx side: the MQTT broker correctly works with Thingworx just putting some values from mosquitto command line: the value are correctly updatedon my mashup.


At this aim, looking at the previous posted error, I am trying to understand if the problem could be just a matter of conversion from string input to number output. The configured ​topic ​is "random/temp" as shown below. I hope this helps.

Thank you,

Ivan

Dear Ivan,

Have you managed to make it work?

Cheers, Christian

Top Tags