Dumb Cheap Smart Thermostat

Tags: #<Tag:0x00007f77ff4a1c20> #<Tag:0x00007f77ff4a19a0> #<Tag:0x00007f77ff4a17e8> #<Tag:0x00007f77ff4a10e0> #<Tag:0x00007f77ff4a0ca8>

Where should I start…, Oke my problem…

Since the beginning of my HA “Era” I’ve been looking for a smart thermostat. Let’s face it, nobody wants to get up to turn the thermostat to get your house heated. This needs to be done by our automation software. At this moment I got that standard thermostat which I need to turn left or right to make it warm or cold.

So…. I started my search for a smart thermostat, but everything had a dead end. First, I found the Nest. However, after some reading I found out its not running anymore on HA. Furthermore, I had found some other smart thermostats but had a dead end as well. So I thought to myself, why not look into the technical specification of my central heating unit (CHU) and see if I can fabricate something myself.

That’s what I did and I got it working. I got a very simple ESP code running, together with a relay that is using the preprogrammed program for use of an “On/Off” thermostat on my CHU. The relay here is functioning as this “On/Off” thermostat. Up to now it’s functioning perfectly. It still needs some improvements, which I want to update throughout time. And if somebody got other ideas, please feel free to contribute and I will see if I can implement it.

Prerequisites for this project

  • On/Off terminals on your CHU (pre-programmed)
  • If you got the above terminals, then your next prerequisite is that you can read electrical schematics and know how to connect those.
  • Some knowhow of electrics.
  • Reading skills to follow this project.
  • The fun factor, to enjoy this automation project.

Improvements that I want to implement throughout time:

  • Deriving power from the Central heating. I have 24V on the terminals, but its delivering to much current. I ordered a converter now and will see if that works. The issue I got now is that it delivers to much current. For now i use a power adapter
  • Improving my heating with more automations

WARNING: Before starting this project, know how your home electrics work. You need to have some knowhow with electrics and high voltage (220V) as this project is going to use the live wire and ground of your home. If you are in doubt about your central heating or electrical wires, please contact your local expert.

Part list

QTY Description Costs
1x Adapter €3,1
1x ESP8266 Node MCu V3 €2,56
1x 5v Relay-Module €0,56
Total €6,22

These are the main parts you need, thereby you need the standard parts such as breadboard wires or crocodile wires for testing. Power wires (Blue, Brown) and a power supply for testing.

I got a small led light on the ESP to see if it has any errors (Status LED). You could choose to leave this away.


Step 1

Install the ESP home Integration trough Hasss.IO in your HA

Step 2:

Upload the below ESP code trough ESP Home and upload it to your ESP chip.

esphome:
  name: smartthermostat
  platform: ESP8266
  board: nodemcu


wifi:
  ssid: !secret wifissid
  password: !secret wifipassword

# Enable logging
logger:

# Enable Home Assistant API
api:

status_led:
  pin: D6

sensor:
  - platform: wifi_signal
    name: "WiFi Signal smartthermostat"
    update_interval: 60s
  - platform: uptime
    name: Uptime Smartthermostat

binary_sensor:
  - platform: status
    name: "ESP Smartthermostat Status"

ota:

switch:
  - platform: gpio
    pin: D2
    name: smartthermostatrelay

Step 3:

Now for the real work wire the parts according the below photographs. You can do some testing before hooking it up to your central heating. Take a light bulb and hook this up to your relay (including 220V) it works if its switching on and off.

D2 goes to your relay’s signal. And the + and - goes to a 3V and ground connection.



Step 4:

Integrate the ESP chip trough integrations, following the below guide

Now into your integrations you should see some sensors popping up. If not redo this step and see if you missed something (typo’s or something)

Step 5:

Before connecting anything to your central heating, take the power plug out. Read the electrical voltage with a multimeter to double check if there’s no hidden UPS plugged in. Then find the correct terminal pins and connect the wires coming from your relay. I got a remeha 28C . For me they were on terminal 3 & 4. My normal thermostat is connected on terminal 1 & 2 but these are a Modbus connection.

Reconnect your power supply to your central heating and test the switch on your HA frontend. Now your Central heating should go on/off. If its not working, please check if you connected everything correctly. If everything else failed you probably don’t the preprogrammed On/Off terminals.

Step 6:

Get the generic thermostat working with HA. Use your switch from the ESP home

Example code:

climate:
  - platform: generic_thermostat
    name: Woonkamer
    heater: switch.smartthermostatrelay_2
    target_sensor: sensor.temperature_158d00033b796b
    min_temp: 15
    max_temp: 24    
    target_temp: 16
    cold_tolerance: 0.5
    hot_tolerance: 0.5
    min_cycle_duration:
      minutes: 5
    initial_hvac_mode: "off"
    away_temp: 16
    precision: 1.0

Step 7:

Add your thermostat to your Lovelace view. And enjoy your cheap dumb smart thermostat. I will upload my config later as i am re-doing my complete lovelace view.

If there are any questions please feel free to ask. I will try to help you as much as i can. If i’m missing any information. Also please comment so i can try to keep it updated.

Good morning, and in case I don’t see ya: Good afternoon, good evening, and good night!

5 Likes

I am facing somewhat facing similar issues. I currently have a Toon at home, but it order for it to work with HA I need to pay almost 3 euro’s a month to have API access. It’s not much and that is currently what I am using.

Looking into something like this to replace my Toon Thermostat. (Or I would have to go and hack the Toon thermostat).

Thanks for this, is there also any compatibility to take into account?

1 Like

I’m not into the Toon hacking, so i can’t help you with that. I don’t even own a smart thermostat at the moment.

I assume you live in the Netherlands as do I. And most CHU (CV-Ketel) does have a on/off terminal hidden inside (see above pictures). If you do have so, you can use the same solution which i used. Hook up a relay with a ESP chip and operate this with the generic thermostat integration from HA.

Nice project and documentation.

I have a more advance version of this using an ESP32, Xiaomi Bluetooth Temperature Sensor, a rotary encoder and a small OLED display.
The thermostat has 2 modes:

  • Smart mode - the relay is triggered by HA Generic Thermostat
  • Manual Mode - the relay is triggered esphome directly. I use the rotary encoder to set the target temperature and Xiaomi BLE Temp sensor to read the temperature in the room. I’ve never really used this feature, but it’s a fallback if HA is down for any reason. I even switch to manual mode automaticallty if the connection to HA, using status

I’ll make some time these days andpost the code on the forum, if anyone is interested

2 Likes

Your Setup looks promising. You can use your thermostat both manual and smart. In principle the same as i use with my manual thermostat on the wall.

Why are you using the small OLED display?. Is it something you look on very often?. For example, my setup is behind a panel on my top floor. So i don’t see it.

I’m using my manual thermostat now as a really expensive digital thermometer :slight_smile:

Why are you using the small OLED display?.

Mostly it was just for testing purposes, I just wanted to play a little bit with the display component of the esphome and see how can it be used.
But I also want to make sure that the system can be used without HA. I can switch to “manual” mode by pressing on the rotary encoder and set the target temperature directly in the ESP32, which will control the heater based on the temperature read from Xiaomi BLE Temp Sensor.

I’ve never used it as a standalone thermostat, but you never know…

Sounds good, Where is your setup hanging?. Is it in the open?. I had to WAF everything :wink:

Do share! I would love to see the code, I’m writing one for a floor heater very similar but using a e-paper display

I love DIY thermostat projects. For those not so interested in full DIY, there are some Tuya based thermostats, like the Beca BHT-002 series, that have option for dry contact and can use Tuya Convert to put your favourite firmware onboard as they use an ESP8266 base with 1mb memory.
I got one for a heat only system and was surprised by just how easily it converted to an MQTT based thermostat.
That said, I still want to do a full DIY build myself option. The only thing is this premade one has a pretty high WAF as it can be used as a normal thermostat on the wall as well as integrated into HA and it looks good…

@Vasco If you need WAF you could buy a premade Tuya based thermostat then use Tuya Convert to put your favouriter MQTT based firmware on board, or if you dont mind a little soldering you could even flash them with ESPHome.