Getting rid of fungus gnats
Every autumn, when the plants come in from the balcony, small black flies follow them. These are fungus gnats. The adults are only annoying, but the larvae live in wet soil and can damage young roots.
The larvae need moist soil, so the first step is to let the top few centimeters of soil dry out between waterings. This alone reduces them a lot.
Yellow sticky traps catch the adults. Put them on a stick in the pot, close to the soil. They also show you how bad the problem is.
For a bad case, I use products with Bacillus thuringiensis israelensis (BTI). You mix it in the watering water. It kills the larvae and is safe for the plants.
A layer of coarse sand on top of the soil also helps, because the adults do not like to lay eggs in dry sand.