Enum
The virtual Enum
component is used to store a set of constant values. It uses Enum
as RPC namespace and has the following methods:
Enum.SetConfig
to update the component's configurationEnum.GetConfig
to obtain the component's configurationEnum.GetStatus
to obtain the component's statusEnum.Set
to update the component's value
Methods
Enum.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
Enum.GetConfig
Properties:
Property | Type | Description |
---|---|---|
| number | Id of the component instance |
Find the Enum.GetConfig response properties in config section
Enum.GetStatus
Properties:
Property | Type | Description |
---|---|---|
| number | Id of the component instance |
Find more about the status response properties in status section
Enum.Set
This method updates the value of the Enum 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 |
| string or null | One of the items from |
Configuration
The configuration of the Enum 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 Enum 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 |
| ||||||||||||||||||
| object or null | Option selected on reboot if | ||||||||||||||||||
| array of options objects | Values that can be set for this enum instance Required | ||||||||||||||||||
| object | Object for storing meta data |
| object | Properties of how the component will be rendered in the UI
|
Status
The status of the Enum 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 Enum component its id
must be specified.
Properties:
Property | Type | Description |
---|---|---|
| string | Source of the last command |
| string or null | One of the items from |
| number | Unix timestamp for the value update |
Webhook Events
Currently, there is one event related to the Enum component that can trigger webhooks:
enum.change
- produced when the value changes.
Examples
Enum.SetConfig example
- Enum.SetConfig HTTP GET Request
- Enum.SetConfig Curl Request
- Enum.SetConfig Mos Request
http://192.168.33.1/rpc/Enum.SetConfig?id=200&config={"name":"Light to toggle","options":["kitchen_light","bedroom_light","bathroom_light","entrance_light"],"meta":{"ui":{"titles":{"kitchen_light":"Kitchen light","bedroom_light":"Bedroom light","bathroom_light":"Bathroom light","entrance_light":"Entrance light"}}}}
curl -X POST -d '{"id":1,"method":"Enum.SetConfig","params":{"id":200,"config":{"name":"Light to toggle","options":["kitchen_light","bedroom_light","bathroom_light","entrance_light"],"meta":{"ui":{"titles":{"kitchen_light":"Kitchen light","bedroom_light":"Bedroom light","bathroom_light":"Bathroom light","entrance_light":"Entrance light"}}}}}}' http://${SHELLY}/rpc
mos --port ${PORT} call Enum.SetConfig '{"id":200,"config":{"name":"Light to toggle","options":["kitchen_light","bedroom_light","bathroom_light","entrance_light"],"meta":{"ui":{"titles":{"kitchen_light":"Kitchen light","bedroom_light":"Bedroom light","bathroom_light":"Bathroom light","entrance_light":"Entrance light"}}}}}'
Response
- Enum.SetConfig HTTP GET Response
- Enum.SetConfig Curl Response
- Enum.SetConfig Mos Response
{
"restart_required": false
}
{
"id": 1,
"src": "shelly1pmminig3-84fce63fe000",
"params": {
"restart_required": false
}
}
{
"restart_required": false
}
Enum.GetConfig example
- Enum.GetConfig HTTP GET Request
- Enum.GetConfig Curl Request
- Enum.GetConfig Mos Request
http://192.168.33.1/rpc/Enum.GetConfig?id=200
curl -X POST -d '{"id":1,"method":"Enum.GetConfig","params":{"id":200}}' http://${SHELLY}/rpc
mos --port ${PORT} call Enum.GetConfig '{"id":200}'
Response
- Enum.GetConfig HTTP GET Response
- Enum.GetConfig Curl Response
- Enum.GetConfig Mos Response
{
"id": 200,
"name": "",
"options": [
"kitchen_light",
"bedroom_light",
"bathroom_light",
"entrance_light"
],
"meta": {
"ui": {
"view": "",
"titles": {
"kitchen_light": "Kitchen light",
"bedroom_light": "Bedroom light",
"bathroom_light": "Bathroom light",
"entrance_light": "Entrance light"
},
"icon": "",
"images": {}
}
},
"persisted": true,
"default_value": "kitchen_light"
}
{
"id": 1,
"src": "shelly1pmminig3-84fce63fe000",
"params": {
"id": 200,
"name": "",
"options": [
"kitchen_light",
"bedroom_light",
"bathroom_light",
"entrance_light"
],
"meta": {
"ui": {
"view": "",
"titles": {
"kitchen_light": "Kitchen light",
"bedroom_light": "Bedroom light",
"bathroom_light": "Bathroom light",
"entrance_light": "Entrance light"
},
"icon": "",
"images": {}
}
},
"persisted": true,
"default_value": "kitchen_light"
}
}
{
"id": 200,
"name": "",
"options": [
"kitchen_light",
"bedroom_light",
"bathroom_light",
"entrance_light"
],
"meta": {
"ui": {
"view": "",
"titles": {
"kitchen_light": "Kitchen light",
"bedroom_light": "Bedroom light",
"bathroom_light": "Bathroom light",
"entrance_light": "Entrance light"
},
"icon": "",
"images": {}
}
},
"persisted": true,
"default_value": "kitchen_light"
}
Enum.GetStatus example
- Enum.GetStatus HTTP GET Request
- Enum.GetStatus Curl Request
- Enum.GetStatus Mos Request
http://192.168.33.1/rpc/Enum.GetStatus?id=200
curl -X POST -d '{"id":1,"method":"Enum.GetStatus","params":{"id":200}}' http://${SHELLY}/rpc
mos --port ${PORT} call Enum.GetStatus '{"id":200}'
Response
- Enum.GetStatus HTTP GET Response
- Enum.GetStatus Curl Response
- Enum.GetStatus Mos Response
{
"value": "kitchen_light",
"source": "rpc",
"last_update_ts": 1700864253
}
{
"id": 1,
"src": "shelly1pmminig3-84fce63fe000",
"params": {
"value": "kitchen_light",
"source": "rpc",
"last_update_ts": 1700864253
}
}
{
"value": "kitchen_light",
"source": "rpc",
"last_update_ts": 1700864253
}
Enum.Set example
- Enum.Set HTTP GET Request
- Enum.Set Curl Request
- Enum.Set Mos Request
http://192.168.33.1/rpc/Enum.Set?id=200&value="kitchen_light"
curl -X POST -d '{"id":1,"method":"Enum.Set","params":{"id":200,"value":"kitchen_light"}}' http://${SHELLY}/rpc
mos --port ${PORT} call Enum.Set '{"id":200,"value":"kitchen_light"}'
Response
- Enum.Set HTTP GET Response
- Enum.Set Curl Response
- Enum.Set Mos Response
null
{
"id": 1,
"src": "shelly1pmminig3-84fce63fe000",
"params": null
}
null