ESPHome Centrally Controlled ThermostatCentrally Controlled Thermostat

This is the next one in the ESPHome How-to Series 1. Hope this makes sense to all of you keeping up with my progress on Home Assistant integration with ESPHome. Wow, what a journey it has been! From the basic setup to some more and more complex tasks in this series! This one takes the cake! I promise it is a crazy ride on this one! Oh, and I am by no means done with this climate control I just had to get what I have done documented for prosperity! Hope you enjoy!

Links on This Page

“As an Amazon Associate I earn from qualifying purchases.”  So, clicking on links gives me clicks in Amazon and help me maintain this site! Also, purchases made through those links also helps!

Overview

I have had an ecobee for years now and I have had no issues with it or integrating it in Home Assistant. However, I hate things that require cloud access. So, to remove this device from HA would be a blessing! Sorry ecobee 🙁 You got to go!

50000 foot view

I wanted a way to centrally control the furnace and then add thermostats around the house that average out the home temperature and then use that average temp to control the furnace. So, to that end I decided to make a esp32 based central controller and then add thermostats both existing and esp32 based to this controller via HA. HA will be responsible for generating the average and then sending this to the central control which will then respond to heat, cool and fan requests via HA and also a LCD based thermostat controller as well (future project here…). Here is a quick block diagram of it!

Quick view of Thermostat Design Idea

Quick Schematic

https://alshowto.com/wp-content/uploads/2023/11/EspCentralThermo.zip

The ESPHome YAML Files

So, this is the current yaml files first for controller the thermostat LCD module.

Controller YAML

esphome:
  name: central-thermo
  friendly_name: Central Thermo

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: !secret therm_controller_key

ota:
  password: !secret therm_ota_key

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Central-Thermo Fallback Hotspot"
    password: !secret therm_ap_pass

captive_portal:

switch:
  - platform: gpio
    pin: 2
    name: "Demand Relay"
    id: dem1
    interlock: &interlock_group [dem1, cool1]
    inverted: False

  - platform: gpio
    pin: 4
    id: cool1
    name: "Cool Relay"
    inverted: False
    interlock: *interlock_group
    
  - platform: gpio
    pin: 32
    id: fan1
    name: "Fan"
    inverted: False

  - platform: gpio
    pin: 25
    id: auxheat1
    name: "Aux Heat"
    inverted: False

sensor:
  - platform: homeassistant
    id: current_temperature
    entity_id: sensor.thermo_control_upper_hall_temperature
    filters:
      - lambda: return (x - 32.0) / 1.8;

climate:
  - platform: thermostat
    name: "Thermostat Climate Controller"
    sensor: current_temperature
    set_point_minimum_differential: .5 °F
    min_cooling_off_time: 120s
    min_cooling_run_time: 120s
    min_heating_off_time: 120s
    min_heating_run_time: 120s
    min_fanning_run_time: 120s
    min_fanning_off_time: 120s
    max_heating_run_time: 1800s
    heat_deadband: .2 °F
    heat_overrun: .1 °F
    cool_overrun: .1 °F
    cool_deadband: .2 °F
    supplemental_heating_delta: 1.3 °F
    min_idle_time: 30s
    cool_mode:
      - switch.turn_on: cool1
    heat_mode:
      - switch.turn_off: cool1
    off_mode:
      - switch.turn_off: dem1
      - switch.turn_off: auxheat1
      - switch.turn_off: cool1
      - switch.turn_off: fan1

    fan_only_mode:
      - switch.turn_off: cool1
      
    cool_action:
      then:
        if:
          condition:
            switch.is_off: cool1
          then:
            - switch.turn_on: cool1
            - delay: 1s    
            - switch.turn_on: dem1
            - switch.turn_on: fan1
          else:
            - switch.turn_on: dem1
            - switch.turn_on: fan1
    heat_action:
      then:
        if:
          condition:
            switch.is_on: cool1
          then:
            - switch.turn_off: cool1
            - delay: 1s    
            - switch.turn_on: dem1
            - switch.turn_on: fan1
          else:
            - switch.turn_on: dem1
            - switch.turn_on: fan1
    supplemental_heating_action:
      then:
        if:
          condition:
            switch.is_on: cool1
          then:
            - switch.turn_off: cool1
            - delay: 1s    
            - switch.turn_on: dem1
            - switch.turn_on: fan1
          else:
            - switch.turn_on: dem1
            - switch.turn_on: fan1
    fan_only_action:
      then:
        if:
          condition:
            switch.is_on: cool1
          then:
            - switch.turn_off: cool1
            - delay: 1s    
            - switch.turn_on: fan1
          else:
            - switch.turn_on: fan1
    idle_action:
      - switch.turn_off: dem1
      - switch.turn_off: fan1
      - switch.turn_off: auxheat1
    default_preset: Home
    preset:
      - name: Home
        default_target_temperature_low: 72 °F
        default_target_temperature_high: 73 °F
    

Thermostat ESPHome Board

So, this is nothing special. I did add a 40v to 5v and bridge rect to it so that I can plug in where the old therm was plugged in at originally. However, it will only use 25v and com as the actual therm control is now at the furnace. So, that is different. For now, I just am powering via use on the ESP32 dev board that I got as a prototype board from Amazon.

esphome:
  name: "thermo-control"
  friendly_name: "Thermo Control"

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: !secret temp_control_key

ota:
  password: !secret temp_control_ota 
  #"624ead912a331823cfc954aedc30ea8d"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Test Fallback Hotspot"
    password: !secret temp_control_ap
      #"R9XYvIqxbqq0"

captive_portal:
    
sensor:
  - platform: dht
    pin: 4
    model: DHT22
    temperature:
      name: "Upper Hall Temperature"
      id: hall_sensor
    humidity:
      name: "Upper Hall Humidity"
    update_interval: 15s

Parts

40v to 5v

DC to DC switched supply. Now, I just had one of these fail after about 12 hours. So, not that impressed. I also have one from JLPCB on the way to test. This is a crazy board that can handle 100 volts so it should handle this circuit without fail! I will let you know here when I replace it!

Here it is from Amazon

Relays

5v Relays that handle sending the 25v AC to tell furnace what to do when heat, cool, or fan is called. Nothing special here should use smaller ones in the final design. Anyway, they are doing their job just fine for now!

Here it is from Amazon

Logic Level MOSFET Low Side Switch

Kept it simple here just used some 2n7000 N Mosfets that I had. Need this because the current draw and also the 5 volts is more than the ESP32 can handle so it must be protected by this MOSFET as a low side switch.

Similar to these on Amazon

ESP32 Used

NodeMCU ESP32 ESP-WROOM-32 WLAN dev board with usb and 3.3 reg get this project done.

Here it is on Amazon

DHT – Digital Humidity Temperature Sensor

Nothing to special here just using the DHT22 dev board.

Here it is on Amazon

More Photos

Relay Portion with screw terms for relays and furnace control(see schematic above)
Back of Relay board; I liked yellow wire here 🙂 I know could look better but it works!!!
The main ESP32 Controller board without the relays attached yet
Final Thermo Control board read for furnace!
Here it is all connected to the furnace control board.
Here is the ESP32 thermostat with DHT22. This will eventually have the GUI LCD on it but for now I control through HA.
How I can control via Home Assistant.

Much more to do

There is so much more to do on this project but I figured this was a good starting point more to come in the future!

  • LCD display maybe LVGL UI via NXP Gui Guider
  • Humidity control
  • Fan control like the ecobee had. Run fan 10 minutes if not run in the hour
  • ect… Things that I have not thought about yet.

Links

My Goodman controller board for heatpump.

https://totalairsupply.com/wp-content/uploads/2020/10/Goodman_AFE18-60A_Dual_Fuel_Control_IO_Manual_9-06.pdf

External Temp for heat pump.

https://iwae.com/media/manuals/goodman/ot18-60a-installation.pdf

Common thermostat wire color codes

Leave a Reply

Your email address will not be published. Required fields are marked *