Skip to main content

Overview

Enable temperature lock to restrict temperature adjustments on the physical thermostat. Requires a 4-digit PIN.
Hosted service only. This endpoint is part of the hosted API at https://nolongerevil.com/api/v1 and requires an nle_ API key. It is not available on the self-hosted server.

Endpoint

Authentication

Required Scopes: write

Request Body

To enable lock: To disable lock:

Example: Enable Lock

The pin_hash is Base64(SHA1(PIN + SERIAL)). Never send the PIN in plaintext! You must concatenate the PIN with the device serial number before hashing.

Example: Disable Lock

Response

Success (200 OK):

Generating PIN Hash

The PIN hash algorithm matches the Nest thermostat’s native format: Algorithm: Base64( SHA1( PIN + SERIAL ) )
You must concatenate the PIN with the device’s serial number before hashing. This matches the Nest protocol and makes PINs device-specific.

Code Examples

Use Cases

Child Safety

Commercial Buildings

Security Notes

Never store or transmit PINs in plaintext. Always hash the PIN client-side before sending to the API.

Important Points

  • PIN Format: Must be exactly 4 digits (0000-9999)
  • Hashing: Use SHA-1 (not SHA-256) with PIN + serial concatenated
  • Encoding: Hash must be Base64-encoded (not hex)
  • Serial Required: You must include the device serial number in the hash
  • Temperature Units: temp_min and temp_max must be in Celsius
  • Device-Specific: Same PIN produces different hashes for different devices

Why SHA-1 + Serial?

This matches the Nest thermostat’s native PIN algorithm:
  • Device-specific: Same PIN produces different hashes for different thermostats
  • Protocol compatibility: Works with the original Nest hardware
  • Simple validation: Thermostat can verify the hash locally without server communication

Next Steps

Get Status

Check lock status

Set Temperature

Set temperature