Virtual Components
Available as preview since 1.1.0-beta3
. The API is subject to change.
Available only for Gen3 and Gen2 Pro* devices.
Virtual
components are a subset of dynamic components
that allow the user to interact with scripts.
Creation and deletion of components is done through 2 methods from the Virtual
namespace.
Virtual.Add
to create new virtual componentVirtual.Delete
to remove existing virtual component
There is a limit of 10 instances per device.
A list with all virtual components can be fetched only by Shelly.GetComponents
method.
Available virtual components:
Interaction with virtual components
Virtual components are used to store/transfer data between scripts or runs, but they provide the possibility for the user to interact with them from the device's local home page. Each virtual group is added to the home page and is made up of cards. Each component has its own card with different inputs inside, based on the component's configuration.
Methods
Virtual.Add
Request
Properties:
Property | Type | Description |
---|---|---|
| string | The type of virtual component to be created. Range of values: |
| object | Configuration to be used for the new component. Optional |
| number | ID for the new component. Accepted range: |
Response
The result from calling this method is a JSON object, with an id on success, otherwise it will return an error.
Received attributes:
Property | Type | Description |
---|---|---|
| number | ID of the newly created component. |
Virtual.Delete
Request
Properties:
Property | Type | Description |
---|---|---|
| string | Component key (in format |
Response
The result from calling this method is null
on success, otherwise it will return an error.
Examples
Virtual.Add example
- Virtual.Add HTTP GET Request
- Virtual.Add Curl Request
- Virtual.Add Mos Request
http://192.168.33.1/rpc/Virtual.Add?type="boolean"
curl -X POST -d '{"id":1,"method":"Virtual.Add","params":{"type":"boolean"}}' http://${SHELLY}/rpc
mos --port ${PORT} call Virtual.Add '{"type":"boolean"}'
Response
- Virtual.Add HTTP GET Response
- Virtual.Add Curl Response
- Virtual.Add Mos Response
{
"id": 200
}
{
"id": 1,
"src": "shelly1pmminig3-84fce63fe000",
"params": {
"id": 200
}
}
{
"id": 200
}
Virtual.Delete example
- Virtual.Delete HTTP GET Request
- Virtual.Delete Curl Request
- Virtual.Delete Mos Request
http://192.168.33.1/rpc/Virtual.Delete?key="boolean:200"
curl -X POST -d '{"id":1,"method":"Virtual.Delete","params":{"key":"boolean:200"}}' http://${SHELLY}/rpc
mos --port ${PORT} call Virtual.Delete '{"key":"boolean:200"}'
Response
- Virtual.Delete HTTP GET Response
- Virtual.Delete Curl Response
- Virtual.Delete Mos Response
null
{
"id": 1,
"src": "shelly1pmminig3-84fce63fe000",
"params": null
}
null