MQTT Auto Publish Data versus MQTTPublishTable()

There are two ways to publish data to CampbellCloud: 1) Auto-publish data by enabling the MQTT Auto-Publish Data setting in the data logger settings, or 2) use the MQTTPublishTable() instruction in the data table.

To enable auto publishing:

In Device Configuration Utility, On the MQTT tab, set MQTT Auto-Publish Data to Enabled.

MQTT Auto-Publish Data setting in Device Configuration Utility

Data tables intended for publishing must include a DataInterval() instruction. For example:

By default, the fastest auto-publish interval is 10 minutes. Data is published as follows:

  • If the DataInterval() is less than 1 minute, the table is excluded from publishing.

  • If the DataInterval() is between 1 and 10 minutes, data stored in the data table is published every 10 minutes.

  • If DataInterval() is greater than 10 minutes, data is published at the specified interval.

  • To publish data more frequently than the 10-minute auto-publish interval, disable MQTT Auto-Publish Data and use the MQTTPublishTable() instruction in the data table; specifying the desired publish rate. Set the OutputFormat parameter in the MQTTPublishTable() to 2, GeoJSON.

NOTE:

Once MQTTPublishTable() is included in a data table in a CRBasic program, Auto-Publish is no longer applicable.