Control ventilation system with dewpoint comparison


I have a variable dewpoint_inside and another dewpoint_out and my ventilation system is also controlable by home assistant (switch on, off, choose steps).

I now want to integrate a function, that when the dewpoint outside and inside reaches a certain level that it switches off the ventilation and on again if it is below a certain value.

How to solve that in home assistant the easiest way ? I thougt about a automation, that is for example triggered every 5 minutes that checks the conditions and switches the entities, but is this the right way ?

How would you do that ? Or is there even a module or integration that could do that ?

Greets Karl