Feat: Add Nest Thermostat Voice Ability (with Full API Mocking)#161
Open
megz2020 wants to merge 7 commits intoopenhome-dev:devfrom
Open
Feat: Add Nest Thermostat Voice Ability (with Full API Mocking)#161megz2020 wants to merge 7 commits intoopenhome-dev:devfrom
megz2020 wants to merge 7 commits intoopenhome-dev:devfrom
Conversation
Contributor
✅ Community PR Path Check — PassedAll changed files are inside the |
Contributor
🔀 Branch Merge CheckPR direction: ✅ Passed — |
Contributor
✅ Ability Validation Passed |
Contributor
🔍 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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