Thing Data

The client application collects and transmits application-specific data defined in the corresponding thing definition in Device Cloud.

An application can transmit the following types of data:

Properties

Properties are numeric values that can be positive or negative floating point or integer values. For int64 data types, the valid range is 9007199254740991 through -9007199254740991. For uint64 data types, the maximum value is 9007199254740991. You can access properties from the thing details page, view them in table and graph form, and get various types of calculations based on historical values, such as average values. Properties are defined in a thing definition. If Auto def properties is selected in the thing definition, the application can transmit properties that are not originally defined in the thing definition. The valid characters for a data items are letters, numbers, underscore (_), and hyphen (-). Auto-defined properties appear as auto:propertyName on the thing details page. For details about properties, see the following:

  • Device Cloud Management Portal User's Guide: Viewing the Properties of a Thing
  • Device Cloud Management Portal User's Guide: Defining Properties

In C applications, use the telemetry APIs to transmit properties.

Attributes

Attributes are typically used for static data, such as a device serial number. Attributes are string values that appear under the Attributes tab on the thing details page. Attributes are defined in a thing definition. If Auto def attributes is selected in the thing definition, the application can transmit attributes that are not originally defined in the thing definition. The valid characters for attributes are letters, numbers, underscore (_), and hyphen (-). Auto-defined attributes appear as auto:attributeName on the thing details page. For details about attributes, see the following:

  • Device Cloud Management Portal User's Guide: Viewing and Updating Attributes of a Thing
  • Device Cloud Management Portal User's Guide: Defining Attributes
Alarms

Alarms are string data with defined states that indicate events for a thing. They appear on the thing details page and can be viewed in chart, table, and graph form. Alarms must be defined in the thing definition. For details about alarms, see the following:

  • Device Cloud Management Portal User's Guide: Viewing and Updating the Alarms of a Thing
  • Device Cloud Management Portal User's Guide: Defining Alarms
Events

Events are log messages for a thing that are published to Device Cloud. They appear under the Events tab on the thing details page. However, they are not defined in the thing definition. For details about event logs on the Management Portal, see Device Cloud Management Portal User's Guide: Viewing Event Logs.

You can use various types of data in cloud triggers.

Because MQTT is configured by default for QOS 1, data items are queued for retransmission if the device is offline.

An organization administrator can specify the data retention periods on the Configuration page on the Management Portal, which you can access from the Administration page.

APIs

Table 1. Python Data APIs

Function

Description

alarm_publish

Publish an alarm state to Device Cloud.

attribute_publish

Publish an attribute value to Device Cloud.

attribute_read_last_sample

Read the last value of an attribute in Device Cloud.

event_publish

Publish an event message to Device Cloud.

telemetry_publish

Publish a property value to Device Cloud.

telemetry_read_last_sample

Read the last value of a property in Device Cloud.

Table 2. C Data APIs

Function

Description

iot_alarm_deregister

Deregister an alarm from the agent and free the associated memory.

iot_alarm_register

Register an alarm with the agent and allocate the required memory.

iot_alarm_publish

Publish an alarm state to Device Cloud

iot_alarm_publish_string

Publish an alarm state with a message to Device Cloud.

iot_attribute_publish

Publish an attribute value to Device Cloud.

iot_event_publish

Publish an event message to Device Cloud.

iot_options_allocate

Allocate the required memory to specify optional information for alarms, attributes, and events.

iot_options_set

Specify optional information for alarms, attributes, and events.

iot_telemetry_allocate

Create a numeric data object (property) and allocate the required memory.

iot_telemetry_free

Destroy a numeric data object (property) and free the associated memory.

iot_telemetry_register

Register a numeric data object (property) with the agent.

iot_telemetry_deregister

Deregister a numeric data object (property) from the agent.

iot_telemetry_publish

Publish a numeric data value (property) to Device Cloud.

iot_telemetry_publish_raw

Publish a raw (base64-encoded) numeric data value (property) to Device Cloud.

iot_telemetry_timestamp_set

Specify the timestamp of a numeric data value (property) .