Files
fresh-home/esphome/hvac-multisensor.yaml
T
2025-10-27 16:49:34 -04:00

701 lines
18 KiB
YAML

# 3v3 en svp sun 34 35 32 33 25 26 27 14 12 gnd 13 sd2 sd3 gnd 5v
substitutions:
devicename: hvac-multisensor
entity_name: hvac_multisensor
friendly_name: HVAC MultiSensor
comment: Clever MultiSensor
platform: ESP32
board: esp32-wroom-32d
variant: esp32
# framework: esp-idf
framework: arduino
static_ip: !secret hvac-multisensor-ip
# Backlight Button
backlight_button: GPIO34
# For TFT Display
tft_dc_pin: GPIO02
tft_reset_pin: GPIO04
tft_cs_pin: GPIO15
tft_backlight_pin: GPIO32
# For SPI and TFT
spi_miso_pin: GPIO19
spi_mosi_pin: GPIO23
spi_clock_pin: GPIO18
# For Touchscreen
touchscreen_irq_pin: GPIO27
# For i2c devices
sda_pin: GPIO21
scl_pin: GPIO22
passive_buzzer_pin: GPIO26
one_wire_pin: GPIO17
packages:
# network: !include common/ethernet.yaml
network: !include common/wifi.yaml
device_base: !include common/device_base.yaml
# ble_proxy: !include common/ble_proxy.yaml
esphome:
name: ${devicename}
friendly_name: ${friendly_name}
name_add_mac_suffix: false
esp32:
# board: ${board}
variant: ${variant}
framework:
type: ${framework}
# Enable logging
logger:
level: VERBOSE
time:
- id: !remove homeassistant_time
- platform: sntp
id: sntp_time
timezone: America/Detroit
on_time:
- hours: 2,3,4,5
minutes: 5
seconds: 0
then:
- switch.turn_on: switch_antiburn
- hours: 2,3,4,5
minutes: 35
seconds: 0
then:
- switch.turn_off: switch_antiburn
api: # Using settings from common/device_base.yaml
actions:
- action: play_rtttl
variables:
song_str: string
then:
- rtttl.play: !lambda 'return song_str;'
on_client_connected:
- logger.log:
format: "Client %s connected to API with IP %s"
args: ["client_info.c_str()", "client_address.c_str()"]
- if:
condition:
lambda: 'return (0 == client_info.find("Home Assistant "));'
then:
- lvgl.widget.show: lbl_hastatus
on_client_disconnected:
- logger.log:
format: "Client %s disconnected to API with IP %s"
args: ["client_info.c_str()", "client_address.c_str()"]
- if:
condition:
lambda: 'return (0 == client_info.find("Home Assistant "));'
then:
- lvgl.widget.hide: lbl_hastatus
ota: # Using settings from common/device_base.yaml
# esp32_ble_tracker:
# globals:
# - id: oled_enabled
# type: bool
# restore_value: yes
# initial_value: 'false'
# - id: screen_power
# type: bool
# restore_value: yes
# initial_value: 'false'
font:
# - file: 'fonts/CascadiaMonoPL.ttf'
# id: regular_20
# size: 20
# bpp: 4
# extras:
# - file: "fonts/materialdesignicons-webfont.ttf"
# glyphs: [
# "\U000F02D1", # mdi-heart
# "\U000F05D4", # mdi-airplane-landing
# "\U000F02DC", # mdi-home
# "\U000F035E", # mdi-menu-left
# "\U000F035F", # mdi-menu-right
# ]
- file: 'fonts/RobotoCondensed-Regular.ttf'
id: regular_20
size: 20
bpp: 4
extras:
- file: "fonts/materialdesignicons-webfont.ttf"
glyphs: [
"\U000F02DC", # mdi-home
"\U000F035E", # mdi-menu-left
"\U000F035F", # mdi-menu-right
"\U000F05A9", # mdi-wifi
"\U000F19B2", # mdi-arrow-up-thin
"\U000F19B3", # mdi-arrow-down-thin
"\U000F04DB", # mdi-stop
]
# - file: "gfonts://Roboto"
# id: roboto_20
# size: 20
# - file: "gfonts://Material+Symbols+Outlined"
# id: icons_50
# size: 50
# glyphs: ["\U0000e425"] # mdi-timer
one_wire:
- platform: gpio
pin:
number: ${one_wire_pin}
mode:
input: true
pullup: true
i2c:
sda: ${sda_pin}
scl: ${scl_pin}
frequency: 800kHz
spi:
clk_pin: ${spi_clock_pin}
mosi_pin: ${spi_mosi_pin}
miso_pin: ${spi_miso_pin}
output:
- platform: ledc
pin: ${tft_backlight_pin}
id: backlight_pwm
- platform: ledc
pin: ${passive_buzzer_pin}
id: rtttl_out
rtttl:
output: rtttl_out
id: buzzer
gain: 60%
switch:
- platform: template
name: Antiburn
id: switch_antiburn
icon: mdi:television-shimmer
optimistic: true
entity_category: "config"
turn_on_action:
- logger.log: "Starting Antiburn"
- if:
condition: lvgl.is_paused
then:
- lvgl.resume:
- lvgl.widget.redraw:
- lvgl.pause:
show_snow: true
turn_off_action:
- logger.log: "Stopping Antiburn"
- if:
condition: lvgl.is_paused
then:
- lvgl.resume:
- lvgl.widget.redraw:
light:
- platform: monochromatic
output: backlight_pwm
name: "Display Backlight"
id: display_backlight
restore_mode: RESTORE_DEFAULT_OFF
number:
- platform: template
name: LVGL Screen timeout
optimistic: true
id: display_timeout
unit_of_measurement: "s"
initial_value: 30
restore_value: true
min_value: 10
max_value: 180
step: 5
mode: box
# binary_sensor:
# - platform: gpio
# pin:
# number: ${backlight_button}
# id: backlight_switch
# filters:
# - delayed_on: 10ms
# - delayed_off: 10ms
# on_press:
# - light.toggle:
# id: display_backlight
sensor:
- platform: dallas_temp
address: 0xB33C01B607798528
name: "Return"
id: hvac_return
icon: mdi:home-thermometer-outline
update_interval: 10s
filters:
- lambda: |-
float val = x;
if (isnan(val)) {
val = 0.0;
}
return val * (9.0/5.0) + 32.0;
#- lambda: return x * (9.0/5.0) + 32.0;
- clamp:
min_value: 0.0
max_value: 100.0
unit_of_measurement: "°F"
state_class: measurement
- platform: dallas_temp
address: 0x0F3C01B6070C1328
name: "Supply"
id: hvac_supply
icon: mdi:thermostat
update_interval: 10s
filters:
- lambda: return x * (9.0/5.0) + 32.0;
- clamp:
min_value: 0.0
max_value: 100.0
unit_of_measurement: "°F"
state_class: measurement
- platform: dallas_temp
address: 0xFA3C01B607005B28
name: "Ambient"
id: ambient
icon: mdi:home-thermometer
update_interval: 10s
filters:
- lambda: return x * (9.0/5.0) + 32.0;
- clamp:
min_value: 0.0
max_value: 100.0
unit_of_measurement: "°F"
state_class: measurement
- platform: template
name: "Delta"
id: hvac_delta
icon: mdi:thermometer-lines
lambda: |-
return (id(hvac_supply).state - id(hvac_return).state);
update_interval: 10s
unit_of_measurement: "°F"
state_class: measurement
filters:
- clamp:
min_value: 0.0
max_value: 100.0
- or:
- throttle: 60s
- delta: 1.0
display:
- platform: ili9xxx
id: main_display
# data_rate: 20MHz
# spi_mode: MODE3
# color_palette: 8BIT
invert_colors: false
auto_clear_enabled: false
update_interval: never
model: ili9488
dc_pin: ${tft_dc_pin}
reset_pin: ${tft_reset_pin}
cs_pin: ${tft_cs_pin}
transform:
swap_xy: true
mirror_x: true
dimensions:
height: 480
width: 320
touchscreen:
# - platform: ft5x06
- platform: ft63x6
id: main_touchscreen
display: main_display
transform:
swap_xy: true
mirror_y: true
interrupt_pin: ${touchscreen_irq_pin}
# 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
# );
on_release:
- if:
condition: lvgl.is_paused
then:
- logger.log: "LVGL resuming"
- lvgl.resume:
- lvgl.widget.redraw:
- if:
condition:
light.is_off: display_backlight
then:
- light.turn_on: display_backlight
lvgl:
buffer_size: 25%
displays: main_display
top_layer:
widgets:
- label:
text: "\U000F05A9"
id: lbl_hastatus
hidden: true
align: top_right
x: -2
y: 7
text_align: right
- buttonmatrix:
align: bottom_mid
styles: header_footer
pad_all: 0
outline_width: 0
id: top_layer
items:
styles: header_footer
rows:
- buttons:
- id: page_prev
text: "\U000F035E"
on_press:
then:
lvgl.page.previous:
- id: page_home
text: "\U000F02DC"
on_press:
then:
lvgl.page.show: main_page
- id: page_next
text: "\U000F035F"
on_press:
then:
lvgl.page.next:
on_idle:
timeout: !lambda "return (id(display_timeout).state * 1000);"
then:
- logger.log: "LVGL is idle"
- light.turn_off: display_backlight
- lvgl.pause:
pages:
- id: room_page
widgets:
- obj: # a properly placed coontainer object for all these controls
align: CENTER
width: 400
height: 256
pad_all: 2
bg_color: 0x414559
bg_opa: TRANSP
border_opa: TRANSP
layout: # enable the GRID layout for the children widgets
pad_row: 6
pad_column: 8
type: GRID # split the rows and the columns proportionally
grid_columns: [FR(1), FR(1), FR(1)] # equal
grid_rows: [FR(10), FR(30), FR(30), FR(30)] # like percents
widgets:
- label:
text: "Red"
grid_cell_column_pos: 0 # place the widget in
grid_cell_row_pos: 0 # the corresponding cell
grid_cell_x_align: STRETCH
grid_cell_y_align: STRETCH
- button:
id: but_cov_up_east
bg_color: 0xFF0000
grid_cell_column_pos: 0
grid_cell_row_pos: 1
grid_cell_x_align: STRETCH
grid_cell_y_align: STRETCH
widgets:
- label:
id: cov_up_east
align: CENTER
text: "\U000F19B2"
- button:
id: but_cov_stop_east
bg_color: 0xFF0000
grid_cell_column_pos: 0
grid_cell_row_pos: 2
grid_cell_x_align: STRETCH
grid_cell_y_align: STRETCH
widgets:
- label:
id: cov_stop_east
align: CENTER
text: "\U000F04DB"
- button:
id: but_cov_down_east
bg_color: 0xFF0000
grid_cell_column_pos: 0
grid_cell_row_pos: 3
grid_cell_x_align: STRETCH
grid_cell_y_align: STRETCH
widgets:
- label:
id: cov_down_east
align: CENTER
text: "\U000F19B3"
- label:
text: "Green"
grid_cell_column_pos: 1
grid_cell_row_pos: 0
grid_cell_x_align: STRETCH
grid_cell_y_align: STRETCH
- button:
id: but_cov_up_south
bg_color: 0x00FF00
grid_cell_column_pos: 1
grid_cell_row_pos: 1
grid_cell_x_align: STRETCH
grid_cell_y_align: STRETCH
widgets:
- label:
id: cov_up_south
align: CENTER
text: "\U000F19B2"
- button:
id: but_cov_stop_south
bg_color: 0x00FF00
grid_cell_column_pos: 1
grid_cell_row_pos: 2
grid_cell_x_align: STRETCH
grid_cell_y_align: STRETCH
widgets:
- label:
id: cov_stop_south
align: CENTER
text: "\U000F04DB"
- button:
id: but_cov_down_south
bg_color: 0x00FF00
grid_cell_column_pos: 1
grid_cell_row_pos: 3
grid_cell_x_align: STRETCH
grid_cell_y_align: STRETCH
widgets:
- label:
id: cov_down_south
align: CENTER
text: "\U000F19B3"
- label:
text: "Blue"
grid_cell_column_pos: 2
grid_cell_row_pos: 0
grid_cell_x_align: STRETCH
grid_cell_y_align: STRETCH
- button:
id: but_cov_up_west
bg_color: 0x0000FF
grid_cell_column_pos: 2
grid_cell_row_pos: 1
grid_cell_x_align: STRETCH
grid_cell_y_align: STRETCH
widgets:
- label:
id: cov_up_west
align: CENTER
text: "\U000F19B2"
- button:
id: but_cov_stop_west
bg_color: 0x0000FF
grid_cell_column_pos: 2
grid_cell_row_pos: 2
grid_cell_x_align: STRETCH
grid_cell_y_align: STRETCH
widgets:
- label:
id: cov_stop_west
align: CENTER
text: "\U000F04DB"
- button:
id: but_cov_down_west
bg_color: 0x0000FF
grid_cell_column_pos: 2
grid_cell_row_pos: 3
grid_cell_x_align: STRETCH
grid_cell_y_align: STRETCH
widgets:
- label:
id: cov_down_west
align: CENTER
text: "\U000F19B3"
- id: main_page
widgets:
- obj:
align: TOP_MID
styles: header_footer
widgets:
- label:
text: "ESPHome LVGL Display"
align: CENTER
text_align: CENTER
- label:
align: CENTER
text: 'Hello World!'
- label:
align: LEFT_MID
text: 'Left Mid'
- label:
align: RIGHT_MID
text: 'Right Mid'
- id: second_page
widgets:
- obj:
align: TOP_MID
styles: header_footer
widgets:
- label:
text: "A second page"
align: CENTER
text_align: CENTER
- label:
align: CENTER
text: 'Hello Again!'
- id: third_page
widgets:
- obj:
align: TOP_MID
styles: header_footer
widgets:
- label:
text: "A third page"
align: CENTER
text_align: CENTER
- label:
align: CENTER
text: 'I am the very model of a modern major general'
- id: fourth_page
widgets:
- obj:
align: TOP_MID
styles: header_footer
widgets:
- label:
text: "A fourth page"
align: CENTER
text_align: CENTER
- label:
align: CENTER
text: "I've information vegetable animal and mineral"
theme:
label:
text_font: regular_20 # set all your labels to use your custom defined font
text_color: 0xcad3f5
button:
bg_color: 0x24273a
bg_grad_color: 0x005782
bg_grad_dir: VER
bg_opa: COVER
border_color: 0x0077b3
border_width: 1
text_color: 0xcad3f5
pressed: # set some button colors to be different in pressed state
bg_color: 0x006699
bg_grad_color: 0x00334d
checked: # set some button colors to be different in checked state
bg_color: 0x1d5f96
bg_grad_color: 0x03324A
text_color: 0xfff300
buttonmatrix:
bg_opa: TRANSP
border_color: 0x0077b3
border_width: 0
text_color: 0xcad3f5
pad_all: 0
items: # set all your buttonmatrix buttons to use your custom defined styles and font
bg_color: 0x24273a
bg_grad_color: 0x005782
bg_grad_dir: VER
bg_opa: COVER
border_color: 0x0077b3
border_width: 1
text_color: 0xcad3f5
text_font: regular_20
pressed:
bg_color: 0x006699
bg_grad_color: 0x00334d
checked:
bg_color: 0x1d5f96
bg_grad_color: 0x03324A
text_color: 0x005580
switch:
bg_color: 0xC0C0C0
bg_grad_color: 0xb0b0b0
bg_grad_dir: VER
bg_opa: COVER
checked:
bg_color: 0x1d5f96
bg_grad_color: 0x03324A
bg_grad_dir: VER
bg_opa: COVER
knob:
bg_color: 0xFFFFFF
bg_grad_color: 0xC0C0C0
bg_grad_dir: VER
bg_opa: COVER
slider:
border_width: 1
border_opa: 15%
bg_color: 0xcccaca
bg_opa: 15%
indicator:
bg_color: 0x1d5f96
bg_grad_color: 0x03324A
bg_grad_dir: VER
bg_opa: COVER
knob:
bg_color: 0x24273a
bg_grad_color: 0x005782
bg_grad_dir: VER
bg_opa: COVER
border_color: 0x0077b3
border_width: 1
text_color: 0xcad3f5
style_definitions:
- id: header_footer
bg_color: 0x24273a
bg_grad_color: 0x005782
bg_grad_dir: VER
bg_opa: COVER
border_opa: TRANSP
radius: 0
pad_all: 0
pad_row: 0
pad_column: 0
border_color: 0x0077b3
text_color: 0xcad3f5
width: 100%
height: 30