Skip to main content

Communication

Established WS connection - basic package types & structure.

Incoming

Device state change.

{
event: "Shelly:StatusOnChange", // EVENT_NAME
deviceId: number, // DEVICE_ID
status: object // DEVICE_SPECIFIC_STATUS_STRUCTURE
}

Commands

Issue a basic on/off command.

Request
{
event: "Shelly:CommandRequest", // EVENT_NAME
trid: number // TRANSACTION_ID
deviceId: number, // DEVICE_ID
data: {
cmd: string, // COMMAND_NAME "relay" | "light"
params: {
id: number, // DEVICE_CHANNEL
turn: string // COMMAND_ACTION "on" | "off"
}
}
}
Response
{
event: "Shelly:CommandResponse", // EVENT_NAME
trid: number, // TRANSACTION_ID
deviceId: number, // DEVICE_ID
user: number, // USER_ID device owner
data: {
isok: boolean; // SUCCESS_FLAG
res?: string; // MESSAGE optional
}
}

Actions

Device Verify. Verify that the device has a valid integration.

Request
{
event: "Integrator:ActionRequest", // EVENT_NAME
trid: number, // TRANSACTION_ID,
data: {
action: "DeviceVerify", // ACTION_NAME "DeviceVerify"
deviceId: number, // DEVICE_ID,
}
}
Response
{
event: "Integrator:ActionResponse", // EVENT_NAME
trid: number, // TRANSACTION_ID,
user: string, // INTEGRATOR_TAG
data: {
result: string, // STATUS "OK" | "UNAUTHORIZED" | "WRONG_API_PARAMETERS"
deviceId: number, // DEVICE_ID
deviceType?: string, // DEVICE_TYPE optional (if device is online)
deviceCode?: string, // DEVICE_CODE optional (if device is online)
deviceStatus?: {} // DEVICE_STATUS optional (if device is online)
}
}

Value of result attribute means:

  • OK - This deviceId has integration enabled.
  • UNAUTHORIZED - This device in not authorized.
  • WRONG_API_PARAMETERS - Malformed request.