Advanced ESPHome OpenTherm Thermostat with Self-Learning & Weather Compensation (Bosch Gaz 6000 W)

Hi everyone,

I’d like to share my project of an advanced DIY thermostat based on ESPHome and the OpenTherm protocol. It was specifically designed for the Bosch Gaz 6000 W boiler, but the logic is portable to most modulating gas boilers.

The main goal was to move beyond a simple on/off thermostat and create a system that rivals high-end commercial solutions like Nest or Tado, while remaining 100% local and cloud-free.

:hammer_and_wrench: Hardware

Wemos D1 mini (ESP8266).

Ihor Melnyk OpenTherm Shield.

BME280 sensor for local temperature/humidity fallback.

:rocket: Key Features

  1. Local PID Control: The temperature is regulated through a local PID Climate controller in ESPHome for smooth modulation and maximum comfort.

  2. Weather Compensation (Equithermic Curve): The PID output is dynamically capped based on the outdoor temperature (via HA weather integration), ensuring efficiency by running the boiler at the lowest possible supply temperature.

  3. Adaptive Night Mode (Self-Learning):

Inertia Tracking: The system measures how fast the house cools down (passive inertia) and heats up.

Dynamic Eco-Offset: Instead of a fixed temperature drop, it calculates an adaptive offset to maintain efficiency without letting the house get too cold.

Morning Preheat: Automatically calculates when to start heating (up to 4 hours in advance) based on current house dynamics so you wake up to a perfectly warm room.

  1. Learning Quality Gate: A safety script validates night measurements (checking night duration and burner activity) to ensure the self-learning coefficients remain accurate.

  2. Robust Fallback Logic: Prioritizes Home Assistant temperature sensors but automatically switches to the local BME280 if the connection is unstable for more than 10 seconds.

  3. Bosch-Specific Optimizations: Includes a “Soft Start” logic with a minimum supply temperature of 42°C and PID averaging to prevent short-cycling (tackling), which is critical for Bosch Gaz 6000 W longevity.

  4. Advanced Web UI: Utilizes Web Server v3 with custom entity grouping for real-time monitoring of PID parameters, calculations, and boiler diagnostics.

:clipboard: Diagnostics

The configuration maps low-level OpenTherm error codes directly to binary sensors (Low Water Pressure, Flame Fault, Air Pressure Fault, etc.), allowing for immediate notifications in Home Assistant.

:link: Repository

ESPHome-thermostat

I’ve spent quite some time fine-tuning the formulas and the “house passport” logic (EMA filtering for heating/cooling rates). I would love to hear your feedback or help anyone who’s looking to automate their Bosch or OpenTherm-compatible boiler!

Special thanks to the ESPHome team and Ihor Melnyk