The icom Data Suite allows to send data to the relayr cloud service from an INSYS Smart Device and receive commands sent from the relayr cloud service to the INSYS Smart Device.

Situation

The value of a data point of an INSYS Smart Device is to be sent to relayr cloud service by the icom Data Suite. relayr again will send a message to the Smart Device to modify a data point of the icom Data Suite.

Solution

The following simple exemplary application transmits the count of a timer of the icom Data Suite to relayr in regular intervals. relayr again sends a message to the icom Data Suite every time the count exceeds a specific value. This message increases a counter in the icom Data Suite that counts how often the timer count has exceeded this threshold. This application is only intended to demonstrate how to send a value to relayr and receive commands from relayr and has no technical importance.

relayr configuration

It is prerequisite that you have a relayr account.

  1. Open the relayr website using a browser:

  2. Log in to your relayr account.

  3. Change to the Models section in the menu on the left ().

  4. Click on ADD NEW MODEL at the bottom right.

  5. Click on Add reading () and edit it:

    • Meaning : Timer

    • Path : leave empty [1]

    • Value type : Number

    • unit : s

    • maximum : 20

    • minimum : 0

  6. Click on Add command () and edit it:

    • Meaning : Counter

    • Value type: Integer

  7. Under Device model details, enter INSYS Smart Device as DEVICE MODEL NAME.

  8. Enter www.insys-tec.com or your website as WEBSITE.

  9. Enter any other details you want to enter.

  10. Click on SAVE MODEL at the bottom right.

  11. Change to the Devices section in the menu on the left ().

  12. Click on ADD…​ .

  13. Change to the By me tab and select the model created above.

  14. Click on FINISH.

  15. Enter a name for the device and click on GO TO DEVICE.

  16. Click on Settings at the top right to open the Device Settings window ().

  17. Copy the JSON code under Credentials to a text editor for the following configuration of the icom Data Suite. [2]

  18. Close the Device Settings window again ().

  19. Change to the Projects section in the menu on the left ().

  20. Click on CREATE A NEW PROJECT.

  21. Enter a PROJECT NAME and click on NEXT.

  22. Enter an optional AUTHORIZATION URL and click on NEXT.

  23. Click on FINISH.

  24. Click on OPEN PROJECT to open the project created above.

  25. Click on CREATE NEW RULE. [3]

  26. Enter a Rule name and specify the If…​ condition of the rule:

    • Select device : Select the device created above.

    • Select : Select the Timer reading.

    • Select comparison : > (Greater than)

    • Enter a comparison value of 13.

  27. Continue to specify the Then…​ condition of the rule:

    • Select device : Select the device created above.

    • Select : Select the Counter command.

    • Enter a comparator value of 1.

  28. Click on SAVE & CLOSE.

icom Data Suite configuration

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 another browser tab or window and start the web interface of the icom Data Suite:

  2. In the Data pointsFlags menu, add a new flag () and edit it ():

    • Description: Counter

    • Type: Unsigned integer

  3. Click on Save settings.

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

    • Description: Message timer

    • Type: Interval, triggered every 23 seconds

  5. Click on Save settings.

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

    • Description: Count sample timer

    • Type: Interval, triggered every 20 seconds

  7. Click on Save settings.

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

    • Description: relayr

    • Server: mqtt.relayr.io

    • Port : 1883

    • Version : v3.1

    • User name : Paste the string user from the credentials copied above (without quotation marks).

    • Password : Paste the string password from the credentials copied above (without quotation marks).

    • Client ID : Paste the string clientId from the credentials copied above (without quotation marks).

  9. Click on Save settings.

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

    • Description: Timer message

    • Topic: Paste the string topic from the credentials copied above (without quotation marks) and add data. [5]

    • Message: Enter the message in the following JSON format:
      {
      "path": "",
      "meaning": "Timer", [6]
      "value": "$timer2 ", [7]
      "received": "$TIME ", [8]
      }

    • Retain:

    • QoS: 0

  11. Click on Save settings.

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

    • Description: Send timer message to relayr

    • Event: Timer expired

    • Timer: select above added timer1 - Message timer

    • Topic: Paste the string topic from the credentials copied above (without quotation marks) and add cmd/. [9]

    • Action: Send message

    • Send message: select above added timer message

  13. Click on Save settings.

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

    • Description: Increase counter upon relayr command

    • Event: MQTT message has been received

    • From MQTT broker: select above added mqttBrkr1 - relayr

    • Text : Leave this empty that the icom Data Suite triggers upon each MQTT message from relayr with this topic.

    • Action: Change analogue data point

    • Data point: select above added flag1 - Counter and increment by user-defined value 1.

  15. Click on Save settings.

  16. Activate the profile ().

  17. Click on StatusCurrent values to watch the lapsing timers and the increase of the counter.

  18. Click on StatusLog view, check Timer and MQTT to watch timer expiries as well as sent and received MQTT messages.

  19. Change back to the relayr browser tab or window.

  20. Change to the Devices section in the menu on the left ().

  21. Select your device to watch the changing timer value that is transmitted regularly.

Troubleshooting

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

  • If the icom Data Suite can connect to the relayr MQTT broker, but relayr does not receive signal data, check the following:

    • The topic of the message must be like in the credentials plus the added string*.

    • The blank behind the variables (like behind $TIME) and before the quotation mark is important. A missing blank causes that the message will not be valid.


1. A path can used to separate multiple readings with the same meaning. For example, if your device includes sensors that are measuring the temperature in different rooms, then path can be used to specify which room each temperature reading is coming from. The property must be supplied, but it can be left blank.
2. This contains access data for the relayr MQTT broker and the topic that will be evaluated by this device.
3. This rule will evaluate the timer reading transmitted from the INSYS Smart Device and issue an MQTT command message every time a counter value exceeding 13 is transmitted.
4. This IP address and host name only apply in case of a standard default installation.
5. Adding data means that the topic must have a format like /v1/d677…​cedb/data.
6. This corresponds to the reading created for the model in relayr above.
7. The blank behind the variable is essential.
8. The blank behind the variable is essential.
9. Adding cmd/ means that the topic must have a format like /v1/d677…​cedb/cmd/#.