The `time.sleep` function cannot be stopped prematurely. This means
that when the program receives a signal indicating it should stop, it
will not be able to do so until the running `sleep` completes. This
means it could take up to 10 seconds for the process to stop.
A better way to handle the shutdown signal is to use a pipe. When the
signal is received, the write end of the pipe is closed. The event loop
will detect this immediately, as `select.select` returns as soon as any
event occurs on any of the polled file descriptors, or the timeout
expires.
The backlight on the CM3-PANEL cannot be controled with normal DPMS. Instead,
the brightness is set using PWM on GPIO pin 22. The
`thermostat.backlight` program runs as a background process to manage
the PWM duty cycle. It exposes a D-Bus service to allow other programs
to control the backlight. It also watches for *xscreensaver* events to
detect when the screen is blanked and disable the backlight.
https://www.acmesystems.it/CM3-PANEL-7-BASIC_backlight