Contact Us
Log In

Data Type

Last Updated on : 2022-02-23 06:56:35download

This topic describes the common data types and values of standard instruction sets and status sets. The common data types are described as follows:

Data type Description Example
Boolean Represent a binary variable value that is either true or false. A switch can be set to the on or off state.
Integer Apply to data that can be linearly adjusted. Adjust the temperature, ranging from 20°C to 40°C.
Enum A finite set of values. Working level, including low, medium, and high.
String Represent the string data type. See the subsequent sections.
JSON Represent a JSON object. There will be explanations of the corresponding object attributes. See the subsequent sections.

Data transfer type

Commands and states can be transferred in three types:

  • Send and report: two-way data transfer between the device and the cloud.
  • Report only: Data can only be reported from the device.
  • Send only: Data can only be sent from the cloud.


Example of integer data type

Value example


Description of value constraint

  • min: the minimum value. Example: 11.

  • max: the maximum value. Example: 86400.

  • unit: the unit of the value. Example: s, short for seconds.

  • scale: the data will be transferred with an exponential conversion of 10. Example: 0, which means the 0th power of 10, that is, 1.

  • step: the data increment interval (step length). step and scale determine the amount of transferred data. Example: step=5 and scale=1. It means that the amount of transferred data is step × 10^1=5 × (10^scale)=10.

    Code Name Type Value constraint
    cur_voltage Actual voltage Integer {“unit”:“V”, “min”:0, “max”:5000, “scale”:2, “step”:5}

    For example, query the device status and get the value {"cur_voltage": 2230}. The user-readable value is 2230/(10 ^ 2)= 22.3V. That is, the voltage is 22.3 volts.

Value constraint range

The value constraint range in a standard instruction set is only for your reference. In fact, each device has a specific value constraint range.

Example of string data type

Value example


Description of value constraint

maxlen: the maximum length of a value. Example: 255.

Example of enumeration data type

Value example


Description of value constraint

range: constraint range of the enumeration values. For example, 1, 2, 3, 4, and 5.