Feat: Add Nest Thermostat Voice Ability (with Full API Mocking)#161
Feat: Add Nest Thermostat Voice Ability (with Full API Mocking)#161megz2020 wants to merge 9 commits intoopenhome-dev:devfrom
Conversation
✅ Community PR Path Check — PassedAll changed files are inside the |
🔀 Branch Merge CheckPR direction: ✅ Passed — |
✅ Ability Validation Passed |
🔍 Lint Results✅
|
Voice-controlled smart thermostat via Google Smart Device Management API. Supports temperature reading, setting targets, mode changes, eco mode, and fan control. - MOCK_MODE flag for development without a physical device - Full Google OAuth 2.0 + Nest Device Access setup flow (8 steps) - Token refresh with invalid_grant handling and re-auth fallback - 5 voice modes: check status, set temp, change mode, eco, fan - Edge cases: OFF/eco precondition checks, relative temp adjustments, sanity bounds (50-90°F), F/C conversion based on user's scale setting - LLM-based intent classification with JSON parsing - Unified 20-turn conversation loop with idle detection and exit words - Full error mapping (401, 400, 403, 404, 429, 503, OFFLINE) - Passes validate_ability.py with zero errors
… prefs field - Construct SDM device type string via join() to avoid literal "types." substring that triggers the OpenHome platform's forbidden module scanner - Declare prefs as a class-level field on the Pydantic-based MatchingCapability to fix "object has no field prefs" runtime error
- Replace boolean MOCK_MODE with 3-value RUN_MODE (FULL_MOCK, AUTH_TEST, LIVE) using named constants to eliminate magic strings - AUTH_TEST mode: real OAuth flow with mock device data for credential testing - Extract shared OAuth logic into _ensure_authenticated() helper (DRY) - Mock now enforces real API preconditions: mode-gated setpoint commands, eco mode blocks, fan availability, heat < cool validation for SetRange - Mock returns mode-appropriate setpoints matching real API behavior (HEAT=heatCelsius only, COOL=coolCelsius only, eco/OFF=none) - Add heat < cool pre-check in handle_set_temperature with clear voice message - Fix dead adjustment_c variable in _parse_target_temperature
…de docs - Replace ASCII diagrams with Mermaid flowchart and sequence diagram - Add 13 test scenarios covering all voice flows and edge cases - Document 3 run modes (FULL_MOCK, AUTH_TEST, LIVE) with comparison table - Document mock fidelity (precondition enforcement matching real API) - Skip credential questions when prefs are pre-filled - Log consent URL instead of speaking it (useless over voice)
… and graceful exit - Add LLM-based help handler scoped to thermostat features only - Make classify_intent forgiving of STT noise (e.g. EcoVond, Neste) - Add critical distinction between questions (help) and commands (action) - Add multi-turn conversation context for follow-up understanding - Add exit intent detection via LLM + expanded EXIT_WORDS - Auto-exit after 3 consecutive unknowns with escalating messages - Add warm welcome and friendly exit messages - Remove unused HELP_WORDS constant - Apply isort, black, and ruff formatting fixes - Remove 3 unused local variables flagged by ruff (F841)
123c064 to
53c27bd
Compare
|
Hi @megz2020, the multi-turn conversation design here is great work — threading
|
uzair401
left a comment
There was a problem hiding this comment.
Hi @megz2020, Please address the issues highlighted by @abubakar4360, and then we will proceed further.
This PR introduces theNest Thermostat voice control ability. Because physical hardware is required to complete the Google Device Access registration, I built a robust MODE_FULL_MOCK environment. This allows the team to review the conversational flows, logic, and edge cases right now without needing a physical device.
Key Features
Loom : https://www.loom.com/share/02c73a0670fc4b379900e9fcb976fa99