I was about to close this project as done but I was annoyed at the fact that the thermostat was still reading just a bit over the room temperature because of the heat that the ESP generates.
I gave the setup another thought and decided that it was better to cram a good old MAX232 instead of the WiFi-enabled mcu, I had 3 extra wires anyway and with a bit of effort, I can make them reach the Raspberry PI where Home Assistant and NodeRED are running. The encoder code stays the same, and I added some code to parse the serial input.
I also switched to an STM32 generic board, I would probably find better uses for the ESP board. I will keep both versions of firmware on GitHub for reference.
The heating is now working perfect with the much-more-colder STM32F103, right on time for spring when I don't need it.