How to start a fan when enclosure too hot

Hi,

I am using OctoPrint 1.11.2 with the Enclosure plugin + Ploty Temp Graph.
I have connected a DS18D20 (waterproof) to the PI and configured it. All working fine.
Now I want to add a fan that starts running when the temp in the enclosure becomes too high.
I know how to connect the fan to the Pi. But how can I make it start and stop depending on the temperature in the enclosure. Anyone that can point me in the right direction?

Thx

Marc Engrie