✓ Verified 💻 Development ✓ Enhanced Data

Nest Sdm

Control Nest thermostat, doorbell, and cameras via the Google Smart Device Management (SDM) API.

Rating
5 (374 reviews)
Downloads
1,100 downloads
Version
1.0.0

Overview

Control Nest thermostat, doorbell, and cameras via the Google Smart Device Management (SDM) API.

Complete Documentation

View Source →

Nest SDM Skill

Control and monitor Google Nest devices via the Smart Device Management REST API.

Setup

Prerequisites

  • Device Access Console — Register at https://console.nest.google.com/device-access ($5 one-time fee)
  • GCP Project — Create at https://console.cloud.google.com with SDM API enabled
  • OAuth Client — Web application type with https://www.google.com as redirect URI
  • SDM scope — Add https://www.googleapis.com/auth/sdm.service to OAuth consent screen

First-time Authorization

  • Build the authorization URL:
text
https://nestservices.google.com/partnerconnections/<PROJECT_ID>/auth?redirect_uri=https://www.google.com&access_type=offline&prompt=consent&client_id=<CLIENT_ID>&response_type=code&scope=https://www.googleapis.com/auth/sdm.service
  • Open in browser, sign in as the device owner Google account
  • Enable ALL device permissions, click Next, then Continue through consent
  • Copy the code= parameter from the redirect URL
  • Exchange for tokens:
bash
curl -s -X POST https://oauth2.googleapis.com/token \
  -d "client_id=<CLIENT_ID>" \
  -d "client_secret=<CLIENT_SECRET>" \
  -d "code=<AUTH_CODE>" \
  -d "grant_type=authorization_code" \
  -d "redirect_uri=https://www.google.com"
  • Save tokens to the config file (see Configuration below)

Configuration

Create ~/.openclaw/workspace/.nest-sdm-tokens.json:

json
{
  "client_id": "<your-client-id>",
  "client_secret": "<your-client-secret>",
  "project_id": "<device-access-project-id>",
  "refresh_token": "<your-refresh-token>",
  "token_type": "Bearer",
  "scope": "https://www.googleapis.com/auth/sdm.service"
}
Secure it: chmod 600 ~/.openclaw/workspace/.nest-sdm-tokens.json

CLI Usage

bash
# Alias for convenience
alias nest="<skill-dir>/nest-sdm.sh"

Device Discovery

bash
nest devices                    # List all devices (JSON)
nest structures                 # List structures/rooms

Thermostat

bash
nest thermostat                 # Current status (temp, humidity, mode, setpoints)
nest set-cool <°F>              # Set to COOL mode at temperature
nest set-heat <°F>              # Set to HEAT mode at temperature
nest set-range <low°F> <high°F> # Set HEATCOOL range
nest set-mode <MODE>            # HEAT | COOL | HEATCOOL | OFF
nest set-eco <MODE>             # MANUAL_ECO | OFF
nest fan-on [duration_seconds]  # Turn fan on (default: 900s / 15min)
nest fan-off                    # Turn fan off

Doorbell & Cameras

bash
nest doorbell                   # Doorbell info & capabilities
nest display                    # Kitchen display info
nest camera-stream <DEVICE_ID>  # Generate WebRTC live stream (returns SDP answer)
nest camera-image <EVENT_ID>    # Get event snapshot URL

Raw API

bash
nest api GET devices                              # Raw device list
nest api GET devices/<DEVICE_ID>                  # Single device
nest api POST devices/<DEVICE_ID>:executeCommand '{"command":"...","params":{...}}'

Supported Devices

TypeTraitsControl
THERMOSTATTemperature, Humidity, Mode, Eco, Fan, HVAC, Setpoint, ConnectivityFull read/write
DOORBELLLiveStream, CameraImage, Person, Motion, Chime, EventImage, ClipPreviewRead + stream
DISPLAYLiveStream, CameraImage, Person, Sound, Motion, EventImageRead + stream

SDM API Commands Reference

Thermostat Commands

CommandParams
ThermostatMode.SetMode{"mode": "HEAT\COOL\HEATCOOL\OFF"}
ThermostatTemperatureSetpoint.SetHeat{"heatCelsius": }
ThermostatTemperatureSetpoint.SetCool{"coolCelsius": }
ThermostatTemperatureSetpoint.SetRange{"heatCelsius": , "coolCelsius": }
ThermostatEco.SetMode{"mode": "MANUAL_ECO\OFF"}
Fan.SetTimer{"timerMode": "ON", "duration": "s"}

Camera Commands

CommandParams
CameraLiveStream.GenerateWebRtcStream{"offerSdp": ""}
CameraLiveStream.StopWebRtcStream{"mediaSessionId": ""}
CameraLiveStream.ExtendWebRtcStream{"mediaSessionId": ""}
CameraEventImage.GenerateImage{"eventId": ""}

Pub/Sub Real-Time Events

Get instant alerts for doorbell presses, motion, person detection, and device state changes.

CLI: nest-events

bash
nest-events setup-check         # Verify Pub/Sub config is ready
nest-events create-topic        # Create GCP Pub/Sub topic
nest-events grant-permissions   # Grant SDM publisher role
nest-events create-subscription # Create pull subscription
nest-events poll                # Pull events once
nest-events listen              # Poll continuously (daemon)

Setup Steps

  • OAuth with Pub/Sub scope — Run OAuth flow as [email protected] with pubsub + cloud-platform scopes. Save tokens to .nest-pubsub-tokens.json.
  • Create topicnest-events create-topic (creates projects/YOUR_GCP_PROJECT/topics/nest-sdm-events)
  • Grant permissionsnest-events grant-permissions (adds [email protected])
  • Create subscriptionnest-events create-subscription
  • Enable in Device Access Console — https://console.nest.google.com/device-access → Enable Pub/Sub → Enter topic ID
  • Trigger initial eventsnest devices (one-time API call)
  • Start listenernest-events listen

Event Types Supported

EventAlert
DoorbellChime.Chime🔔 DOORBELL — Someone rang!
CameraPerson.Person👤 Person detected at device
CameraMotion.Motion🏃 Motion at device
CameraSound.Sound🔊 Sound at device
ThermostatHvac status change❄️/🔥 HVAC now COOLING/HEATING
ThermostatTemperatureSetpoint🌡️ Setpoint changed
Temperature trait🌡️ Ambient temperature change

Configuration

Environment Variables:

VariableDescriptionDefault
NEST_PUBSUB_TOKENSPath to Pub/Sub OAuth tokens~/.openclaw/workspace/.nest-pubsub-tokens.json
TELEGRAM_BOT_TOKENBot token for alertsfrom ~/.zshenv
TELEGRAM_CHAT_IDUser/chat ID for alertsfrom ~/.zshenv
POLL_INTERVALSeconds between polls10
GCP_PROJECTGCP project IDYOUR_GCP_PROJECT
PUBSUB_TOPICTopic namenest-sdm-events
PUBSUB_SUBSCRIPTIONSubscription namenest-sdm-events-sub

Event Logs

Raw events are logged to data/nest-events/events-YYYY-MM-DD.jsonl.

Alert Dedup

Same event type won't re-alert within 60 seconds to prevent alert fatigue.

Important Notes

  • Token expiry: If the GCP app is in "testing" mode, refresh tokens expire in 7 days. Publish the app to avoid re-auth.
  • Temperature: API uses Celsius internally. The CLI handles F↔C conversion.
  • Setpoint constraints: HEATCOOL range must have at least 1.5°C (2.7°F) gap between heat and cool setpoints.
  • Camera streams: WebRTC only (no RTSP). Requires SDP offer/answer exchange.
  • Rate limits: 10 queries/min per device, 10 commands/min per device.
  • Events: Use nest-events listen for real-time alerts. Requires Pub/Sub setup (see above).

Installation

Terminal bash

openclaw install nest-sdm
    
Copied!

💻Code Examples

5. Exchange for tokens:

5-exchange-for-tokens.sh
curl -s -X POST https://oauth2.googleapis.com/token \
  -d "client_id=<CLIENT_ID>" \
  -d "client_secret=<CLIENT_SECRET>" \
  -d "code=<AUTH_CODE>" \
  -d "grant_type=authorization_code" \
  -d "redirect_uri=https://www.google.com"

Create `~/.openclaw/workspace/.nest-sdm-tokens.json`:

create-openclawworkspacenest-sdm-tokensjson.json
{
  "client_id": "<your-client-id>",
  "client_secret": "<your-client-secret>",
  "project_id": "<device-access-project-id>",
  "refresh_token": "<your-refresh-token>",
  "token_type": "Bearer",
  "scope": "https://www.googleapis.com/auth/sdm.service"
}

nest api POST devices/<DEVICE_ID>:executeCommand '{"command":"...","params":{...}}'

nest-api-post-devicesdeviceidexecutecommand-commandparams.txt
## Supported Devices

| Type | Traits | Control |
|------|--------|---------|
| THERMOSTAT | Temperature, Humidity, Mode, Eco, Fan, HVAC, Setpoint, Connectivity | Full read/write |
| DOORBELL | LiveStream, CameraImage, Person, Motion, Chime, EventImage, ClipPreview | Read + stream |
| DISPLAY | LiveStream, CameraImage, Person, Sound, Motion, EventImage | Read + stream |

## SDM API Commands Reference

### Thermostat Commands
| Command | Params |
|---------|--------|
| `ThermostatMode.SetMode` | `{"mode": "HEAT\|COOL\|HEATCOOL\|OFF"}` |
| `ThermostatTemperatureSetpoint.SetHeat` | `{"heatCelsius": <float>}` |
| `ThermostatTemperatureSetpoint.SetCool` | `{"coolCelsius": <float>}` |
| `ThermostatTemperatureSetpoint.SetRange` | `{"heatCelsius": <float>, "coolCelsius": <float>}` |
| `ThermostatEco.SetMode` | `{"mode": "MANUAL_ECO\|OFF"}` |
| `Fan.SetTimer` | `{"timerMode": "ON", "duration": "<seconds>s"}` |

### Camera Commands
| Command | Params |
|---------|--------|
| `CameraLiveStream.GenerateWebRtcStream` | `{"offerSdp": "<SDP offer>"}` |
| `CameraLiveStream.StopWebRtcStream` | `{"mediaSessionId": "<id>"}` |
| `CameraLiveStream.ExtendWebRtcStream` | `{"mediaSessionId": "<id>"}` |
| `CameraEventImage.GenerateImage` | `{"eventId": "<event-id>"}` |

## Pub/Sub Real-Time Events

Get instant alerts for doorbell presses, motion, person detection, and device state changes.

### CLI: `nest-events`
example.sh
nest thermostat                 # Current status (temp, humidity, mode, setpoints)
nest set-cool <°F>              # Set to COOL mode at temperature
nest set-heat <°F>              # Set to HEAT mode at temperature
nest set-range <low°F> <high°F> # Set HEATCOOL range
nest set-mode <MODE>            # HEAT | COOL | HEATCOOL | OFF
nest set-eco <MODE>             # MANUAL_ECO | OFF
nest fan-on [duration_seconds]  # Turn fan on (default: 900s / 15min)
nest fan-off                    # Turn fan off
example.sh
nest doorbell                   # Doorbell info & capabilities
nest display                    # Kitchen display info
nest camera-stream <DEVICE_ID>  # Generate WebRTC live stream (returns SDP answer)
nest camera-image <EVENT_ID>    # Get event snapshot URL
example.sh
nest api GET devices                              # Raw device list
nest api GET devices/<DEVICE_ID>                  # Single device
nest api POST devices/<DEVICE_ID>:executeCommand '{"command":"...","params":{...}}'
example.sh
nest-events setup-check         # Verify Pub/Sub config is ready
nest-events create-topic        # Create GCP Pub/Sub topic
nest-events grant-permissions   # Grant SDM publisher role
nest-events create-subscription # Create pull subscription
nest-events poll                # Pull events once
nest-events listen              # Poll continuously (daemon)

Tags

#smart_home-and-iot #api

Quick Info

Category Development
Model Gemini 2.0
Complexity One-Click
Author tag-assistant
Last Updated 3/10/2026
🚀
Optimized for
Gemini 2.0
💎

Ready to Install?

Get started with this skill in seconds

openclaw install nest-sdm