CodeSys don't publish to my broker

Hi,

I have a WAGO PFC300 with CodeSys 3.5 and MQTT Client SL library v1.12.0. Mosquitto broker is on VPS. Manual mosquitto_pub test works perfectly from ssh connection.

My code uses MQTTClient and MQTTPublish. Connection establishes correctly (xConnectedToBroker = TRUE) but publish never completes (xDone stays FALSE). I’ve tested with simple messages, simple topics, and even forcing xExecute := TRUE. No messages arrive at the broker.

The issue seems to be that MQTT publish doesn’t complete despite an established connection. Has anyone encountered this problem before?

It is necessary to configure the cloud connectivity in the WBM ? Because I didn’t.
I have 2 MQTT client : the wago which publish/push the data (from codesys) and node js which will retrieve/pull the data. And 1 MQTT Broker (mosquitto) installed on a VPS.

So what’s the goal of cloud connectivity configuration on the wago ?

mosquitto_pub is a linux program, so it have nothing in common with Codesys MQTT library. If you use Wago Cloud Connectivity, then you should use WagoAppCloud library. I think its the easiest way to use MQTT, but you are limited to 1 broker or 2 with extra license. If you don’t use several brokers, go for it :wink:

btw, Cloud Connectivity has 1 BIG advantage - built in buffer! So if you lost connection, it will buffer data

Thank you :slight_smile: , I already solved the problem with the WagoAppCLoud Library ! I was using the wrong library