Skip to content

Instantly share code, notes, and snippets.

@nrturner
Last active November 20, 2025 11:11
Show Gist options
  • Select an option

  • Save nrturner/1bea5c534dfa3b4c474871086859523e to your computer and use it in GitHub Desktop.

Select an option

Save nrturner/1bea5c534dfa3b4c474871086859523e to your computer and use it in GitHub Desktop.
esphome:
name: $name
friendly_name: $friendly_name
esp8266:
board: esp01_1m
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: $key
ota:
- platform: esphome
password: $password
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
min_auth_mode: wpa2
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "esphome-smartplug"
password: $fallbackpassword
captive_portal:
web_server:
port: 80
binary_sensor:
- platform: gpio
pin:
number: GPIO13
mode: INPUT_PULLUP
inverted: True
use_interrupt: True
name: "Power Button"
id: "smartplug_button"
on_press:
- switch.toggle: "smartplug_relay"
disabled_by_default: True
switch:
- platform: gpio
name: "Switch"
id: "smartplug_relay"
pin: GPIO5
on_turn_on:
- output.turn_on: led
on_turn_off:
- output.turn_off: led
restore_mode: RESTORE_DEFAULT_ON
output:
- platform: gpio
pin: GPIO4
inverted: true
id: led
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment