Code Monkey home page Code Monkey logo

nest-logger's Introduction

Nest Logger

Logs structured information about your home's Nest thermostats to third-party logging services like Datadog. You can use this to:

  • Learn about your home's heating and cooling performance & patterns
  • Experiment with energy efficiency techniques

You could also fork & extend it to control your heating & cooling appliances via the Nest API.

Screen Shot 2021-11-21 at 3 02 07 PM

Getting Started

  1. Create a file called auth.json (see below)
  2. Run node nest-logger.js

That's it! You should see your home data in your logging service within a few minutes.

auth.json format

Sample:

{
    "nestRefreshToken": "1//jkasdfjasdfjasdf-adsfaskdfaksdf-5d-AB--jXjLuU0S8XjDjf",
    "datadogApiKey": " 4f089ce1054244157e53d92760cec66"
}

Datadog API key

Your Datadog API key can be generated via the website (docs)

Google Nest Refresh Token

(instructions & code copied from homebridge-nest README)

The "refreshToken" is a code provided by Google when you log into your account, and we provide an easy-to-use tool to obtain it.

Just run: node nest-login.js and follow the instructions on the screen.

You'll be prompted to navigate to a URL in your browser, log into Google, and copy and paste a code from your browser into the login tool. You'll then be provided with the "refreshToken" to add to config.json. The refresh token is a random string of letters and numbers - it does not begin with, end with, or contain any spaces. Please make sure you copy and paste it exactly as shown, or it will not work.

Troubleshooting

When you run it, you should see something like this:

{"instance":0.9169385740067195,"level":"info","message":"starting up","service":"nest-logger"}
{"instance":0.9169385740067195,"level":"info","message":"authed: true","service":"nest-logger"}
{"instance":0.9169385740067195,"level":"info","service":"nest-logger"}

Then it might take a few seconds or a few minutes (I don't know why) before you see this:

{"instance":0.9169385740067195,"level":"info","message":"got data","service":"nest-logger"}
{"instance":0.9169385740067195,"level":"info","message":{"cooling":false,"fan":false,"fanMode":"FAN_MODE_AUTO","heating":false,"humidity":35.899993896484375,"mode":"heat","msgType":"thermostat","room":"Living Room","sensor":"Living Room Thermostat","state":"off","targetTemp":73.01753845214844,"targetTempType":"heat","temp":73.4},"service":"nest-logger"}
{"instance":0.9169385740067195,"level":"info","message":{"cooling":false,"fan":false,"fanMode":"FAN_MODE_AUTO","heating":false,"humidity":42.399993896484375,"mode":"heat","msgType":"thermostat","room":"Entryway","sensor":"Entryway Thermostat","state":"off","targetTemp":72.79863586425782,"targetTempType":"heat","temp":72.30199890136718},"service":"nest-logger"}
{"instance":0.9169385740067195,"level":"info","message":{"cooling":false,"fan":false,"fanMode":"FAN_MODE_AUTO","heating":false,"humidity":44.09999084472656,"mode":"range","msgType":"thermostat","room":"Master Bedroom","sensor":"Master Bedroom Thermostat","state":"off","targetTemp":70.60386962890625,"targetTempType":"range","temp":69.60199890136718},"service":"nest-logger"}
{"instance":0.9169385740067195,"level":"info","message":{"msgType":"sensor","sensor":"Kitchen","temp":73.57998352050781},"service":"nest-logger"}
{"instance":0.9169385740067195,"level":"info","message":{"msgType":"sensor","sensor":"Living Room","temp":73.4},"service":"nest-logger"}
{"instance":0.9169385740067195,"level":"info","message":{"msgType":"sensor","sensor":"Play Room","temp":72.31998901367187},"service":"nest-logger"}
{"instance":0.9169385740067195,"level":"info","message":{"msgType":"sensor","sensor":"Sam’s Office","temp":75.3799835205078},"service":"nest-logger"}
{"instance":0.9169385740067195,"level":"info","message":{"msgType":"sensor","sensor":"Master Bedroom","temp":69.61998901367187},"service":"nest-logger"}
{"instance":0.9169385740067195,"level":"info","message":{"msgType":"sensor","sensor":"Kids Room","temp":67.63997802734374},"service":"nest-logger"}
{"instance":0.9169385740067195,"level":"info","message":{"msgType":"sensor","sensor":"Keith’s Office","temp":69.61998901367187},"service":"nest-logger"}
{"instance":0.9169385740067195,"level":"info","message":{"away":false,"msgType":"homeAway"},"service":"nest-logger"}

The application polls forever, so every few minutes you will see more output:

{"instance":0.9169385740067195,"level":"info","message":"got data","service":"nest-logger"}
{"instance":0.9169385740067195,"level":"info","message":{"cooling":false,"fan":false,"fanMode":"FAN_MODE_AUTO","heating":false,"humidity":35.899993896484375,"mode":"heat","msgType":"thermostat","room":"Living Room","sensor":"Living Room Thermostat","state":"off","targetTemp":73.01753845214844,"targetTempType":"heat","temp":73.4},"service":"nest-logger"}

nest-logger's People

Contributors

keithkml avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

defter1760

nest-logger's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.