Function Definition

Last Updated on : 2022-06-20 07:04:14download

The function definition is the first step in product development. The product function is mainly composed of the DP. Before selecting the DP, learn the standard function DP and add the standard function.

Types of data point (DP)

The Tuya IoT Platform allows you to define functions with six data types, including Boolean, value, enum, fault, string, and RAW.

  • Bool: Binary variable (true or false), such as the function of the contact sensor on and off.
  • Value: Numerical functions can be displayed linearly, For example, the temperature range is from 0 to 40 °C, the brightness range is from 0 to 1000lux, the humidity range is from 0 to 100%.
  • Enum value: A custom finite set of values, such as water alarm and normal for water immersion, human and unmanned PIR human movement, and the high, medium, low sensitivity level of the SOS key button.

Add standard features

Function Definition

DP description

DP ID Data point Identifier Transmission Type DP type DP property Remarks
1 Current temperature temp_current Report only Integer The value ranges from -100 to 600, with a pitch of 1 and a scale of 1. Unit: °C. The default unit is Celsius with one decimal point.
2 Current humidity humidity_value Report only Integer The value ranges from 0 to 1,000, with a pitch of 1 and a scale of 1. Unit: %. Default unit is % with a decimal number.
4 Battery capacity battery_percentage Report only Integer The value ranges from 0 to 1000, with a pitch of 1 and a scale of 0. Unit: %. Foe the alarm push, it is recommended that 0 to 19% is low, and 20 to 100% is normal.

DP ID 1 (required) Current temperature temp_current

  • Basic functions are displayed on the app panel.
  • Report the latest and most recently collected data depending on the latest value of the collection frequency (not real-time). The specific frequency is based on the firmware configuration item. By default, data is collected every 5 minutes.
  • The temperature can support a numerical range from -200 to 850, and the actual general recommended configuration range is from-100 to 600, that is, the actual detection temperature range is from-10.0 to 60.0°C.
  • The temperature has one decimal number.

DP ID 2 (Required) Current humidity value humidity_value

  • Basic functions are displayed on the app panel.
  • Report the latest and most recently collected data depending on the latest value of the collection frequency (not real-time). The specific frequency is based on the firmware configuration item. By default, data is collected every 5 minutes.
  • The supported range of humidity is from 0 to 1,000, and the actually recommended configuration range is from 0 to 1,000, that is, the detection RH0 is between 0-100.0%.
  • The humidity has one decimal number.

DP ID 4 (Optional) battery level battery_percentage

  • Basic functions are displayed on the app panel.
  • When the battery is powered, it represents the remaining power of the battery, 0% represents the power is 0, and 100% represents the full power.
  • The collection frequency defaults to collecting once every 4 hours, and reporting once every 4 hours.
  • When selecting battery power DP, select ordinary battery or rechargeable battery, the battery power percentage is essentially a mapping of the battery voltage, there is a certain proportional relationship. It is only for reference, and the real voltage may have large fluctuations. It is recommended to choose high-quality batteries or batteries with good linearity when selecting the battery.