using 2 esp32s for thermostat system

This commit is contained in:
Chris Cochrun 2025-07-14 12:53:15 -05:00
parent db0b5bf77d
commit c063bac416
3 changed files with 134 additions and 107 deletions

63
hvac.yml Normal file
View file

@ -0,0 +1,63 @@
esphome:
name: hvac
esp32:
board: nodemcu-32s
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
password: ""
ota:
- platform: esphome
password: ""
wifi:
ssid: "Cochrun"
password: "GreasyChicken784"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Kitchen Fallback Hotspot"
password: "RUfAhbEfZmOU"
captive_portal:
switch:
- platform: gpio
name: heat
pin:
number: 0
mode:
output: true
input: false
inverted: false
id: heater
restore_mode: RESTORE_DEFAULT_OFF
- platform: gpio
name: ac
pin:
number: 4
mode:
output: true
input: false
open_drain: false
inverted: false
id: ac
restore_mode: RESTORE_DEFAULT_OFF
- platform: gpio
name: fan
pin:
number: 16
mode:
output: true
input: false
open_drain: false
inverted: false
id: fan
restore_mode: RESTORE_DEFAULT_OFF

59
relay.yml Normal file
View file

@ -0,0 +1,59 @@
esphome:
name: relay-test
esp32:
board: nodemcu-32s
framework:
type: arduino
# Enable logging
logger:
ota:
- platform: esphome
password: ""
wifi:
ssid: "Cochrun"
password: "GreasyChicken784"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Kitchen Fallback Hotspot"
password: "RUfAhbEfZmOU"
api:
password: ""
captive_portal:
switch:
- platform: gpio
name: heat
pin:
number: 0
mode:
output: true
input: false
inverted: false
id: heater
- platform: gpio
name: cool
pin:
number: 4
mode:
output: true
input: false
open_drain: false
inverted: false
id: ac
- platform: gpio
name: fan
pin:
number: 16
mode:
output: true
input: false
open_drain: false
inverted: false
id: fan

View file

@ -61,9 +61,6 @@ wifi:
password: "GreasyChicken784"
power_save_mode: none
reboot_timeout: 10s
# output_power: 20.5dB
# enable_btm: true
# enable_rrm: true
manual_ip:
static_ip: 192.168.1.123
gateway: 192.168.1.1
@ -72,19 +69,12 @@ wifi:
# ssid: "TFC"
# password: "Disciple77"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Thermostat Fallback Hotspot"
password: "RUfAhbEfZmOU"
captive_portal:
# external_components:
# # replace 1234 with the number of the Pull Request
# - source: github://pr#5198
# components:
# # list all components modified by this Pull Request here
# - aht10
i2c:
- id: bus_a
sda: GPIO08
@ -92,11 +82,6 @@ i2c:
scan: True
frequency: 400kHz
# uart:
# tx_pin: GPIO27
# rx_pin: GPIO26
# baud_rate: 115200
time:
- platform: homeassistant
id: hass_time
@ -110,15 +95,6 @@ time:
return time.strftime("%a %m/%d/%y %I:%M");
# - script.execute: update_date_time_label
sensor:
# - platform: aht10
# variant: AHT20
# temperature:
# name: "Temperature"
# id: temperature
# humidity:
# name: "Humidity"
# id: humidity
# address: 0x66
- platform: bme280_i2c
temperature:
name: "Temperature"
@ -139,94 +115,17 @@ sensor:
name: "Pressure"
id: pressure
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:
- platform: gpio
pin:
ch422g:
number: 5
mode:
output: true
input: false
inverted: true
- platform: homeassistant
id: heater
restore_mode: ALWAYS_OFF
- platform: gpio
pin:
ch422g:
number: 8
mode:
output: true
input: false
open_drain: false
inverted: true
entity_id: switch.hvac_heat
- platform: homeassistant
id: ac
restore_mode: ALWAYS_OFF
- platform: gpio
pin:
ch422g:
number: 9
mode:
output: true
input: false
open_drain: false
inverted: true
entity_id: switch.hvac_ac
- platform: homeassistant
id: fan
restore_mode: ALWAYS_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
entity_id: switch.hvac_fan
climate:
- platform: thermostat
@ -254,12 +153,18 @@ climate:
- switch.turn_off: heater
- switch.turn_off: fan
fan_only_action:
- switch.turn_off: ac
- switch.turn_off: heater
- switch.turn_on: fan
- lambda: !lambda ESP_LOGD("fan", "DA FAN");
default_preset: Home
preset:
- name: Home
default_target_temperature_low: 67 °F
default_target_temperature_high: 78 °F
- name: Away
default_target_temperature_low: 60 °F
default_target_temperature_high: 85 °F
on_state:
then:
- if: