From 826cf8d8aab70a7111370d90ffd9266a08311cbc Mon Sep 17 00:00:00 2001 From: Home Assistant Version Control Date: Wed, 29 Jul 2026 15:50:05 +0000 Subject: [PATCH] .session_nest_snapshot_20260729.md --- .session_nest_snapshot_20260729.md | 42 ++++++++++++------------------ 1 file changed, 17 insertions(+), 25 deletions(-) diff --git a/.session_nest_snapshot_20260729.md b/.session_nest_snapshot_20260729.md index 32221c8..8d968ad 100644 --- a/.session_nest_snapshot_20260729.md +++ b/.session_nest_snapshot_20260729.md @@ -1,34 +1,26 @@ # Nest Snapshot Session — July 29, 2026 ## Goal -Capture still images from Nest cameras (Google Nest SDM API, `supported_features: 2` — streaming only) for AI (Ollama) analysis. +Capture still images from Nest cameras (Google Nest SDM API) for AI (Ollama) analysis. -## What Was Built +## What Was Built (Previous Session) +Custom integration `nest_snapshot` at `/homeassistant/custom_components/nest_snapshot/`: +- `manifest.json`, `services.yaml`, `__init__.py` +- Uses WebRTC (`aiortc`) to grab one video frame → saves as JPEG +- Test automation `automation.test_nest_snapshot_capture` -### Custom Integration: `nest_snapshot` -Location: `/homeassistant/custom_components/nest_snapshot/` +## What Was Fixed (This Session) +### Bug: `Nest integration data not available for camera.front_door_front_door` -3 files: -- **manifest.json** — domain `nest_snapshot`, depends on `nest`, no extra requirements -- **services.yaml** — `capture` service with `entity_id` (camera, required) and `filename` (template string, optional) -- **__init__.py** — Main logic: resolves Nest config entry → gets `CameraLiveStreamTrait` → creates `RTCPeerConnection` → generates SDP offer → calls `trait.generate_web_rtc_stream(offer_sdp)` → receives one `av.VideoFrame` → saves JPEG via PIL → cleans up +**Root cause:** The integration was written for an older Nest SDM API. In HA 2026.7: +1. Nest stores runtime data in `entry.runtime_data` (a `NestData` dataclass), **not** in `hass.data["nest"]` +2. Camera entity `unique_id` has a `-camera` suffix, but `device_manager.devices` is keyed by the raw Google device name -### Config Change -- `/homeassistant/configuration.yaml` — line `nest_snapshot:` appended at end - -### Test Automation -- **`automation.test_nest_snapshot_capture`** — manual trigger, calls `nest_snapshot.capture` on `camera.front_door_front_door` → `/media/nest_snapshot_test_{{ now().strftime('%Y%m%d_%H%M%S') }}.jpg` - -## Key Technical Details -- Nest cameras do NOT support `camera.snapshot`, `camera.record`, `camera.play_stream`, `camera.get_stream_source`, or `camera_proxy` — all return errors or placeholders -- Working approach: one-shot WebRTC stream via `google-nest-sdm` + `aiortc` inside HA's Python env -- `aiortc` and `PIL` are NOT available in this MCP add-on container — they live in HA's separate Python environment. All WebRTC/SDP handling runs inside HA. -- HA version: `2026.7.4` -- Primary test camera: `camera.front_door_front_door` -- Blink cameras work fine with `blink.trigger_camera` → `camera.snapshot` (separate flow) +**Changes in `__init__.py`:** +- Line 69: Replaced `hass.data.get(NEST_DOMAIN, {}).get(config_entry_id)` with `config_entry.runtime_data` +- Lines 78-81: Added `-camera` suffix stripping before device_manager lookup ## To Resume Testing -1. **Restart HA** — required for `nest_snapshot` component to load -2. Verify service `nest_snapshot.capture` appears in Developer Tools → Services -3. Trigger automation `automation.test_nest_snapshot_capture` (or call service manually) -4. Check `/media/` for output file (>10 KB = success, ~1-2 KB = placeholder) +1. **Restart HA** — required for custom component file changes to take effect +2. Trigger automation `automation.test_nest_snapshot_capture` or call `nest_snapshot.capture` on `camera.front_door_front_door` +3. Check `/media/` for output file (>10 KB = success, ~1-2 KB = placeholder)