Skip to content

Instantly share code, notes, and snippets.

@TheGroundZero
Last active October 31, 2023 20:00
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TheGroundZero/9eeaee14f1b5323778454244bcacc056 to your computer and use it in GitHub Desktop.
Save TheGroundZero/9eeaee14f1b5323778454244bcacc056 to your computer and use it in GitHub Desktop.
SSD1306 OLED Display and ESP32 dev kit v1
# ESP32 board:
# - https://www.aliexpress.com/item/1005001267643044.html
# SSD1306 OLED Display:
# - https://s.click.aliexpress.com/e/_AVnlEn
# ESPHome docs:
# - https://esphome.io/components/display/ssd1306.html
# - https://esphome.io/components/i2c.html#i2c
# - https://esphome.io/components/display/index.html#formatted-text
# Wiring diagram
# | SSD1306 | ESP32 | Description |
# | :-----: | :---: | :---------- |
# | GND | GND | Ground |
# | VCC | 3V3 | 3V power |
# | SCL | D22 | I²C data |
# | SDA | D21 | I²C clock |
substitutions:
esphome_name: esp32_ssd1306
esphome:
name: "${esphome_name}"
platform: ESP32
board: esp32doit-devkit-v1
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_pass
domain: .iot.local
esp32_ble_tracker:
# Enable logging
logger:
# Enable Home Assistant API
api:
reboot_timeout: 60min
password: !secret esphome_api_pass
ota:
password: !secret esphome_ota_pass
web_server:
port: 80
time:
- platform: homeassistant
# TrueType Font file stored in /config/esphome/fonts/
# https://all-free-download.com/font/monospace.html
font:
- file: "_fonts/monof55.ttf"
id: monofur
size: 14
i2c:
sda: 21
scl: 22
scan: True
display:
- platform: ssd1306_i2c
model: "SSD1306 128x32"
address: 0x3C
external_vcc: False
lambda: |-
it.printf(0, 0, id(tiquet), "State: %s", id(onboard_led).state ? "ON" : "OFF");
sensor:
# General
- platform: uptime
name: "${esphome_name} - Uptime Sensor"
- platform: wifi_signal
name: "${esphome_name} - WiFi Signal"
update_interval: 60s
switch:
- platform: gpio
name: "${esphome_name} - Onboard LED"
pin: 2
id: onboard_led
- platform: restart
name: "${esphome_name} - Restart"
id: restart_switch
# Text sensors with general information.
text_sensor:
# Expose ESPHome version as sensor.
- platform: version
name: "${esphome_name} ESPHome Version"
# Expose WiFi information as sensors.
- platform: wifi_info
ip_address:
name: "${esphome_name} IP"
ssid:
name: "${esphome_name} SSID"
bssid:
name: "${esphome_name} BSSID"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment