Files
hassos_config/esphome/esp32-nixie.yaml
2026-03-26 12:10:21 +01:00

139 lines
2.9 KiB
YAML

substitutions:
device_name: "esp32-nixie"
friendly_name: "esp32-nixie"
comment: "esp32"
location: "Woonkamer"
api_password: "RjgVy40E6HfdRtEVN4Uod2315B2yoFA+ilOl1Wf/PwE="
ota_password: !secret ota_password
wifi_ssid: !secret wifi_ssid
wifi_password: !secret wifi_password
gateway: !secret ip_gateway
subnet: !secret ip_subnet
board: "esp32dev"
framework: esp-idf
packages:
board: !include boards/esp32-gen.yaml
device_base: !include common/common.yaml
connection: !include common/wifi.yaml
logger: !include templates/logger.yaml
# logger:
# level: WARN
external_components:
- source:
type: local
path: custom_component
components: [nixie_display]
time:
# - platform: sntp
# id: sntp_time
# servers:
# - 0.pool.ntp.org
# - 1.pool.ntp.org
# - 2.pool.ntp.org
- platform: homeassistant
id: ha_time
spi:
id: nixie_spi
clk_pin: GPIO18
mosi_pin: GPIO23
miso_pin: GPIO19
display:
- platform: nixie_display
id: nixie_clock
spi_id: nixie_spi
time_id: ha_time
auto_time: true
debug_logging: false
anti_poisoning: true
lambda_hold_ms: 0
update_interval: 200ms
refresh_interval_us: 1000
anode0_pin: GPIO5
anode1_pin: GPIO13
anode2_pin: GPIO17
le_pin: GPIO22
switch:
- platform: template
id: date_mode_switch
name: "Nixie Date Mode"
lambda: |-
return id(nixie_clock).is_date_mode();
restore_mode: RESTORE_DEFAULT_OFF
turn_on_action:
- lambda: |-
id(nixie_clock).set_date_mode(true);
turn_off_action:
- lambda: |-
id(nixie_clock).set_date_mode(false);
- platform: template
id: auto_rotate_switch
name: "Nixie Auto Rotate"
lambda: |-
return id(nixie_clock).is_auto_rotate();
restore_mode: RESTORE_DEFAULT_OFF
turn_on_action:
- lambda: |-
id(nixie_clock).set_auto_rotate(true);
turn_off_action:
- lambda: |-
id(nixie_clock).set_auto_rotate(false);
# 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: ledc
pin: GPIO25
id: underglow_led_r
- platform: ledc
pin: GPIO26
id: underglow_led_g
- platform: ledc
pin: GPIO27
id: underglow_led_b