Themostat heating and cooling automations

I just implemented my first climate component and I was about to start writing some automations for turning on heating or air conditioning as appropriate. But then I figured that somebody must have done this sort of thing before.

I’ve searched, of course, but I’ve only found automations for units that do solely heating. I have a heat pump that can heat, cool, and dehumidify, and I’m trying to control all of these states with automations.

Anybody have ideas or code to share?

I think what I’m going for is to be able to define a “Goldilocks” range of temperatures between which it’s neither heating nor cooling. Below the range, it’ll heat. And above the range, it’ll cool. With the exception of high humidity, in which case it’ll dehumidify.

If nobody has anything like this already, I guess I’ll start working on it.