Skip to main content

Outbound Websocket

The Outbound Webscoket component makes it possible to configure a Gen2 Shelly device to establish and maintain an outbound websocket connection. An RPC channel is available over said connection, supporting all features of inbound WS and MQTT channels, along with unsolicited complete status notifications on connect. The Outbound Websocket component uses ws as RPC namespace and provides the methods:

It uses the key ws when enumerated in objects including multiple component payloads, like Shelly.GetStatus.

Methods

Ws.SetConfig

PropertyTypeDescription

config

object

Configuration that the method takes

Find more about the config properties in config section

Ws.GetConfig

Find the Ws.GetConfig response properties in config section

Ws.GetStatus

Find the Ws.GetStatus response properties in status section

Configuration

PropertyTypeDescription

enable

boolean

true if websocket outbound connection is enabled, false otherwise

server

string

Name of the server to which the device is connected. When prefixed with wss:// a TLS socket will be used

ssl_ca

string

Type of the TCP sockets

ValueDescription

*

TLS with disabled certificate validation

user_ca.pem

TLS connection verified by the user-provided CA

ca.pem

TLS connection verified by the built-in CA bundle

Status

PropertyTypeDescription

connected

boolean

true if device is connected to a websocket outbound connection or false otherwise.

Examples

Ws.SetConfig example

http://192.168.33.1/rpc/Ws.SetConfig?config={"ssl_ca":"*"}

Response

{
"restart_required": true
}

Ws.GetConfig example

http://192.168.33.1/rpc/Ws.GetConfig

Response

{
"enable": false,
"server": null,
"ssl_ca": "*"
}

Ws.GetStatus example

http://192.168.33.1/rpc/Ws.GetStatus

Response

{
"connected": false
}