Skip to content

Instantly share code, notes, and snippets.

@mbernson
Forked from Nizzle/shabadge.yaml
Last active December 12, 2024 09:24
Show Gist options
  • Save mbernson/29514bf4a5e8067aa362c22f2dd5d0be to your computer and use it in GitHub Desktop.
Save mbernson/29514bf4a5e8067aa362c22f2dd5d0be to your computer and use it in GitHub Desktop.
ESPhome config for SHA2017 badge (https://wiki.sha2017.org/w/Projects:Badge)
esphome:
name: sha2017-badge
friendly_name: SHA2017 Badge
esp32:
board: esp32-pro
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "xxxxxxxx"
ota:
- platform: esphome
password: "xxxxxxxx"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Sha2017 Badge Fallback Hotspot"
password: "hunter2!"
captive_portal:
i2c:
sda: 26
scl: 27
scan: True
mpr121:
id: mpr121_component
address: 0x5A
touch_debounce: 1
release_debounce: 1
touch_threshold: 12
release_threshold: 6
binary_sensor:
- platform: mpr121
id: touch_buttonA
channel: 0
name: "Touch Button A"
- platform: mpr121
id: touch_buttonB
channel: 1
name: "Touch Button B"
- platform: mpr121
id: touch_buttonStart
channel: 2
name: "Touch Button Start"
- platform: mpr121
id: touch_buttonSelect
channel: 3
name: "Touch Button Select"
- platform: mpr121
id: touch_buttonDown
channel: 4
name: "Touch Button Down"
- platform: mpr121
id: touch_buttonRight
channel: 5
name: "Touch Button Right"
- platform: mpr121
id: touch_buttonUp
channel: 6
name: "Touch Button Up"
- platform: mpr121
id: touch_buttonLeft
channel: 7
name: "Touch Button Left"
# - platform: mpr121
# id: charging_status
# channel: 9
# name: "Charging Status"
- platform: gpio
name: "Flash Button"
pin: 0
filters:
- invert:
sensor:
- platform: adc
pin: 34
attenuation: 6db
filters:
- multiply: 2.91
name: "USB Voltage"
update_interval: 20s
accuracy_decimals: 1
- platform: adc
pin: 35
attenuation: 6db
#attenuation: 2.5db
filters:
- multiply: 2.91
#- multiply: 1.95
name: "Battery Voltage"
update_interval: 20s
accuracy_decimals: 1
spi:
clk_pin: 18
mosi_pin: 5
text_sensor:
- platform: version
id: ver
hide_timestamp: true
display:
- platform: waveshare_epaper
cs_pin: 19
dc_pin: 21
busy_pin: 22
reset_pin: 23
model: 2.90in-dke
full_update_every: 30
update_interval: 60s
lambda: |-
it.printf(0, 0, id(defaultfont), "Version: %s", id(ver).state.c_str());
rotation: 270
font:
- file: "gfonts://Roboto"
id: defaultfont
size: 24
output:
- id: led_and_ext_power
platform: gpio
pin:
mpr121: mpr121_component
number: 10
mode: OUTPUT
inverted: true
- id: buzzer_power
platform: gpio
pin:
mpr121: mpr121_component
number: 8
mode: OUTPUT
button:
- platform: output
name: "Buzzer"
output: buzzer_power
duration: 4000ms
icon: mdi:vibrate
light:
- platform: neopixelbus
type: GRBW
variant: sk6812
pin: 32
num_leds: 6
name: "Badge LEDs"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment