Show HN: Levoit air purifier scolds me over Sonos like an angry mom when I smoke A developer released levoit-mom-mode, an open-source Python 3.12+ tool that polls Levoit air purifier PM2.5 readings through the VeSync cloud via pyvesync and, when particulate levels spike past a configurable PM25_THRESHOLD or PM25_DELTA, plays a scolding voice clip on a Sonos speaker. The clips are generated with Google's Gemini TTS model gemini-2.5-flash-preview-tts using the Kore voice and an acting prompt, in Turkish, English or any language set via --language, with fallbacks to Edge TTS and macOS say when offline. The script uses SoCo Snapshot to save and restore Sonos playback, caches audio in audio_cache/, enforces a COOLDOWN_SECONDS between scoldings, and adds support for newer purifiers such as the Eleva 300X (LAP-C341S-WEU) through direct deviceProp parsing. Your Levoit air purifier doesn't have a speaker—but your Sonos does. Whenever PM2.5 spikes in the room, this script uses Gemini TTS to scold you out loud over your Sonos speaker like an angry mom who literally just finished cleaning . Levoit Purifier ──► VeSync Cloud pyvesync ──► PM2.5 Spike Detector │ Sonos Speaker ◄── Local HTTP Audio Server ◄── Gemini TTS Kore + acting prompt - Angry Mom Voice Persona: Powered by Gemini TTS gemini-2.5-flash-preview-tts , voice Kore with expressive acting direction—supports Turkish tr , English en , or any language via --language . - Broad Levoit Support: Works with standard pyvesync air purifiers plus newer models not yet in pyvesync 's device map like the Eleva 300X / LAP-C341S-WEU via direct deviceProp parsing. - Smart Spike Detection: Triggers on either an absolute PM25 THRESHOLD or a sudden upward jump PM25 DELTA , with a configurable COOLDOWN SECONDS so it doesn't yell every 45 seconds. - Sonos Snapshot & Resume: Uses SoCo Snapshot to capture current Sonos state, play the scolding clip at your chosen volume, and restore playback afterward. - On-Demand Trigger & Custom Lines: Speak immediately with levoit-blame say or pass -s / --sentence to deliver any exact phrase. - Clip Caching & Offline Fallbacks: Caches generated audio in audio cache/ and automatically falls back from Gemini TTS → Edge TTS → macOS say if offline or unconfigured. - Python 3.12+ and uv https://docs.astral.sh/uv/ - macOS uses /usr/bin/afconvert and /usr/bin/afinfo for M4A conversion & duration inspection, plus say as the offline fallback - A Levoit smart air purifier connected to VeSync - A Sonos speaker on the same local network - A Google Gemini API key optional if you use --backend edge or --backend macos 1. Clone and install dependencies: git clone https://github.com/guneriu/levoit-mom-mode.git cd levoit-mom-mode uv sync 2. Create your .env file from .env.example : cp .env.example .env 3. Fill in your credentials in .env : - VESYNC EMAIL & VESYNC PASSWORD : Your VeSync mobile app email and password. Signed up with Google? VeSync doesn't provide a separate API key and pyvesync cannot use Google SSO directly. Log out of the VeSync mobile app, tap Forgot Password with the same Gmail address, and set a standalone VeSync password this does not change your Google password . - VESYNC COUNTRY CODE : Your VeSync account region US , DE , etc. . - GEMINI API KEY : Your Gemini API key for Gemini TTS. - SONOS IP : Optional—leave blank to auto-discover your Sonos speaker, or set its LAN IP. Check Sonos discovery read-only and live Levoit PM2.5 telemetry: uv run levoit-blame status --sonos-only uv run levoit-blame status Generate a TTS clip locally without playing on Sonos: uv run levoit-blame test-tts -l tr uv run levoit-blame test-tts -l en -s "I just cleaned it, why are you doing this? " Trigger an immediate scolding clip on Sonos say or test-sonos : Random angry Turkish mom line uv run levoit-blame say -l tr Random angry English mom line uv run levoit-blame say -l en Exact custom sentence uv run levoit-blame say -l en -s "I just cleaned it, why are you doing this? " uv run levoit-blame test-sonos -l tr -s "Ya daha yeni temizledim burayı " Simulate a PM2.5 spike end-to-end dry-run by default; add --play-sonos to play : uv run levoit-blame simulate --pm25 45 -l tr uv run levoit-blame simulate --pm25 45 -l en --play-sonos Run the continuous polling monitor: uv run levoit-blame run --dry-run uv run levoit-blame run -l tr uv run levoit-blame run -l en -s "I just cleaned it, why are you doing this? " | Variable | Default | Description | |---|---|---| | VESYNC EMAIL | "" | VeSync account email | | VESYNC PASSWORD | "" | VeSync account password | | VESYNC TIMEZONE | Europe/Berlin | IANA timezone | | VESYNC COUNTRY CODE | DE | VeSync account country code | | SONOS IP | "" | Sonos speaker IP blank = auto-discover | | SONOS VOLUME | 35 | Announcement volume 0–100 | | PM25 THRESHOLD | 20 | Trigger when PM2.5 reaches this value µg/m³ | | PM25 DELTA | 10 | Or trigger on a single-poll jump of this size | | POLL INTERVAL SECONDS | 45 | VeSync polling interval keep ≥ 30s to avoid rate limits | | COOLDOWN SECONDS | 300 | Minimum seconds between announcements | | TTS BACKEND | gemini | gemini , edge , or macos | | GEMINI API KEY | "" | Google Gemini API key | | TTS MODEL | gemini-2.5-flash-preview-tts | Gemini TTS model | | TTS VOICE | Kore | Voice name Kore , Gacrux , Algenib , Charon , etc. | | TTS LANGUAGE | tr | Default phrase & prompt language tr , en , or any code | | TTS STYLE PROMPT | Angry Turkish mom prompt | Custom acting direction prepended for Gemini TTS | | HTTP PORT | 8765 | Local HTTP port for serving clips to Sonos | Want to switch back to a grumpy uncle or try another vibe? Update .env : - Angry Mom default : TTS VOICE=Kore or Gacrux for a slightly more mature tone - Grumpy Uncle: TTS VOICE=Algenib deep/gravelly and customize TTS STYLE PROMPT uv run pytest -v