Ventilation adapted to air quality