Before the PLC can publish to over MQTT, the WagoAppCloud settings needs to be changed to fit the system this is done by writing the PLC's IP into the searchbar of a web browser, then cloud connectivity → connection 1. The settings are set to:
To set up a MQTT publisher in codesys the following libraries are necessary to use:
WagoSysPlainMem
WagoAppCloud
The functionblock MQTT_Publisher was then created , with the following code: