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

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

Regarding Thingworx MQTT Extension

tayyasamy
1-Newbie

Regarding Thingworx MQTT Extension

Hi,

I have one scenario.

I created a,

     new thing called "MQTTSubscriber",

     template as "MQTT",

     property as "Temperature",

     topic as "/temperature/" and "subscribe" checkbox checked.

If payload comes to this topic, i am trying to call one subscription and trying to update the property of another thing called "MQTTPublisher". But, i am getting error like "JavaException: com.thingworx.common.exceptions.InvalidRequestException: Not authorized for PropertyWrite on MQTTPublisher". Stuck here, please help.

5 REPLIES 5
ankigupta
5-Regular Member
(To:tayyasamy)

Hi Thangavel Ayyasamy​,

This seems to be Permission issues.

Check the application for the error "JavaException: com.thingworx.common.exceptions.InvalidRequestException: Not authorized for PropertyWrite on MQTTPublisher". Note the username for whom this error is occurring. Give this user permission to write property on MQTTPublisher.

I hope it helps.

Thanks,

Ankit Gupta

Hi,

I am facing some issue in MQTT communication.

I downloaded MQTT extension, then I imported this zip file into Thingworx composer. and I created the Thing called MQTTtesting. after this I am unable to connect with my MQTT broker. I thing some configuration issue. This is my configuration and properties screens. please guide me to resolve this issue.

Thanks in advance.

supandey
19-Tanzanite
(To:tponnuchamy)

Hi Thangarasu, are you following this Re: MQTT support in ThingWorx ? BTW, how is your topic setup? are you able to publish message to the topic where you have your broker installed? I think that would the first check, if that's working you can attempt from ThingWorx -  Just to be sure is your Thing connected?

Hi Sushant,

Thanks for your response.

Now I am able to communicate with MQTT. In this case I am configuring the server name as test.mosquitto.org ​in Thingworx configuration page, ​I think in this server one MQTT broker & client is running.



properties page after configuration,



But I don't want this MQTT broker. I want to use my own MQTT broker which is running on my machine (IP : 192.168.1.89). So I have to change the server name as 192.168.1.89 in my Thingworx config page right.



After this configuration Thingworx server is unable to connect with my MQTT broker.



It is possible to use my MQTT broker...?

If it is possible anything I have to change in configuration page...?

supandey
19-Tanzanite
(To:tponnuchamy)

Thangarasu, you definitely can use your own MQTT Broker if its working. I think before using your own MQTT Broker, just to make sure that the broker is working fine and you are able to publish and subscribe to topics. If you check that great post from Franck Bailleux​ i shared in my response earlier it's quite quick and straight forward :

1. Start your MQTT broker in verbose mode via a command prompt, so you know what is it doing and you will see if somehow the connections are blocked or disconnected, etc :

     mosquitto –v

2. Start another command prompt to subscribe to a topic:

     mosquitto_sub -v -i subclient -q 2 -t random/temp

3. Finally start 1 more command prompt to publish message to a topic

     mosquitto_pub -q 2 -t random/temp -m 33

The if all that goes through without any error you should see the actions MQTT broker took in the background and then the message being published to the subscribing client . Check https://mosquitto.org/documentation/ for more detail on those parameters

This should confirm you that your own MQTT Broker is working as expected. Once you have this you can use this in ThingWorx, and good thing is that there's not much to configure for a simple test in the MQTT Extension, here's how it looks like for my own broker configuration

Once it's configured you can either set the values from the Thing or can subscribe to the topic to get the updates

here's quick test i did publishing from the client

and showing that value in the Thing's property

If you are also setting this up on windows machines, do check the broker's verbose window as it will show you the updates in case the connections are blocked by firewall

Top Tags