I've done it in "pure" HA due to specific requirements and do not recommend it. Reliability has not been a problem but everything else was. You'd probably need a custom thermostat software component (as the HA built in one is limited), a wi-fi connected switch (like a Shelly), a high amp relay (if heating or controlling an AC due to startup load) and a low latency temp sensor (most have a 10+ minute delay or 2 degree F delay, I found Govee Bluetooth sensors to work well). Then you'd still probably want a remote control or a physical control panel/dashboard. The IR remotes for ACs are absurdly difficult to decipher (I never succeeded) and there's no good Zigbee remotes I found (the best I found is the Yolink remote but that's not local). Dashboards either involve running a browser on some LCD on a wall or an e-paper display wired to esp-home. Making a dashboard in esp-home is like going back 40 years as everything is individual graphic components drawn one by one. It might annoy you (like it did me) enough to build an svg bashed dashboard creator, a renderer on your HA box and then use a dead PR's remote image loading support in esp-home.
edit: The only positive about my approach is that I was able to build a custom "feel like" temperature curve that combines temp and humidity. So I no longer wonder all the time why I'm feeling cold or hot despite the thermostat being set to the same thing as last week.