Maybe you're reinventing the wheel? I did what you're doing, but controlled a floor heater in my office - but the task is still the same... I struggled to get a rule to work perfectly...
then I implemented this:
I now connected my floor heater and my window AC and viola. PERFECT. My HD+ tiles are flawless - the app runs really nice. I will admit I tweaked it to take the safety feature down a notch but - then with this:
You can do the "mode" portion smoothly. Here's my thermo tile running this very second in my office hd+ display (and a couple other tiles I'm using):