Sleep disconnects animals from the external world, at considerable risks and costs that must be offset by a vital benefit. Insight into the nature of this mysterious benefit will likely come from understanding sleep homeostasis: to monitor sleep need, an internal bookkeeper must track physiological changes that are intimately linked to the core function of sleep. In Drosophila, a crucial component of the machinery for sleep homeostasis is a cluster of neurons innervating the dorsal fan-shaped body (dFB) of the central complex. Artificial activation of these cells induces sleep, whereas reductions in excitability cause insomnia. I will present evidence that homeostatic sleep control works by switching these sleep-promoting neurons between active and quiescent states. State switching involves the antagonistic modulation of two identified potassium conductances by the neuromodulator dopamine.