Shelly Pro Output Add-On
ProOutputAddon is a Service (similar to Webhook and Schedule), which manages the exposure of add-on peripherals. It uses ProOutputAddon as RPC namespace and provides the following methods:
ProOutputAddon.AddPeripheralto add peripheralProOutputAddon.RemovePeripheralto remove peripheralProOutputAddon.GetPeripheralsto list all peripherals
ProOutputAddon allows the client to link add-on peripherals to Component instances, which in effect means that access to said peripherals is available through the standard Component interfaces: <Component>.GetStatus(), <Component>.GetConfig(), <Component>.SetConfig().
Ids of Components linked to add-on peripherals start from 100 and are limited to 199. Ids range [0..99] is reserved for Components linked to "internal" peripherals.
Below is a list of supported add-on peripherals and the Component types they can be linked to:
| Peripheral type | Component type |
|---|---|
| digital_out | switch |
Changes in peripheral<->component links made with ProOutputAddon.AddPeripheral, ProOutputAddon.RemovePeripheral bond the firmware to spawn/destroy Component instances and therefore require reboot to apply.
Devices that support Shelly Pro Output Addon
Addon configuration
Addon board can be enabled or disabled by setting device.addon_type parameter in Sys config. To enable Shelly Pro Output Addon, addon_type must be set to "prooutput". When Addon is enabled, device must be restarted and methods for managing Addon peripherals will become available. To disable Shelly Pro Output Addon, parameter device.addon_type must be set to null.
Methods
ProOutputAddon.AddPeripheral
ProOutputAddon.AddPeripheral links an add-on peripheral to a Component instance. After adding a peripheral, the device needs reboot in order to use it.
Request
Parameters:
| Property | Type | Description |
|---|---|---|
| string | Peripheral type |
| object | Attributes that the method takes |
Find more about the attrs properties in AddPeripheral attributes section
Response
List of JSON objects, where the object key designates the Component key (in format <type>:<id>, e.g. switch:100) to which the peripheral is linked.
Examples: ProOutputAddon.AddPeripheral Example
ProOutputAddon.GetPeripherals
ProOutputAddon.GetPeripherals returns the configured links between add-on peripherals and Components.
Request
This method takes no parameters.
Response
List of JSON objects, one for each supported peripheral, where the object key designates the peripheral type ([digital_out]). The object body contains a nested list of JSON objects, where the object key designates the Component keys (in format <type>:<id>, e.g. switch:100) to which the peripheral is linked. The object body may contain additional attributes depending on the peripheral type.
Examples: ProOutputAddon.GetPeripherals Examples
ProOutputAddon.RemovePeripheral
Request
| Property | Type | Description |
|---|---|---|
| string | Linked |
Response
The result from this method is null on success otherwise will return error information.
Examples: ProOutputAddon.RemovePeripheral Examples
AddPeripheral Attributes
For every ProOutputAddon peripheral, component cid can be predefined or will be taken first available.
| Property | Type | Description |
|---|---|---|
| number | Id of component. (optional) |
Examples
Enable / Disable ProOutputAddon examples
Enable ProOutputAddon
- Sys.SetConfig HTTP GET Request
- Sys.SetConfig Curl Request
- Sys.SetConfig Mos Request
http://192.168.33.1/rpc/Sys.SetConfig?config={"device":{"addon_type":"prooutput"}}
curl -X POST -d '{"id":1,"method":"Sys.SetConfig","params":{"config":{"device":{"addon_type":"prooutput"}}}}' http://${SHELLY}/rpc
mos --port ${PORT} call Sys.SetConfig '{"config":{"device":{"addon_type":"prooutput"}}}'
Disable ProOutputAddon
- Sys.SetConfig HTTP GET Request
- Sys.SetConfig Curl Request
- Sys.SetConfig Mos Request
http://192.168.33.1/rpc/Sys.SetConfig?config={"device":{"addon_type":null}}
curl -X POST -d '{"id":1,"method":"Sys.SetConfig","params":{"config":{"device":{"addon_type":null}}}}' http://${SHELLY}/rpc
mos --port ${PORT} call Sys.SetConfig '{"config":{"device":{"addon_type":null}}}'
ProOutputAddon.AddPeripheral example
- ProOutputAddon.AddPeripheral HTTP GET Request
- ProOutputAddon.AddPeripheral Curl Request
- ProOutputAddon.AddPeripheral Mos Request
http://192.168.33.1/rpc/ProOutputAddon.AddPeripheral?type="digital_out"&attrs={"cid":100}
curl -X POST -d '{"id":1,"method":"ProOutputAddon.AddPeripheral","params":{"type":"digital_out","attrs":{"cid":100}}}' http://${SHELLY}/rpc
mos --port ${PORT} call ProOutputAddon.AddPeripheral '{"type":"digital_out","attrs":{"cid":100}}'
Response
- ProOutputAddon.AddPeripheral HTTP GET Response
- ProOutputAddon.AddPeripheral Curl Response
- ProOutputAddon.AddPeripheral Mos Response
{
"switch:100": {}
}
{
"id": 1,
"params": {
"switch:100": {}
}
}
{
"switch:100": {}
}
ProOutputAddon.RemovePeripheral example
- ProOutputAddon.RemovePeripheral HTTP GET Request
- ProOutputAddon.RemovePeripheral Curl Request
- ProOutputAddon.RemovePeripheral Mos Request
http://192.168.33.1/rpc/ProOutputAddon.RemovePeripheral?component="switch:100"
curl -X POST -d '{"id":1,"method":"ProOutputAddon.RemovePeripheral","params":{"component":"switch:100"}}' http://${SHELLY}/rpc
mos --port ${PORT} call ProOutputAddon.RemovePeripheral '{"component":"switch:100"}'
Response
- ProOutputAddon.RemovePeripheral HTTP GET Response
- ProOutputAddon.RemovePeripheral Curl Response
- ProOutputAddon.RemovePeripheral Mos Response
null
{
"id": 1,
"params": null
}
null
ProOutputAddon.GetPeripherals example
- ProOutputAddon.GetPeripherals HTTP GET Request
- ProOutputAddon.GetPeripherals Curl Request
- ProOutputAddon.GetPeripherals Mos Request
http://192.168.33.1/rpc/ProOutputAddon.GetPeripherals
curl -X POST -d '{"id":1,"method":"ProOutputAddon.GetPeripherals"}' http://${SHELLY}/rpc
mos --port ${PORT} call ProOutputAddon.GetPeripherals
Response
- ProOutputAddon.GetPeripherals HTTP GET Response
- ProOutputAddon.GetPeripherals Curl Response
- ProOutputAddon.GetPeripherals Mos Response
{
"digital_out": {
"switch:100": {}
}
}
{
"id": 1,
"params": {
"digital_out": {
"switch:100": {}
}
}
}
{
"digital_out": {
"switch:100": {}
}
}