Button
The virtual Button
component is used to store a list of components keys. It uses Button
as RPC namespace and has the following methods:
Button.SetConfig
to update the component's configurationButton.GetConfig
to obtain the component's configurationButton.Trigger
to trigger an event
Methods
Button.SetConfig
Property | Type | Description |
---|---|---|
| number | Id of the component instance Required |
| object | Configuration that the method takes Required |
Find more about the config properties in config section
Button.GetConfig
Properties:
Property | Type | Description |
---|---|---|
| number | Id of the component instance Required |
Find the Button.GetConfig response properties in config section
Button.Trigger
Properties:
Property | Type | Description |
---|---|---|
| number | Id of the component instance Required |
| string | Event name. Range of values: |
Configuration
The configuration of the Button component contains properties of how it will be rendered in the UI. To Get/Set the configuration of the Button component its id
must be specified.
Properties:
Property | Type | Description | |||
---|---|---|---|---|---|
| number | Id of the component instance | |||
| string or null | Name of the component instance | |||
| object | Object for storing meta data |
| object | Properties of how the component will be rendered in the UI |
Status
The status of the Button component is empty.
Webhook Events
Currently, these are the events related to the Button component that can trigger webhooks:
button.single_push
button.double_push
button.triple_push
button.long_push
Examples
Button.SetConfig example
- Button.SetConfig HTTP GET Request
- Button.SetConfig Curl Request
- Button.SetConfig Mos Request
http://192.168.33.1/rpc/Button.SetConfig?id=200&config={"name":"Button 1"}
curl -X POST -d '{"id":1,"method":"Button.SetConfig","params":{"id":200,"config":{"name":"Button 1"}}}' http://${SHELLY}/rpc
mos --port ${PORT} call Button.SetConfig '{"id":200,"config":{"name":"Button 1"}}'
Response
- Button.SetConfig HTTP GET Response
- Button.SetConfig Curl Response
- Button.SetConfig Mos Response
{
"restart_required": false
}
{
"id": 1,
"src": "shelly1pmminig3-84fce63fe000",
"params": {
"restart_required": false
}
}
{
"restart_required": false
}
Button.GetConfig example
- Button.GetConfig HTTP GET Request
- Button.GetConfig Curl Request
- Button.GetConfig Mos Request
http://192.168.33.1/rpc/Button.GetConfig?id=200
curl -X POST -d '{"id":1,"method":"Button.GetConfig","params":{"id":200}}' http://${SHELLY}/rpc
mos --port ${PORT} call Button.GetConfig '{"id":200}'
Response
- Button.GetConfig HTTP GET Response
- Button.GetConfig Curl Response
- Button.GetConfig Mos Response
{
"id": 200,
"name": "Button 1",
"meta": null
}
{
"id": 1,
"src": "shelly1pmminig3-84fce63fe000",
"params": {
"id": 200,
"name": "Button 1",
"meta": null
}
}
{
"id": 200,
"name": "Button 1",
"meta": null
}
Button.Trigger example
- Button.Trigger HTTP GET Request
- Button.Trigger Curl Request
- Button.Trigger Mos Request
http://192.168.33.1/rpc/Button.Trigger?id=200&event="single_push"
curl -X POST -d '{"id":1,"method":"Button.Trigger","params":{"id":200,"event":"single_push"}}' http://${SHELLY}/rpc
mos --port ${PORT} call Button.Trigger '{"id":200,"event":"single_push"}'
Response
- Button.Trigger HTTP GET Response
- Button.Trigger Curl Response
- Button.Trigger Mos Response
null
{
"id": 1,
"src": "shelly1pmminig3-84fce63fe000",
"params": null
}
null