Hey all,
I am looking at whether it is possible to have a Siemens S7-1200 / -1500 CPU send MQTT messages directly to the Azure-IoT-Hub, but it is currently not working.
I am wondering if the Azure-IoT-Hub accepts regular MQTT messages. The PLC is linked with a CA-certificate and the connection is created correctly. But from the moment I send the first MQTT message it goes wrong. Azure then closes the connection for a reason unknown to me.
Since all tutorials about Azure-IoT-Hub always work with an SDK that you have to download, I don't really get any further. It is not possible to work with SDKs on a Siemens PLC. Programming is in "SCL" (Structured Control Language) language and messages must be completely constructed from zero.
The first message to be sent is the "Connect" function according to the MQTT standard (if I'm not mistaken). For my code I used this example: r_example_mqtt.htm
I'm also following the standard MQTT v3.1.1 specification
Below is a screenshot of the data being sent to the CPU interface in which you see the connect MQTT message. Maybe there is an error, but then I don't see it yet. I have already tried several things (for example turning on the "clean session" bit) but no success yet . User & password is not required as the connection is established with certificates (this works). For the rest, I have other options turned off to keep the message as simple as possible.
But something tells me that Azure-IoT-Hub is not really an MQTT-broker and it is simply not going to work this way. So if someone can confirm this to me? Or even better: know how to get it done?
Thanks in advance
PS: Siemens has also released "LMQTT_Client" function blocks, but these also do not work with the Azure-IoT-Hub (same error). Sending messages to another MQTT-Broker as for example AWS-IOT-Hub (Amazon) works fine with these blocks. fb-lmqtt_client-for-simatic-s7-cpu