112 lines
2.1 KiB
YAML
112 lines
2.1 KiB
YAML
esphome:
|
|
name: nixie-clock
|
|
platform: esp32
|
|
board: esp32-c3-devkitm-1
|
|
|
|
wifi:
|
|
ssid: !secret wifi_ssid
|
|
password: !secret wifi_password
|
|
ap:
|
|
ssid: "Nixie-Clock"
|
|
password: "12345678"
|
|
|
|
captive_portal:
|
|
|
|
logger:
|
|
level: INFO
|
|
|
|
api:
|
|
encryption:
|
|
key: !secret api_encryption_key
|
|
|
|
ota:
|
|
password: !secret ota_password
|
|
|
|
time:
|
|
- platform: sntp
|
|
id: sntp_time
|
|
servers:
|
|
- 0.pool.ntp.org
|
|
- 1.pool.ntp.org
|
|
- 2.pool.ntp.org
|
|
|
|
spi:
|
|
id: nixie_spi
|
|
clk_pin: GPIO18
|
|
mosi_pin: GPIO23
|
|
miso_pin: GPIO19
|
|
frequency: 1MHz
|
|
|
|
display:
|
|
- platform: nixie_display
|
|
id: nixie_clock
|
|
spi_id: nixie_spi
|
|
anode0_pin: GPIO5
|
|
anode1_pin: GPIO13
|
|
anode2_pin: GPIO17
|
|
le_pin: GPIO22
|
|
|
|
# Update display with current time HH:MM:SS
|
|
lambda: |-
|
|
auto time_obj = id(sntp_time).now();
|
|
if (time_obj.is_valid()) {
|
|
char time_str[7];
|
|
snprintf(time_str, sizeof(time_str), "%02d%02d%02d",
|
|
time_obj.hour,
|
|
time_obj.minute,
|
|
time_obj.second);
|
|
it.printf(time_str);
|
|
} else {
|
|
it.printf("000000");
|
|
}
|
|
return;
|
|
|
|
# Buttons from defines.h
|
|
binary_sensor:
|
|
- platform: gpio
|
|
pin:
|
|
number: GPIO2
|
|
mode: INPUT_PULLUP
|
|
name: "Up Button"
|
|
on_press:
|
|
then:
|
|
- logger.log: "Up button pressed"
|
|
|
|
- platform: gpio
|
|
pin:
|
|
number: GPIO4
|
|
mode: INPUT_PULLUP
|
|
name: "Down Button"
|
|
on_press:
|
|
then:
|
|
- logger.log: "Down button pressed"
|
|
|
|
- platform: gpio
|
|
pin:
|
|
number: GPIO16
|
|
mode: INPUT_PULLUP
|
|
name: "Mode Button"
|
|
on_press:
|
|
then:
|
|
- logger.log: "Mode button pressed"
|
|
|
|
# Underglow LED (RGB) for tube illumination from defines.h
|
|
light:
|
|
- platform: rgb
|
|
name: "Tube Underglow"
|
|
red: underglow_led_r
|
|
green: underglow_led_g
|
|
blue: underglow_led_b
|
|
restore_mode: RESTORE_DEFAULT_ON
|
|
|
|
output:
|
|
- platform: gpio
|
|
pin: GPIO25
|
|
id: underglow_led_r
|
|
- platform: gpio
|
|
pin: GPIO26
|
|
id: underglow_led_g
|
|
- platform: gpio
|
|
pin: GPIO27
|
|
id: underglow_led_b
|