Smart Home & IoTDocumentedScanned
nest-devices
Control Nest smart home devices (thermostat, cameras, doorbell) via the Device Access API.
Share:
Installation
npx clawhub@latest install nest-devicesView the full skill documentation and source below.
Documentation
Nest Device Access
Control Nest devices via Google's Smart Device Management API.
Setup
1. Google Cloud & Device Access
as an authorized redirect URI
5. Link your Nest account to the Device Access project
### 2. Get Refresh Token
Run the OAuth flow to get a refresh token:
__CODE_BLOCK_0__
### 3. Store Credentials
Store in 1Password or environment variables:
**1Password** (recommended):
Create an item with fields: project_id, client_id, client_secret, refresh_token
**Environment variables:**
__CODE_BLOCK_1__
## Usage
### List devices
__CODE_BLOCK_2__
### Thermostat
__CODE_BLOCK_3__
### Cameras
__CODE_BLOCK_4__
## Python API
__CODE_BLOCK_5__
## Configuration
The script checks for credentials in this order:
1. **1Password**: Set NEST_OP_VAULT and NEST_OP_ITEM (or use defaults: vault "Alfred", item "Nest Device Access API")
2. **Environment variables**: NEST_PROJECT_ID, NEST_CLIENT_ID, NEST_CLIENT_SECRET, NEST_REFRESH_TOKEN
## Temperature Reference
| Setting | Celsius | Fahrenheit |
|---------|---------|------------|
| Eco (away) | 15-17°C | 59-63°F |
| Comfortable | 19-21°C | 66-70°F |
| Warm | 22-23°C | 72-73°F |
| Night | 17-18°C | 63-65°F |
---
## Real-Time Events (Doorbell, Motion, etc.)
For instant alerts when someone rings the doorbell or motion is detected, you need to set up Google Cloud Pub/Sub with a webhook.
### Prerequisites
- Google Cloud CLI (gcloud) installed and authenticated
- Cloudflare account (free tier works) for the tunnel
- Clawdbot hooks enabled in config
### 1. Enable Clawdbot Hooks
Add to your clawdbot.json:
__CODE_BLOCK_6__
Generate a token: openssl rand -hex 24
### 2. Create Pub/Sub Topic
__CODE_BLOCK_7__
### 3. Link Topic to Device Access
Go to [console.nest.google.com/device-access]() → Your Project → Edit → Set Pub/Sub topic to:
__CODE_BLOCK_8__
### 4. Set Up Cloudflare Tunnel
__CODE_BLOCK_9__
Create ~/.cloudflared/config.yml:
__CODE_BLOCK_10__
Create DNS route:
__CODE_BLOCK_11__
### 5. Create Systemd Services
**Webhook server** (/etc/systemd/system/nest-webhook.service):
__CODE_BLOCK_12__
**Cloudflare tunnel** (/etc/systemd/system/cloudflared-nest.service):
__CODE_BLOCK_13__
Enable and start:
__CODE_BLOCK_14__
### 6. Create Pub/Sub Push Subscription
__CODE_BLOCK_15__
### 7. Test
__CODE_BLOCK_16__
### Supported Events
| Event | Behaviour |
|-------|-----------|
| DoorbellChime.Chime | 🔔 **Alerts** — sends photo to Telegram |
| CameraPerson.Person | 🚶 **Alerts** — sends photo to Telegram |
| CameraMotion.Motion | 📹 Logged only (no alert) |
| CameraSound.Sound | 🔊 Logged only (no alert) |
| CameraClipPreview.ClipPreview | 🎬 Logged only (no alert) |
> **Staleness filter:** Events older than 5 minutes are logged but never alerted. This prevents notification floods if queued Pub/Sub messages are delivered late.
### Image Capture
When a doorbell or person event triggers an alert:
1. **Primary:** SDM GenerateImage API — fast, event-specific snapshot
2. **Fallback:** RTSP live stream frame capture via ffmpeg (requires ffmpeg installed)
### Environment Variables
| Variable | Required | Description |
|----------|----------|-------------|
| CLAWDBOT_GATEWAY_URL | No | Gateway URL (default: ) |CLAWDBOT_HOOKS_TOKEN | Yes | Gateway hooks token for awareness notifications |
OP_SVC_ACCT_TOKEN | Yes | 1Password service account token for Nest API credentials |
TELEGRAM_BOT_TOKEN | Yes | Telegram bot token for sending alerts |
TELEGRAM_CHAT_ID | Yes | Telegram chat ID to receive alerts |
PORT | No | Webhook server port (default: 8420) |
Important Setup Notes
- Verify the full Pub/Sub topic path in Device Access Console matches your GCP project exactly:
projects/YOUR_GCP_PROJECT_ID/topics/nest-events - Use a push subscription, not pull — the webhook expects HTTP POST delivery
- Test end-to-end after setup: ring the doorbell and confirm a photo arrives. Don't rely on simulated POST requests alone.
Limitations
- Camera event images expire after ~5 minutes (RTSP fallback captures current frame instead)
- Real-time events require Pub/Sub setup (see above)
- Quick tunnels (without Cloudflare account) have no uptime guarantee
- Some older Nest devices may not support all features
- Motion and sound events are intentionally not alerted to avoid notification fatigue