96 lines
1.5 KiB
YAML
96 lines
1.5 KiB
YAML
esphome:
|
|
name: smartcube
|
|
|
|
esp8266:
|
|
board: d1_mini
|
|
framework:
|
|
version: recommended
|
|
|
|
# WiFi
|
|
wifi:
|
|
ssid: "YOUR_WIFI_SSID"
|
|
password: "YOUR_WIFI_PASSWORD"
|
|
|
|
ap:
|
|
ssid: "SmartCube"
|
|
password: "12345678"
|
|
|
|
captive_portal:
|
|
|
|
logger:
|
|
|
|
api:
|
|
|
|
ota:
|
|
- platform: esphome
|
|
- platform: web_server
|
|
|
|
# I2C for OLED
|
|
i2c:
|
|
sda: GPIO4 # D2
|
|
scl: GPIO5 # D1
|
|
scan: true
|
|
|
|
# Font (must be BDF)
|
|
font:
|
|
- id: my_font
|
|
file: "Roboto-Regular-8pt.bdf"
|
|
size: 8
|
|
|
|
# SSD1306 OLED
|
|
display:
|
|
- platform: ssd1306_i2c
|
|
model: "SSD1306 128x64"
|
|
address: 0x3C
|
|
rotation: 180
|
|
lambda: |-
|
|
it.print(0, 0, id(my_font), "Hello SmartCube!");
|
|
|
|
# Buttons
|
|
binary_sensor:
|
|
- platform: gpio
|
|
pin:
|
|
number: GPIO12 # D6
|
|
mode: INPUT_PULLUP
|
|
inverted: true
|
|
name: "Button Left"
|
|
id: button_left
|
|
|
|
- platform: gpio
|
|
pin:
|
|
number: GPIO13 # D7
|
|
mode: INPUT_PULLUP
|
|
inverted: true
|
|
name: "Button Middle"
|
|
id: button_middle
|
|
|
|
- platform: gpio
|
|
pin:
|
|
number: GPIO15 # D8
|
|
mode: INPUT_PULLUP
|
|
inverted: true
|
|
name: "Button Right"
|
|
id: button_right
|
|
|
|
# Buzzer
|
|
output:
|
|
- platform: gpio
|
|
pin: GPIO0 # D3
|
|
id: buzzer_output
|
|
|
|
switch:
|
|
- platform: output
|
|
name: "SmartCube Buzzer"
|
|
output: buzzer_output
|
|
|
|
# Battery voltage monitoring
|
|
sensor:
|
|
- platform: adc
|
|
pin: A0 # TOUT
|
|
name: "Battery Voltage"
|
|
id: battery_voltage
|
|
update_interval: 30s
|
|
filters:
|
|
- multiply: 6.93
|
|
unit_of_measurement: "V"
|