Skip to main content
Version: 1.0

Number

The virtual Number component is used to store a numeric value. It uses Number as RPC namespace and has the following methods:

Methods

Number.SetConfig

PropertyTypeDescription

id

number

Id of the component instance

config

object

Configuration that the method takes

Find more about the config properties in config section

Number.GetConfig

Properties:

PropertyTypeDescription

id

number

Id of the component instance

Find the Number.GetConfig response properties in config section

Number.GetStatus

Properties:

PropertyTypeDescription

id

number

Id of the component instance

Find more about the status response properties in status section

Number.Set

This method updates the value of the Number component. It can be used to trigger webhooks. More information about the events triggering webhooks available for this component can be found below.

Request

Parameters:

PropertyTypeDescription

id

number

Id of the component instance. Required

value

number

Number to be saved Required

Configuration

The configuration of the Number component contains information about the default value, whether it should persist after reboot, and properties of how it will be rendered in the UI. To Get/Set the configuration of the Number component its id must be specified.

Properties:

PropertyTypeDescription

id

number

Id of the component instance

name

string or null

Name of the component instance

persisted

boolean

true for the value to be persist, default false

default_value

number

Number, applied on reboot if persisted is set to false

meta

object or null

Stores the component's metadata

min

number

Minimum allowed value (default: -999999999999999)

max

number

Maximum allowed value (default: 999999999999999)

Status

The status of the Number component contains information about its current value, the timestamp for the value update, and the source of the last command. To obtain the status of the Number component its id must be specified.

Properties:

PropertyTypeDescription

source

string

Source of the last command

value

number

Value of the component

last_update_ts

number

Unix timestamp for the value update

Webhook Events

Currently, there is one event related to the Number component that can trigger webhooks:

  • number.change - produced when the value changes.

Examples

Number.SetConfig example

http://192.168.33.1/rpc/Number.SetConfig?id=200&config={"name":"Savings","min":0,"meta":{"ui":{"view":"field","step":0.01,"unit":"$"}}}

Response

{
"restart_required": false
}

Number.GetConfig example

http://192.168.33.1/rpc/Number.GetConfig?id=200

Response

{
"id": 200,
"name": "Savings",
"min": 0,
"max": 999999999999999,
"meta": {
"ui": {
"view": "field",
"unit": "$",
"step": 0.01,
"icon": null
}
},
"persisted": false,
"default_value": 0
}

Number.GetStatus example

http://192.168.33.1/rpc/Number.GetStatus?id=200

Response

{
"value": 25.6,
"source": "rpc",
"last_update_ts": 1700864253
}

Number.Set example

http://192.168.33.1/rpc/Number.Set?id=200&value=25.6

Response

null