ESPhome Climate Bang Bang

Not sure if this is the correct forum. I am trying to replace a thermostat for a HVAC system with an NodeMcu. I have successfully used the Climate Bang Bang in ESP home and a thermostat card in lovelace. It works great, except I can’t work out how to create a time lock to delay the signal going from heat to cool. ie I would like a delay of say 5 minutes before a heat signal is sent after a cool signal has been sent and visa versa. Also is this the correct method of using Esphome and Lovelace?

1 Like

Search esphome github repository of issues. I believe this feature is requested already. You can upvote there and increase the chances of a feature like that to be implemented

Hi Mark, I would be interest to see your esphome yaml and lovelace yaml for the Bang Bang, if you could post it? I messed around with the Bang Bang thermostat and couldn’t get it to function properly and put it aside till later.
In regards to a delay, almost every air conditioner I’ve work on in 20 years has a delay on break timer fitted to stop a quick change between modes of heat and cool, and restarts, it’s usually just a solid state device to the relay that controls the compressor in the outdoor unit. (Excluding new fancy electronic controlled units, for which it is unlikely you would be using a Bang Bang thermostat on.)

Please note, I am still in beta stage, so code is very rough. I am passing the temperature from Home assistant, because the temperature is coming from a different NodeMcu.
ESPhome.yaml
I am now thinking of going a different direction. That is to use the climate function in home assistant, using the ESPhome switches. having two thermostat,s but with a button, that displays the relevant heat or cool thermostat.

api:

ota:

dallas:
  - pin: D1

sensor:
  - platform: homeassistant
    name: "Input Boolean From Home Assistant"      
    entity_id: sensor.bom_melbourne_air_temp_c
  - platform: dht
    pin: D2
    temperature:
      name: "upstairs temp d2"
    humidity:
      name: "upstairs hum d2"
    update_interval: 60s
    model: dht22
  - platform: dht
    pin: D5
    temperature:
      name: "upstairs temp d5"
    humidity:
      name: "upstairs hum d5"
    update_interval: 60s
    model: dht22
  - platform: dht
    pin: D6
    temperature:
      name: "upstairs temp d6"
    humidity:
      name: "upstairs hum d6"
    update_interval: 60s 
    model: dht22

  - platform: dallas
    address: 0xFB011448396CAA28
    name: "temp_dallas_1"
    id: temp_dallas_1
  - platform: dallas
    address: 0xF1011447E3DCAA28
    name: "Temp dallas 2"
    
switch:
  - platform: gpio
    name: "Heating"
    id: "Heating_D3"
    pin: D3
    
  - platform: gpio
    name: "Cooling"
    id: "Cooling_d7"
    pin: D7

climate:
  - platform: bang_bang
    name: esp climate
    id: bang_bang_climate
    visual:
      min_temperature: 12 °C
      max_temperature: 25 °C
      temperature_step: 0.1 °C
    sensor: temp_dallas_1
   
    default_target_temperature_low: 12 °C
    default_target_temperature_high: 22 °C

    heat_action:
      - switch.turn_on: Heating_D3 
    idle_action:
      - switch.turn_off: Heating_D3
      - switch.turn_off: Cooling_d7
    cool_action:
      - switch.turn_on: Cooling_d7

LoveLace
- entity: climate.esp_climate
name: Thermostat
type: thermostat```
type or paste code here

@Mark53 Are you using SSR or mechanical relays on your heating/cooling pins? also, are you controlling the fan with it?

Hi Evban,
I have changed my config. I am using ESPhome for the relays, not SSR and using home assistant withy generic climate to contrl the rest. I have two thermostat cards, one for heating and one for cooling, using a conditional card to display the card that is required. Yes the relays control the fan. I found the bang bang controller made is two dfiffciult, it is must easier with home assistant. It looks like they may have released a fix for the bang bang controller, but I had an issue where both heating and coling were on.

I think it was two years ago now, but before they had implemented the bang bang platform, I was working on an air conditioner config that would do the minimum delay functionality. It involved a few global variables, but allowed me to set my AC to run the compressor for a minimum on time of two minutes, and I think I got it to respect a minimum off time as well. If not, it would be a simple matter to imlement the pattern I used a second time.

You can see the scripts file specifically in the repo: https://github.com/jptrsn/esphome_aircon/blob/0c7c1f88f10c0b718ce31b3d969dfd4d2e9e43b6/scripts.yaml

That might be helpful.

Cheers