Docs

Custom Functions

Last Updated on : 2020-07-29 02:55:02download

Overview

Custom function: allows you to create functions that are not supported by standard function.

Data point (DP) is the abstract representation of function, and each function can be defined by different function types. Six data types are available now, namely Boolean, Integer, Enum, Fault, Char type and RAW type.

Custom Functions

  • Boolean, Integer and Enum are the three basic function types, and most of the functions can be defined by them.
  • Fault is specified for fault statistics in the backend.
  • Char type and RAW type are the advanced types for defining complicated functions. These two types are recommended when the other four types cannot meet your needs.

More details about defining data points are described as follows.

Basic concepts

Data point: represents functions of smart devices and parameters.

DP ID: indicates code of a data point. Subsequent function data transfer between the device and the cloud is through data point ID.

Name: indicates name of a custom function.

Identifier: indicates code value of a data point, displaying function name in multi-language on the app. Support letters, digits and underlines, starting with a letter.

Data type:

  • Boolean: indicates binary variable value (true or false). For instance: switching function (On or Off).
  • Integer: represents data that can be linearly adjusted. For instance: temperature adjustment, ranging from 20 to 40 °C.
  • Enum: indicates custom finite set value. For instance: working level (low, middle and high).
  • Fault: specified for fault report and statistics. Support Only report when multiple faults occur.
  • Char type: indicates data transfer in char type.
  • RAW type: indicates data transfer in a raw binary format. Generally, it is recommended to use raw data transfer when the other five types cannot cope with the complicated product functions.

Data transfer type:

  • Issue and report: indicates two-way data transfer between the device and the cloud.
  • Only report: indicates one-way data transfer. Data can only be reported from the device.
  • Only issue: indicates one-way data transfer. Data can only be issued by the cloud.

Description

Boolean

Application: represents binary variable value (true or false).

Custom Functions

Instance: device switch, child lock on heating device, fan head, resetting filter cartridge for air purifier and so on.

Integer

Application: represents data that can be linearly adjusted.

Custom Functions

Instance:

  • For the scenario that temperature ranges from 20 to 40 °C with each change of 1 °C, it indicates the adjustable temperature is between 20 to 40 °C, and each operation triggers change of 1 °C.
  • For the scenario that a device with a 12-hour timer is set to turn on or off automatically at a specified time, you can set the reservation from 1 hour to 12 hours with the interval of 1 hour.

If you have any further questions, refer to Integer FAQ.

Enum

Application: represents custom finite set value.

Custom Functions

Instance:

  • Working level: low, middle and high.
  • Modes: comfort, sleep, smart, and power save.
  • Colors: red, blue, green and black.

Note: when editing function points, enum value supports letters, digits and underlines. After you press the Enter key, the enum value will be automatically generated. Code of enum value starts from 0, and data is transferred in enum code during hardware integration testing. The length of each enum value cannot exceed 15 characters, and a maximum of 10 enum values can be defined. Each time you enter an enum value, press the Enter key to generate a value.

If you have any further questions, refer to Enum FAQ.

Fault

Application: specified for fault report and statistics. Later, this function will be used for statistics.

Custom Functions

Instance:

  • Temperature sensor fault, motor fault and high-temperature fault.

Note: fault data is in the format of bitmap, so defining multiple faults is available. The fault only supports data report, so just Only report is available in data transfer type.

If any further questions, refer to Fault FAQ.

Char type

Application: indicates data transfer in char type. If the product definition cannot be completed by above four function types, you can choose char type as the data transfer type.

Custom Functions

Note: the length of a single char type cannot exceed 255 bytes.

RAW type

Application: indicates data transfer in a raw binary format. Generally, it is recommended to use raw data transfer when the other five types cannot cope with the complicated product functions.

Custom Functions

Note: the length of raw data cannot exceed 255 bytes.

At present, it is recommended that the number of standard data points and custom data points for each product should not exceed 40. If the total number exceeds the maximum, test the product stability.

For more FAQ about function definitions, refer to Function Definitions FAQ.

Click for services and help