Overview
tempwatch is a Raspberry Pi service that monitors temperature — either from the National Weather Service API or a physical DS18B20 sensor — and triggers a spoken voice alert over a Sonos speaker when a threshold is crossed. A separate component publishes indoor and outdoor sensor readings over MQTT to a web dashboard with a historical chart.
Features
- Reads temperature from the NWS observation API or a wired DS18B20 sensor
- Threshold-based voice alerts synthesized with text-to-speech and played over Sonos
- Hysteresis logic to prevent repeated alerts from flapping near the threshold
- Configurable “waking hours” window that suppresses alerts at night
- Cooldown period between repeat alerts
- MQTT-based pipeline for indoor/outdoor sensor readings
- Web dashboard with live readings and 24-hour, weekly, and all-time historical views
- Runs as a systemd service for unattended operation on boot
How it works
Two services run on the Pi. One polls temperature on an interval, runs a small state machine with hysteresis and a cooldown timer to decide when to alert, then synthesizes a spoken message and pushes it to a Sonos speaker, saving and restoring whatever was already playing. The other publishes sensor readings over MQTT to a Flask dashboard backed by SQLite, which downsamples history to a fixed point count so the chart stays responsive regardless of the selected time range.