Dynamic fan speed controlled by CO2 Measurements

You don’t need to do that, you can more meaningfully compare your reading with a threshold also in ppm

What are the sleeps supposed to achieve? Neither the captured reading nor the threshold can change in that time.