I need to set up MQTT communication with an EMQX broker via TLS, but when I try to connect to the broker, I get error 16#8730 and diagnostics subfunction 5. According to the documentation, the error lies in non-authorization (incorrect password or username), but I'm pretty sure I have the correct credentials. I protect the project with security and added a CA certificate downloaded from EMQX.
(EMQX certificate (CA) I added to the Certification Manager into Certificate Authority (CA) tab. Later I found out that in the MQTT example they added certificate into Trusted certificate and root certificates tab. Could this be causing this problem?)
Information:
PLC: S7-1200, firmware v4.5
LMQTT 4.0.2, TIA Portal v17.
In the attached image, you can see my LMQTT configuration.
(I tried to set keepAlive or willTopic, but it still doesn't work.)
Thanks for help!
After an extensive investigation, I found that the PLC S7-1200 does not support TLS with SNI. However, most cloud serverless brokers, such as HiveMQ and EMQX, require SNI support.
The solution is to create a custom broker (for example, Mosquitto) and set up TLS without SNI. I've successfully set up Mosquitto on my Raspberry Pi with a static IP, and it now works flawlessly.