MQTT Communication with IIOT Library
I am trying to establish mqtt library on my plcnext axc 2152 v2021_0_5 with plcnext engineer 2021.3
i am using IIoT_library_2 and specifically mqtt blocks
I have attached an image where I am using mqtt blocks and trying to establish mqtt communication and test it through mqtt explorer however I am unable to establish
My plcnext ip is 192.168.1.2
url for mqtt: tcp://192.168.1.20:1883
i have tried with user name and password and without username and password
Would appreciate the help
[attachment]plcnext mqtt.png[/attachment]
i am using IIoT_library_2 and specifically mqtt blocks
I have attached an image where I am using mqtt blocks and trying to establish mqtt communication and test it through mqtt explorer however I am unable to establish
My plcnext ip is 192.168.1.2
url for mqtt: tcp://192.168.1.20:1883
i have tried with user name and password and without username and password
Would appreciate the help
[attachment]plcnext mqtt.png[/attachment]
Comments
In your screen shot, the ENO output on the FB instance is false, indicating that the MQTT Client is not ready for method calls. The EN input on the FB instance must be maintained in the TRUE state.
Also, as mentioned in the documentation for that FB, most methods should not be called continuously with EN := TRUE, especially not the Connect method.
Please note that you are able to get support for any library or application in the PLCnext Store, directly from the developers, using the "Contact" button on the app page in the Store.
Appreciate the response
the example program you shared asks for two libraries including JSON_utility_library and MQTT_Client_Library. When i go to plcnext store, i believe these libraries are udated into IioT_Library1 and IIoT_Library2.
So now issue is, these libraries are updated and example program shows error due to above similar library not available
Please guide or if you can provide those older libraries
However, it should be possible to use similar code to what you see in that example to successfully connect to a public MQTT broker, like Mosquitto, which should give some clues about how to solve the problems in your own application.