2.6 KiB
2.6 KiB
Nest Snapshot Session — July 29, 2026
Goal
Capture still images from Nest cameras (Google Nest SDM API) for AI (Ollama) analysis.
What Was Built
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
Bug Fixes Applied
Fix 1: Nest integration data not available
- Root cause: HA 2026.7 stores Nest runtime data in
config_entry.runtime_data(NestData dataclass), not inhass.data["nest"]. Camera entityunique_idhas-camerasuffix, butdevice_manager.devicesis keyed by raw Google device name. - Changes: Line 69:
config_entry.runtime_datainstead ofhass.data.get(...). Lines 78-81:-camerasuffix stripping before device_manager lookup. - Status: ✅ Fixed
Fix 2: aiortc module not installed
- Root cause:
aiortcandPillownot in manifest.json requirements. - Changes: Added
"requirements": ["aiortc", "Pillow"]to manifest.json. - Status: ✅ Fixed
Fix 3: SDP format — "Offer must contain audio, video and application m lines"
- Root cause: Only added video transceiver; Google needs audio + video + application in order.
- Changes: Added
pc.addTransceiver("audio", ...),pc.addTransceiver("video", ...),pc.createDataChannel(...). - Status: ✅ Fixed
Fix 4 (current): invalid literal for int() with base 10: 'udp'
- Root cause:
aiortcICE candidate parser expectscandidate:ID <int:component> udp ...but Google Nest API sendscandidate:ID udp ...(missing component number). - Attempt 1: Sanitize via
_sanitize_sdp()checkingparts[1].lower() == "udp"— didn't match actual format. - Attempt 2: Changed to
not parts[1].isdigit()— still failing. Possibly the line format isa=candidate:udp ...whereparts[0].split(':')[1]isudpandparts[1]IS a digit. - Current state: Added debug logging of raw SDP from Google. Need restart to see logs.
- Status: 🔴 In progress — add logging to see actual SDP format
File States
__init__.py— has_sanitize_sdp()withnot parts[1].isdigit()check + debug logsmanifest.json— has["aiortc", "Pillow"]requirementsservices.yaml— unchanged, definescaptureserviceAGENTS.local.md— restart rule added (must ask each time)
Pending Changes (committed but not tested after latest edit)
_sanitize_sdp()now usesnot parts[1].isdigit()(broader match)- Debug logging added for raw + sanitized SDP
- Need restart → test → check system log for SDP content