The icom Data Suite allows to send data to the Microsoft Azure IoT Hub from an INSYS Smart Device and receive commands sent from the Microsoft Azure IoT Hub to the INSYS Smart Device.

Situation

The value of a data point of an INSYS Smart Device is to be sent to the Microsoft Azure IoT Hub by the icom Data Suite. The IoT Hub again will send a message to the Smart Device to toggle an output of the router.

Solution

The following simple exemplary application transmits the count of a timer of the icom Data Suite to the IoT Hub in regular intervals. The icom Data Suite will be configured that it changes the state of an output every time it receives a specified message from the IoT Hub. This application is only intended to demonstrate how to send a value to the IoT Hub and receive commands from the IoT Hub and has no technical importance.

Configuration of Microsoft Azure

It is prerequisite that you have a Microsoft Azure account and the IoT Hub is installed. [1]
In order to generate the required credentials, it is also prerequisite that you’ve installed the Azure IoT Explorer on your computer. [2]

  1. Open the Microsoft Azure website using a browser:

  2. Log in using your Microsoft credentials.

  3. Select the IoT Hub from All resources.

  4. Select IoT devices in the Explorers section.

  5. Click on New ().

  6. Enter a descriptive Device ID for your device.

  7. Click on Save.

  8. Open the Azure IoT Explorer software.

  9. If the Azure IoT Explorer is used for the first time with this IoT Hub, paste the IoT hub connection string into the Select or type an IoT hub connection string field and click on Connect. [3]

  10. Click on the device and under Connection String with SAS token on the down arrow () to generate the token.

  11. In the Symmetric key field, select Primary key, enter a validity period in the Expiration (minutes) field and click on Generate.

  12. Keep this Azure IoT Explorer window open for later use since you need this token for the configuration in the icom Data Suite. The string starting with SharedAccessSignature sr= (behind SharedAccessSignature=) until the end needs to be copied.

Exemplary string

HostName=<client>.azure-devices.net;DeviceId=xxx;SharedAccessSignature=SharedAccessSignature sr=<client>.azure-devices.net%2Fdevices%2Fxxx\&sig=Uc9yPCZABVtTo7XasecB%2Fe3ldBLXTYndVmxNc37uw80%3D\&se=1511321749

Configuration of the icom Data Suite

It is prerequisite that you have access to the web interface of the icom Data Suite. The Smart Device must have Internet connection. The following instructions assume that the icom Data Suite is in default settings and has the required licenses.

  1. Open the web interface of the icom Data Suite using a browser:

  2. In the Data pointsDigital I/Os menu under Outputs, add a new output ():

    • Description: Output 3.1

    • Output: 3.1 [4]

  3. Click on Save settings.

  4. In the Data pointsTimer menu, add a new timer () and edit it ():

    • Description: Count sample timer

    • Type: Interval, triggered each 30 seconds

  5. Click on Save settings.

  6. In the Data pointsTimer menu, add a new timer () and edit it ():

    • Description: Message trigger timer

    • Type: Interval, triggered each 4 seconds

  7. Click on Save settings.

  8. In the MessagesMQTT menu, add a new broker () and edit it ():

    • Description: Azure

    • Server: <client>.azure-devicves.net [5]

    • Port: 8883

    • Version: v3.1.1

    • User name: <client>.azure-devicves.net/<Device Id>/api-version=2018-06-30 [6]

    • Password: Enter the SAS token generated using Azure IoT Explorer above.

    • Client ID: <Device Id> [7]

    • Use SSL/TLS:

  9. Click on Save settings.

  10. In the MessagesMQTT menu, add a new message () and edit it ():

    • Description: Azure message

    • Topic: devices/<Device Id>/messages/events/

    • Message:
      {
      "count": $timer1
      }

  11. Click on Save settings.

  12. In the Events menu, add a new event () and edit it ():

    • Description: Send message to Azure

    • Event: Timer has expired

    • Timer: timer2 - Message trigger timer

    • Action: Send message

    • Send message: mqttMsg1 - Azure message

  13. Click on Save settings.

  14. In the Events menu, add a new event () and edit it ():

    • Description: Receive message from Azure

    • Event: MQTT message has been received

    • From MQTT-Broker: mqttBrkr1 - Azure

    • Topic: devices/<Device Id>/messages/#

    • Text: Filter [8]

    • Action: Set digital data point

    • Data point: output1 - Output 3.1 and toggle

  15. Click on Save settings.

  16. Activate the profile ().

Result testing

Check the connectivity using the Azure IoT Explorer.

  1. In the Azure IoT Explorer, click on Refresh () and check, whether the Connection state of the device is Connected.

  2. Click on the device and in the Telemetry section on Start () to check, whether messages are received.

  3. Enter in the Cloud-to-device message the Message body Filter and click on Send message to device () to check, whether the Smart Device reacts on the message by toggling the configured output. You can check the state of the output in the StatusCurrent values menu of the icom Data Suite.

Troubleshooting

  • If the icom Data Suite cannot connect to the IoT Hub, check the configuration of the MQTT broker.

  • Take care to copy the correct portion of the token string generated using Azure IoT Explorer.


1. The IoT Hub can be added under All Ressources.
2. On the Github page, click on releases to find the Windows MSI file and Linux packages.
3. Copy the connection string of the IoT hub under Shared access policies in the Settings section with a click on the iothubowner policy and then on the copy symbol () behind Connection string – primary key.
4. The number of the output may differ depending on your INSYS Smart Device.
5. The server address is the Hostname of your IoT Hub. Copy it from the IoT Hub under Overview by a click on the copy symbol ( ) behind Hostname.
6. The user name is composed of the server address (hostname), the ID of your device in the IoT Hub and the api-version string.
7. The ID of your device as entered in the IoT Hub under Configuration of Microsoft Azure above.
8. This text string must to be sent from Azure to the Smart Device that the Smart Device triggers the action.