How to keep switch on while sensor temp is high

I have an automation that turns on a fan when the temp is higher than a specific value. Works great.

What is the best way to turn that off, after the temp is lowered below that value?

Should I use a second automation? Or is there a way to combine them into a single automation?
Or is there a non-triggered way of monitoring the temp and determining whether to turn it on/off?

A second automation is easy to understand. Combining the two would require a service template that may not be, depending on your level of experience.

Make sure to add a bit of hysteresis (e.g. on at 20 degrees but off at 17 degrees) to prevent flapping (rapid on / off switching).