I guess it depends on your reasons for doing it.
Mechanical thermostats that use bi-metallic strips have built-in hysteresis because of the way they work and their lag in responding to changes. There is very little to go wrong, so are very reliable. We have one in our house that is over 25 years old and still works perfectly.
Obviously it can’t be used to turn the heating on/off remotely or set the temperature remotely.
Any system is only as good as it’s weakest part (which for a smart system includes the code it’s running) and the more components you have the greater the risk of failure.
I understand, I still want to try, since my goal is to learn, and I also see the advantage that in the event of a long power cut, a programmer based on esp8266 will reset itself on the PSTN time.
Can the RTC time be based on the server? in this way there is a power cut and a disconnection from the internet the program will restore the RTC time
Which library do you recommend for me to do this? (in 24 hour format)
Only always on in a power cut if you have a UPS big enough to keep it running.
If you’ve set the Pi up to synchronise to a NTP server and set the timezone correctly then it will synchronise when an internet connection becomes available, but you could do the same for your ESP device too.
No, not really.
Might be best to stick with the mechanical controller you already have.