Skip to content
Yurii edited this page Nov 25, 2026 · 5 revisions

MQTT

English · Русский

MQTT provides access to OTGateway and sensor state, settings and commands. OTGateway receives commands through the broker, validates them and uses them when controlling the OpenTherm Slave device.

The prefix is set under MQTT settings and represented by <prefix> in the tables. The default is otgateway_ followed by the ESP32 chip ID in hexadecimal.

Connection settings

MQTT can be enabled under Settings → MQTT settings, where the broker address, port and credentials are also set. The publish interval is 3–60 seconds, with a default of 5 seconds.

Home Assistant Discovery enables entity discovery in Home Assistant. Its discovery prefix defaults to homeassistant and is separate from the device prefix. See Home Assistant setup.

The discovery prefix accepts 1–32 bytes without +, # or a NUL character. Nested prefixes containing / are allowed.

Topic structure and access

Topic Access Meaning
<prefix>/status RO ESP's connection to the broker, online or offline
<prefix>/state/master/<path> RO Circuit states reported by OTGateway, calculated setpoints and combined sensor readings
<prefix>/state/slave/<path> RO OpenTherm link to the Slave device, its status, limits and diagnostics
<prefix>/settings/<path> RO Current value of a writable setting
<prefix>/settings/<path>/set WO Request a new value for that setting
<prefix>/sensors/<slug>/<field> RO Connection status or measurement for one configured sensor
<prefix>/sensors/<slug>/value/set WO Supply a measurement for an enabled MANUAL sensor
<prefix>/actions/<action>/set WO Request a restart, fault reset or diagnostic reset

RO is a topic you subscribe to for readings. WO is a topic you publish commands to. RW means you can read and change a value. Reading and writing use separate topics, as shown in the table.

Command payloads are plain text. Booleans are written as true or false, and numbers without quotes or unit symbols, for example 21.5. Numbers must be finite and use the units selected in OTGateway. The command topic limit is 128 bytes including the prefix, and the payload limit is 64 bytes.

State topics

All state topics are RO and refresh at the configured MQTT publish interval (3–60 seconds, default 5). <prefix>/status reports OTGateway availability. Its values are online and offline.

Note

Firmware publications use QoS 0. The broker last will announces offline at QoS 1. Fresh telemetry starts at least 30 seconds after the ESP reconnects. Retained values from the previous connection can arrive sooner.

Heating and domestic hot water (DHW) as reported by OTGateway

State topic (RO) Payload Meaning
<prefix>/state/master/heating/enabled Boolean OTGateway has enabled the heating circuit
<prefix>/state/master/heating/blocking Boolean Indoor temperature hysteresis is blocking heating
<prefix>/state/master/heating/smart_control Boolean true means the heating target is indoor temperature (PID, Equitherm or the Slave device's native weather compensation). false means the target is heating fluid temperature.
<prefix>/state/master/heating/overheat Boolean Heating overheat protection is active
<prefix>/state/master/heating/freezing Boolean Freeze protection is active
<prefix>/state/master/heating/target_temp Temperature Requested heating target
<prefix>/state/master/heating/setpoint_temp Temperature Setpoint calculated by OTGateway
<prefix>/state/master/heating/current_temp Temperature Average heating flow temperature
<prefix>/state/master/heating/return_temp Temperature Average heating return temperature
<prefix>/state/master/heating/indoor_temp Temperature Combined indoor sensor reading
<prefix>/state/master/heating/outdoor_temp Temperature Combined outdoor sensor reading
<prefix>/state/master/heating/min_temp Temperature Current lower limit for the heating target
<prefix>/state/master/heating/max_temp Temperature Current upper limit for the heating target
<prefix>/state/master/dhw/enabled Boolean OTGateway has enabled the DHW circuit
<prefix>/state/master/dhw/overheat Boolean DHW overheat protection is active
<prefix>/state/master/dhw/target_temp Temperature Requested DHW target
<prefix>/state/master/dhw/current_temp Temperature Average DHW temperature
<prefix>/state/master/dhw/return_temp Temperature Average DHW return temperature
<prefix>/state/master/dhw/min_temp Temperature Configured lower DHW target limit
<prefix>/state/master/dhw/max_temp Temperature Configured upper DHW target limit

Device connections and outputs

State topic (RO) Payload Meaning
<prefix>/state/master/network/connected Boolean ESP32 has a Wi-Fi or Ethernet network connection
<prefix>/state/master/network/connection_type Text wifi, ethernet, wifi-ap or none, for the currently selected network interface
<prefix>/state/master/network/rssi dBm Wi-Fi signal strength; interpret only when connection_type is wifi
<prefix>/state/master/emergency/state Boolean Emergency mode is active
<prefix>/state/master/ext_pump/state Boolean External pump is on
<prefix>/state/master/cascade_control/input Boolean Cascade control input state
<prefix>/state/master/cascade_control/output Boolean Cascade control output state
<prefix>/state/master/uptime Seconds Time since ESP32 startup

Slave device operating state

State topic (RO) Payload Meaning
<prefix>/state/slave/connected Boolean OTGateway is receiving OpenTherm replies from the Slave device
<prefix>/state/slave/flame Boolean Slave device reports flame on
<prefix>/state/slave/heating/active Boolean Slave device reports central heating active
<prefix>/state/slave/heating/min_temp Temperature Slave device's lower heating temperature bound
<prefix>/state/slave/heating/max_temp Temperature Slave device's upper heating temperature bound
<prefix>/state/slave/dhw/active Boolean Slave device reports DHW active
<prefix>/state/slave/dhw/min_temp Temperature Slave device's lower DHW temperature bound
<prefix>/state/slave/dhw/max_temp Temperature Slave device's upper DHW temperature bound
<prefix>/state/slave/cooling/active Boolean Slave device reports cooling active
<prefix>/state/slave/cooling/setpoint % Cooling control signal returned by the Slave device
<prefix>/state/slave/modulation/min % Minimum modulation reported by the Slave device
<prefix>/state/slave/modulation/max % Upper modulation limit returned by the Slave device when OTGateway writes the setting
<prefix>/state/slave/power/min kW Minimum power calculated from the reported maximum capacity and minimum modulation
<prefix>/state/slave/power/max kW Maximum capacity reported by the Slave device

Slave device identification and diagnostics

State topic (RO) Payload Meaning
<prefix>/state/slave/member_id Integer Member ID reported by the Slave device
<prefix>/state/slave/flags Integer Slave device configuration flags, as a byte
<prefix>/state/slave/type Integer Slave device type byte
<prefix>/state/slave/app_version Integer Slave device application version
<prefix>/state/slave/protocol_version Number OpenTherm protocol version
<prefix>/state/slave/fault/active Boolean Fault flag
<prefix>/state/slave/fault/code Integer Manufacturer's fault code
<prefix>/state/slave/fault/available Boolean OpenTherm is connected and a fault is active
<prefix>/state/slave/diag/active Boolean Diagnostic flag
<prefix>/state/slave/diag/code Integer Manufacturer's diagnostic code
<prefix>/state/slave/diag/available Boolean Diagnostic flag is set, or a fault is active with OpenTherm connected

Settings

Settings support reading and writing (RW). The tables list read topics. Writing uses the same topic with the /set suffix. For example, the DHW target is read from <prefix>/settings/dhw/target, and a new temperature is sent to <prefix>/settings/dhw/target/set.

OTGateway publishes accepted settings on their read topics after a change and every 10 MQTT publish intervals.

If a heating, DHW or emergency target is outside the allowed range, OTGateway substitutes the default for that mode and bounds it by the current limits.

You can configure the network, OpenTherm and sensors in the web interface. Programmatic changes to these settings are described in the REST API.

Heating

Read topic (RO) Payload What it controls
<prefix>/settings/heating/enabled Boolean Allow central heating
<prefix>/settings/heating/target Temperature Requested indoor or heating fluid temperature, depending on regulation mode
<prefix>/settings/heating/min_temp Temperature Minimum flow temperature
<prefix>/settings/heating/max_temp Temperature Maximum flow temperature
<prefix>/settings/heating/max_modulation 1–100% Upper limit on relative modulation for heating
<prefix>/settings/heating/turbo Boolean Enable turbo heating with PID or Equitherm
<prefix>/settings/heating/turbo_factor 1.5–10 Strength of the indoor temperature correction in turbo mode
<prefix>/settings/heating/hysteresis/enabled Boolean Use indoor temperature hysteresis to pause and resume heating
<prefix>/settings/heating/hysteresis/value 0–15 Distance on either side of the indoor target at which heating switches
<prefix>/settings/heating/indoor_temp_avg_type 0 / 1 / 2 Combine indoor readings using mean / minimum / maximum
<prefix>/settings/heating/outdoor_temp_avg_type 0 / 1 / 2 Combine outdoor readings using mean / minimum / maximum
<prefix>/settings/heating/overheat_protection/high_temp Temperature Temperature that triggers heating overheat protection. Writing 0 sets the upper threshold to low_temp.
<prefix>/settings/heating/overheat_protection/low_temp Temperature Temperature that clears heating overheat protection. A value of 0 disables this protection.
<prefix>/settings/heating/freeze_protection/low_temp Temperature Trigger freeze protection
<prefix>/settings/heating/freeze_protection/high_temp Temperature Clear freeze protection

Emergency mode

Read topic (RO) Value Controls
<prefix>/settings/emergency/target Temperature Target temperature in emergency mode

Domestic hot water

Read topic (RO) Payload What it controls
<prefix>/settings/dhw/enabled Boolean Allow domestic hot water heating
<prefix>/settings/dhw/target Temperature DHW target temperature
<prefix>/settings/dhw/min_temp Temperature Lower DHW target limit
<prefix>/settings/dhw/max_temp Temperature Upper DHW target limit
<prefix>/settings/dhw/max_modulation 1–100% Upper limit on relative modulation for DHW
<prefix>/settings/dhw/overheat_protection/high_temp Temperature Temperature that triggers DHW overheat protection. Writing 0 sets the upper threshold to low_temp.
<prefix>/settings/dhw/overheat_protection/low_temp Temperature Temperature that clears DHW overheat protection. A value of 0 disables this protection.

PID control

Read topic (RO) Payload What it controls
<prefix>/settings/pid/enabled Boolean Enable PID control
<prefix>/settings/pid/p_factor 0 < value ≤ 1000 Proportional gain
<prefix>/settings/pid/i_factor 0–100 Integral gain
<prefix>/settings/pid/d_factor 0–100000 Derivative gain
<prefix>/settings/pid/dt 30–1800 s Time between PID calculations, in whole seconds
<prefix>/settings/pid/min_temp Number Lower PID output limit
<prefix>/settings/pid/max_temp Number Upper PID output limit
<prefix>/settings/pid/deadband/enabled Boolean Use separate gains near the indoor target
<prefix>/settings/pid/deadband/threshold_high 0–5 Width of the deadband above the target
<prefix>/settings/pid/deadband/threshold_low 0–5 Width of the deadband below the target
<prefix>/settings/pid/deadband/p_multiplier 0–1 Multiply proportional gain inside the deadband
<prefix>/settings/pid/deadband/i_multiplier 0–1 Multiply integral gain inside the deadband
<prefix>/settings/pid/deadband/d_multiplier 0–1 Multiply derivative gain inside the deadband

Weather compensation (Equitherm)

Read topic (RO) Payload What it controls
<prefix>/settings/equitherm/enabled Boolean Enable weather compensation
<prefix>/settings/equitherm/slope 0.001–10 Slope of the heating curve
<prefix>/settings/equitherm/exponent 0.01 < value ≤ 2 Curvature of the heating curve
<prefix>/settings/equitherm/shift −15 to +15 Offset applied to the heating curve
<prefix>/settings/equitherm/target_diff_factor 0–10 Strength of the correction for the difference between the indoor target and the indoor reading

Units of measurement

Metric temperatures use °C, DHW flow uses L/min and pressure uses bar. In the imperial system these are °F, US gal/min and psi. Power is always in kW and modulation is a percentage. A setting write contains only the number.

Hysteresis, PID deadband and Equitherm shift keep their numeric values when units change. Standalone PID limits set the flow temperature range. With Equitherm, they limit the correction to the heating curve.

Actions

Action topics are WO. A true payload with retain off requests the action. false takes no action. The corresponding status can be checked after the next update.

Command topic (WO) What it does Where to check the result
<prefix>/actions/restart/set Schedules an ESP32 restart in 15 seconds <prefix>/state/master/uptime starts again after the restart
<prefix>/actions/reset_fault/set Queues a fault reset. OTGateway sends it when the Slave device is ready and reports an active fault <prefix>/state/slave/fault/active and <prefix>/state/slave/fault/code
<prefix>/actions/reset_diagnostic/set Queues a diagnostic reset. OTGateway sends it when the Slave device is ready and reports an active diagnostic flag <prefix>/state/slave/diag/active and <prefix>/state/slave/diag/code

Sensor topics

A sensor topic uses the slug derived from its name. For example, Heating return temp becomes heating_return_temp. The current slug is available through the sensor REST API. After a sensor is renamed, its subscriptions and the topic used to supply readings use the new slug.

Readings are published for enabled sensors with a name, type and purpose.

Topic Access Applies to Payload
<prefix>/sensors/<slug>/connected RO All publishing sensors true or false. A disconnected sensor may retain its last measurement
<prefix>/sensors/<slug>/value RO OpenTherm, OTGateway heating setpoint, Dallas, NTC, MANUAL Primary measurement in the sensor's units
<prefix>/sensors/<slug>/temperature RO Bluetooth, DHT11, DHT22 °C or °F
<prefix>/sensors/<slug>/humidity RO Bluetooth, DHT11, DHT22 Relative humidity, %
<prefix>/sensors/<slug>/battery RO Bluetooth Battery level, %
<prefix>/sensors/<slug>/rssi RO Bluetooth Radio signal strength, dBm
<prefix>/sensors/<slug>/signal_quality RO Bluetooth, Dallas, DHT11, DHT22 Signal quality, 0–100%
<prefix>/sensors/<slug>/value/set WO Enabled MANUAL sensors only Reading in the units for the sensor’s purpose. Zero is valid. OTGateway stores the number directly, without calibration or filtering

Sensor readings refresh on change and about every 5 minutes while unchanged.

Default sensor topics

The standard build supports up to 20 sensors. The table gives the default names and topics for IDs 0–10. IDs 11–19 are available for additional sensors. Each sensor in the table also publishes connected alongside value. The Dallas indoor sensor additionally publishes <prefix>/sensors/indoor_temp/signal_quality when enabled.

ID Default name Measurement topic (RO) Unit Enabled by default
0 Outdoor temp <prefix>/sensors/outdoor_temp/value °C or °F No
1 Indoor temp <prefix>/sensors/indoor_temp/value °C or °F No
2 Heating temp <prefix>/sensors/heating_temp/value °C or °F Yes
3 Heating return temp <prefix>/sensors/heating_return_temp/value °C or °F Yes
4 Heating setpoint temp <prefix>/sensors/heating_setpoint_temp/value °C or °F Yes
5 DHW temp <prefix>/sensors/dhw_temp/value °C or °F Yes
6 DHW flow rate <prefix>/sensors/dhw_flow_rate/value L/min or US gal/min Yes
7 Exhaust temp <prefix>/sensors/exhaust_temp/value °C or °F Yes
8 Pressure <prefix>/sensors/pressure/value bar or psi Yes
9 Modulation level <prefix>/sensors/modulation_level/value % Yes
10 Power <prefix>/sensors/power/value kW Yes

OTGateway calculates the heating setpoint and estimates power from modulation reported by the Slave device and the configured power range. The other measurements enabled by default depend on what the Slave device reports. <prefix>/state/slave/flame shows whether the burner is firing. Zero modulation is valid while the flame is on.

Examples

The commands use broker.domain as a placeholder for your broker address and otgateway_abcdef for the device prefix.

Follow a heating request over OpenTherm

This example sets a flow temperature of 50 °C. The published data lets you check the accepted setting, calculated setpoint and actual operation of the Slave device.

flowchart TD
    client["Your MQTT client"]
    device["OTGateway on ESP32"]
    slave["OpenTherm Slave device"]
    client -->|"Set target to 50 °C"| device
    device -->|"Request 50 °C flow"| slave
    slave -->|"Heating active, flow at 46.5 °C"| device
    device -->|"Target 50 °C, measured flow 46.5 °C"| client
Loading

1. Check both connections. Open a monitor in one terminal. The device publishes online on status when connected to the broker. Look for true on state/slave/connected as well before interpreting data from the Slave device.

mosquitto_sub -h broker.domain -v \
  -t 'otgateway_abcdef/status' -t 'otgateway_abcdef/state/slave/connected' \
  -t 'otgateway_abcdef/settings/heating/target' \
  -t 'otgateway_abcdef/state/master/heating/+' \
  -t 'otgateway_abcdef/state/slave/heating/active' \
  -t 'otgateway_abcdef/state/slave/flame' -t 'otgateway_abcdef/sensors/heating_temp/+'

2. Request a target. In the first terminal, find smart_control, min_temp and max_temp under state/master/heating. With smart_control = true, send the desired indoor temperature. In this example smart_control = false, so the command sets the heating fluid temperature. If you use metric units and the 50 °C you want is within the displayed limits, send the command from a second terminal.

mosquitto_pub -h broker.domain -t 'otgateway_abcdef/settings/heating/target/set' -m '50'

3. Compare the request and the result in the first terminal. Each topic updates independently.

What to check Topic Example value
What target did OTGateway accept? <prefix>/settings/heating/target 50 °C
What setpoint did OTGateway calculate? <prefix>/state/master/heating/setpoint_temp 50 °C
Does the Slave device report that heating is active? <prefix>/state/slave/heating/active true
Does the Slave device report a flame? <prefix>/state/slave/flame true
What is the measured flow temperature? <prefix>/sensors/heating_temp/value 46.5 °C

If the target changes while the burner stays idle, you can compare the heating request from OTGateway in state/master/heating/enabled with the activity the Slave device reports in state/slave/heating/active. Further details are in heating mode and circuit limits. The flow temperature reading is current when the sensor is connected: connected must be true.

Work with a sensor over MQTT

Read a physical sensor

Subscribe to <prefix>/sensors/heating_temp/+ to read the heating flow sensor's value and connection status. Its value is one measurement. <prefix>/state/master/heating/current_temp is the average of connected sensors assigned the heating-temperature purpose. Use <prefix>/sensors/+/connected to see which named sensors are reporting.

mosquitto_sub -h broker.domain -v -t 'otgateway_abcdef/sensors/heating_temp/+'

Supply a reading from another system

A new sensor can be configured in the web interface. For example, select Manual via MQTT/API, name the sensor Indoor probe, enable it and choose its purpose. Temperature exposes a generic reading. Indoor temperature includes it in the indoor temperature that OTGateway uses for heating.

For programmatic sensor creation, see the REST API example.

Subscribe in one terminal to receive the accepted reading and sensor connection status.

mosquitto_sub -h broker.domain -v \
  -t 'otgateway_abcdef/sensors/indoor_probe/value' \
  -t 'otgateway_abcdef/sensors/indoor_probe/connected'

Send a reading from another terminal. With metric units selected, this supplies 21.5 °C.

mosquitto_pub -h broker.domain -t 'otgateway_abcdef/sensors/indoor_probe/value/set' -m '21.5'

Once processed, the command sets value to 21.5 and connected to true. If the reading does not update, check that the sensor is enabled, uses the MANUAL type and has the slug indoor_probe.

Important

Send a reading more often than every 10 minutes. Repeating the same value keeps the MANUAL sensor connected.

Migration from firmware that published aggregate JSON is covered in the MQTT migration instructions.

Clone this wiki locally