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.

Configuration of Microsoft Azure

The following prerequisites are assumed:

  • You have a Microsoft Azure account

  • The IoT Hub is installed in the Azure environment [1]

  • The Azure IoT Explorer is installed on your local computer [2]

In the following, a new device will be added in the IoT Hub and a security token will be generated for this device using the IoT Explorer.

  1. Open the Microsoft Azure website using a browser: https://portal.azure.com

  2. Log in using your Microsoft credentials.

  3. Select the IoT Hub from All resources.

    cg en ids cloud sending value to azure 01

  4. Select IoT devices in the Explorers section.

    cg en ids cloud sending value to azure 02

  5. Click on New in the heading line.

    cg en ids cloud sending value to azure 10

  6. Enter a descriptive Device ID for your device; there is no need to make further settings.

    cg en ids cloud sending value to azure 03

  7. Click on Save.

  8. Under Shared access policies, click on the iothubowner policy to display the connection strings of the IoT hub and copy it with a click on the copy symbol () behind Connection string – primary key.

    cg en ids cloud sending value to azure 04

  9. Open the Azure IoT Explorer software.

  10. Paste the Connection string - primary key copied above into the Select or type an IoT hub connection string field (if the Azure IoT Explorer is used with this IoT Hub for the first time) and click on Connect.

    cg ids cloud sending value to azure iot hub 01

  11. In the IoT Explorer, click on the device and under Connection String with SAS token on the down arrow () to show the parameters for generating the token.

  12. In the Symmetric key field, select Primary key, enter a validity period that is long enough in the Expiration (minutes) field and click on Generate. [3]

    cg ids cloud sending value to azure iot hub 02

  13. 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 (your icom OS router) 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.

    cg en ids cloud sending value to azure 08

  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 [5]

  7. Click on Save settings.

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

    • Description: Azure

    • Server: <client>.azure-devices.net [6]

    • Port: 8883

    • Version: v3.1.1

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

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

    • Client ID: <Device Id> [8]

    • Use SSL/TLS:

  9. Click on Save settings.

    cg en ids cloud sending value to azure 06

  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. [5]

    cg en ids cloud sending value to azure 07

  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: Switch [9]

    • 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 () in the Devices menu 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.

    cg ids cloud sending value to azure iot hub 03

  3. Enter in the Cloud-to-device message the Message body Switch and click on Send message to device () to check, whether the Smart Device reacts on the message by toggling the configured output.

    cg ids cloud sending value to azure iot hub 04 You can check the state of the output in the StatusCurrent values menu of the icom Data Suite.

Troubleshooting

  • Check in the StatusCurrent values menu of the icom Data Suite, whether the icom Data Suite is connected to the MQTT broker (IoT Hub). If not, check the configuration of the MQTT broker.

  • If you encounter problems with MQTT message dispatch, check the configuration of Topic and Message. The slash (/) of the topic will be ignored frequently, but it is necessary.

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

  • View in the StatusCurrent values menu of the icom Data Suite the MQTT log and check the log entries.

    cg en ids cloud sending value to azure 09


Back to the Configuration Guides for the icom Data Suite

Back to overview


1. The IoT Hub can be added under All ressources. To do this, click on Add () and enter IoT Hub in the search field (Screenshot).
2. On the Github page, click on releases to find the Windows MSI file and Linux packages (Screenshot).
3. The validity period limits the validity of the token. No connection to the IoT Hub is possible any longer upon its expiry.
4. It is also possible to select a different output. The number of the output depends on the hardware configuration of the INSYS Smart Device.
5. A transmission interval of 30 seconds and one transmitted measuring value may result approx. 10 MByte data volume for a cellular connection. The value increases with the frequency or more measured values.
6. 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 (Screenshot). The first part of the server address is also the ID of your device in the IoT Hub.
7. The user name is composed of the server address (hostname), the ID of your device in the IoT Hub and the api-version string; this is case-sensitive.
8. The ID of your device as entered in the IoT Hub under Configuration of Microsoft Azure above; this is case-sensitive. The ID of your device in the IoT Hub is also the first part of the server address above.
9. This text string must to be sent from Azure to the Smart Device that the Smart Device triggers the action; this is case-sensitive.