After part 1 and part 2, the controller runs the boiler for good. This part is about what works when the device runs day and night in a house that is supposed to be warm. Most of the bugs here were not bugs in the code in the strict sense. They were two sensible mechanisms that together did something stupid.
A head you can set…
The Danfoss Ally heads I had on the radiators only accept a target temperature and decide for themselves how far to open the valve. I describe my attempt to change that in a separate post about dead ends. The answer turned out to be the Sonoff TRVZB head, at about 100 zł. It has two settings: how far to open the valve when heating, and how far to close it when not. We got around its mechanism: set to X and 100 − X, they give a valve open at X%, whatever the head itself thinks about the temperature.
The motor’s travel was too short to time with a stopwatch, so I pointed a microscope at the pin of a radiator valve – I happened to have one at hand from a radiator I had removed from a room where I installed underfloor heating. The series from 0 to 100% came out monotonic and repeatable, and between 0 and 40% the pin moved about 15 pixels for every 5%. The head does not report where the valve really is, so the controller has to remember what it set.

A night at 19.7 °C
The first head to be swapped went into the children’s room. The controller calculated its opening proportionally: 0% at the target, 100% at a 0.4 K shortfall. A few days later the room sat all night at 19.7 °C with a target of 20.0. The valve got 70–80% and never more, because the shortfall was small. Meanwhile the system that lowers the water temperature decided the room “had headroom”, because the valve was below 85%. Nobody raised the water and nobody opened the valve. The app did show a “not reaching target” warning, except nobody reads it at night.

The fix, tightening: when the room is below target and not rising for 20 minutes, the valve gets +10%, then another +10% every 10 minutes, up to 100%. The next day it turned out tightening did not work with lowered water. It only counted the 20 minutes while the burner was running, and the burner ran for 15 minutes and waited 14. The window reset at every pause. We switched the timers from burner run time to an ordinary clock.
One small obstacle was left. The thermometer showed 19.83 °C, a 0.17 K shortfall, just under the 0.2 K threshold. The threshold went down to 0.1 K.
On 10 November all four radiators got Sonoffs. The head’s own thermometer sits next to the hot radiator: in the office it showed 24.9 °C while the room was at 20.0 °C. If the head went back to working on its own after a controller failure, it would close the valve in a cold room. That is why Home Assistant feeds the heads the temperature from the room thermometer. The evening with four Sonoffs looked different from the day before: 27 burner starts a day against 46, and the burner running 35% of the time against 64%. That day was disturbed by tests and swapping heads, so it is an observation, not a result.
The update that struck the module dumb
On the morning of 9 November a new firmware image stopped transmitting after an over-the-air update. Receiving worked, but not a single read or command went out on the bus: in 21 minutes, 0 successful reads and 356 failed ones. After a few minutes the watchdog script handed the boiler back to the factory vSMART. Going back to the previous day’s image restored transmitting straight away.
Then came the surprise. The same code built again, byte-for-byte identical apart from the timestamp, started transmitting 24 seconds after being flashed again. In the evening it happened once more, and reflashing helped again. The code was fine. The transmitter’s failure to start after an update is random, and we still don’t know why.
What this failure left behind is a procedure. After every update I first wait until my own register reads start succeeding (up to 90 seconds), and only then switch control on. If they don’t, I flash the image again or go back to the previous one. The test board won’t catch this, because it isn’t connected to the bus.
Two restarts in three minutes
On the evening of 16 November, the controller crashed and restarted twice, at 20:03 and around 20:06. The previous day’s fix should have worked, but another safety fuse got there first. The watchdog handed the boiler to vSMART after just 8 seconds, even though it was meant to tolerate 360 seconds precisely for a restart. With vSMART on the bus, the controller politely did not resume control after its restart. It is the same family of bugs as the valve stuck at 70%: two safety mechanisms, each correct on its own, blocked each other.

Along the way it came out that during its 11 hours vSMART had set the domestic hot water in the boiler to 55 °C. The boiler kept it there for a whole day against my setting of 45 °C, because the controller only sent the setting when a user changed it. Now it sends it after a restart and when control starts.
We don’t know what caused the three crashes on 15 and 16 November. Crash dumps were switched off in the firmware. Turning them on needed a new partition table, which can’t be changed over the network, so the firmware had to be flashed over a USB cable. The next crash will leave a trace.
Requirements for the board
Since 31 October the controller has been running on a breadboard. After two weeks we wrote down the requirements for a printed circuit board, and I settled the open decisions in a quarter of an hour: power from a USB-C charger, the ESP32-S3 module in sockets instead of soldered, SMD parts soldered by hand. The cheaper ESP32-C3 was ruled out, because without 8 MB of extra memory the firmware has only about 46 kB free.
The most important new element is a hardware transmit limit. A hung ESP with its transmit line held low would hold down the whole bus, and the boiler and the other controller would lose communication. The solution is a single 47 µF capacitor in series with the optocoupler’s LED: short bits pass unchanged, and a hung program lets go of the bus by itself after a few tens of milliseconds. The margin is smaller than it looks. At the end of the longest valid low state the LED still has about 5.9 mA, and it needs about 4.5 mA. For now that is only calculation. Before the board gets made, I’m building the whole controller again on a large breadboard and measuring it with an oscilloscope.

What I still don’t know
- Why the transmitter sometimes fails to start after an update.
- What causes the crashes on 15 and 16 November and the spontaneous restart on the night of 4 November.
- Why the boiler is so slow to raise its power.
- How much gas the controller saves compared with the 2024/25 season. That measurement has only just started.
The controller heats the house, but it isn’t finished. I describe the wall panel and the room sensor in separate posts.



Leave a comment