Skip to content

MQTT Client EPC1502

Hello all,

I am trying to connect an EPC 1502 to a MQTT server (test.mosquitto.org). For that purpose I am using the IIoT_Library_4 from the PLCnext Store.

I have called the MQTT Client function block as well as the connect FB, and at the same time I am using the IsConnected FB to see if the connection works. But as you can see in the following image, the client does not connect to the server.


The diagnose message I get is that "Client is not Ready"

I have tried to send and receive MQTT messages with the EPC using Node-Red and with the same server and it works perfectly.


Do you have any hint or advice to make it work?

Thanks in advance,

Best regards.

Comments

    1. It looks like you have at least three different MqttClient function block instances, and the two methods in your screen shot are not being called on the FB instance that has the EN input set to TRUE. So the diagnostics message is probably correct, the other two FB instances do not have EN set to TRUE.
    2. Since the FB methods execute asynchronously, they are triggered off a rising edge of the xRequest input. That means each method is only executed once when the xRequest input goes high. So, for example, to check the connection status again, you will need to set the xRequest input to FALSE and then to TRUE again.
    3. When using the public Mosquitto server you should set the ClientID to something that is likely to be unique, to avoid conflicts with other clients that might have the same ClientID.

    It is also possible to get help from the library developers, using the Contact Developer button on the app page in the PLCnext Store.

  • Hi Martin,

    Thanks for the fast answer. I called the FB and both methods with the same instance and triggered the isConnected method separately and works perfectly now.

    Thanks again for your help.

    Best regards.

Sign In or Register to comment.