Pill
The Pill component uses Pill as RPC namespace and implements the following methods:
Pill.GetConfigto obtain the component's configurationPill.SetConfigto update the component's configurationPill.GetStatusto obtain the component's status
Methods
Pill.SetConfig
Parameters:
| Property | Type | Description |
|---|---|---|
| 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:
| Property | Type | Description |
|---|---|---|
| string | Device mode. Range of values |
| string | Pin 0 mode. Range of values |
| string | Pin 1 mode. Range of values |
| string | Pin 2 mode. Range of values |
mode property selects one of the following peripheral modes:
| mode | description |
|---|---|
onewire | Temperature sensor: OneWire (DS18B20) |
dht22 | Temperature & Humidity: DHT22 |
analog_in | Analog sensor (Range: 0-2.5V without additional addons) |
ssr | Solid State Relay Addon (2x channels; IO3 is available) |
digital_io | Digital IO: Inputs/Outputs are configurable via the pinX_mode |
serial | Serial port. Creates a Serial component instance for UART, Modbus RTU Client or Server. |
pinX_mode (pin0_mode, pin1_mode, pin2_mode respectively for each pin) selects individual I/O pin mode.
| pinX_mode | description |
|---|---|
none | I/O not used (default) |
digital_in | Digital input (NOTE: Active LOW state) |
digital_out | Digital output |
reserved | Reserved for Device Peripheral function |
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.
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.
Status
The status of the Pill component is empty.
Pill.SetConfig example
- Pill.SetConfig HTTP GET Request
- Pill.SetConfig Curl Request
- Pill.SetConfig Mos Request
http://192.168.33.1/rpc/Pill.SetConfig?config={"mode":"onewire","pin0_mode":"none"}
curl -X POST -d '{"id":1,"method":"Pill.SetConfig","params":{"config":{"mode":"onewire","pin0_mode":"none"}}}' http://${SHELLY}/rpc
mos --port ${PORT} call Pill.SetConfig '{"config":{"mode":"onewire","pin0_mode":"none"}}'
Response
- Pill.SetConfig HTTP GET Response
- Pill.SetConfig Curl Response
- Pill.SetConfig Mos Response
{
"restart_required": false
}
{
"id": 1,
"params": {
"restart_required": false
}
}
{
"restart_required": false
}
Pill.GetConfig example
- Pill.GetConfig HTTP GET Request
- Pill.GetConfig Curl Request
- Pill.GetConfig Mos Request
http://192.168.33.1/rpc/Pill.GetConfig?
curl -X POST -d '{"id":1,"method":"Pill.GetConfig","params":{}}' http://${SHELLY}/rpc
mos --port ${PORT} call Pill.GetConfig '{}'
Response
- Pill.GetConfig HTTP GET Response
- Pill.GetConfig Curl Response
- Pill.GetConfig Mos Response
{
"mode": "digital_io",
"pin0_mode": "digital_in",
"pin1_mode": "digital_out",
"pin2_mode": "none"
}
{
"id": 1,
"params": {
"mode": "digital_io",
"pin0_mode": "digital_in",
"pin1_mode": "digital_out",
"pin2_mode": "none"
}
}
{
"mode": "digital_io",
"pin0_mode": "digital_in",
"pin1_mode": "digital_out",
"pin2_mode": "none"
}
Pill.GetStatus example
- Pill.GetStatus HTTP GET Request
- Pill.GetStatus Curl Request
- Pill.GetStatus Mos Request
http://192.168.33.1/rpc/Pill.GetStatus?
curl -X POST -d '{"id":1,"method":"Pill.GetStatus","params":{}}' http://${SHELLY}/rpc
mos --port ${PORT} call Pill.GetStatus '{}'
Response
- Pill.GetStatus HTTP GET Response
- Pill.GetStatus Curl Response
- Pill.GetStatus Mos Response
{}
{
"id": 1,
"params": {}
}
{}