FORUM CTRLX AUTOMATION
ctrlX World Partner Apps for ctrlX AUTOMATION
Dear Community User! We have started the migration process.
This community is now in READ ONLY mode.
Read more: Important
information on the platform change.
09-14-2022 08:29 PM
Hi,
I am just trying out the MQTT Client SL library after installing the CODESYS IIoT Libraries into ctrlX PLC.
I am using Cedalo MQTT broker installed in my ctrlX CORE at port 8883.
From ctrlX PLC, I have successfully connected to the MQTT Broker using the MQTTClient function block.
So my next attempt is to subscribe to a mqtt topic by using the MQTTSubscribe function block.
The topic in this case is a "Temperature" topic that was already published to the mqtt broker from a sensor.
My attempt is to retrieve the message from the topic in ctrlX PLC.
According to the FB description, the input wsTopicFilter is a WSTRING(1024) data type.
However after adding the MQTT Subscribe FB and downloaded to PLC, I got the error at the output of the MQTTSubscribe FB:
VAR_OUTPUT MQTTSubscribe.eMQTTError : MQTT_Error --> TOPIC_FILTER_EMPTY
Can anyone help?
Solved! Go to Solution.
09-19-2022 12:20 PM
The topic in MQTT is the name of the variable you want to retrieve.
This name can contain wildcards, therefore I the FB parmater is called TopicFilter.
In your screenshoot you just provide an empty string "" which makes no sense.
Therefore you get the error message, which exactly points you to the problem.
09-19-2022 01:04 PM
Hi, thank you for your feedback. Yes you are right.
I managed to find the solution when I referred to the example MQTT Client SL FB with the visualization.
Everything works now. Since the MQTTClient and MQTTSubscribe variables are available in the Data Layer, I brought it up to webiq and created a similar hmi which now can be accessed using a tablet pc/iPad.
Thanks!