Skip to content

Shelly The Pill

State: untested Generation: 3 Chip: ESP32-C3

Reported: the USB-C port exposes the chip's USB Serial/JTAG, so this device can be flashed and recovered with esptool without opening it. That makes UART recovery much easier than on the other models.

Fact Value
Profile Pill
Flash 8 MB
Official package 2.0.1
Partition table 0x10000
App slot size 0x280000
Bootloader min_version 1.0.9 (set in the profile)
ESPHome device page Shelly The Pill

Before you start

Check first:

  • the device runs Shelly's own firmware, not ESPHome yet
  • you know its IP address (--ip), or this PC is on the device's own access point (default 192.168.33.1)
  • the device can reach this PC: same network, port 8000 (--port) not blocked
  • your ESPHome config uses the partition table below and is compiled

Also:

ESPHome config

Important

build refuses a config without Shelly's partition table. Copy partitions/Pill-stock.csv from this repository next to your YAML and keep CONFIG_PARTITION_TABLE_OFFSET: "0x10000".

esp32:
  variant: ESP32C3
  board: esp32-c3-devkitm-1
  flash_size: 8MB
  partitions: Pill-stock.csv        # copy from partitions/ in this repository
  framework:
    type: esp-idf
    sdkconfig_options:
      CONFIG_PARTITION_TABLE_OFFSET: "0x10000"
    advanced:
      enable_ota_rollback: false

ota:
  - platform: esphome
    allow_partition_access: true

Tip

The ESPHome device page has the pins and an example config. Replace its esp32: block with the one above, or build refuses it.

Pins

The pins (the three I/O pins of the sensor port, the reset button, the status LED) are on the ESPHome device page. USB-C is the flashing path, so no soldering is needed. The sensor port takes Shelly's add-ons (5-terminal, SSR, analog 0 to 30 V, DS18B20).

Flash it

  1. Install the requirements (once):
pip install -r requirements.txt
  1. Fetch the official package:
python ota.py fetch Pill --insecure
  1. Build: put your app into it; the ZIP goes to out/:
python ota.py build Pill app.ota.bin --esphome-factory app.factory.bin --esphome-yaml app.yaml
  1. Check the device first. Nothing is sent:
python ota.py send Pill out/Pill-app-<date>.zip --ip <device IP> --dry-run
  1. Flash it (the log goes to a file with --log-file):
python ota.py send Pill out/Pill-app-<date>.zip --ip <device IP> --log-file

app.ota.bin and app.factory.bin are the two files ESPHome compiles. --dry-run only checks the device and, for this package, reads the update target slot. Command reference: Commands.

What to expect

send shows these lines at the default log level, in this order:

# Log line Meaning
1 Update target slot: 0 ... The slot check of send. Anything else: run python ota.py restore Pill first
2 Device: The bootloader will be replaced ... (raw log: Boot: cur ... min ... update? 1) The installer will write ESPHome's bootloader. WARNING: ESPHome's bootloader was NOT written (update? 0) means it will not: build again with a higher --boot-min-version (why)
3 The progress (Update: ... %, one line that updates in place) up to 100 %, then Done: update installed, the device confirmed it The device restarts into ESPHome

Notes for this device

No device-specific findings yet. Please report the file written by --log-file, especially the lines Update target slot, Boot: cur ... update? and Will write to slot.

Way back

USB-C and esptool (Recovery over UART: the same steps, with the USB-C port instead of a UART adapter, if the report holds). While Shelly firmware runs: python ota.py restore Pill.


Warning

  • Wipes Wi-Fi and settings. ESPHome opens its own access point or joins the Wi-Fi from your config; if nothing comes up, power-cycle the device (help).
  • Flashed it? Tell us, also when it worked: open a device report.