esphome/thermostat.yml
Chris Cochrun 96732ec6ae yup
2025-07-02 17:05:57 -05:00

365 lines
8 KiB
YAML

esphome:
name: thermostat
# esp32:
# board: esp32-s3-devkitc-1
# variant: esp32s3
# framework:
# type: esp-idf
# sdkconfig_options:
# CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240: y
# CONFIG_ESP32S3_DATA_CACHE_64KB: y
# CONFIG_SPIRAM_FETCH_INSTRUCTIONS: y
# CONFIG_SPIRAM_RODATA: y
esp32:
board: esp32-s3-devkitc-1
variant: esp32s3
flash_size: 8MB
framework:
type: esp-idf
version: latest
sdkconfig_options:
CONFIG_IDF_TARGET: "esp32s3"
CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240: y
CONFIG_ESPTOOLPY_FLASHMODE_QIO: y
CONFIG_ESPTOOLPY_FLASHFREQ_80M: y
CONFIG_ESPTOOLPY_FLASHSIZE_8MB: y
CONFIG_IDF_EXPERIMENTAL_FEATURES: y
CONFIG_SPIRAM_FETCH_INSTRUCTIONS: y
CONFIG_SPIRAM: y
CONFIG_SPIRAM_MODE_OCT: y
CONFIG_SPIRAM_RODATA: y
CONFIG_SPIRAM_SPEED_80M: y
CONFIG_FREERTOS_HZ: "1000"
CONFIG_ESP32S3_DATA_CACHE_LINE_64B: y
COMPILER_OPTIMIZATION_SIZE: y
psram:
mode: octal
speed: 80MHz
# Enable logging
logger:
ch422g:
# address: 0x24
# Enable Home Assistant API
api:
password: ""
ota:
- platform: esphome
password: ""
wifi:
# ssid: "Cochrun"
# password: "GreasyChicken784"
ssid: "TFC"
password: "Disciple77"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Thermostat Fallback Hotspot"
password: "RUfAhbEfZmOU"
captive_portal:
i2c:
- id: bus_a
sda: GPIO08
scl: GPIO09
scan: True
# - id: bus_b
# sda:
# pin:
# ch422g:
# number: 6
# scl:
# pin:
# ch422g:
# number: 5
# scan: True
# uart:
# tx_pin: GPIO27
# rx_pin: GPIO26
# baud_rate: 115200
sensor:
- platform: aht10
variant: AHT20
temperature:
name: "Temperature"
id: temperature
humidity:
name: "Humidity"
id: humidity
# address: 0x76
# dfrobot_sen0395:
# binary_sensor:
# # Information coming from uart bus
# - platform: dfrobot_sen0395
# id: mmwave_uart
# name: Mmwave UART
# # on_...:
# # - dfrobot_sen0395.settings:
# # factory_reset: true
# # detection_segments:
# # # Define between one and four segments
# # - [0cm, 3m]
# # - [5.1m, 6.6m]
# # output_latency:
# # delay_after_detect: 0s
# # delay_after_disappear: 0s
# # sensitivity: 7
# # Information coming from dedicated gpio (IO2)
# - platform: gpio
# name: Mmwave GPIO
# device_class: motion
# pin:
# number: GPIO25
# mode: INPUT_PULLDOWN
switch:
# # Switch to turn on/off detection
# - platform: dfrobot_sen0395
# type: sensor_active
# name: Mmwave Active
# - platform: dfrobot_sen0395
# type: presence_via_uart
# name: Mmwave UART active
# restore_mode: always_on
# - platform: dfrobot_sen0395
# type: turn_on_led
# name: Mmwave Led
# restore_mode: always_on
# icon: "mdi:led-on"
# - platform: dfrobot_sen0395
# type: start_after_boot
# name: Mmwave Start
# restore_mode: always_on
# on_turn_on:
# then:
# - number.set:
# id: sensitivity
# value: !lambda |-
# return id(mmwave_uart).state + 1;
- platform: gpio
pin: 16
id: heater
restore_mode: RESTORE_DEFAULT_OFF
- platform: gpio
pin: 44
id: ac
restore_mode: RESTORE_DEFAULT_OFF
- platform: gpio
pin: 15
id: fan
restore_mode: RESTORE_DEFAULT_OFF
# button:
# - platform: template
# id: inner_button
# on_press:
# - dfrobot_sen0395.settings:
# sensitivity: !lambda |-
# return id(sensitivity).state - 1;
# - platform: template
# id: inner_distance
# on_press:
# - dfrobot_sen0395.settings:
# detection_segments:
# - [0cm, 3.3m]
# - platform: template
# id: distance
# name: Mmwave distance
# optimistic: true
# min_value: 0.0
# max_value: 9.0
# step: 0.1
# mode: slider
# set_action:
# - button.press:
# id: inner_distance
climate:
- platform: thermostat
name: "Thermostat"
sensor: temperature
humidity_sensor: humidity
min_cooling_off_time: 10s
min_cooling_run_time: 10s
min_heating_off_time: 10s
min_heating_run_time: 10s
min_idle_time: 30s
cool_action:
- switch.turn_off: heater
- switch.turn_on: ac
- switch.turn_on: fan
heat_action:
- switch.turn_off: ac
- switch.turn_on: heater
- switch.turn_on: fan
idle_action:
- switch.turn_off: ac
- switch.turn_off: heater
- switch.turn_off: fan
default_preset: Home
preset:
- name: Home
default_target_temperature_low: 67 °F
default_target_temperature_high: 76 °F
# Example minimal configuration entry
display:
- platform: rpi_dpi_rgb
id: my_display
auto_clear_enabled: false
update_interval: never
color_order: RGB
pclk_frequency: 14MHz
dimensions:
width: 800
height: 480
de_pin:
number: 5
hsync_pin:
number: 46
ignore_strapping_warning: true
vsync_pin:
number: 3
ignore_strapping_warning: true
pclk_pin: 7
pclk_inverted: false
hsync_back_porch: 10 #30
hsync_front_porch: 20 #210
hsync_pulse_width: 10 #30
vsync_back_porch: 10 #4
vsync_front_porch: 10 #4
vsync_pulse_width: 10 #4
data_pins:
red:
- 1 #r3
- 2 #r4
- 42 #r5
- 41 #r6
- 40 #r7
blue:
- 14 #b3
- 38 #b4
- 18 #b5
- 17 #b6
- 10 #b7
green:
- 39 #g2
- 0 #g3
- 45 #g4
- 48 #g5
- 47 #g6
- 21 #g7
font:
- file: "gfonts://Roboto"
id: chu_nano
size: 18
touchscreen:
- platform: gt911
id: my_touchscreen
interrupt_pin: 4
reset_pin:
ch422g:
number: 1
on_touch:
- lambda: |-
ESP_LOGI("cal", "x=%d, y=%d, x_raw=%d, y_raw=%0d",
touch.x,
touch.y,
touch.x_raw,
touch.y_raw
);
color:
- id: bg
hex: 282A36
lvgl:
buffer_size: 25%
default_font: chu_nano
pages:
- id: page
bg_color: 0x282A36
widgets:
- obj:
align: top_mid
width: 800
widgets:
- slider: # Clock container
pad_top: 30px
align: top_mid
width: 600
id: heat_id
value: 76
min_value: 50
max_value: 100
- label:
pad_top: 40px
align: center
text: "Hello World"
text_color: 0xE2E4E5
- slider: # Clock container
pad_top: 60px
align: top_mid
width: 600
id: cool_id
value: 68
min_value: 50
max_value: 100
- label:
pad_top: 70px
align: center
text: "Hello World"
text_color: 0xE2E4E5
- label:
align: center
text: "Hello World"
text_color: 0xE2E4E5
# time:
# - platform: homeassistant
# id: time_comp
# interval:
# - interval: 30s
# then:
# if:
# condition:
# time.has_time:
# then:
# - script.execute: time_update
# script:
# - id: time_update
# then:
# - lvgl.indicator.update:
# id: minute_hand
# value: !lambda |-
# return id(time_comp).now().minute;
# - lvgl.indicator.update:
# id: hour_hand
# value: !lambda |-
# auto now = id(time_comp).now();
# return std::fmod(now.hour, 12) * 60 + now.minute;