An open API service indexing awesome lists of open source software.

https://github.com/anonrig/thermostat-wars

My wife always changes the thermostat to 75F, and now I respond
https://github.com/anonrig/thermostat-wars

Last synced: 9 months ago
JSON representation

My wife always changes the thermostat to 75F, and now I respond

Awesome Lists containing this project

README

          

# Nest Thermostat Auto-Controller

A Cloudflare Worker that automatically sets your Google Nest thermostat to 73°F whenever it detects temperature changes.

## Setup

### 1. Google Nest API Setup

1. Register for the [Device Access Program](https://developers.google.com/nest/device-access/registration) ($5 fee)
2. Create a project in the [Device Access Console](https://console.nest.google.com/device-access/)
3. Set up OAuth credentials in [Google Cloud Console](https://console.cloud.google.com/)
4. Enable the Smart Device Management API

### 2. Environment Variables

Set these secrets using `wrangler secret put`:

```bash
wrangler secret put NEST_ACCESS_TOKEN
wrangler secret put NEST_PROJECT_ID
wrangler secret put NEST_REFRESH_TOKEN
wrangler secret put NEST_CLIENT_ID
wrangler secret put NEST_CLIENT_SECRET
```

### 3. Deploy

```bash
npm install
wrangler deploy
```

## Features

- Automatically sets thermostat to 73°F when changes detected
- Handles Google Pub/Sub webhooks
- Automatic OAuth token refresh
- Scheduled checks every 30 minutes
- Compatible with Cloudflare Workers

## API Endpoints

- `POST /` - Webhook endpoint for thermostat events
- Scheduled runs every 30 minutes for periodic checks

## How It Works

1. Receives webhook notifications from Google Nest when thermostat changes
2. Checks current temperature setting
3. If not 73°F, automatically adjusts it
4. Includes fallback scheduled checks every 30 minutes

---

🤖 Generated with [Claude Code](https://claude.ai/code)