Skip to content

Factory reset

Two Home Assistant buttons, plus a long-press on the board's BOOT button.

button:
  - platform: factory_reset
    id: factory_reset_btn
    name: Factory Reset

  - platform: restart
    name: Restart

binary_sensor:
  - platform: gpio
    id: boot_btn
    internal: true
    pin:
      number: GPIO9
      mode: INPUT_PULLUP
      inverted: true
      ignore_strapping_warning: true
    on_click:
      - min_length: 5s
        max_length: 30s
        then:
          - button.press: factory_reset_btn

What reset does

flowchart TD
  B[Hold BOOT 5–30 s] --> R[Factory Reset]
  H[Factory Reset in Home Assistant] --> R
  R --> E[Prefs erased]
  E --> S[Restarts on QR setup page]
Button Effect
Factory Reset Clears saved home Wi‑Fi, the API encryption key, Mode, schedule window, and night lux thresholds, then restarts
Restart Reboots without wiping settings

The firmware binary stays. After reset you're back on the setup hotspot from ap_ssid / ap_password, Mode returns to Off, and the screen shows the SoftAP QR again. A plain RST or power-cycle does not wipe prefs and should not show the QR once Wi‑Fi is saved. How to test it is in Configure and test.

BOOT hold times

On the ESP32-C3, GPIO9 is the board BOOT button. Don't wire anything else to it (ESP32 wiring).

Hold Result
Under 5 s Nothing (avoids accidental wipes)
5–30 s Presses Factory Reset when you let go
Over 30 s Nothing
Key Why
inverted: true Button pulls the pin low when pressed
internal: true Hidden from Home Assistant — it only triggers reset
ignore_strapping_warning: true GPIO9 is also a boot strapping pin; this silences ESPHome's warning

Check your edits

After you change the YAML, validate it without building:

.venv/bin/esphome config firmware/lux.yaml

A good run ends with INFO Configuration is valid!. Needs ESPHome installed. Errors name the block and line (for example an ap_password shorter than 8 characters).

Next: Build the image