Skip to main content
Version: 1.0

Pill

The Pill component uses Pill as RPC namespace and implements the following methods:

Methods​

Pill.SetConfig​

Parameters:

PropertyTypeDescription

config

object

Configuration that the method takes

Find more about the config properties in config section

Pill.GetConfig​

Find the Pill.GetConfig response properties in config section

Pill.GetStatus​

Find more about the status response properties in status section

Configuration​

The configuration of the Pill component changes peripheral modes.

Parameters:

PropertyTypeDescription

mode

string

Device mode. Range of values onewire, dht22, analog_in, ssr, digital_io, js_uart, mb_client

pin0_mode

string

Pin 0 mode. Range of values none, reserved, digital_in, digital_out

pin1_mode

string

Pin 1 mode. Range of values none, reserved, digital_in, digital_out

pin2_mode

string

Pin 2 mode. Range of values none, reserved, digital_in, digital_out

mode property selects one of the following peripheral modes:

modedescription
onewireTemperature sensor: OneWire (DS18B20)
dht22Temperature & Humidity: DHT22
analog_inAnalog sensor (Range: 0-2.5V without additional addons)
ssrSolid State Relay Addon (2x channels; IO3 is available)
digital_ioDigital IO: Inputs/Outputs are configurable via the pinX_mode
js_uartRaw UART for scripts. Creates a Serial component instance in jsuart mode.
mb_clientModbus RTU client. Creates a Serial component instance in mb_client mode plus an MbRtuClient component.
note

The js_uart and mb_client modes are available for firmware version 2.0.1 and above.

pinX_mode (pin0_mode, pin1_mode, pin2_mode respectively for each pin) selects individual I/O pin mode.

pinX_modedescription
noneI/O not used (default)
digital_inDigital input (NOTE: Active LOW state)
digital_outDigital output
reservedReserved for Device Peripheral function
note

Modes affect the current set of device components. Switching a mode may cause new components to emerge, and/or components that were created under the previous mode to disappear.

note

Some device modes use specific pins for their functionality. When such a mode is enabled, the corresponding pin mode appears as reserved and any changes to it will have no effect until the device switches to a mode that does not use the pin.

Obtaining Supported Pill Modes​

The supported modes for the running firmware can be obtained using the shelly.getcomponents RPC method with the pill key:

GET /rpc/shelly.getcomponents?keys=["pill"]

The response will include the modes attribute containing the list of supported modes for the current device and firmware version.

Status​

The status of the Pill component is empty.

Pill.SetConfig example​

http://192.168.33.1/rpc/Pill.SetConfig?config={"mode":"onewire","pin0_mode":"none"}

Response

{
"restart_required": false
}

Pill.GetConfig example​

http://192.168.33.1/rpc/Pill.GetConfig?

Response

{
"mode": "digital_io",
"pin0_mode": "digital_in",
"pin1_mode": "digital_out",
"pin2_mode": "none"
}

Pill.GetStatus example​

http://192.168.33.1/rpc/Pill.GetStatus?

Response

{}