The Enclosure plugin has a "cooler" controller. However, at the moment, you can only assign a controller to a GPIO temperature sensor. The ability to associate a controller with the heatbed temperature sensor would be a perfectly reasonable (and trivial) feature request.
In the meantime, the Enclosure plugin invokes a unique Python script corresponding to each type of temperature sensor (BME280.py, tmp102.py, ...). You could hack one of the existing scripts to return the heatbed temperature.
Edit: Refer to my comment below regarding the octoprint.comm.protocol.temperatures.received hook.
At the moment, an Enclosure plugin controller is only capable of controlling GPIO "regular" outputs. Again, I think it would be a perfectly reasonable feature request to control other types of outputs.
I'm using Enclosure plugin heater and cooler controllers to control filament dryer heating elements and fans (simply for circulation). I'm also using Enclosure plugin heater and cooler controllers to control an enclosure heater (Lasko compact space heater) and an HEPA / activated-carbon air purifier with a three-speed fan. All of the heaters, heating elements and fans are controlled via Qwiic I2C relays. Again, the Enclosure plugin controllers don't support I2C outputs. I wrote a simple plugin that "maps" GPIO outputs to I2C outputs. Of course, this technique could be used to map GPIO outputs to anything.
The Enclosure plugin controllers support several practical startup and shutdown options,
- Start with server - Choose if output should turn on automatically when octoprint starts
- Auto Startup - Choose if output should turn on automatically when print starts
- Auto Shutdown - Choose if output should turn off automatomatically when print finishes
I assume you'd like your fans to start automatically when the print finishes. I have a similar requirement with my air purifier. However, I'd prefer the air purifier simply run for a fixed (configured) period of time (e.g., 60 seconds to purge the air from the enclosure). Again, I think both options are perfectly reasonable feature requests.
Edit: @Dak0r has integrated the Enclosure plugin with the octoprint.comm.protocol.temperatures.received hook. The intension is for the Enclosure plugin to contribute the actual temperature and/or humidity of the configured sensors to the hook. However, with @Dak0r's integration, the hook makes the heatbed temperature available to the Enclosure plugin.