ym88659208ym87991671
Allowed values of functions | Documentation for developers

Allowed values of functions

Last updated on August 26, 2022

The structure is used to describe device models and defines values that can be taken by the model functions. This structure shall be used if you want to re-define the values allowable by default.

For example:

  • The function hvac_temp_set determines the temperature to be reached by an air conditioner or a similar device. By default, it can take values from 5 to 50 C at an interval of 1 C. If your device supports this function but has different range of allowable values or interval, they can be changed as required.

    After that, the user will be able to set the temperature only within the defined range. When changing the temperature by using voice commands "Make it warmer" or "Make it colder" or via the interface by using buttons, the function value will be changed by the number of grades you set as the interval.

  • The function open_rate determines the speed at which curtains or a similar device must be opened. By default, it can take values auto, low, medium, high. If your curtains' model does not support any opening speed, it may be deleted and will not be displayed in the interface.

The structure can be used only in describing functions that take values of one of the following types: FLOAT, INTEGER, ENUM.

FieldTypeMandatory?Description
allowed_valuesmap<string, object>✔︎Contains the functions list. For each function, values are described which it can take
func_namestring✔︎

A function for which a range of allowable values is described.

For the functions list, see Device functions

typestring✔︎

Type of data taken by the function. Possible values:

  • FLOAT
  • INTEGER
  • ENUM

float_valuesobject✔︎*

Allowed values for the function taking the FLOAT value.

The following must be specified:

  • min. Minimum function value (inclusive)
  • max. Maximum function value (inclusive)

integer_valuesobject✔︎*

Allowed values for the function taking the INTEGER value.

The following must be specified:

  • min. Minimum function value (inclusive). Must be specified as the integer value "long" written as a string.
  • max. Maximum function value (inclusive). Must be specified as the integer value "long" written as a string.
  • step. An interval at which the function's values change. Must be specified as the integer value "long" written as a string

enum_valuesobject✔︎*

Allowed values for the function taking the ENUM value.

A list of values must be given with at least one value

{
"allowed_values": {
"func_name": {
"type": "FLOAT",
"float_values": {
"min": number,
"max": number,
}
},
"func_name": {
"type": "INTEGER",
"integer_values": {
"min": string,
"max": string,
"step": string
}
},
"func_name": {
"type": "ENUM",
"enum_values": {
"values": [
"value_1",
"value_2",
// ...
]
}
},
{
// ...
},
}
}

Allowed value range description example

In this example, allowed values are set for the functions hvac_water_level (water level in the water tank in liters), hvac_humidity set (target air humidity level) and hvac_air_flow_power (fan operation speed).

{
"allowed_values": {
"hvac_water_level": {
"type": "FLOAT",
"float_values": {
"min": 0.5,
"max": 5,
}
},
"hvac_humidity_set": {
"type": "INTEGER",
"integer_values": {
"min": "35",
"max": "85",
"step": "5"
}
},
"hvac_air_flow_power": {
"type": "ENUM",
"enum_values": {
"values": [
"auto",
"high",
"low",
"medium"
]
}
}
}
}
Sber process cookies only to personalize services according to Cookies Usage Policy. You can prevent the processing of cookies in your browser settings.