Skip to main content
Version: 1.0

XMOD

XMOD service handles configuration for ShellyX and Powered by Shelly devices.

Methods

XMOD.ApplyProductJWS

Used to apply a product configuration JWS token obtained from the developer portal.

Request

Properties:

PropertyTypeDescription

jws

string

Product configuration JWS

Response

On success, an empty (null) response is returned. The module performs a factory reset and reboots into its “new product” mode.

On error, the token is not applied. Possible error codes are:

  • -107 Permission denied: if the module already has a JWS with the final flag set.

  • -103 Invalid argument: if jws is missing, malformed or otherwise invalid.

XMOD.GetProductJWS

Returns the currently-applied product configuration JWS.

Request

This method takes no parameters.

Response

Attributes in the result:

PropertyTypeDescription

jws

string

The applied token.

On error, the request has failed if the device has never been provisioned. Possible error codes:

  • -114 Unavailable – no JWS has been applied to the device.

XMOD.GetInfo

Returns the parsed jws token as json. Notable properties are:

Request

This method takes no parameters.

Response

Attributes in the result:

PropertyTypeDescription

aud

string

The application for which the token is intended.

iat

number

The time when the token was issued.

jti

string

A unique identifier assigned to the token.

v

string

Version

p

string

Product prefix, used as part of AP SSID, hostname, MQTT Client Id and other system identifiers

n

string

Product Name

m

string

Manufacturer Name

url

string

Product URL

f

bitfield

FlagDescription
0x01Final. If set, no new JWS can be applied.

xmod

object

XMOD-specific settings

PropertyTypeDescription

ni

number

Number of Inputs

no

number

Number of Outputs (Switches)

led

number

Type of system led. 1: Plain, active-low; 2: WS2812 or compatible RGB

Examples

XMOD.ApplyProductJWS example

http://192.168.33.1/rpc/XMOD.ApplyProductJWS?jws="ewogICAgImFsZyI6IkVTMzg0IiwKICAgICJ0eXAiOiJKV1QiCn0.ewogICAgImF1ZCI6IlhUMSIsCiAgICAiYyI6ewogICAgICAgICJhZGRvbiI6ewogICAgICAgICAgICAic2Vuc29yIjp7CiAgICAgICAgICAgICAgICAicGlucyI6ewogICAgICAgICAgICAgICAgICAgICJvbmVfd2lyZV9pbiI6MAogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9LAogICAgICAgICAgICAic3VwcG9ydGVkIjoiMCIsCiAgICAgICAgICAgICJ0eXBlIjowCiAgICAgICAgfSwKICAgICAgICAidHV5YW1jdSI6ewogICAgICAgICAgICAiZW5hYmxlIjp0cnVlCiAgICAgICAgfQogICAgfSwKICAgICJmIjowLAogICAgImlhdCI6MTcyNzk1NDAxMSwKICAgICJqdGkiOiIwMDAwQzEwMDAwMDMiLAogICAgIm4iOiJXYXRlciBWYWx2ZSIsCiAgICAicCI6IldhdGVyVmFsdmUiLAogICAgInVybCI6IiIsCiAgICAidiI6MSwKICAgICJ4dDEiOnsKICAgICAgICAic3ZjMCI6ewogICAgICAgICAgICAidHlwZSI6InNpbXBsZS13YXRlci12YWx2ZS1jb250cm9sbGVyIgogICAgICAgIH0KICAgIH0KfQ.g5CmtlZ6DU0FDuMsa9gXYU7YNJ-2Xk66Nr9g8UcBpng4sm7xBbTaLbhVlu10iQnGfyccuCuBMz0QKawVPYwQr6Dlj7d1b5qo1Y0SiTyVZOAukVhcRksCuRimO55sDp1K"

Response

null

XMOD.GetProductJWS example

http://192.168.33.1/rpc/XMOD.GetProductJWS

Response

{
"jwt": "ewogICAgImFsZyI6IkVTMzg0IiwKICAgICJ0eXAiOiJKV1QiCn0.ewogICAgImF1ZCI6IlhUMSIsCiAgICAiYyI6ewogICAgICAgICJhZGRvbiI6ewogICAgICAgICAgICAic2Vuc29yIjp7CiAgICAgICAgICAgICAgICAicGlucyI6ewogICAgICAgICAgICAgICAgICAgICJvbmVfd2lyZV9pbiI6MAogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9LAogICAgICAgICAgICAic3VwcG9ydGVkIjoiMCIsCiAgICAgICAgICAgICJ0eXBlIjowCiAgICAgICAgfSwKICAgICAgICAidHV5YW1jdSI6ewogICAgICAgICAgICAiZW5hYmxlIjp0cnVlCiAgICAgICAgfQogICAgfSwKICAgICJmIjowLAogICAgImlhdCI6MTcyNzk1NDAxMSwKICAgICJqdGkiOiIwMDAwQzEwMDAwMDMiLAogICAgIm4iOiJXYXRlciBWYWx2ZSIsCiAgICAicCI6IldhdGVyVmFsdmUiLAogICAgInVybCI6IiIsCiAgICAidiI6MSwKICAgICJ4dDEiOnsKICAgICAgICAic3ZjMCI6ewogICAgICAgICAgICAidHlwZSI6InNpbXBsZS13YXRlci12YWx2ZS1jb250cm9sbGVyIgogICAgICAgIH0KICAgIH0KfQ.g5CmtlZ6DU0FDuMsa9gXYU7YNJ-2Xk66Nr9g8UcBpng4sm7xBbTaLbhVlu10iQnGfyccuCuBMz0QKawVPYwQr6Dlj7d1b5qo1Y0SiTyVZOAukVhcRksCuRimO55sDp1K"
}

XMOD.GetInfo example

http://192.168.33.1/rpc/XMOD.GetInfo

Response

{
"jwt": {
"aud": "XT1",
"iat": 1000000000,
"jti": "000000000000",
"v": 1,
"p": "WaterValve",
"n": "Water Valve",
"m": "",
"url": "",
"f": 0,
"xt1": {
"svc0": {
"type": "water-valve"
}
}
}
}