ESP32 tasmota OpenTherm Thermostat
Today we will build a simple OpenTherm Wi-Fi thermostat using ESP8266 Thermostat Shield and Tasmota automation system
Tasmota binaries preparation
An ESP32 Tasmota binary with OpenTherm support enabled is needed.
We have built it, so you can grab firmware from here.
Alternatively, if you need some customizations - build your own with GitPod/Platformio, its pretty straightforward.
Upload tasmota firmware to the ESP32 device.
Initial configuration
After uploading ESP will create new WiFi access point named 'tasmota_XXXXXX-XXXX' for initial configuration
- Connect to the 'tasmota_XXXXXX-XXXX' WiFi network
- Navigate to 'http://192.168.4.1/'
- Scan for WiFi networks and select your home one
Now tasmota device should be connected to your home network. For further configuration you'll need its IP address. You can find it either in your home router or in serial monitor.
Module configuration
- Navigate to the address of your module (192.168.88.38 in our case)
- Go to Configuration -> Configure Module menu
-
In the Module parameters window, assign pins to the corresponding functions:
- GPIO18 as DS18x20 (to use built-in temperature sensor)
- GPIO21 as OpenTherm RX
- GPIO22 as OpenTherm TX
- Save settings and restart
For detailed explanation and some advanced configuration items please refer to the official documentation.
After completion all steps above you should be able to view current temperature and boiler status on your tasmota device page.
Automation
Now you can create a simple rule to set boiler target temp depending on the difference between room setpoint and actual temperature.
We will use a simple linear curve just for demo purpose. It will map 0 °C room temp difference to 35 °C boiler temp, and more than 3 °C room temp difference will be mapped to 75 °C boiler temp.
22.0 in line 3 is room setpoint. You can set it to a variable which will be updated by some other trigger, e.g. wall knob/encoder/button etc.
Rule1
ON DS18B20#Temperature DO Var1 %value% ENDON
ON DS18B20#Temperature DO Var2=(22.0-%Var1%)*13.0+35.0 ENDON
ON Var2#State >= 35.0 DO Var3=%Var2% ENDON
ON Var2#State >= 75.0 DO Var3=75 ENDON
ON Var2#State < 35.0 DO Var3=35.0 ENDON
ON Var3#State DO ot_tboiler %Var3% ENDON
Put all things together
- Use 2-pins screw terminal to connect ESP8266 Thermostat Shield to the boiler.
- Connect micro-USB power supply
Automation rules in action
You can observe a rules in action navigating to Console menu from module's main page