alebrije - 2022-09-01

Hello,

So I would like to implement this library into my project, I spent yesterday the whole day before deciding to write in this forum.
The situation is as follows:
First my setup: Codesys V3.18.20, I'm using Control win x64 V3.18.20, Azure portal and Azure IoT explorer
I am using the example project and another empty project with only the function block.

First azure.
I created my IoT Hub Host name "HotTest.azure-devices.net", and there I created my device "TestDevice" which is enabled and the Authentication type is SaS.
In Azure IoT Explorer I am connected to the hub and i can see the Device and generate an SaS Token

Codesys:

I am using the example project with the function block

VAR
    sSubDomainName : STRING(100) := 'HotTest';//'YOUR_IOT_HUB_NAME'; // The name of your Azure IoT Hub
    sDeviceId : STRING(100) := 'TestDevice';//'YOUR_DEVICE_NAME'; // The device id
    wsDeviceSaS : WSTRING(255) := "SharedAccessSignature sr=HotTest.azure-devices.net%2Fdevices%2FTestDevice&sig=wXOzM%2BsWTGlcrMcAtD6kw3oLvTpCFiaq1KDoPqARHg8%3D&se=**********";//"SharedAccessSignature sr=YOUR_IOT_HUB_SAS_TOKEN"; // Your device SaS token (needed for c2d and d2c messages)
    azureMqttClient : AZURE.AzureMQTTClient; // Function block to establish a MQTT connection to Azure IoT Hub
END_VAR

// Create a connection via MQTT
azureMqttClient(    xEnable := xConnect,
                    uiKeepAlive := 10,
                    sHubDomainName := sSubDomainName,
                    sDeviceId := sDeviceId,
                    wsSaS := wsDeviceSaS);

So my IoT Hub name is HotTest
My device is TestDevice
and the SaS connection string is as follows:
HostName=HotTest.azure-devices.net;DeviceId=TestDevice;SharedAccessSignature=SharedAccessSignature sr=HotTest.azure-devices.net%2Fdevices%2FTestDevice&sig=cxphNRGt%2BdqY0SwfOFzu2nz0eAYD711Qut3XpdAlmYQ%3D&se=*
(I am using
at the end to protect the connection)
So i read about the SaS token and notice that the part that is required is the one after SharedAccessSignature=:
SharedAccessSignature sr=HotTest.azure-devices.net%2Fdevices%2FTestDevice&sig=cxphNRGt%2BdqY0SwfOFzu2nz0eAYD711Qut3XpdAlmYQ%3D&se=*

But after putting all the information that I mentioned before
The function block only shows the xBusy signal as TRUE and nothing more, no timeout error, no error, nothing!
And the documentation is not used with IoT explorer but with device explorer from azure which I could not find.
So I have the following questions:
* Is there any pre configuration required from my Codesys control / gateway? like permissions? or should be enough if its connected to the internet?

  • Is there something different that I need to do from azure side? The manuals show that this should be sufficient.

Extra:
I found an error in the example visualization, the field for the SaS token is linked to the Host name. Just for you to take it in count.

I hope you can help me so I can connect my Codesys controller with my azure IoT Hub, let me know if you need more information.

Best regards
Alebrije