From c063bac416929731ea3e9346103f8fbda6f95f44 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Mon, 14 Jul 2025 12:53:15 -0500 Subject: [PATCH] using 2 esp32s for thermostat system --- hvac.yml | 63 ++++++++++++++++++++++++++ relay.yml | 59 ++++++++++++++++++++++++ thermostat.yml | 119 +++++-------------------------------------------- 3 files changed, 134 insertions(+), 107 deletions(-) create mode 100644 hvac.yml create mode 100644 relay.yml diff --git a/hvac.yml b/hvac.yml new file mode 100644 index 0000000..0bea176 --- /dev/null +++ b/hvac.yml @@ -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 diff --git a/relay.yml b/relay.yml new file mode 100644 index 0000000..7e17add --- /dev/null +++ b/relay.yml @@ -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 diff --git a/thermostat.yml b/thermostat.yml index c4b96f4..5051901 100644 --- a/thermostat.yml +++ b/thermostat.yml @@ -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: