Skip to content

Instantly share code, notes, and snippets.

@klaasnicolaas
Created January 18, 2024 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save klaasnicolaas/eb163a5cba5bc9d886870525ec7ea1ea to your computer and use it in GitHub Desktop.
Save klaasnicolaas/eb163a5cba5bc9d886870525ec7ea1ea to your computer and use it in GitHub Desktop.
A basic YAML config for the Shelly 1, equipped with everything necessary to use it.
---
# Shelly 1 - ESPHome yaml config
substitutions:
device_name: shelly-1
friendly_name: Shelly 1
project_version: "1.0.0"
# Define GPIO pins
relay_pin: GPIO4
switch_pin: GPIO5
esphome:
name: '${device_name}'
name_add_mac_suffix: true
project:
name: "klaasnicolaas.shelly-1"
version: "${project_version}"
esp8266:
board: esp01_1m
wifi:
ap:
ssid: '${friendly_name}'
logger:
api:
# Allow OTA updates
ota:
safe_mode: true
reboot_timeout: 10min
num_attempts: 5
# Allow provisioning Wi-Fi via serial
improv_serial:
# In combination with the `ap` this allows the user
# to provision wifi credentials to the device via WiFi AP.
captive_portal:
# To have a "next url" for improv serial
web_server:
# Output
output:
- platform: gpio
pin: ${relay_pin}
id: shelly_1_relay
# Button
button:
# Restart the ESP
- platform: restart
name: '${friendly_name} - Restart'
# Text sensor
text_sensor:
# ESPHome version
- platform: version
hide_timestamp: true
name: '${friendly_name} - ESPHome Version'
# IP address and connected SSID
- platform: wifi_info
ip_address:
name: '${friendly_name} - IP Address'
icon: mdi:wifi
ssid:
name: '${friendly_name} - Connected SSID'
icon: mdi:wifi-strength-2
# Light
light:
- platform: binary
name: '${friendly_name} - Light'
output: shelly_1_relay
id: light_id
# Binary sensor
binary_sensor:
- platform: gpio
pin:
number: ${switch_pin}
#mode: INPUT_PULLUP
#inverted: True
name: '${friendly_name} - Switch'
on_state:
then:
- light.toggle: light_id
internal: true
id: switch_id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment