November 1, 2026Heating / Home Assistant
Diesel Heater: An ESP32-P4 Takes Over the Control Panel
ESP32-P4ESP-IDFLVGLBlue-WireDiesel HeaterTouchscreenMQTTHome Assistant
Safety notice — rebuild at your own risk
Rebuilds at your own risk. This description is a personal documentation, not a verified build guide — you have to verify suitability for your use case yourself.
Five Buttons and a Menu
The diesel heater is a budget Chinese model. It heats reliably, but it can only be operated through its original control panel: a small LCD, a few buttons, and the key settings such as pump and fan limits are hidden behind a coded menu. I can only see whether it is running, how warm it is, or if there is an error when I stand in front of it.
I wanted to control the heater on site, from my phone and in Home Assistant, using schedules and without a cloud.



The First Attempt Never Worked
I began working with ESPHome in October 2025. The plan was to use an ESP32 to listen on the bus, employing a custom lambda parser and two third-party GitHub components. It never worked, so I set it aside.
When I revisited the project in July, I first studied the protocol documentation in detail and compared it with my old code. Almost every assumption was incorrect. I had thought that frames beginning with 0x76 came from the control panel and those starting with 0x78 came from the heater. In reality, 0x76 and 0x78 only differentiate two types of control panels. The heater also replies with 0x76, and its response can only be distinguished by timing: it arrives within 10 ms of the panel's frame. Additionally, many values span two bytes instead of one, so none of my byte offsets were accurate.
The electrical side also posed problems. The bus operates at 5 V, while the ESP32 pins can only handle 3.3 V. Without level shifting, the signal was unreliable, and I did not have that hardware at the time.
A Test Bench First, Then the Firmware
The second attempt started on the opposite side rather than the control panel. A simple ESP32 emulates the heater: it replies to the original panel's frames exactly as a real heater would, including a simulated warm-up and temperature control. On 15 July the original panel accepted it without any error and acknowledged both start and stop. This proved the protocol was understood in both directions: 25,000 baud, 24-byte frames approximately every 300 ms, CRC-16/MODBUS checksum.
This emulator has been my test bench ever since. I could develop the firmware for the new control panel at my desk without any diesel flowing anywhere.
The control panel itself is an ESP32-P4 with a 4.3-inch touchscreen, 800 × 480 in landscape. I had ordered a Waveshare board, but what arrived was a Guition JC4880P443. I only noticed the mismatch when none of the pins from the Waveshare documentation matched, which cost me half an afternoon. The firmware is written in ESP-IDF and C, and the interface uses LVGL 9. The ready-made driver for the display controller stalled at boot because it reads the panel ID and the panel does not respond. I now send the roughly 40 initialization commands myself. ESP-IDF 5.4 could not handle the display either. It only worked with 5.5.5.



When the Control Panel Fails
The heater's electronics manage ignition, warm-up, and cooldown. The control panel merely issues commands like start, stop and the target temperature. In a later test I disconnected power from the P4 while the heater was running. My heater continued for a few minutes, then shut down in a controlled sequence with an afterglow phase and cooldown. When I powered the display back on during that sequence, it recognised and displayed the ongoing process. The heater was ready to start again afterwards. That is what I saw on my heater. I don't know whether other models behave the same way.
This leads to several firmware rules. When the panel restarts, it retrieves the last target temperature from memory, preventing the factory default from overriding it. It intentionally does not save whether the heater was on or off, because no one wants a unit that begins pumping diesel after a power outage. If the firmware section that communicates with the heater stalls for 20 seconds, the panel will restart, but no more than three consecutive times. That restart has never been triggered so far. A start command is issued only when a fresh reply is received from the heater.
Now there is a BSS138 level shifter between the bus and the ESP32, and the display has its own power supply.
What the Test Bench Did Not Know
In September I worked through the error codes and discovered that my web interface would have displayed a blinking red "Error E-01" while the heater was running normally. The heater reports 0 in the error byte for "no error, idle" and 1 for "no error, running." Only values 2 and above represent a real error, and the displayed code is the value minus one. My web interface treated every value other than 0 as an error.
No one noticed because my emulator always sends 0 in that byte. Consequently the test bench did not check the exact spot where the real heater differs during its first minute of operation. It now sends 1 while running, and errors appear in plain text on the display, from low voltage to flame out.
On 31 October the panel was connected to the real heater for the first time, in the garden. Before that I had to locate a bug in the UART initialization: one call in the wrong order disconnected the transmit line from the UART again in ESP-IDF 5.5.5. After correcting this, valid replies arrived: 12 V, standby, no error.
The first start failed. The heater preheated, the pump ran at 3.2 Hz, but the heat exchanger stayed around 10 °C for a long time. After about 242 seconds it reported a failed ignition attempt and tried again. I stopped it then. With the original panel on the same power supply it starts normally. The second start with my panel, with no settings changed, proceeded: ignition, warm-up, running, heat exchanger at 123 °C, pump at 5.2 Hz. However, the heat exchanger was already at 25 °C by that time. I do not yet know why the first attempt failed, so a cold start is not proven.
The next day brought another surprise: as soon as the heater was connected, the panel kept rebooting. Without the heater it ran fine. The cause was a stack overflow. I had increased the buffer for the JSON state from 1 to 2 kB, but it was still on the stack of the WebSocket task. With real readings, meaning numbers with decimals, the formatting required so much extra space that it no longer fit. That never happened in standby or with the emulator. The buffer now lives on the heap. The P4 has since been used on the real heater again, and that reboot loop did not recur in the subsequent tests.
Gentler Control, Estimated Consumption
During the garden test I lowered the target temperature and observed how the heater self-regulates. At an actual temperature of 12 °C and a target of 11 °C the frequency dropped from 5.2 to 1.6 Hz, and the fan speed fell from about 4,300 to 1,900 rpm. At 1.6 Hz the pump ticked evenly and warm air continued to flow. When the temperature returned to 11 °C while the target was 12 °C, the frequency jumped straight back to 5.2 Hz. A difference of just one degree is enough to trigger full power.
Now the thermostat mode offers a gentle control option. It spreads the output over a 4 °C range and adjusts the pump frequency by no more than 0.1 Hz every 10 seconds. At the target temperature the heater runs at low output instead of cycling on and off. The original control remains available. If all room sensors fail, the heater continues to run at a separately configured fixed frequency. This cannot maintain a room temperature and is not a replacement for monitored frost protection. The current version has since run on the real heater. I still need to see how the control behaves over a longer period.
I estimate fuel consumption from the pump frequency. Each pump stroke dispenses a small amount of diesel, and the default is 22 ml per 1,000 strokes. One hour at 1.6 Hz comes to about 0.13 litres. The default has not been measured for my pump yet, so this figure is an estimate. An HX711 tank scale can also report the gross weight of the tank. The panel subtracts the configured tare weight and calculates litres, tank level and remaining runtime at the current output. The scale now sends its readings straight to the P4, so Home Assistant is no longer needed for that.
The display and web interface can switch between German and English. The views labelled as demos come from a PC simulation of the original interface or from the web interface with simulated values. My own photographs, a web capture and videos of actual operation are now included as well.


3 November Update: The Tank Scale Talks Directly to the P4
My tank scale is an ESP8266 with an HX711 that used to run Tasmota. Before switching firmware, I backed up the full flash and checked the backup. The new firmware keeps the old calibration and sends the weight straight to the P4 over the local Wi-Fi. If MQTT is set up, the readings also go to Home Assistant, even while the P4 is off. Home Assistant lists the device with Bastelix-Lab as the manufacturer.
My tank holds 20 litres. The tank and fittings weigh about 1.3 kg together, and that has to be subtracted. With 8.64 kg on the scale, that leaves about 7.34 kg of diesel. At the configured density of 0.835 kg/l, that is roughly 8.8 litres. Tank size, tare weight and density are all adjustable.
Without a scale you can track the fuel by hand: set the tank size, enter the current contents and add each refill. A 5-litre canister then shows 100 percent just like my 20-litre tank. The estimated consumption is subtracted as it runs. Below five percent, the P4 blocks new starts and priming. It does not stop a heater that is already running. If no valid fuel level is known at all, starting stays blocked too.
The scale throws away unsettled readings. If I push against the canister, a dash shows up instead of a weight for a moment and Home Assistant reports the value as unavailable. Only a stable reading gets accepted again.
Viewing Consumption Separately from Settings
On a desktop, the web interface now uses more of the screen width, while the phone layout stays as compact as before. On the main page, "View consumption" opens its own window with consumption and tank data. Tank size, scale, tare weight and pump delivery are still in the "Tank & consumption" settings tab.
The consumption counter starts with the heater, not with the display. If valid replies from the heater are missing, the interface shows dashes for the affected values. Before, it simply kept the last heat exchanger temperature, which looked like a current reading. The built-in temperature and humidity sensor is sent over MQTT regardless of which room sensor is selected.
The two views below come from the current web interface, and the values in them are simulated.


Home Assistant Can Run the Heater, Updates Go over Wi-Fi
With MQTT, a Home Assistant automation can start and stop the heater through the discovered climate entity and set the target temperature. So Home Assistant can take over deciding when to heat. The P4 schedules then stay off. Ignition, gentle control and the controlled cooldown are still handled by the controller and the heater. The low-fuel lock applies to Home Assistant starts as well. And stopping does not just cut the power supply.
The P4 and the scale ESP can now be updated over Wi-Fi. For the last P4 update, only the heater's power supply was on, and the heater itself stayed off. After the update I spent a little over three minutes checking the bus, MQTT, tank scale and settings, among other things. The bus capture showed no start or priming command. That was an update and idle test, not another heating run.
A comment on Reddit added one more point: flash writes can briefly interrupt the picture on a DSI display. So CACHE_SAFE is now enabled and the LVGL integration has been adjusted to match. I build changes like that and check memory use afterwards. The scale also ran for six minutes with valid readings and without free memory dropping steadily. That still doesn't replace a test running for several days.
Footage from the Real Installation
I took these during my tests in the garden. In the photo the P4 shows cooldown, and the web interface reports the heater running. The two short videos show preheating and warm-up on the real display. Nothing here is simulated. They only cover single operating phases, though, not complete cold-start or endurance tests. I compressed the clips for the website and removed the sound.


What Comes Next
Repeatable cold-start tests, longer testing of gentle control and a multi-day endurance run remain on the list. I also need to measure the pump output so the consumption estimate better matches my installation. During an older test, the voltage reported over the bus dropped after cooldown and replies subsequently stopped, even though the power supply and cable remained connected. A later stop test completed normally with stable replies and around 12 V. That does not yet explain the earlier failure.
More technical details about this project:
View Project →Mike Sobczinski
Trained in automation and computer technology, working full-time in the semiconductor industry. Builds IoT solutions with ESP32, LoRa, and Home Assistant — from firmware to dashboard.
Learn more →

