Skip to content

Shelly 1 Gen3

State: confirmed Generation: 3 Chip: ESP32-C3

Gen3 / ESP32-C3.

Fact Value
Profile S1G3
Flash 8 MB
Official package 2.0.1
Partition table 0xf000
App slot size 0x2b0000

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
  • a UART adapter is at hand as your way back (Recovery over UART)

ESPHome config

Important

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

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

ota:
  - platform: esphome
    allow_partition_access: true

Flash it

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

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

In the --watch log look for these lines, in this order:

# Log line Meaning
1 Update target slot: 0 ... The slot check of send. Anything else: run python ota.py restore S1G3 first
2 Boot: cur ... min ... update? 1 The installer will write ESPHome's bootloader. update? 0 means it will not: build again with a higher --boot-min-version (why)
3 ota_progress up to 95 %, then ota_success The device restarts into ESPHome

Notes for this device

  • Result: first report (#98, thanks to chusovich), two devices, from stock 1.4.0 with the package built from this profile (revision 2, package 2.0.3, --esphome-factory). send read the update target slot 0 (the device itself reported slot 1), the device reached the PC at -41 dBm, the flash ran to 94 % and the device then restarted into ESPHome. A later ESPHome OTA took effect, so ESPHome's bootloader is in place.
  • Loader 1.0.1 on stock 1.4.0: Boot: cur 010001ff, new 00000000, min 010009ff, update? 1, so boot_min_version: 1.0.9 made the installer write ESPHome's bootloader. The log then shows Will write to slot 0, New app_0: 2818048@0x20000 (0x2b0000, as in the table) and the usual efuse ... Write operation is forbidden lines, which did no harm. The tool's last note ("did not confirm within 30 s") is the device restarting.
  • Config used: the partition table S1G3-stock.csv from this repository, copied next to the YAML of the reporter's own ESPHome repository. The command line esphome complained about missing sections, so the base config of this page was used to satisfy it.
  • Not reported: relay, switch input and button under real use; the pins are those of the profile.

The profile sets boot_min_version: "1.0.9": devices of this family run Shelly's loader 1.0.3, which would otherwise skip ESPHome's bootloader (update? 0).

Way back

python ota.py restore S1G3 sends the official firmware back while Shelly firmware still runs.


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).
  • No way back over the network once ESPHome's bootloader runs: restore gets no answer, only UART brings Shelly OS back (Recovery over UART). Take a flash backup first if you can.
  • Flashed it? Tell us, also when it worked: open a device report.