{"slug": "show-hn-levoit-air-purifier-scolds-me-over-sonos-like-an-angry-mom-when-i-smoke", "title": "Show HN: Levoit air purifier scolds me over Sonos like an angry mom when I smoke", "summary": "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.", "body_md": "Your Levoit air purifier doesn't have a speaker—but your Sonos does.\n\nWhenever 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*.\n\n```\nLevoit Purifier ──► VeSync Cloud (pyvesync) ──► PM2.5 Spike Detector\n                                                         │\nSonos Speaker ◄── Local HTTP Audio Server ◄── Gemini TTS (Kore + acting prompt)\n```\n\n- **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` .\n- **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.\n- **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.\n- **Sonos Snapshot & Resume:** Uses`SoCo`` Snapshot` to capture current Sonos state, play the scolding clip at your chosen volume, and restore playback afterward.\n- **On-Demand Trigger & Custom Lines:** Speak immediately with`levoit-blame say` or pass`-s` /`--sentence` to deliver any exact phrase.\n- **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.\n\n- **Python 3.12+** and[`uv`](https://docs.astral.sh/uv/)\n- **macOS** (uses`/usr/bin/afconvert` and`/usr/bin/afinfo` for M4A conversion & duration inspection, plus`say` as the offline fallback)\n- A **Levoit** smart air purifier connected to**VeSync**\n- A **Sonos** speaker on the same local network\n- A **Google Gemini API key** (optional if you use`--backend edge` or`--backend macos` )\n\n1. \n**Clone and install dependencies:**\n\n```\ngit clone https://github.com/guneriu/levoit-mom-mode.git\ncd levoit-mom-mode\nuv sync\n```\n\n2. \n**Create your `.env` file from `.env.example`:**\n\n```\ncp .env.example .env\n```\n\n3. \n**Fill in your credentials in `.env`:**\n  - `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).\n  - `VESYNC_COUNTRY_CODE` : Your VeSync account region (`US` ,`DE` , etc.).\n  - `GEMINI_API_KEY` : Your Gemini API key for Gemini TTS.\n  - `SONOS_IP` : Optional—leave blank to auto-discover your Sonos speaker, or set its LAN IP.\n\nCheck Sonos discovery (read-only) and live Levoit PM2.5 telemetry:\n\n```\nuv run levoit-blame status --sonos-only\nuv run levoit-blame status\n```\n\nGenerate a TTS clip locally without playing on Sonos:\n\n```\nuv run levoit-blame test-tts -l tr\nuv run levoit-blame test-tts -l en -s \"I just cleaned it, why are you doing this?!\"\n```\n\nTrigger an immediate scolding clip on Sonos (`say` or `test-sonos`):\n\n```\n# Random angry Turkish mom line\nuv run levoit-blame say -l tr\n\n# Random angry English mom line\nuv run levoit-blame say -l en\n\n# Exact custom sentence\nuv run levoit-blame say -l en -s \"I just cleaned it, why are you doing this?!\"\nuv run levoit-blame test-sonos -l tr -s \"Ya daha yeni temizledim burayı!\"\n```\n\nSimulate a PM2.5 spike end-to-end (dry-run by default; add `--play-sonos` to play):\n\n```\nuv run levoit-blame simulate --pm25 45 -l tr\nuv run levoit-blame simulate --pm25 45 -l en --play-sonos\n```\n\nRun the continuous polling monitor:\n\n```\nuv run levoit-blame run --dry-run\nuv run levoit-blame run -l tr\nuv run levoit-blame run -l en -s \"I just cleaned it, why are you doing this?!\"\n```\n\n| Variable | Default | Description | \n|---|---|---|\n| `VESYNC_EMAIL` | `\"\"` | VeSync account email | \n| `VESYNC_PASSWORD` | `\"\"` | VeSync account password | \n| `VESYNC_TIMEZONE` | `Europe/Berlin` | IANA timezone | \n| `VESYNC_COUNTRY_CODE` | `DE` | VeSync account country code | \n| `SONOS_IP` | `\"\"` | Sonos speaker IP (blank = auto-discover) | \n| `SONOS_VOLUME` | `35` | Announcement volume ( `0–100` ) | \n| `PM25_THRESHOLD` | `20` | Trigger when PM2.5 reaches this value (µg/m³) | \n| `PM25_DELTA` | `10` | Or trigger on a single-poll jump of this size | \n| `POLL_INTERVAL_SECONDS` | `45` | VeSync polling interval (keep ≥ 30s to avoid rate limits) | \n| `COOLDOWN_SECONDS` | `300` | Minimum seconds between announcements | \n| `TTS_BACKEND` | `gemini` | `gemini` ,`edge` , or`macos` | \n| `GEMINI_API_KEY` | `\"\"` | Google Gemini API key | \n| `TTS_MODEL` | `gemini-2.5-flash-preview-tts` | Gemini TTS model | \n| `TTS_VOICE` | `Kore` | Voice name ( `Kore` ,`Gacrux` ,`Algenib` ,`Charon` , etc.) | \n| `TTS_LANGUAGE` | `tr` | Default phrase & prompt language ( `tr` ,`en` , or any code) | \n| `TTS_STYLE_PROMPT` | Angry Turkish mom prompt | Custom acting direction prepended for Gemini TTS | \n| `HTTP_PORT` | `8765` | Local HTTP port for serving clips to Sonos | \n\nWant to switch back to a grumpy uncle or try another vibe? Update `.env`:\n\n- **Angry Mom (default):**`TTS_VOICE=Kore` (or`Gacrux` for a slightly more mature tone)\n- **Grumpy Uncle:**`TTS_VOICE=Algenib` (deep/gravelly) and customize`TTS_STYLE_PROMPT`\n\n```\nuv run pytest -v\n```\n\n", "url": "https://wpnews.pro/news/show-hn-levoit-air-purifier-scolds-me-over-sonos-like-an-angry-mom-when-i-smoke", "canonical_source": "https://github.com/guneriu/levoit-mom-mode", "published_at": "2026-11-29 17:56:33+00:00", "updated_at": "2026-11-29 18:15:11.044441+00:00", "lang": "en", "topics": ["ai-tools", "generative-ai", "ai-products"], "entities": ["Levoit", "Sonos", "VeSync", "pyvesync", "Gemini TTS", "Google", "levoit-mom-mode", "Eleva 300X"], "also_reported_by": [], "takeaway": "The levoit-mom-mode CLI polls Levoit PM2.5 data via pyvesync, triggers on an absolute PM25_THRESHOLD or PM25_DELTA with a COOLDOWN_SECONDS gap, and generates speech with gemini-2.5-flash-preview-tts (Kore voice), falling back to Edge TTS then macOS say when offline.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/show-hn-levoit-air-purifier-scolds-me-over-sonos-like-an-angry-mom-when-i-smoke", "markdown": "https://wpnews.pro/news/show-hn-levoit-air-purifier-scolds-me-over-sonos-like-an-angry-mom-when-i-smoke.md", "text": "https://wpnews.pro/news/show-hn-levoit-air-purifier-scolds-me-over-sonos-like-an-angry-mom-when-i-smoke.txt", "jsonld": "https://wpnews.pro/news/show-hn-levoit-air-purifier-scolds-me-over-sonos-like-an-angry-mom-when-i-smoke.jsonld"}}