Allowed values of functions
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
.
Field | Type | Mandatory? | Description |
allowed_values | map<string, object> | ✔︎ | Contains the functions list. For each function, values are described which it can take |
func_name | string | ✔︎ | A function for which a range of allowable values is described. For the functions list, see Device functions |
type | string | ✔︎ | Type of data taken by the function. Possible values:
|
float_values | object | ✔︎* | Allowed values for the function taking the The following must be specified:
|
integer_values | object | ✔︎* | Allowed values for the function taking the The following must be specified:
|
enum_values | object | ✔︎* | Allowed values for the function taking the A list of |
{
"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"
]
}
}
}
}