1
0
Fork 0
Commit Graph

4 Commits (e30e8aaedc81dde7ac279d48e24285a64dfb884a)

Author SHA1 Message Date
Dustin e30e8aaedc sensor: Add availability messages
Home Assistant can mark MQTT-based sensors as "unavailable" when it
receives a special message (`offline`) on a designated topic.  We send
an `online` message when the sensor process starts, and `offline` when
the process shuts down.  Additionally, we set the last will and
testament message to `offline` as well, so that Home Assistant will
still get the notification, even if the sensor does not shut down
cleanly.
2021-05-01 15:57:03 -05:00
Dustin 205989aefd sensor: Use pipe to interrupt loop
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.
2021-05-01 15:27:33 -05:00
Dustin 9503e87b4b Add backlight daemon
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
2021-04-30 08:24:14 -05:00
Dustin a64c749f18 Initial commit 2021-04-29 09:36:49 -05:00