How to configure the Nest Learning Thermostat with Homebridge using your Google Account

Last Updated on May 8, 2023 by Freddy Reyes

To configure the Nest Learning Thermostat with Homebridge using your Google Account, you’ll need to set up the Homebridge-Nest plugin, which allows you to control your Nest devices using Apple HomeKit. Here’s a step-by-step guide to help you with the process:

  1. Install Homebridge: First, make sure you have Homebridge installed on a compatible device (like a Raspberry Pi or a computer running macOS, Linux, or Windows). You can follow the official installation guide here: https://github.com/homebridge/homebridge/wiki
  2. Install Homebridge-Nest plugin: After successfully installing Homebridge, you need to install the Homebridge-Nest plugin. Open a terminal or command prompt and run the following command:
npm install -g homebridge-nest
  1. Create a Google Cloud Project: Go to the Google Cloud Console (https://console.cloud.google.com/) and sign in with your Google Account. Create a new project by clicking on the project dropdown, then the “New Project” button.
  2. Enable the Nest API: In your Google Cloud project, open the “APIs & Services” dashboard, and click “Enable APIs and Services”. Search for “Nest” and enable the “Nest Device Access” API.
  3. Create OAuth2 credentials: Click “Create Credentials” and select “OAuth client ID”. Choose “Web application” as the application type, and set the “Authorized redirect URIs” to “https://www.google.com“. Click “Create” and note down the “Client ID” and “Client secret”.
  4. Get the authorization code: Open a new browser window and visit the following URL (replace YOUR_CLIENT_ID with your actual Client ID):
https://accounts.google.com/o/oauth2/auth?client_id=YOUR_CLIENT_ID&redirect_uri=https%3A%2F%2Fwww.google.com&response_type=code&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fsdm.service+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fnest-account&access_type=offline

After granting permission, you’ll be redirected to google.com with an authorization code in the URL. Copy the value of the code parameter.

  1. Get the access token and refresh token: Using the terminal or command prompt, run the following command (replace YOUR_CLIENT_ID, YOUR_CLIENT_SECRET, and YOUR_AUTHORIZATION_CODE with the respective values):
curl -L -X POST 'https://oauth2.googleapis.com/token' \
-H 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'client_id=YOUR_CLIENT_ID' \
--data-urlencode 'client_secret=YOUR_CLIENT_SECRET' \
--data-urlencode 'code=YOUR_AUTHORIZATION_CODE' \
--data-urlencode 'grant_type=authorization_code' \
--data-urlencode 'redirect_uri=https://www.google.com'

The response will include an access_token and a refresh_token. Save both values.

  1. Configure Homebridge: Open the Homebridge config.json file (located in the .homebridge folder within your user directory) and add the following configuration under the “platforms” section (replace the placeholders with your respective values):
{
  "platform": "Nest",
  "googleAuth": {
    "issueToken": "https://accounts.google.com/o/oauth2/token",
    "cookies": "https://accounts.google.com/o/oauth2/auth",
    "clientId": "YOUR_CLIENT_ID",
    "clientSecret": "YOUR_CLIENT_SECRET",
    "refreshToken":