For work with Microsoft Azure MQTT protocol is used with Poseidon2 and Damocles2 units. It is necessary to have FW 3.2.6 and higher.
For settings and activity verification we use Device Explorer Twin software. It can be downloaded on https://github.com/Azure/azure-iot-sdks/releases/download/2016-11-17/SetupDeviceExplorer.msi When open application we enter string into window IoT Hub Connection String, which was recieved when account. After that, click on the update button. MS Azure was created and we generate SAS key for required time. In our case 365 days:
Now please switch on Management tab and create new product on Device IP with name e.g. Poseidon24002Demo
Creation is confirmed by this window:
Now you can see the device in the list of devices
We will select new device and by pressing SAS Token password can be generated:
Here we notice DeviceID column which contains right device and field TTL (Days) should have suitable lenght, the lenght indicate the lenght of validity:
We copy password from Token. It contains everything what starts with string SharedAccessSignature sr
Now we set Poseidon unit:
On MQTT page we enable MQTT protocol support. Enter server address which was assigned to us when creating MS Azure account, port add 8883 and at the same time we check Secure SSL Mode. Into field Password we enter password generated by previous step. Username is always a compound of server address and DeviceID, for example hwg.azure-devices.net/Poseidon24002Demo and Client ID is in this case on same level as DeviceID.
At the same time, you still need to allow user defined Topic and as Topic name set: devices/YOUR_DEVICE_ID/messages/events/, for example devices/Poseidon24002Demo/messages/events/:
Into Topic Value we can fill definated content using macros:
// XML template
<?xml version="1.0" encoding="utf-8" ?> <BinaryInSet>%LOOP_IN%<Entry> <ID>%VAL_ID%</ID> <Name>%VAL_NAME%</Name> <Value>%VAL_VALUE%</Value> <State>%VAL_STATE%</State> </Entry>%LOOP_IN_END%</BinaryInSet>
<BinaryOutputSet>%LOOP_OUT%<Entry> <ID>%VAL_ID%</ID> <Name>%VAL_NAME%</Name> <Value>%VAL_VALUE%</Value> <State>%VAL_STATE%</State> </Entry>%LOOP_OUT_END%</BinaryOutputSet>
<SensorSet>%LOOP_SENSOR%<Entry> <ID>%VAL_ID%</ID> <Name>%VAL_NAME%</Name> <Value>%VAL_VALUE%</Value> <State>%VAL_STATE%</State> </Entry>%LOOP_SENSOR_END%</SensorSet>
<BinaryOutputSet>%ID_OUT_3%<Entry> <ID>%VAL_ID%</ID> <Name>%VAL_NAME%</Name> <Value>%VAL_VALUE%</Value> <State>%VAL_STATE%</State> </Entry>%ID_OUT_END%</BinaryOutputSet>
// Json template
{ "sensors": [ %LOOP_SENSOR%{"id":%VAL_ID%, "name":"%VAL_NAME%", "value":%VAL_VALUE%, "state":%VAL_STATE% },
%LOOP_SENSOR_END%,], "inputs": [ %LOOP_IN%{"id":%VAL_ID%, "name":"%VAL_NAME%", "value":%VAL_VALUE%, "state":%VAL_STATE% }, %LOOP_IN_END%,],
"outputs": [ %LOOP_OUT%{"id":%VAL_ID%, "name":"%VAL_NAME%", "value":%VAL_VALUE%, }, %LOOP_OUT_END%,] }