Repository navigation
WirenBoard
English · Русский
OTGateway connects to WirenBoard through MQTT. The ready-to-use wb-rules module creates a virtual device with heating and DHW controls, controller settings, states and sensor readings. One script can connect several OTGateway devices.
-
OTGateway uses the same MQTT broker as WirenBoard. The connection is configured in the OTGateway web interface under Settings → MQTT settings, with MQTT enabled and the broker's address, port and credentials saved. If the broker runs on WirenBoard, its address is the controller's network address. The Device prefix is shown in these settings.
-
The module ZIP archive contains
otgateway.js(view JS source). After extracting the archive, saveotgateway.jsto the/etc/wb-rules-modules/directory on WirenBoard. For example, download the file directly over SSH:wget -O /etc/wb-rules-modules/otgateway.js https://raw.githubusercontent.com/wiki/Laxilef/OTGateway/assets/wirenboard/otgateway.js
-
An
otgateway.jsscript with the example below can be created under Rules in the WirenBoard web interface. Its file will be stored at/etc/wb-rules/otgateway.js. Theotgateway_prefixvalue must match Device prefix in your OTGateway MQTT settings:var otgw = require("otgateway"); otgw.createDevice({ id: "boiler", name: "Boiler", prefix: "otgateway_prefix", sensors: otgw.defaultSensors });
-
After the script is saved, wb-rules loads it automatically, and the virtual device appears under Devices in WirenBoard. Fresh data starts arriving 30 seconds after OTGateway connects to the broker.
Important
The module requires OTGateway's metric units: °C, L/min, bar and kW. Imperial units require changes to the module's units, numeric ranges and steps.
The tables list control IDs for wb-rules. RW means the setting can be read and changed; RO means the state or reading is read only.
Available readings and command support depend on the Slave device. For example, not all boilers support a maximum modulation limit. Control modes and protections can be configured in the OTGateway web interface; details are in Heating and OpenTherm.
| Control | Access | Description |
|---|---|---|
heating_enabled |
RW | Heating enable setting in OTGateway |
heating_target_temp |
RW | Target temperature, °C. With direct control, the flow temperature; with PID, weather compensation or the Slave device's native weather compensation (native OTC), the indoor temperature |
heating_turbo |
RW | Turbo mode for faster warm-up with PID or weather compensation |
heating_hysteresis_enabled |
RW | Enable setting for heating hysteresis based on indoor temperature |
heating_hysteresis_value |
RW | Deviation from the indoor target used to pause and resume heating, °C |
heating_max_modulation |
RW | Maximum modulation limit during heating, % |
dhw_enabled |
RW | DHW enable setting in OTGateway |
dhw_target_temp |
RW | DHW target temperature, °C |
dhw_max_modulation |
RW | Maximum modulation limit during DHW operation, % |
Target temperature ranges in WirenBoard follow OTGateway's current limits.
| Control | Access | Description |
|---|---|---|
pid_enabled |
RW | PID enable setting |
pid_p_factor |
RW | P gain: response to the current difference between indoor temperature and its target |
pid_i_factor |
RW | I gain: accumulated correction to remove a persistent deviation from the target |
pid_d_factor |
RW | D gain: response to the rate of change of the difference between target and measured temperature |
pid_dt |
RW | PID calculation interval, seconds |
pid_min_temp |
RW | Lower PID output limit, °C |
pid_max_temp |
RW | Upper PID output limit, °C |
pid_deadband_enabled |
RW | Separate P, I and D multipliers within the deadband near the indoor target |
pid_deadband_p_multiplier |
RW | P gain multiplier within the deadband |
pid_deadband_i_multiplier |
RW | I gain multiplier within the deadband |
pid_deadband_d_multiplier |
RW | D gain multiplier within the deadband |
pid_deadband_threshold_high |
RW | Deadband width above the indoor target temperature, °C |
pid_deadband_threshold_low |
RW | Deadband width below the indoor target temperature, °C |
Without weather compensation, PID output limits set the flow temperature range. With weather compensation, they limit the correction to the heating curve. Values use whole degrees; a negative lower limit applies only with weather compensation.
| Control | Access | Description |
|---|---|---|
equitherm_enabled |
RW | Weather compensation enable setting |
equitherm_slope |
RW | Heating curve slope: how much the flow temperature rises as outdoor temperature falls |
equitherm_exponent |
RW | Heating curve curvature |
equitherm_shift |
RW | Offset to the calculated flow temperature, °C |
equitherm_target_diff_factor |
RW | Correction factor for the difference between indoor temperature and its target. Used with PID and Turbo off |
| Control | Access | Description |
|---|---|---|
heating_current_temp |
RO | Mean heating flow temperature, °C |
heating_return_temp |
RO | Mean heating return temperature, °C |
dhw_current_temp |
RO | Mean DHW temperature, °C |
dhw_return_temp |
RO | Mean DHW return temperature, °C |
heating_setpoint_temp |
RO | Calculated heating setpoint, °C. With native OTC, the indoor target temperature |
heating_indoor_temp |
RO | Combined temperature of sensors with the Indoor temperature purpose, °C |
heating_outdoor_temp |
RO | Combined temperature of sensors with the Outdoor temperature purpose, °C |
These are the values OTGateway uses for control. Individual readings are added through sensors as sensor_<name> controls; their configuration is described in the sensor section.
| Control | Access | Description |
|---|---|---|
heating_allowed |
RO | OTGateway permits heating, taking the current mode, hysteresis, protections and cascade input into account |
dhw_allowed |
RO | OTGateway permits DHW operation |
heating_active |
RO | The Slave device reports active heating |
dhw_active |
RO | The Slave device reports active DHW |
heating_blocking |
RO | Heating is temporarily blocked by hysteresis |
heating_smart_control |
RO |
true: the heating target is an indoor temperature; false: a flow temperature |
bus_state |
RO | OpenTherm connection between OTGateway and the Slave device |
flame |
RO | The Slave device reports a flame |
fault_active |
RO | The Slave device reports a fault |
fault_code |
RO | Slave device fault code; used with fault_active
|
diag_active |
RO | The Slave device reports a diagnostic event |
diag_code |
RO | Slave device diagnostic code; used with diag_active
|
uptime |
RO | Time since the ESP32 started, seconds |
heating_enabled, heating_allowed and heating_active show the setting, OTGateway's permission and Slave device activity respectively. For example, heating may be enabled in settings but temporarily blocked by hysteresis. The corresponding DHW controls are dhw_enabled, dhw_allowed and dhw_active.
| Control | Access | Description |
|---|---|---|
heating_overheat |
RO | Heating overheat protection is active |
heating_freezing |
RO | Freeze protection is active |
dhw_overheat |
RO | DHW overheat protection is active |
emergency_active |
RO | Emergency mode is using a fallback setpoint because a required temperature source is unavailable |
ext_pump_active |
RO | OTGateway has commanded the additional circulation pump on |
cascade_input |
RO | The cascade control input is active |
cascade_output |
RO | The cascade control output is active |
These indicators show the current state. Protection thresholds and emergency mode, pump and cascade control parameters can be configured in the OTGateway web interface.
otgw.createDevice(config) creates one virtual device and returns its wb-rules object.
| Parameter | Purpose |
|---|---|
id |
Required unique ID of the WirenBoard virtual device. Used in rules and MQTT topics /devices/<id>/...
|
name |
Required device display name |
prefix |
Required OTGateway MQTT prefix, matching Device prefix in its MQTT settings |
sensors |
Optional object containing sensor definitions. otgw.defaultSensors adds the standard set; without this parameter, individual sensors are not added |
disabledDefinitions |
Optional array of control names to exclude. By default, all controls and states are added |
id and prefix can differ. For example, a device with id: "boiler" can receive data from OTGateway with prefix: "otgateway_a1b2c3".
otgw.definitionPresets provides exclusion presets for common configurations:
| Preset | Controls excluded |
|---|---|
no_dhw |
DHW controls and states, DHW temperature and flow rate sensors |
no_pid |
PID settings, including deadband |
no_equitherm |
Weather compensation settings |
no_hysteresis |
Hysteresis settings |
no_extpump |
Additional pump state |
no_cascade |
Cascade input and output states |
no_internal_state |
Combined temperatures and internal OTGateway control states, ESP32 uptime |
direct_control |
Controls from no_internal_state, no_pid, no_equitherm, no_hysteresis, plus Turbo, emergency mode and the default calculated setpoint sensor |
native_otc |
Controls from no_internal_state, no_pid, no_equitherm, plus Turbo and the default calculated setpoint sensor. Hysteresis and emergency mode remain |
Presets can be combined with [].concat(...). Individual controls can also be excluded by name, for example:
disabledDefinitions: [].concat(
otgw.definitionPresets.no_extpump,
otgw.definitionPresets.no_cascade,
["sensor_exhaust_temp"]
)Note
Exclusion presets only change the contents of the WirenBoard virtual device. For example, direct_control does not enable direct control in OTGateway, and no_dhw does not disable DHW. The heating mode and parameters can be configured in the OTGateway web interface.
Each OTGateway needs its own createDevice() call with a unique id and MQTT prefix. For example, 2 devices using direct control, without an additional pump or cascade control; the second also has no DHW:
var otgw = require("otgateway");
otgw.createDevice({
id: "baxi_slim",
name: "Baxi Slim",
prefix: "baxi_slim",
disabledDefinitions: [].concat(
otgw.definitionPresets.direct_control,
otgw.definitionPresets.no_extpump,
otgw.definitionPresets.no_cascade
),
sensors: otgw.defaultSensors
});
otgw.createDevice({
id: "geffen",
name: "Geffen",
prefix: "geffen",
disabledDefinitions: [].concat(
otgw.definitionPresets.direct_control,
otgw.definitionPresets.no_dhw,
otgw.definitionPresets.no_extpump,
otgw.definitionPresets.no_cascade
),
sensors: otgw.defaultSensors
});The baxi_slim and geffen prefixes in the example must match the settings of the corresponding OTGateway devices. The exclusion presets in disabledDefinitions depend on the functions in use.
Note
The Geffen example includes otgw.definitionPresets.no_dhw because DHW is disabled in this boiler's service settings and the boiler is not physically connected to a DHW circuit.
otgw.defaultSensors contains all 11 default OTGateway sensors. For example, indoor_temp creates the sensor_indoor_temp control, which receives readings and connection status from the sensor's MQTT topics. An unused sensor's control can be excluded with disabledDefinitions, for example "sensor_indoor_temp".
Caution
Indoor temp and Outdoor temp are disabled by default. Sensors can be enabled and configured in the OTGateway Sensors settings, and their readings checked on the Dashboard.
The topic and attributes.available fields use the sensor's MQTT topics.
A key in sensors sets the WirenBoard control ID sensor_<key> and does not have to match the OTGateway sensor's slug. All topics in the definitions are relative to prefix.
A custom object can replace otgw.defaultSensors. For example, for a Bluetooth sensor named Living room:
var otgw = require("otgateway");
otgw.createDevice({
id: "boiler",
name: "Boiler",
prefix: "otgateway_prefix",
sensors: {
indoor_temp: {
cell: {
title: "Living room temperature",
type: "value",
value: 0,
units: "deg C"
},
topic: "sensors/living_room/temperature",
attributes: {
available: "sensors/living_room/connected"
}
},
indoor_humidity: {
cell: {
title: "Living room humidity",
type: "value",
value: 0,
units: "%"
},
topic: "sensors/living_room/humidity",
attributes: {
available: "sensors/living_room/connected"
}
}
}
});This adds 2 sensors instead of the default set. Their WirenBoard controls are sensor_indoor_temp and sensor_indoor_humidity.
The default set can be extended with custom sensors. This example adds a humidity reading from Living room to a copy of otgw.defaultSensors:
var otgw = require("otgateway");
var sensors = {};
Object.keys(otgw.defaultSensors).forEach(function(sensorId) {
sensors[sensorId] = otgw.defaultSensors[sensorId];
});
sensors.living_room_humidity = {
cell: {
title: "Living room humidity",
type: "value",
value: 0,
units: "%"
},
topic: "sensors/living_room/humidity",
attributes: {
available: "sensors/living_room/connected"
}
};
otgw.createDevice({
id: "boiler",
name: "Boiler",
prefix: "otgateway_prefix",
sensors: sensors
});All default sensor controls remain in WirenBoard, with sensor_living_room_humidity added as an extra control.
If a sensor is already connected to WirenBoard, its temperature can be supplied to OTGateway. For this connection, Indoor temp must be enabled in the OTGateway Sensors settings, with Manual via MQTT/API as its type and Indoor temperature as its purpose. The settings take effect after saving.
In a wb-rules script, a single reading is sent as follows:
publish("otgateway_prefix/sensors/indoor_temp/value/set", "21.5", 0, false);The rule supplies the sensor's current temperature instead of 21.5 and the OTGateway prefix instead of otgateway_prefix. Readings can be sent when the temperature changes and periodically, for example every 1 minute, while the source is available and its reading is current. Outdoor temperature uses Outdoor temp, the Outdoor temperature purpose and the sensors/outdoor_temp/value/set topic.
Important
The interval between transmissions must be less than 10 minutes, even if the temperature stays the same. Otherwise OTGateway marks the MANUAL sensor disconnected. Readings must be sent without retain; an unavailable source must not keep sending its last reading.
- If the device does not appear, the script can be checked under Rules and wb-rules messages under Settings → System log in WirenBoard. The module must be in
/etc/wb-rules-modulesand the script in/etc/wb-rules. - A control with a read error is highlighted in red under Devices in the WirenBoard web interface. This means OTGateway is unavailable over MQTT, no value has been received yet, the value is invalid or the sensor is disconnected. The last received value may still be displayed. MQTT status is available in the OTGateway web interface; topics can be checked under Settings → MQTT channels in WirenBoard.
-
bus_stateshows the OpenTherm connection. MQTT availability alone does not mean OTGateway is connected to the Slave device. - If a sensor's readings stop updating, its enabled state, name and type can be checked in the OTGateway web interface. The
topicandattributes.availablefields in the script must match that sensor's MQTT topics. - After updating the module, the script that imports it must be saved again.
English · Русский
