5 Replies Latest reply on Jan 5, 2017 9:49 AM by supandey RSS
    tayyasamy Explorer

    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.

      • Re: Regarding Thingworx MQTT Extension
        Ankit Gupta Ninja

        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

        • Re: Regarding Thingworx MQTT Extension
          tponnuchamy Explorer

          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...?

            • Re: Regarding Thingworx MQTT Extension
              supandey Collaborator

              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