Files
shellySrv/shellyapi.md
2026-01-10 23:25:45 -05:00

1677 lines
37 KiB
Markdown

Version: 1.0
RPC Protocol
RPCs (Remote Procedure Calls) are used to send commands to devices and receive notifications and replies from these devices.
Gen2+ is monitored and controlled by JSON-RPC 2.0 protocol. This protocol is supported by Shelly OS and detailed documentation about it can be found here. The protocol is symmetric: both peers can call methods and notify.
According to the Shelly conventions each procedure is a method that has a name (e.g., Switch.GetConfig), takes JSON object as arguments (e.g., {"id":1}) and returns JSON object as a result (e.g., {"restart_required":false}). Methods are kept in namespaces as in:
Shelly - system management, configuration and status
Shelly.FactoryReset
Shelly.ResetWiFiConfig
Shelly.ListTimezones, etc.
Switch - A component for a discrete power output; usually a relay
Switch.Set
Switch.GetConfig, etc.
There are three types of frames in the communication between a user and a device:
request frame
response frame
notification frame
Request Frame
The request frame is a JSON object, containing the following attributes:
Property Type Description
jsonrpc
string
2.0. The version of jsonrpc used. May be omitted
id
number or string
Identifier of this request, will be used to match the response frame. Required
src
string
Name of the source of the request (you can choose whatever string you like to identify you as the source of the request).Required
method
string
Name of the procedure to be called. Required
params
object
Parameters that the method takes (if any) Optional
Example 1:
Request frame invoking Switch.GetConfig method:
{
"jsonrpc":"2.0",
"id": 1,
"src":"user_1",
"method":"Switch.GetConfig",
"params": {
"id":2
}
}
Example 2:
Request frame invoking Switch.Set method:
{
"id": 2,
"src":"user_1",
"method":"Switch.Set",
"params": {
"id":1,
"on":true
}
}
Response Frame
The response frame is a JSON object, containing the following attributes:
Property Type Description
id
number or string
Id of the communication
src
string
Name of the source of the response
dst
string
Name of the destination (the source of the request)
result
object
The result of the invoked procedure and is returned if the request is successful. result and error re mutually exclusive. More about the error frames used in Gen2+ can be found here
error
object
Contains description of the error occurred and is returned if the request is unsuccessful.result and error re mutually exclusive. More about the error frames used in Gen2+ can be found here
Example 1:
Response frame returning result object after successful request:
{
"id": 2,
"src": "shellypro4pm-f008d1d8b8b8",
"dst": "user_1",
"result": {
"was_on": false
}
}
Example 2:
Response frame returning error object after unsuccessful request:
{
"id": 1,
"src": "shellypro4pm-f008d1d8b8b8",
"dst": "user_1",
"error": {
"code": -105,
"message": "Bad id=12"
}
}
Notification Frame
The notification frame is a JSON object, similar to a request but not expecting a response. It contains the following attributes:
Property Type Description
src
string
Name of the source of the response. Required
dst
string
Name of the destination. Required
method
string
The method invoked. Required
params
object
The parameters of the notification. Required
Example 1:
Notification frame containing information about status change:
{
"src": "shellypro4pm-f008d1d8b8b8",
"dst": "user_1",
"method": "NotifyStatus",
"params": {
"ts": 1623243781.01,
"switch:3": {
"id": 3,
"aenergy": {
"by_minute": [
0,
0.015,
0
],
"minute_ts": 1623243779,
"total": 0.037
}
}
}
}
Example 2:
Notification frame containing information about event occurred:
{
"src": "shellypro4pm-f008d1d8b8b8",
"dst": "user_1",
"method": "NotifyEvent",
"params": {
"ts": 1631266595.44,
"events": [
{
"component": "input:0",
"id": 0,
"event": "single_push",
"ts": 1631266595.44
}
]
}
}
Websocket
The connection is kept alive through the whole duration of the communication (not only for one request-response pair) as used by the local web interface and aioshelly. Each Shelly device has a websocket endpoint and a client can connect to it to communicate with the device. Protection through digest authentication is supported over this channel.
The websocket channel is served on ws://<shelly.addr>/rpc. Clients must send at least one request frame with valid src to be able to receive notifications from the device.
Example 1:
A websocket connection to Shelly host is opened and the method Switch.Set is invoked:
wscat -c ws://${SHELLY}/rpc
{"id":2, "src":"user_1", "method":"Switch.Set", "params":{"id":0, "on":true}}
Component Concept
General
A component is an encapsulated functional unit which exposes methods for communication with the outside world. Each component has a status and a configuration. Hence, each component supports the methods: <component>.GetStatus, <component>.GetConfig, <component>.SetConfig. The behavior of these methods is identical, they only differ in the format of the configuration and status structures.
Status
The status contains all static characteristics of a component. To get the status of a component, the method <component>.GetStatus can be used. Alternatively, to see the status of all components in your device in one place, you can use Shelly.GetStatus. As the status characteristics are static, they cannot be set and that's the reason why Shelly Gen2+ devices support only <component>.GetStatus method (but not a <component>.SetStatus one).
The <component>.GetStatus method returns an object specific to the chosen component. Hence, a parameter id is needed in case the device has more than one instance of this component. Otherwise, <component>.GetStatus takes no parameters. For example, a Shelly Pro4PM device has 4 instances of the switch component and only one instance of the cloud component.
Notifications
Shelly components support two types of notifications through the methods NotifyStatus and NotifyEvent. The structure of the notification frames is described on the RPC Protocol page. More information about the notifications sent over each of the supported channels can found on this page.
Briefly:
notifications cannot be received over HTTP;
to start receiving notifications over websocket you have to send at least one request frame with a valid source (src);
to receive notifications over MQTT you have to subscribe to the topic <shelly-id_>/events/rpc.
NotifyStatus
This method notifies about change in the status of a component, and carries information about the changes which occurred. It is defined by:
method: "NotifyStatus"
params:
Property Type Description
ts
number
Unix timestamp (in UTC)
component
object
With the same structure as the status object of the component. Some or all unchanged attributes of the status object may not be visible. component must be substituted by the component type, (for example, cloud, wifi, mqtt). If more than one instance of this type of component are available, component will be substituted by component_type:id (e.g., switch:2, input:0)
The intended use of these notifications is to overlay the changes from NotifyStatus over a known status. This should yield identical results to what would be returned by a fresh GetStatus call.
Certain status keys will only exist in certain situations. When such keys disappear from the status payload, the NotifyStatus payload which notifies about the change will include the key with a null value.
Example 1:
Notify that a button has changed the output state of the switch with id=0.
{
"src": "shellypro4pm-f008d1d8b8b8",
"dst": "user_1",
"method": "NotifyStatus",
"params": {
"ts": 1631186545.04,
"switch:0": {
"id": 0,
"output": true,
"source": "button"
}
}
}
Example 2:
Notify that this device has lost connection to the cloud.
{
"src": "shellypro4pm-f008d1d8b8b8",
"dst": "user_1",
"method": "NotifyStatus",
"params": {
"ts": 1624348482.25,
"cloud": {
"connected": false
}
}
}
Example 3:
Notify that config for this device has changed.
{
"src": "shellyplus1-a8032abe54dc",
"dst": "user_1",
"method": "NotifyStatus",
"params": {
"ts": 1655369046.4,
"sys": {
"cfg_rev": 19
}
}
}
NotifyFullStatus
Since version 0.11.0
This method has the same semantics as NotifyStatus, but the payload contains the full status of all components.
method: "NotifyFullStatus"
params:
ts: number, unix timestamp (in UTC)
<component>: JSON object, with the same structure as the status object of the component.
Example 1:
{
"src": "shellyplusht-f008d1d8b8b8",
"dst": "user_1",
"method": "NotifyFullStatus",
"params": {
"ts": 1631186545.04,
"ble": {},
"cloud": {
"connected": false
},
"mqtt": {
"connected": false
},
"sys": {
"mac": "F008D1E62338",
"restart_required": false,
"time": null,
"unixtime": null,
"last_sync_ts": null,
"uptime": 41,
"ram_size": 254948,
"ram_free": 146620,
"fs_size": 458752,
"fs_free": 229376,
"cfg_rev": 0,
"available_updates": {}
},
"wifi": {
"sta_ip": null,
"status": "disconnected",
"ssid": null,
"rssi": 0
},
"temperature:0": {
"id": 0,
"tC": 20.0,
"tF": 68.0
},
"humidity:0": {
"id": 0,
"rh": 50.0
},
"devicepower:0": {
"id": 0,
"battery": {
"V": 4.59,
"percent": 11
},
"external": {
"present": false
}
},
"ht_ui": {}
}
}
The notification is emitted:
over outbound websocket RPC channel for all devices
over outbound websocket, MQTT and outbound UDP channels on battery-operated (sleeping) devices.
NotifyEvent
This method notifies about an occurred event that is not reflected in the status of a component (e.g., pushed button, changed configuration, ...). It is defined by:
method: "NotifyEvent"
params:
Property Type Description
ts
number
Unix timestamp (in UTC)
events
array of objects
Containing all the events occurred. Each JSON object describes an event and contains different attributes according to the type of the event
The following attributes are common for every JSON object present in the events array:
Property Type Description
ts
number
Unix timestamp (in UTC)
component
string
Component key (component_type[:id], e.g. switch:0; wifi)
id
number
Component id
event
string
Event name
Example 1:
Notify that a button single push event has occurred.
{
"src": "shellypro4pm-f008d1d8b8b8",
"dst": "user_1",
"method": "NotifyEvent",
"params": {
"ts": 1631266595.44,
"events": [
{
"component": "input:0",
"id": 0,
"event": "single_push",
"ts": 1631266595.44
}
]
}
}
Example 2:
Notify that a sys button push event has occurred.
{
"src": "shellypro1pm-f008d3256874",
"dst": "user_1",
"method": "NotifyEvent",
"params": {
"ts": 1713361785.51,
"events": [
{
"component": "sys",
"event": "sys_btn_push",
"ts": 1713361785.51
}
]
}
}
Common event notifications
The following notifications are common for all functional and system components.
Configuration change
Example 1:
Notify that the configuration of input with id=0 has been changed.
{
"src": "shellypro4pm-f008d1d8b8b8",
"dst": "user_1",
"method": "NotifyEvent",
"params": {
"ts": 1631266460.71,
"events": [
{
"component": "input:0",
"id": 0,
"event": "config_changed",
"restart_required": false,
"ts": 1631266460.71,
"cfg_rev": 18
}
]
}
}
mDNS
Gen2+ shellies advertise themselves the Multicast Domain Name System (mDNS), also known as Bonjour. Devices advertise two types of services:
_http._tcp - a web server serving on port 80. This service is also advertised for Gen1 shellies
_shelly._tcp - service instance specific to Gen2+ Shelly devices.
In the TXT record for both services devices include gen=2 or gen=3. This key can be used to distinguish from Gen1 shellies if discovery is done using the _http._tcp service instance.
Introduction
In the Components and Services section, you can find information for all possibly available (may differ, depending on the device/device profile) Components and Services.
Each Component/Service page in here is structured as follows:
Methods
All Components always contain the following methods:
Component.SetConfig
Component.GetConfig
Component.GetStatus
Services may not have GetConfig/SetConfig or GetStatus.
Additionally, component-specific methods are listed on each page.
More information on how to work with those methods can be found in:
General - RPC Protocol - Protocol used in Shelly Gen2+ devices
General - RPC Channels - Different channels which can be used for working with the API
General - Component Concept - Core explanation of the concept of a Component
Configuration
Each Component, would have a configuration, available through GetConfig and SetConfig.
Configuration for Services is optional.
Status
Each Component, would have a status, available through GetStatus.
Status for Services is optional.
Webhook Events
Components may trigger web hook events. If such are available, for the specific component, they would be documented in the Webhook Events section.
Notifications
Notifications are a concept that handles events and status changes.
Each component and service, may support those.
The core ones are:
1) config_changed - when a configuration (Component.GetConfig) is changed (mostly via Component.SetConfig):
{
"component": "switch:0",
"id": 0,
"event": "config_changed",
"restart_require": false,
"ts":1654698383.84,
"cfg_rev":10
}
2) State changes - when a state (in Component.GetStatus) changes:
{
"id": 0,
"output": true,
"source": "WS_in"
}
Component specific articles, where needed
Some components, may introduce their own concepts and require explanation on how they work. For such cases, there would be separate component specific articles.
Examples
Examples are a list of requests (with specific methods and parameters), shown together with responses.
Shelly
This service is common for all Gen2+ devices. It handles device management. Here are listed all methods supported by the Shelly namespace.
Shelly.GetStatus
This method returns the status of all the components of the device.
Request
This method takes no parameters.
Response
Attributes in the result are the status objects of all components in the device.
Shelly.GetConfig
This method returns the configuration of all the components of the device.
Request
This method takes no parameters.
Response
Attributes in the result are the configuration objects of all components in the device.
Shelly.ListMethods
This method lists all available RPC methods. It takes into account both ACL and authentication restrictions and only lists the methods allowed for the particular user/channel that's making the request.
Request
This method takes no parameters.
Response
Attributes in the result:
Property Type Description
methods
array of type string
Names of the methods allowed
Shelly.GetDeviceInfo
This method returns information about the device.
Request
Parameters:
Property Type Description
ident
boolean
Flag specifying if extra identifying information should be displayed. Optional
Response
Attributes in the result:
Property Type Description
id
string
Id of the device
mac
string
Mac address of the device
model
string
Model of the device
gen
number
Generation of the device
fw_id
string
Id of the firmware of the device
ver
string
Version of the firmware of the device
app
string
Application name
profile
string
Name of the device profile (only applicable for multi-profile devices)
auth_en
boolean
true if authentication is enabled, false otherwise
auth_domain
string or null
Name of the domain (null if authentication is not enabled)
discoverable
boolean
Present only when false. If true, device is shown in 'Discovered devices'. If false, the device is hidden.
key
string
Cloud key of the device (see note below), present only when the ident parameter is set to true
batch
string
Batch used to provision the device, present only when the ident parameter is set to true
fw_sbits
string
Shelly internal flags, present only when the ident parameter is set to true
note
The cloud key of the device is a JSON Web Token (JWT), generated by the Shelly provisioning server and obtained by the device during provisioning used to identify device to the Shelly cloud. More information about JSON Web Token as well as an online tool to verify the integrity of the cloud key be found on this site. The public key to verify the signature of the cloud key JWT is:
-----BEGIN PUBLIC KEY-----
MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEhwiPS5G27EGpuW3uaRQYSlcCxdxMm9E0
0xI6zeqfou0cI7Cn5+oaf7SsH2E/8nKQN4uAkRIlX2PG/yoggEXR+iwOzA/ZW6km
Pcy25FAkstbYuzYWJRme27O8OhURBc7W
-----END PUBLIC KEY-----
Shelly.ListProfiles
The term profile abstracts high-level device functionality. Some devices can operate in different exclusive modes or profiles, for example, Shelly Plus2PM and Shelly Pro2PM can operate in a switch or cover profile. Shelly.ListProfiles lists the names of available profiles and the type/count of functional components exposed for each profile. Shelly.ListProfiles is only available on multi-profile devices.
Request
This method takes no parameters.
Shelly.SetProfile
This method sets the device profile. Shelly.SetProfile is only available on multi-profile devices.
danger
Changing the device profile will delete all webhooks and schedules on the device.
Request
Parameters:
Property Type Description
name
string
Name of the device profile
Response
When the newly selected profile is different than the active profile:
Shelly.SetProfile returns profile_was, followed by an automatic reboot
When the newly selected profile is the same as the active profile:
Shelly.SetProfile returns profile_was
Shelly.ListTimezones
This method returns list of timezones, it supports paging.
Request
Parameters:
Property Type Description
offset
number
Index of the list from which to start generating the result Optional
Response
Attributes in the result:
Property Type Description
timezones
array of type string
List of timezones
offset
number
Index of the first entry in the result
total
number
Total number of available timezones
Shelly.DetectLocation
This method detects and returns the location of the device.
Request
This method takes no parameters.
Response
Attributes in the result:
Property Type Description
tz
string or null
Timezone of the detected location (null if not available)
lat
number or null
Latitude of the detected location in degrees (null if not available)
lon
number or null
Longitude of the detected location in degrees (null if not available)
Shelly.CheckForUpdate
This method checks for new firmware version for the device and returns information about it. If no update is available returns empty JSON object as result.
Request
This method takes no parameters.
Response
Attributes in the result (only the ones available are shown):
Property Type Description
stable
object
Indicates new stable version of the firmware.
Property Type Description
version
string
The new version
build_id
string
Id of the new build
beta
object
Indicates new beta version of the firmware.
Property Type Description
version
string
The new version
build_id
string
Id of the new build
Shelly.Update
This method updates the firmware version of the device.
Request
Parameters:
Property Type Description
stage
string
The type of the new version - either stable or beta. By default updates to stable version. Optional
url
string
Url address of the update. Optional
caution
Shelly.Update takes either stage or url.
Shelly.FactoryReset
This method resets the configuration to its default state.
Request
This method takes no parameters.
Shelly.ResetWiFiConfig
This method resets the WiFi configuration of the device.
Request
This method takes no parameters.
Response
The result from this method is null.
Shelly.Reboot
This method reboots the device.
Request
Parameters:
Property Type Description
delay_ms
number
Delay until reboot in milliseconds. Any values are valid but the minimum is capped at 500 ms. Default value: 1000 ms. Optional
Shelly.SetAuth
This method sets authentication details (password) for the device. More detailed description of the authentication mechanism can be found here.
Request
Parameters:
Property Type Description
user
string
Must be set to admin. Only one user is supported. Required
realm
string
Must be the id of the device. Only one realm is supported. Required
ha1
string or null
"user:realm:password" encoded in SHA256 (null to disable authentication). Required
Shelly.PutUserCA
This method allows uploading of a custom certificate authority (CA) PEM bundle. Because the file can be larger than what can fit in a single RPC frame, the method allows uploading in chunks (for example line by line). More about the user CA support provided by Shelly can be found here.
Request
Parameters:
Property Type Description
data
string or null
Contents of the PEM file (null if you want to delete the existing data). Required
append
boolean
true if more data will be appended afterwards, default false.
Response
The result from this method is the lenght of the certificate in bytes.
Shelly.PutTLSClientCert
This method allows uploading of a custom client certificate client.crt. Because the file can be larger than what can fit in a single RPC frame, the method allows uploading in chunks (for example line by line). More about the user certificate support provided by Shelly can be found here.
Request
Parameters:
Property Type Description
data
string or null
Contents of the client.crt file (null if you want to delete the existing data). Required
append
boolean
true if more data will be appended afterwards, default false.
Response
The result from this method is the lenght of the certificate in bytes.
Shelly.PutTLSClientKey
This method allows uploading of a custom client key client.key. Because the file can be larger than what can fit in a single RPC frame, the method allows uploading in chunks (for example line by line). More about the user certificate support provided by Shelly can be found here.
Request
Parameters:
Property Type Description
data
string or null
Contents of the client.key file (null if you want to delete the existing data). Required
append
boolean
true if more data will be appended afterwards, default false.
Response
The result from this method is the length of the certificate in bytes.
Shelly.GetComponents
This method returns a list with device's components, it supports paging, filter for dynamic components (for example virtual components) and allows the user to get only the needed information from the component.
Request
Parameters:
Property Type Description
offset
number
Index of the component from which to start generating the result Optional
include
array of strings
"status" will include the component's status, "config" - the config. The keys are always included. Combination of both (["config", "status"]) to get the full config and status of each component. Optional
keys
array of strings
An array of component keys in the format <type> <cid> (for example, boolean:200) which is used to filter the response list. If empty/not provided, all components will be returned. Optional
dynamic_only
boolean
true to include only dynamic components, default false. Optional
Response
Property Type Description
components
array of objects
Property Type Description
key
string
Component's key (in format <type>:<cid>, for example boolean:200)
status
object
Component's status, will be omitted if "status" is not specified in the include property.
config
object
Component's config, will be omitted if "config" is not specified in the include property.
cfg_rev
number
Sys's configuration revision
offset
number
Index of the first component in the result
total
number
Total number of components with all filters applied
HTTP Endpoint: /shelly
This resource is equivalent to invoking Shelly.GetDeviceInfo. The aim of this request is to identify a device. As the generation (gen) of the device determines the channels and methods/endpoints available, this information is useful for further integrations of Shelly devices in other systems.
Example:
Request
curl http://${SHELLY}/shelly
Response
{
"id": "shellypro4pm-f008d1d8b8b8",
"mac": "F008D1D8B8B8",
"model": "SPSW-004PE16EU",
"gen": 2,
"fw_id": "20210720-153353/0.6.7-gc36674b",
"ver": "0.6.7",
"app": "FourPro",
"auth_en": true,
"auth_domain": "shellypro4pm-f008d1d8b8b8"
}
HTTP Endpoint: /ota
danger
Flashing devices with custom firmware will irreversably void the device warranty.
Shelly devices contains a suite of safety features. Every firmware build goes through extensive testing to ensure all safety features and protection mechanisms work reliably. We cannot provide the same guarantee for unofficial firmware images.
This endpoints allows a shelly device to be flashed with a compatible Shelly OS firmware. It expects a url parameter and will attempt to download the firmware image from there.
Example:
Request
curl http://${SHELLY}/ota?url=http://third-party-firmware.site/path/to/image.zip
Examples
Shelly.GetStatus example
Shelly.GetStatus HTTP GET Request
Shelly.GetStatus Curl Request
Shelly.GetStatus Mos Request
http://192.168.33.1/rpc/Shelly.GetStatus
Response
{
"ble": {},
"cloud": {
"connected": false
},
"eth": {
"ip": "10.33.55.170"
},
"input:0": {
"id": 0,
"state": false
},
"input:1": {
"id": 1,
"state": false
},
"input:2": {
"id": 2,
"state": false
},
"input:3": {
"id": 3,
"state": false
},
"mqtt": {
"connected": false
},
"switch:0": {
"id": 0,
"source": "timer",
"output": true,
"timer_started_at": 1626935739.79,
"timer_duration": 60,
"apower": 8.9,
"voltage": 237.5,
"aenergy": {
"total": 6.532,
"by_minute": [
45.199,
47.141,
88.397
],
"minute_ts": 1626935779
},
"temperature": {
"tC": 23.5,
"tF": 74.4
}
},
"switch:1": {
"id": 1,
"source": "init",
"output": false,
"apower": 0,
"voltage": 237.5,
"aenergy": {
"total": 0,
"by_minute": [
0,
0,
0
],
"minute_ts": 1626935779
},
"temperature": {
"tC": 23.5,
"tF": 74.4
}
},
"switch:2": {
"id": 2,
"source": "timer",
"output": false,
"timer_started_at": 1626935591.8,
"timer_duration": 345,
"apower": 0,
"voltage": 237.5,
"aenergy": {
"total": 0.068,
"by_minute": [
0,
0,
0
],
"minute_ts": 1626935779
},
"temperature": {
"tC": 23.5,
"tF": 74.4
}
},
"switch:3": {
"id": 3,
"source": "init",
"output": false,
"apower": 0,
"voltage": 237.5,
"aenergy": {
"total": 0,
"by_minute": [
0,
0,
0
],
"minute_ts": 1626935779
},
"temperature": {
"tC": 23.5,
"tF": 74.4
}
},
"sys": {
"mac": "A8032ABE54DC",
"restart_required": false,
"time": "16:06",
"unixtime": 1650035219,
"last_sync_ts": 1650035219,
"uptime": 11081,
"ram_size": 254744,
"ram_free": 151560,
"fs_size": 458752,
"fs_free": 180224,
"cfg_rev": 26,
"kvs_rev": 2725,
"schedule_rev": 0,
"webhook_rev": 0,
"available_updates": {
"stable": {
"version": "0.10.1"
}
}
},
"wifi": {
"sta_ip": null,
"status": "disconnected",
"ssid": null,
"rssi": 0
},
"ws": {
"connected": true
}
}
Shelly.GetConfig example
Shelly.GetConfig HTTP GET Request
Shelly.GetConfig Curl Request
Shelly.GetConfig Mos Request
http://192.168.33.1/rpc/Shelly.GetConfig
Response
{
"ble": {
"enable": true
},
"cloud": {
"enable": false,
"server": "iot.shelly.cloud:6012/jrpc"
},
"eth": {
"enable": true,
"ipv4mode": "dhcp",
"ip": null,
"netmask": null,
"gw": null,
"nameserver": null
},
"input:0": {
"id": 0,
"name": null,
"type": "switch",
"invert": false
},
"input:1": {
"id": 1,
"name": null,
"type": "switch",
"invert": false
},
"input:2": {
"id": 2,
"name": null,
"type": "switch",
"invert": false
},
"input:3": {
"id": 3,
"name": null,
"type": "switch",
"invert": false
},
"mqtt": {
"enable": false,
"server": null,
"user": null,
"pass": null
},
"switch:0": {
"id": 0,
"name": null,
"in_mode": "follow",
"initial_state": "match_input",
"auto_on": true,
"auto_on_delay": 60,
"auto_off": true,
"auto_off_delay": 60,
"power_limit": 3500,
"voltage_limit": 280,
"current_limit": 16
},
"switch:1": {
"id": 1,
"name": null,
"in_mode": "follow",
"initial_state": "match_input",
"auto_on": false,
"auto_on_delay": 60,
"auto_off": false,
"auto_off_delay": 60,
"power_limit": 3500,
"voltage_limit": 280,
"current_limit": 16
},
"switch:2": {
"id": 2,
"name": null,
"in_mode": "follow",
"initial_state": "match_input",
"auto_on": true,
"auto_on_delay": 345,
"auto_off": true,
"auto_off_delay": 2,
"power_limit": 3500,
"voltage_limit": 280,
"current_limit": 16
},
"switch:3": {
"id": 3,
"name": null,
"in_mode": "follow",
"initial_state": "match_input",
"auto_on": false,
"auto_on_delay": 60,
"auto_off": false,
"auto_off_delay": 60,
"power_limit": 3500,
"voltage_limit": 280,
"current_limit": 16
},
"sys": {
"device": {
"name": null,
"mac": "F008D1D8B8B8",
"fw_id": "20210720-153353/0.6.7-gc36674b"
},
"location": {
"tz": "Europe/Sofia",
"lat": 42.67236,
"lon": 23.38738
},
"ui_data": {},
"sntp": {
"server": "time.google.com"
}
},
"wifi": {
"ap": {
"ssid": "ShellyPro4PM-F008D1D8B8B8",
"is_open": true,
"enable": true
},
"sta": {
"ssid": null,
"is_open": true,
"enable": false,
"ipv4mode": "dhcp",
"ip": null,
"netmask": null,
"gw": null,
"nameserver": null
},
"sta1": {
"ssid": null,
"is_open": true,
"enable": false,
"ipv4mode": "dhcp",
"ip": null,
"netmask": null,
"gw": null,
"nameserver": null
},
"ws": {
"enable": false,
"server": null,
"ssl_ca": "ca.pem"
},
"roam": {
"rssi_thr": -80,
"interval": 60
}
}
}
Shelly.ListMethods example
Shelly.ListMethods HTTP GET Request
Shelly.ListMethods Curl Request
Shelly.ListMethods Mos Request
http://192.168.33.1/rpc/Shelly.ListMethods
Response
{
"methods": [
"Switch.SetConfig",
"Switch.GetConfig",
"Switch.GetStatus",
"Switch.Toggle",
"Switch.Set",
"Schedule.List",
"Schedule.DeleteAll",
"Schedule.Delete",
"Schedule.Update",
"Schedule.Create",
"Input.SetConfig",
"Input.GetConfig",
"Input.GetStatus",
"Webhook.ListSupported",
"Webhook.List",
"Webhook.DeleteAll",
"Webhook.Delete",
"Webhook.Update",
"Webhook.Create",
"Mqtt.SetConfig",
"Mqtt.GetConfig",
"Mqtt.GetStatus",
"Cloud.SetConfig",
"Cloud.GetConfig",
"Cloud.GetStatus",
"BLE.SetConfig",
"BLE.GetConfig",
"BLE.GetStatus",
"Eth.SetConfig",
"Eth.GetConfig",
"Eth.GetStatus",
"Wifi.Scan",
"Wifi.SetConfig",
"Wifi.GetConfig",
"Wifi.GetStatus",
"Sys.SetConfig",
"Sys.GetConfig",
"Sys.GetStatus",
"HTTP.GET",
"Shelly.ListMethods",
"Shelly.PutTLSClientKey",
"Shelly.PutTLSClientCert",
"Shelly.PutUserCA",
"Shelly.Reboot",
"Shelly.SetAuth",
"Shelly.Update",
"Shelly.CheckForUpdate",
"Shelly.DetectLocation",
"Shelly.ListTimezones",
"Shelly.GetStatus",
"Shelly.FactoryReset",
"Shelly.ResetWiFiConfig",
"Shelly.GetConfig",
"Shelly.GetDeviceInfo",
"Shelly.ListProfiles",
"Shelly.SetProfile"
]
}
Shelly.GetDeviceInfo example
Shelly.GetDeviceInfo HTTP GET Request
Shelly.GetDeviceInfo Curl Request
Shelly.GetDeviceInfo Mos Request
http://192.168.33.1/rpc/Shelly.GetDeviceInfo
Response
{
"id": "shellypro4pm-f008d1d8b8b8",
"mac": "F008D1D8B8B8",
"model": "SPSW-004PE16EU",
"gen": 2,
"fw_id": "20210720-153353/0.6.7-gc36674b",
"ver": "0.6.7",
"app": "FourPro",
"auth_en": true,
"auth_domain": "shellypro4pm-f008d1d8b8b8",
"discoverable": false
}
Shelly.ListProfiles example
Shelly.ListProfiles HTTP GET Request
Shelly.ListProfiles Curl Request
Shelly.ListProfiles Mos Request
http://192.168.33.1/rpc/Shelly.ListProfiles
Response
{
"profiles": {
"cover": {
"components": [
{
"type": "input",
"count": 2
},
{
"type": "cover",
"count": 1
}
]
},
"switch": {
"components": [
{
"type": "input",
"count": 2
},
{
"type": "switch",
"count": 2
}
]
}
}
}
Shelly.SetProfile example
Shelly.SetProfile HTTP GET Request
Shelly.SetProfile Curl Request
Shelly.SetProfile Mos Request
http://192.168.33.1/rpc/Shelly.SetProfile?name="cover"
Response
{
"profile_was": "switch"
}
Shelly.ListTimezones example
Shelly.ListTimezones HTTP GET Request
Shelly.ListTimezones Curl Request
Shelly.ListTimezones Mos Request
http://192.168.33.1/rpc/Shelly.ListTimezones
Response
{
"timezones": [
"Africa/Abidjan",
"Africa/Accra",
"Africa/Addis_Ababa",
"Africa/Algiers",
"Africa/Asmara",
"Africa/Asmera"
],
"offset": 0,
"total": 597
}
Shelly.DetectLocation example
Shelly.DetectLocation HTTP GET Request
Shelly.DetectLocation Curl Request
Shelly.DetectLocation Mos Request
http://192.168.33.1/rpc/Shelly.DetectLocation
Response
{
"tz": "Europe/Sofia",
"lat": 42.67236,
"lon": 23.38738
}
Shelly.CheckForUpdate example
Shelly.CheckForUpdate HTTP GET Request
Shelly.CheckForUpdate Curl Request
Shelly.CheckForUpdate Mos Request
http://192.168.33.1/rpc/Shelly.CheckForUpdate
Response
{
"beta": {
"version": "0.5.1",
"build_id": "20210610-122509/g4bbec18"
}
}
Shelly.Update example
Shelly.Update HTTP GET Request
Shelly.Update Curl Request
Shelly.Update Mos Request
http://192.168.33.1/rpc/Shelly.Update?stage="beta"
Response
null
Shelly.FactoryReset example
Shelly.FactoryReset HTTP GET Request
Shelly.FactoryReset Curl Request
Shelly.FactoryReset Mos Request
http://192.168.33.1/rpc/Shelly.FactoryReset
Response
null
Shelly.ResetWiFiConfig example
Shelly.ResetWiFiConfig HTTP GET Request
Shelly.ResetWiFiConfig Curl Request
Shelly.ResetWiFiConfig Mos Request
http://192.168.33.1/rpc/Shelly.ResetWiFiConfig
Response
null
Shelly.Reboot example
Shelly.Reboot HTTP GET Request
Shelly.Reboot Curl Request
Shelly.Reboot Mos Request
http://192.168.33.1/rpc/Shelly.Reboot
Response
null
Shelly.SetAuth example
Shelly.SetAuth HTTP GET Request
Shelly.SetAuth Curl Request
Shelly.SetAuth Mos Request
http://192.168.33.1/rpc/Shelly.SetAuth?user="admin"&realm="shellypro4pm-f008d1d8b8b8"&ha1="7f22c63135ab3c86d165d812fbab2ac30950ee53d86451e508c699e5de9c39ac"
Response
null
Shelly.PutTLSClientKey example
Shelly.PutTLSClientKey HTTP GET Request
Shelly.PutTLSClientKey Curl Request
Shelly.PutTLSClientKey Mos Request
http://192.168.33.1/rpc/Shelly.PutTLSClientKey?data="MIIB4TCCAYegAwIBAgIRKjikHJYKBN5CsiilC+g0mAIwCgYIKoZIzj0EAwIwUDEk"&append=true
Response
{
"len": 64
}
Shelly.PutTLSClientCert example
Shelly.PutTLSClientCert HTTP GET Request
Shelly.PutTLSClientCert Curl Request
Shelly.PutTLSClientCert Mos Request
http://192.168.33.1/rpc/Shelly.PutTLSClientCert?data="MIIB4TCCAYegAwIBAgIRKjikHJYKBN5CsiilC+g0mAIwCgYIKoZIzj0EAwIwUDEk"&append=true
Response
{
"len": 64
}
Shelly.PutUserCA example
Shelly.PutUserCA HTTP GET Request
Shelly.PutUserCA Curl Request
Shelly.PutUserCA Mos Request
http://192.168.33.1/rpc/Shelly.PutUserCA?data="MIIB4TCCAYegAwIBAgIRKjikHJYKBN5CsiilC+g0mAIwCgYIKoZIzj0EAwIwUDEk"&append=true
Response
{
"len": 64
}
Shelly.GetComponents example
Shelly.GetComponents HTTP GET Request
Shelly.GetComponents Curl Request
Shelly.GetComponents Mos Request
http://192.168.33.1/rpc/Shelly.GetComponents?include=["config"]&keys=["ble","bthomesensor:200"]
Response