Boolean
The virtual Boolean
component is used to store a true
/false
value. It uses Boolean
as RPC namespace and has the following methods:
Boolean.SetConfig
to update the component's configurationBoolean.GetConfig
to obtain the component's configurationBoolean.GetStatus
to obtain the component's statusBoolean.Set
to update the component's value
Methods
Boolean.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
Boolean.GetConfig
Properties:
Property | Type | Description |
---|---|---|
| number | Id of the component instance |
Find the Boolean.GetConfig response properties in config section
Boolean.GetStatus
Properties:
Property | Type | Description |
---|---|---|
| number | Id of the component instance |
Find more about the status response properties in status section
Boolean.Set
This method updates the value of the Boolean 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 |
| boolean | For truthy value only |
Configuration
The configuration of the Boolean 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 Boolean 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 |
| ||||||||||||||||||
| boolean | Value, 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 Boolean 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 Boolean component its id
must be specified.
Properties:
Property | Type | Description |
---|---|---|
| string | Source of the last command |
| boolean | Value of the component |
| number | Unix timestamp for the value update |
Webhook Events
Currently, there is one event related to the Boolean component that can trigger webhooks:
boolean.change
- produced when the value changes.
Examples
Boolean.SetConfig example
- Boolean.SetConfig HTTP GET Request
- Boolean.SetConfig Curl Request
- Boolean.SetConfig Mos Request
http://192.168.33.1/rpc/Boolean.SetConfig?id=200&config={"name":"Gate status","meta":{"ui":{"titles":["Close","Open"]}}}
curl -X POST -d '{"id":1,"method":"Boolean.SetConfig","params":{"id":200,"config":{"name":"Gate status","meta":{"ui":{"titles":["Close","Open"]}}}}}' http://${SHELLY}/rpc
mos --port ${PORT} call Boolean.SetConfig '{"id":200,"config":{"name":"Gate status","meta":{"ui":{"titles":["Close","Open"]}}}}'
Response
- Boolean.SetConfig HTTP GET Response
- Boolean.SetConfig Curl Response
- Boolean.SetConfig Mos Response
{
"restart_required": false
}
{
"id": 1,
"src": "shelly1pmminig3-84fce63fe000",
"params": {
"restart_required": false
}
}
{
"restart_required": false
}
Boolean.GetConfig example
- Boolean.GetConfig HTTP GET Request
- Boolean.GetConfig Curl Request
- Boolean.GetConfig Mos Request
http://192.168.33.1/rpc/Boolean.GetConfig?id=200
curl -X POST -d '{"id":1,"method":"Boolean.GetConfig","params":{"id":200}}' http://${SHELLY}/rpc
mos --port ${PORT} call Boolean.GetConfig '{"id":200}'
Response
- Boolean.GetConfig HTTP GET Response
- Boolean.GetConfig Curl Response
- Boolean.GetConfig Mos Response
{
"id": 200,
"name": "Gate status",
"meta": {
"ui": {
"view": "label",
"titles": [
"Close",
"Open"
],
"buttonIcons": [
"http://192.168.25.2:7999/icon_close.png",
"http://192.168.25.2:7999/icon_open.png"
],
"icon": "http://192.168.25.2:7999/icon_gate.png"
}
},
"persisted": true,
"default_value": false
}
{
"id": 1,
"src": "shelly1pmminig3-84fce63fe000",
"params": {
"id": 200,
"name": "Gate status",
"meta": {
"ui": {
"view": "label",
"titles": [
"Close",
"Open"
],
"buttonIcons": [
"http://192.168.25.2:7999/icon_close.png",
"http://192.168.25.2:7999/icon_open.png"
],
"icon": "http://192.168.25.2:7999/icon_gate.png"
}
},
"persisted": true,
"default_value": false
}
}
{
"id": 200,
"name": "Gate status",
"meta": {
"ui": {
"view": "label",
"titles": [
"Close",
"Open"
],
"buttonIcons": [
"http://192.168.25.2:7999/icon_close.png",
"http://192.168.25.2:7999/icon_open.png"
],
"icon": "http://192.168.25.2:7999/icon_gate.png"
}
},
"persisted": true,
"default_value": false
}
Boolean.GetStatus example
- Boolean.GetStatus HTTP GET Request
- Boolean.GetStatus Curl Request
- Boolean.GetStatus Mos Request
http://192.168.33.1/rpc/Boolean.GetStatus?id=200
curl -X POST -d '{"id":1,"method":"Boolean.GetStatus","params":{"id":200}}' http://${SHELLY}/rpc
mos --port ${PORT} call Boolean.GetStatus '{"id":200}'
Response
- Boolean.GetStatus HTTP GET Response
- Boolean.GetStatus Curl Response
- Boolean.GetStatus Mos Response
{
"value": true,
"source": "rpc",
"last_update_ts": 1700864253
}
{
"id": 1,
"src": "shelly1pmminig3-84fce63fe000",
"params": {
"value": true,
"source": "rpc",
"last_update_ts": 1700864253
}
}
{
"value": true,
"source": "rpc",
"last_update_ts": 1700864253
}
Boolean.Set example
- Boolean.Set HTTP GET Request
- Boolean.Set Curl Request
- Boolean.Set Mos Request
http://192.168.33.1/rpc/Boolean.Set?id=200&value=true
curl -X POST -d '{"id":1,"method":"Boolean.Set","params":{"id":200,"value":true}}' http://${SHELLY}/rpc
mos --port ${PORT} call Boolean.Set '{"id":200,"value":true}'
Response
- Boolean.Set HTTP GET Response
- Boolean.Set Curl Response
- Boolean.Set Mos Response
null
{
"id": 1,
"src": "shelly1pmminig3-84fce63fe000",
"params": null
}
null