Building my own HomeKit Thermostat
I've been running homemade HVAC control for 12 years now.  A few points:1. Have "can't fail" safeties.  In my case, that's the existing thermostat in parallel with the relay (so that the house can't freeze up if my system fails) and a second extra thermostat in series with it (so that if it fails stuck on, things won't overheat too badly).  The second safety thermostat can be out of the way, like in the basement.2. Assuming you live in a northern area and have a furnace that's less than a decade old, it may well be a two-stage (i.e. high and low heat mode) one set up for autostaging (run on low for 5 minutes, then fire up full blast) because the installers were too lazy to fish the extra wire to run a proper 2-stage thermostat.   My homemade system has a 0.3 degree Celsius difference between the low and high stage cut-in, plus some hysteresis to avoid short cycling, and it keeps the temperature wonderfully stable (within 0.2 degrees of the set point) with the furnace only ever switching to high if you turn up the temperature (on the very most brutally cold winter days it might run almost continuously on low).  At least here in Canada, installers have to leave the technical manual with the furnace, so you know which DIP switch or jumper to change to disable autostaging.3. Mechanical thermostats have something called an "anticipator" which slightly warms the sensing element as the furnace runs, so it tends to turn off below the set point.  This is to avoid overshoot. Digital thermostats do it in software by pulse width modulating the furnace enable as the temperature nears the set point.  In my case it's completely unnecessary to code this up - I guess the thermostat location is just perfect - but if you do get overshoot, just simulate it in software.4. AC units can be damaged by short-cycling and sure enough an early version of my system had a bug that caused this.  Luckily I noticed right away.  Now it's full of safeties like minimum run and rest times and probably much more conservative than a real thermostat.  Longer AC run times are better for dehumidification anyway.  I also enforce minimum run times on the furnace.