
ElectronX (Customer) asked a question.
I am not receiving updates on topics I am subscribed to using the MQTTSUB block and I am not sure what to try next.
I am using MQTTSUB to subscribe to a topic on a ThingSpeak broker (it's a MATLAB owned IoT dashboard). I know the broker is working because I am subscribed to the same topic with MQTT.fx and can view updates there when I publish them from the PLC.
I know my PLC is connected to the broker because when I turn on MQTTSUB, I see "CONNACK received" and "SUBACK received" in the Do-more logger. I also see my "On Success" bit change from off to on. The payload is supposed to go to SS0, but I never see the data there even when I see the data appear on the MQTT.fx app. I'm not sure what else to look at - does anybody else know what might be going on?
Hi ElectronX
I would double-check your topic prefix.
https://accautomation.ca/brx-do-more-plc-mqtt-communications/
What version of firmware are you using?
Regards,
Garry
https://accautomation.ca/series/brx-do-more-plc/
Also, make sure nothing else is writing to SS0. No logic. No array index stuff. No HMI.
Look at the Cross Reference view for SS0 and any array references. This won't point to HMI writes, but it will point to any logic writing to SS0 or SS block as an array (in addition to anything looking at it as an input parameter).
Thanks for the really quick replies. I have topic prefixes turned off and I've stripped the ladder logic down to 2 rungs - 1 to turn on logging and 1 for MQTTSUB. Still the same issue
The PLC OS is version 2.8.3 and booter is 1.0.8 - so almost the most recent.
Try updating to most recent OS and GA:
2.8.4 and 1.10
Can you attach your code? Your topic must have your prefixes.
Regards,
Garry
I've stripped it down to these two rungs:
This is my MQTT client config (exact same as MQTTPUB which works)
Thanks again for your quick replies. I hope this is readable
thanks,
dave
p.s. Garry, I've learned a tonne from your website - I really appreciate all the info there.
Thanks for the comment Dave.
I do not see anything out of the ordinary.
I would try what HOST_franji1 suggested and try updating your system.
Garry
Try putting a forward slash "/" in front of "channels".
It must be a problem on the ThingSpeak side because I changed the broker to the HiveMQ test broker and everything worked.
Thanks for the update.
Garry