Sonoff mini switch example yaml for esphome

I have a sonoff mini which I am testing with ESP home. I was able to successfully flash the firmware using the below yaml file and now I was able to add the device to Home Assistant. This shows one “firmware” entity.

esphome:
  name: sonoff-mini-1
  friendly_name: Sonoff Mini 1

esp8266:
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "Generated key"

ota:
  password: "ae82e5e890ed4k3lj55fcd6c9e7796d1"

wifi:
  ssid: myssid
  password: my-wifi-key

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Sonoff-Mini-1 Fallback Hotspot"
    password: "LqtR4cHQvOWN"

captive_portal:
    

I would like to now update the yaml and firmware so the switch can actually do something, but not able to figure out what exactly needs to be done. I was able to find the Sonoff S20 yaml at Using With Sonoff S20 — ESPHome. But a bit clueless on how to adapt this for Sonoff mini. Can someone please provide an example yaml for sonoff mini?

Have you read the docs?

As always start by reading the docs, then back it with other guides.

Hi, yes I have been reading some docs, but wasn’t able to get very far. After a lot of trail and error, got the below working. This gives me the switch toggle functionality. But I understand I could get the wifi strength etc, but haven’t figured that out yet.

esphome:
  name: sonoff-mini-1
  friendly_name: Sonoff Mini 1

esp8266:
  board: esp01_1m

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Sonoff-Mini-1 Fallback Hotspot"
    password: "LqtR4cHQvOWN"

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "Generated key"

ota:
  password: "ae82e5e890ed4k3lj55fcd6c9e7796d1"

captive_portal:

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO0
      mode:
        input: true
        pullup: true
      inverted: true
    name: "Sonoff Mini Button"
    on_press:
      - switch.toggle: relay

switch:
  - platform: gpio
    name: "Sonoff Mini"
    pin: GPIO12
    id: relay

status_led:
  pin:
    number: GPIO13
    inverted: yes
   













Actually, the link your provided is helpful. I haven’t come across this when I was looking this morning. I was going through Generic Sonoff — ESPHome.

You can add lots of generic stuff to your yaml for things like RSSI, restart etc just google “esphome” followed by what ever it is you want to add e.g wifi signal

1 Like

Thanks very much for your inputs. I now have all the required entries.

I am using this device to get used to ESPHome as I just ordered some ESP32 boards and LD2410C mmwave sensors and would need to set them up in ESP Home when they arrive :slight_smile: .