Overview
The No Longer Evil API server provides two distinct APIs on different ports:Thermostat Communication API
Port 443 (HTTPS)Handles direct communication with Nest thermostats
Control API
Port 8081 (HTTP)Provides external control and status monitoring
Base URLs
API Differences
Thermostat Communication API (Port 443)
Purpose: Replicate Google’s Nest API for thermostat compatibility Clients: Nest thermostat devices only Protocol: HTTPS with SSL/TLS Authentication:- Basic Auth with device serial number as username
- Entry key validation for device claiming
- Device state synchronization (long-polling)
- Weather data proxying
- Entry key generation for device linking
- Object-based state management
This API is designed to be 100% compatible with the original Nest protocol. The thermostat believes it’s talking to Google’s servers.
Control API (Port 8081)
Purpose: Provide external control interface for dashboards and automation Clients: Web frontends, mobile apps, home automation systems Protocol: HTTP (can be localhost-only for security) Authentication: Optional (add your own if exposing publicly) Key Features:- Simple command interface (set temperature, mode)
- Device status queries
- List all connected devices
- Real-time status updates
Data Format
All APIs use JSON for request/response bodies.Thermostat Communication API
Uses Nest’s proprietary object-key format:Control API
Uses simplified command format:Rate Limits
No rate limits currently enforced on hosted service or self-hosted setups.However, excessive requests may impact thermostat performance. Recommended limits:
- Control API: Max 10 requests/minute per device
- Status queries: Max 60 requests/minute
Error Handling
HTTP Status Codes
| Code | Meaning | Common Causes |
|---|---|---|
200 | Success | Request processed successfully |
400 | Bad Request | Invalid parameters or malformed JSON |
401 | Unauthorized | Invalid authentication or entry key |
404 | Not Found | Device or endpoint doesn’t exist |
500 | Server Error | Internal server error, check logs |
Error Response Format
Long-Polling
The Thermostat Communication API uses long-polling for real-time updates:- Client (thermostat) subscribes via
POST /transportwithchunked: true - Server keeps connection open
- When state changes, server pushes update
- Client reconnects after receiving data or timeout
State Synchronization
State is managed using a revision-based system:- Each object has a
$versionfield - Clients send their current version
- Server returns only changed objects since that version
- Prevents unnecessary data transfer