Contact Us
Log In
Contact Us
Log In
Go to main website
App Develop

App Development

Tuya provides multiple mobile app development methods such as no-code or IoT App SDK development to maximize the monetization of IoT apps.

Data Type and Value Constraint

Last Updated on : 2021-08-05 03:57:42download

Data type

  • Boolean: a binary variable that is either true or false. For example, regarding the switch function, the value is on or off.
  • Integer: suitable for linearly adjustable data. For example, regarding temperature adjustment, the temperature range is 20–40°C.
  • Enumeration: a limited set of values. For example, the working level includes low, medium, or high.
  • String: string type.
  • JSON: The value sent is the JSON object, and there will be explanations of the corresponding object attributes.

Data transmission type

  • Send and report: Instruction data can be sent to the device, and device data can be reported to the cloud.
  • Report only: Data can only be reported from the device.
  • Send only: Data can only be sent from the cloud.

Value constraint

Example format of integer type data


Description of value constraint

  • min: the minimum value. Example value: 11.
  • max: the maximum value. Example value: 86400.
  • unit: the unit of the value. Example value: s.
  • scale: the data will be transmitted with an exponential conversion of 10. Example: 0, which means the 0th power of 10, that is, 1.
  • step: data increment interval (step length). Example value: 1.

Description of scale parameter

The following is an example of the constraint on the present voltage value. scale value is 1.

If the value obtained by querying the device status is {"cur_voltage":2230}, then the user-readable value is 2230/(10^1 )= 223V (the voltage is 223 volts).

code Name Data type Value constraint
cur_voltage Present voltage Integer {“unit”:“V”,“min”:0,“max”:5000,“scale”:1,“step”:1}

Description of value constraint range
The value constraint range in the standard instruction set document is the reference range. In fact, each device has a specific value constraint range.

Example format of string type data


Description of value constraint

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

Example format of enumeration type data


Description of value constraint

  • range: constraint range of the enumeration value. Examples: "1", "2", "3", "4", and "5".