Skip to content
Yurii edited this page Dec 1, 2026 · 9 revisions

OTGateway

English · Русский

OTGateway is ESP32 firmware that lets you control an OpenTherm appliance from a browser, Home Assistant or your own application. The ESP32 connects to the appliance through an OpenTherm adapter and to your home network over Wi-Fi or Ethernet.

OpenTherm connects two devices. The Master selects operating modes, sends target temperatures and requests data. The Slave accepts commands and replies to requests. OTGateway on the ESP32 takes the Master role. Any device that supports the OpenTherm Slave role can be connected. Its capabilities determine which functions are available.

Quick start

For a new board, we recommend starting with the latest release.

  1. Choose a supported ESP32 board and an OpenTherm adapter. Connect the board's GPIOs to the adapter and its OpenTherm terminals to the Slave device.
  2. Upload the firmware and its matching filesystem image to the ESP32.
  3. Basic settings covers network connection and web interface access.
  4. After checking the OpenTherm connection, you can continue with sensor setup and heating and DHW configuration.

Control and feedback

OTGateway communicates with the Slave device throughout normal operation. It sends heating and domestic hot water (DHW) requests, target temperatures (setpoints) and other control parameters over OpenTherm. Replies provide circuit status, sensor readings, fault information and limits reported by the Slave device.

You choose a temperature in the web interface or an application. With direct control, the controller sends your chosen flow setpoint to the Slave device. Weather compensation calculates the setpoint using outdoor temperature, while the PID controller uses indoor temperature. You can also combine the two.

Setpoints and Slave device replies are stored in ESP32 memory. This allows OpenTherm communication, regulation and network applications to run at the same time.

---
config:
  layout: dagre
  look: classic
  flowchart:
    diagramPadding: 8
    padding: 8
    minNodeWidth: 64
    wrappingWidth: 210
    nodeSpacing: 16
    rankSpacing: 20
    subGraphTitleMargin:
      top: 6
      bottom: 14
---
flowchart TB
    accTitle: OTGateway control and feedback
    accDescr: Apps read state and change settings over HTTP or through an MQTT broker. The ESP32 stores sensor readings and device replies in memory. It uses these readings and settings to calculate setpoints, apply protections and send commands through the OpenTherm adapter.

    apps["Browser and applications<br/>HTTP · MQTT through broker"]
    slave["OpenTherm Slave device"]

    subgraph esp["ESP32 with OTGateway"]
        exchange["Slave device communication"]
        data["Current state<br/>and readings in memory"]
        settings["Settings"]
        control["Regulation<br/>and protections"]

        exchange -->|Slave device replies| data
        data --> control
        settings --> control
        control -->|Setpoints and commands| exchange
    end

    slave <-->|OpenTherm through adapter| exchange
    sensors["ESP32 sensors"] --> data
    data -->|Read| apps
    apps -->|Change settings| settings
    classDef external fill:#87929f12,stroke:#808c99
    classDef internal fill:#388bfd16,stroke:#5989b7
    class apps,sensors,slave external
    class settings,data,control,exchange internal
    style esp fill:transparent,stroke:#808c99
Loading

Background tasks

Slave device communication, sensor readings and networking need different update intervals. The firmware divides this work into small background tasks (Task), organised into four groups.

  • OpenTherm handles bus communication. Its tasks send setpoints and circuit enables and read the Slave device's status, measurements and diagnostics.
  • Sensors reads ESP32 sensors, processes measurements and checks that they are up to date. It combines readings by purpose to provide indoor, outdoor and circuit temperatures.
  • App calculates setpoints, checks protections, saves settings and publishes MQTT data.
  • System maintains the network connection, monitors the ESP32 and performs maintenance, including device restarts.

Tasks within a group run in turn. Groups run independently and exchange results through shared data in memory. Each task uses the latest available values when it next runs.

A temperature reading can come from the Slave device, a wired or Bluetooth sensor connected to the ESP32, or another system. The sensor's purpose determines which calculations use its reading.

Settings, state and readings

Your selected modes, target temperatures, controller parameters, sensor configuration and network connection details are saved in flash memory. After a restart, OTGateway loads these settings and resumes operation with them.

Current state is held in RAM. For OTGateway, this includes calculated setpoints, circuit enables, protections and emergency mode status. For the Slave device, it includes reported heating and DHW activity, flame status, modulation and faults. RAM also holds the latest sensor readings.

When troubleshooting, you can compare OTGateway's request with the Slave device's response. The heating enable shows that the firmware allows the circuit to operate. Actual heating activity is reported by the Slave device itself.

After a restart, OTGateway polls its data sources again, recalculates setpoints and checks protection conditions.

Local network access

The built-in web interface is the main way to configure OTGateway. It opens in a browser at the ESP32's address. The Dashboard provides heating and DHW controls, status and readings.

Your applications can use two interfaces.

  • REST returns data in response to HTTP requests and accepts settings changes in JSON.
  • MQTT publishes data through the configured broker and accepts commands on control topics.

Background tasks poll the Slave device on their own schedule. REST returns the latest data held in memory, while MQTT sends it when publishing. Connection status shows whether a reading's source is available.

Standalone operation and integrations

OTGateway is a self-contained heating control system. A single device provides everything needed for standalone operation: controllers to maintain a comfortable temperature, plus overheating and freeze protection.

All control logic runs on the ESP32. With sensors connected to the ESP32 or boiler, it manages heating independently — Home Assistant, an MQTT broker and other external controllers are optional. If Home Assistant is unavailable, heating control continues. You always have local control through the controller's web interface!

For example, ESPHome's OpenTherm component provides a basis for a custom boiler control configuration. OTGateway has its controllers and protections built into the firmware: you can select the functions you need and set their parameters through the web interface.

Integration with smart home and other automation systems extends these capabilities: readings can come from other systems, which can also provide heating schedules and automations. For example, they can lower the temperature during unoccupied periods, warm the premises before the working day and coordinate heating with other devices. Regulation and protections continue to run independently.

Documentation

Section Pages
Installation Installation and updates
Hardware ESP32 boards, boilers, OpenTherm adapters
Configuration Basic settings, sensors, heating, DHW and controllers, protections and automation
Integrations MQTT, REST API, Home Assistant, HOMEd, WirenBoard
Troubleshooting Frequently asked questions, core dump analysis

Clone this wiki locally