Writing Values Using SMS, MQTT and Cloud Control
  • 12 Sep 2024
  • PDF

Writing Values Using SMS, MQTT and Cloud Control

  • PDF

Article summary

Values of the icom Data Suite can be set in various ways.

1. Situation

The value of an analogue flag of the icom Data Suite is to be written via SMS, MQTT and Cloud Control.

2. Solution

An event will be defined that triggers an action as soon as a message is received that contains a specific text. The action will then set an analogue value to a value extracted from the message text.

It is prerequisite that you have access to the web interface of the icom Data Suite. The router must have Internet connection.

2.1. Writing a value using SMS

It is prerequisite that the router is able to receive SMS.

  1. Open the web interface of the icom Data Suite:

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

    • Description: analogue test flag

    • Type: Unsigned integer

  3. Click on Save settings.

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

    • Event: SMS has been received

    • Description: set value by SMS message

    • From contact: leave empty

    • With SMS text: Set value to:

    • Action: Set analogue data point

    • Data point: to value from message between to: and

      Please note!

      If the field From contact is empty, an SMS from any contact will be accepted. Configure a contact in the MessagesContacts menu to limit it to a specific contact.

      Only SMS messages beginning with exactly the text entered in With SMS text will be evaluated; evaluation is case-sensitive.

      The text strings preceding and following the message must be specified for this. If the value is at the beginning or end of the message, only the respective limiting text string must be specified; evaluation is case-sensitive, blanks are ignored.

  5. Click on Save settings.

  6. Activate the profile ().

  7. Send an SMS containing the text Set value to: 23 (or any other signed integer) to the INSYS router and verify the value change in the StatusCurrent values menu in the icom Data Suite.

2.2. Writing a value using MQTT

It is prerequisite that you have a functional MQTT broker and another device as MQTT client.

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

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

    • Description: analogue test flag

    • Type: Unsigned integer

  3. Click on Save settings.

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

    • Description: test broker

    • Server: enter the server URL of your MQTT broker (obtain data from your MQTT broker; you may also use a free MQTT broker for test purposes)

    • Port: enter the server port of your MQTT broker

  5. Click on Save settings.

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

    • Description: set value by MQTT message

    • Event: MQTT message has been received

    • From MQTT broker: select above added broker

    • Topic: enter a topic such as test/set

    • Text: Set value to:

    • QoS: 0

    • Action: Set analogue data point

    • Data point: to value from message between to: and

      Please note!

      Topics of MQTT messages are structured hierarchically and use slash (/) as level separator.
      Only MQTT messages beginning with exactly the text entered in the Text field will be evaluated; evaluation is case-sensitive.
      The QoS setting depends on the application’s requirements, but must be compliant in the message.
      The text strings preceding and following the message must be specified for this. If the value is at the beginning or end of the message, only the respective limiting text string must be specified; evaluation is case-sensitive, blanks are ignored.

  7. Click on Save settings.

  8. Activate the profile ().

  9. Publish an MQTT message to the broker using the same topic with the content Set value to: 23 (or any other signed integer) from the other MQTT client and verify the value change in the StatusCurrent values menu in the icom Data Suite.

2.3. Writing a value using Cloud Control

It is prerequisite that you have a Cumulocity Cloud account provided by INSYS icom.

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

  2. In the Data pointsFlags menu under Inputs, add a new flag ():

    • Description: analogue test flag

    • Type: Unsigned integer

  3. Click on Save settings.

  4. In the MessagesCumulocity menu, add a new server () and edit it ():

    • Description: cumulocity server

    • Protocol: HTTPS

    • Server: enter the server URL of your Cumulocity server (obtain data from Cumulocity)

    • Device name: enter a descriptive name for your device

    • Self registration: (refer to the Cumulocity Device Guide to find out how to register a device if it is not yet registered)

  5. Click on Save settings.

  6. In the MessagesCumulocity menu, add a new message () and edit it ():

    Please note!

    This message defines which data points are available in Cloud Control and transmits the value of the selected data points to Cloud Control.

    • Description: cloud control message

    • Class: Cloud Control

    • Data points: check analogue test flag added above

  7. Click on Save settings.

  8. In the DatapointsTimer menu, add a new timer () and edit it ():

    • Description: message send interval

    • Type: Interval, triggered every 1 hour

  9. Click on Save settings.

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

    Please note!

    This event triggers a regular dispatch of the Cloud Control message.

    • Description: send cloud control message

    • Event: Timer expired

    • Timer:  message send interval

    • Action: Send message

    • Send message: cloud control message

  11. Click on Save settings.

  12. Activate the profile ().

  13. Open another browser tab or window and enter your Cumulocity account. Click on Other applications () in the top right corner and select INSYS icom. Click on All devices () in the menu on the left and select your INSYS router from the list. Select the Cloud Control () screen and locate the data point to modify.

  14. Enter the new value for this data point in the New Value field and click on Send Value Update.

  15. Verify the value change in the StatusCurrent values menu in the icom Data Suite.

  16. Click on Request Value Update and Refresh View () in Cloud Control to see the new value in Cloud Control as well. This initiates an immediate value update independent from the regular Cloud Control message.

3. Troubleshooting

  • In order to be able to send an SMS by the icom Data Suite, the modem  in the router must know the SMS center number of the provider. This is usually read out from the SIM card. If no number is stored on the SIM card, this must be entered in the InterfacesSlot 2: LTE menu in the web interface of the router.

  • In order to be able to receive an SMS by the icom Data Suite, incoming SMS must be forwarded to the container. The checkbox Forward SMS to containers must be checked in the AdministrationContainer menu in the web interface of the router.

  • If IP filters are enabled in the INSYS router hosting the icom Data Suite, check whether a filter rule exists in the NetfilterIP filter menu in the web interface of the router that permits the reception of MQTT messages.

  • The status of an MQTT or Cumulocity connection can be verified in the StatusCurrent values menu.

  • The Cloud Control message must be sent at least once before the data  point(s) transmitted with this message appear(s) in Cloud Control. This is to ensure that only those data points can be modified that are permitted by sending them with the Cloud control message.

4. Resources

The following ASCII configuration can be taken over using copy & paste. It must be observed that the individual parameters need to be adapted to the own application. Correct numbering must be observed for numbered parameters. Moreover, it must be observed that no existing parameters with the same number will be overwritten. A proper functionality can only be ensured if the opened profile has been created from default settings before.

ASCII configuration

datapoints.flags.flag.add
datapoints.flags.flag[1].name=flag1
datapoints.flags.flag[1].active=1
datapoints.flags.flag[1].description=analogue test flag
datapoints.flags.flag[1].type=unsigned_int

datapoints.timer.timer.add
datapoints.timer.timer[1].name=timer1
datapoints.timer.timer[1].active=1
datapoints.timer.timer[1].description=message send interval
datapoints.timer.timer[1].type=interval
datapoints.timer.timer[1].interval_hh=1

messages.mqtt.broker.add
messages.mqtt.broker[1].active=1
messages.mqtt.broker[1].name=mqttBrkr1
messages.mqtt.broker[1].description=test broker
messages.mqtt.broker[1].server=broker-url.com
messages.mqtt.broker[1].port=1883
messages.mqtt.broker[1].username=
messages.mqtt.broker[1].password=
messages.mqtt.broker[1].client_id=
messages.mqtt.broker[1].use_ssl_tls=0
messages.mqtt.broker[1].verify_peer=0
messages.mqtt.broker[1].verify_host=0

messages.cumulocity.server.add
messages.cumulocity.server[1].active=1
messages.cumulocity.server[1].name=c8yServ1
messages.cumulocity.server[1].description=cumulocity server
messages.cumulocity.server[1].protocol=https
messages.cumulocity.server[1].server=tenant.cumulocity.com
messages.cumulocity.server[1].verify_peer=0
messages.cumulocity.server[1].verify_host=0
messages.cumulocity.server[1].device_name=INSYS Smart Device
messages.cumulocity.server[1].self_registration=1
messages.cumulocity.server[1].username=serial_number
messages.cumulocity.server[1].password=
messages.cumulocity.server[1].device_id=

messages.cumulocity.server[1].feed.add
messages.cumulocity.server[1].feed[1].message_active=1
messages.cumulocity.server[1].feed[1].message_name=c8yMsg1
messages.cumulocity.server[1].feed[1].message_description=cloud control message
messages.cumulocity.server[1].feed[1].message_class=cloudcontrol
messages.cumulocity.server[1].feed[1].message_datapoints=flag1
messages.cumulocity.server[1].feed[1].message_buffer=0

events.event.add
events.event[1].active=1
events.event[1].description=set value by SMS message
events.event[1].event_type=ev_sms
events.event[1].event_sms_contact=
events.event[1].event_sms_text=-----BEGIN event_sms_text-----Set value to:-----END event_sms_text-----
events.event[1].event_mqtt_broker=---
events.event[1].action_type=act_analog
events.event[1].action_analog_datapoint=flag1
events.event[1].action_analog_set=by_message
events.event[1].action_analog_message_escape_start=to:
events.event[1].action_analog_message_escape_end=

events.event.add
events.event[2].active=1
events.event[2].description=set value by MQTT message
events.event[2].event_type=ev_mqtt
events.event[2].event_mqtt_broker=mqttBrkr1
events.event[2].event_mqtt_topic=test/set
events.event[2].event_mqtt_text=-----BEGIN event_mqtt_text-----Set value to:-----END event_mqtt_text-----
events.event[2].event_mqtt_qos=0
events.event[2].action_type=act_analog
events.event[2].action_analog_datapoint=flag1
events.event[2].action_analog_set=by_message
events.event[2].action_analog_message_escape_start=to:
events.event[2].action_analog_message_escape_end=

events.event.add
events.event[3].active=1
events.event[3].description=send cloud control message
events.event[3].event_type=ev_timer
events.event[3].event_timer_name=timer1
events.event[3].action_type=act_message
events.event[3].action_message=c8yMsg1


Was this article helpful?