Number
The virtual Number
component is used to store a numeric value. It uses Number
as RPC namespace and has the following methods:
Number.SetConfig
to update the component's configurationNumber.GetConfig
to obtain the component's configurationNumber.GetStatus
to obtain the component's statusNumber.Set
to update the component's value
Methods
Number.SetConfig
Property | Type | Description |
---|---|---|
| number | Id of the component instance |
| object | Configuration that the method takes |
Find more about the config properties in config section
Number.GetConfig
Properties:
Property | Type | Description |
---|---|---|
| number | Id of the component instance |
Find the Number.GetConfig response properties in config section
Number.GetStatus
Properties:
Property | Type | Description |
---|---|---|
| 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:
Property | Type | Description |
---|---|---|
| number | Id of the component instance. Required |
| number | String 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:
Property | Type | Description | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| number | Id of the component instance | ||||||||||||||||||
| string or null | Name of the component instance | ||||||||||||||||||
| boolean |
| ||||||||||||||||||
| number | Number, applied on reboot if | ||||||||||||||||||
| object | Object for storing meta data |
| object | Properties of how the component will be rendered in the UI
|
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:
Property | Type | Description |
---|---|---|
| string | Source of the last command |
| number | Value of the component |
| 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
- Number.SetConfig HTTP GET Request
- Number.SetConfig Curl Request
- Number.SetConfig Mos Request
http://192.168.33.1/rpc/Number.SetConfig?id=200&config={"name":"Savings","min":0,"meta":{"ui":{"view":"field","step":0.01,"unit":"$"}}}
curl -X POST -d '{"id":1,"method":"Number.SetConfig","params":{"id":200,"config":{"name":"Savings","min":0,"meta":{"ui":{"view":"field","step":0.01,"unit":"$"}}}}}' http://${SHELLY}/rpc
mos --port ${PORT} call Number.SetConfig '{"id":200,"config":{"name":"Savings","min":0,"meta":{"ui":{"view":"field","step":0.01,"unit":"$"}}}}'
Response
- Number.SetConfig HTTP GET Response
- Number.SetConfig Curl Response
- Number.SetConfig Mos Response
{
"restart_required": false
}
{
"id": 1,
"src": "shelly1pmminig3-84fce63fe000",
"params": {
"restart_required": false
}
}
{
"restart_required": false
}
Number.GetConfig example
- Number.GetConfig HTTP GET Request
- Number.GetConfig Curl Request
- Number.GetConfig Mos Request
http://192.168.33.1/rpc/Number.GetConfig?id=200
curl -X POST -d '{"id":1,"method":"Number.GetConfig","params":{"id":200}}' http://${SHELLY}/rpc
mos --port ${PORT} call Number.GetConfig '{"id":200}'
Response
- Number.GetConfig HTTP GET Response
- Number.GetConfig Curl Response
- Number.GetConfig Mos Response
{
"id": 200,
"name": "Savings",
"min": 0,
"max": 999999999999999,
"meta": {
"ui": {
"view": "field",
"unit": "$",
"step": 0.01,
"icon": null
}
},
"persisted": false,
"default_value": 0
}
{
"id": 1,
"src": "shelly1pmminig3-84fce63fe000",
"params": {
"id": 200,
"name": "Savings",
"min": 0,
"max": 999999999999999,
"meta": {
"ui": {
"view": "field",
"unit": "$",
"step": 0.01,
"icon": null
}
},
"persisted": false,
"default_value": 0
}
}
{
"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
- Number.GetStatus HTTP GET Request
- Number.GetStatus Curl Request
- Number.GetStatus Mos Request
http://192.168.33.1/rpc/Number.GetStatus?id=200
curl -X POST -d '{"id":1,"method":"Number.GetStatus","params":{"id":200}}' http://${SHELLY}/rpc
mos --port ${PORT} call Number.GetStatus '{"id":200}'
Response
- Number.GetStatus HTTP GET Response
- Number.GetStatus Curl Response
- Number.GetStatus Mos Response
{
"value": 25.6,
"source": "rpc",
"last_update_ts": 1700864253
}
{
"id": 1,
"src": "shelly1pmminig3-84fce63fe000",
"params": {
"value": 25.6,
"source": "rpc",
"last_update_ts": 1700864253
}
}
{
"value": 25.6,
"source": "rpc",
"last_update_ts": 1700864253
}
Number.Set example
- Number.Set HTTP GET Request
- Number.Set Curl Request
- Number.Set Mos Request
http://192.168.33.1/rpc/Number.Set?id=200&value=25.6
curl -X POST -d '{"id":1,"method":"Number.Set","params":{"id":200,"value":25.6}}' http://${SHELLY}/rpc
mos --port ${PORT} call Number.Set '{"id":200,"value":25.6}'
Response
- Number.Set HTTP GET Response
- Number.Set Curl Response
- Number.Set Mos Response
null
{
"id": 1,
"src": "shelly1pmminig3-84fce63fe000",
"params": null
}
null