Also you can decouple the handling of ac and heat, and check the current state to prevent a redundant transition into the current state.
if (temp > max + error)
if (off (ac))
turn_on (ac);
if (temp < max - error)
if (on (ac))
turn_off (ac);
if (temp < min - error)
if (off (heat))
turn_on (heat);
if (temp > min + error)
if (on (heat))
turn_off (heat);