{"id":20641869,"url":"https://github.com/cbartram/nest","last_synced_at":"2025-10-07T03:45:05.771Z","repository":{"id":40409509,"uuid":"254194413","full_name":"cbartram/Nest","owner":"cbartram","description":"Access the Nest Camera API through a Reactive Node.JS Interface","archived":false,"fork":false,"pushed_at":"2025-09-01T01:46:12.000Z","size":3247,"stargazers_count":39,"open_issues_count":1,"forks_count":8,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-09-11T08:49:53.352Z","etag":null,"topics":["api","camera","events","javascript","js","nest","node","reactive","streaming"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cbartram.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["cbartram"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2020-04-08T20:33:07.000Z","updated_at":"2025-06-05T19:15:30.000Z","dependencies_parsed_at":"2025-02-10T01:22:13.872Z","dependency_job_id":"06100b19-7db1-4ba0-b5f8-b46a9ac1ae5c","html_url":"https://github.com/cbartram/Nest","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cbartram/Nest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cbartram%2FNest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cbartram%2FNest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cbartram%2FNest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cbartram%2FNest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cbartram","download_url":"https://codeload.github.com/cbartram/Nest/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cbartram%2FNest/sbom","scorecard":{"id":268438,"data":{"date":"2025-08-11","repo":{"name":"github.com/cbartram/Nest","commit":"e049535461a67be9719b319ff2b72d5f3efedf1b"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Code-Review","score":10,"reason":"all changesets reviewed","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/greetings.yml:1","Warn: no topLevel permission defined: .github/workflows/label.yml:1","Warn: no topLevel permission defined: .github/workflows/stale.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/greetings.yml:9: update your workflow using https://app.stepsecurity.io/secureworkflow/cbartram/Nest/greetings.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/label.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/cbartram/Nest/label.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/stale.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/cbartram/Nest/stale.yml/master?enable=pin","Info:   0 out of   3 GitHub-owned GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"32 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-jr5f-v2jv-69x6","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-vjh7-7g9h-fjfh","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-4q6p-r6v2-jvc5","Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6","Warn: Project is vulnerable to: GHSA-pfrx-2q88-qq97","Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-wc69-rhjr-hc9g","Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55","Warn: Project is vulnerable to: GHSA-h7cp-r72f-jxh6","Warn: Project is vulnerable to: GHSA-v62p-rq8g-8h59","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-hxcc-f52p-wc94","Warn: Project is vulnerable to: GHSA-76p7-773f-r4q5","Warn: Project is vulnerable to: GHSA-3jfq-g458-7qm9","Warn: Project is vulnerable to: GHSA-r628-mhmh-qjhw","Warn: Project is vulnerable to: GHSA-9r2w-394v-53qc","Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh","Warn: Project is vulnerable to: GHSA-qq89-hq3f-393p","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-17T12:45:55.601Z","repository_id":40409509,"created_at":"2025-08-17T12:45:55.601Z","updated_at":"2025-08-17T12:45:55.601Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278717439,"owners_count":26033542,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","camera","events","javascript","js","nest","node","reactive","streaming"],"created_at":"2024-11-16T16:07:05.056Z","updated_at":"2025-10-07T03:45:05.755Z","avatar_url":"https://github.com/cbartram.png","language":"JavaScript","funding_links":["https://github.com/sponsors/cbartram"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003cimg src=\"./assets/logo.png\" alt=\"logo\" /\u003e\n\u003c/p\u003e\n\n# Nest Camera SDK\n![npm](https://img.shields.io/npm/dm/nest-cam)\n![build](https://img.shields.io/travis/com/cbartram/Nest)\n![npm bundle size](https://img.shields.io/bundlephobia/min/nest-cam)\n[![SonarCloud Coverage](https://sonarcloud.io/api/project_badges/measure?project=cbartram_Nest-Cam\u0026metric=coverage)](https://sonarcloud.io/component_measures/metric/coverage/list?id=cbartram_Nest-Cam)\n![npm](https://img.shields.io/npm/v/nest-cam)\n\n\nAccess \u0026 Stream the Nest API Camera data through a Reactive Node.JS interface. \n\nIn 2019 Google deprecated the Works With Nest program and shut down the Nest API's for new developers and pigeon hole'd the existing Nest developers\nto migrate their Nest account's to Google. Google integrated the Nest products under the \"Works With Google\" umbrella and essentially made data access to your own\nNest devices a one way street.\n\nYou can give your Nest data to Google but you can't get it back out of the cloud. This Nest Camera SDK aims\nto give developers the freedom and ability to access their own camera feed data in order to continue building great applications.\n\n![nest denial letter](./assets/nest_denied.png)\n\n## Quick Start\n\nTo get started with the Unofficial Nest Camera SDK you can install the package from [NPM](https://npmjs.com): \n\n```shell script\n$ npm install nest-cam\n```\n\n### Examples\n\nYou can do a whole lot more with the Nest Camera SDK but here is a quick example to get you started:\n\n```javascript\nconst Nest = require('nest-cam');\n\nconst nest = new Nest({\n    nestId: \"YOUR_NEST_ID\",\n    refreshToken: \"YOUR_REFRESH_TOKEN\",\n    apiKey: \"YOUR_API_KEY\",\n    clientId: \"YOUR_CLIENT_ID\"\n});\n\nnest.init().then(() =\u003e {\n    nest.subscribe((eventStream) =\u003e {\n        console.log('There was some motion or sound caught on the camera!', eventStream);\n    });\n    // ...or\n    nest.getLatestSnapshot().then(image =\u003e {\n        image.pipe(fs.createWriteStream('/My/Path/to/save/image_3.jpg'));\n    });\n    // ... or\n    nest.subscribeSnapshot((image) =\u003e {\n       image.pipe(fs.createWriteStream('/My/Path/to/save/image_3.jpg'));\n    }, (error) =\u003e {\n        console.log('Oh no there was an error!')\n    })\n});\n```\n\n### Prerequisites\n\nBefore you go hooking into your camera data you will need some security credentials. Check out the table below for a description\nof each credential that is required.\n\n| **Name**       | **Data Type** | **Description**                                                                                                                                                                                                                                                   |\n|----------------|---------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `nestId`       | String        | A unique string which identifies your Nest Camera to the Google Nest API. This value will not change.                                                                                                                                                             |\n| `refreshToken` | String        | Nest uses OAuth 2.0 to securely authenticate users. A refresh token allows an application to obtain a new OAuth access token without prompting the user for any information. This is a long lived token which will expire but not for an estimated several weeks. |\n| `apiKey`       | String        | This value comes with special privileges to tell the Nest servers how often the client wielding the api key can call the backend. This value will not change.                                                                                                     |\n| `clientId`     | String        | The Client Id is a unique string which is used by the Nest API to identify which client or application is calling the backend resources.                                                                                                                          |\n\nRetrieving these values is a one time process than can be somewhat cumbersome. Below is an in depth tutorial of each step\nwith helpful images to guide you to the security credentials you need. The whole process should take less than 10 minutes! \n\n## Obtaining Nest Security Credentials\n\nTo get the security credentials you will have to setup a proxy on the same WiFi network as your Nest Camera. We will proxy requests from your Android or iPhone \nthrough the Nest app (and our proxy) to intercept the security credentials before they get to the Nest servers. Don't worry this is **way** easier than it sounds.\nThis tutorial is written for the Mac \u0026 iOS but works in a similar fashion on Windows and Android. Please consult the [Charles Documentation](https://www.charlesproxy.com/documentation/using-charles/ssl-certificates/) to\nlearn how to trust the SSL certificates on a Windows machine. \n\n### Installing Charles Proxy\n\nFirst head to the [Charles Proxy Website](https://www.charlesproxy.com/) and download and install the proxy software. Next we are going to configure\nCharles to trust all SSL certificates it proxies so that we can see the request's and response's that Nest uses to communicate with its API's (The credentials you are after are in these requests and responses). \n\n### Trusting the Root Charles SSL Certificate\n\nCharles generates its own certificates for sites, which it signs using a Charles Root Certificate. The root certificate is uniquely generated for your installation of Charles (as of v3.10). In order\nto avoid having to trust each website you visit individually you can simply trust the Charles Root Certificate one time and it will take care of everything else for you.\n\nYou need to trust the same certificate on your Mac/Windows and iPhone/Android\n\n#### Mac \n\nIn Charles go to the Help menu and choose \"SSL Proxying \u003e Install Charles Root Certificate\".\n\n - Keychain Access will open. \n - Find the \"Charles Proxy...\" entry, and double-click to get info on it. \n - Expand the \"Trust\" section, and beside \"When using this certificate\" change it from \"Use System Defaults\" to \"Always Trust\". \n - Then close the certificate info window, and you will be prompted for your Administrator password to update the system trust settings. \n\n![charles trust](./assets/charles_trust.png) \n\n#### iOS\n\nIn order to install the Charles Trust Certificate on iOS there are a couple simple steps.\n\nSet your iOS device to use Charles as its HTTP proxy in the Settings app \u003e Wifi settings. For the IP Address set the IP\naddress for the device that is running the charles proxy. This is usually something like: `192.168.1.153`. You can view your Mac's network\nsettings in System Preferences to locate the correct IP address. The port number will always be `8888`\nand there is no Authentication.\n\n- Open Settings\n- Open Wifi\n- Select the informational \"I\" next to the Wifi network that your Nest camera is connected to.\n- Select Proxy Settings\n\n\u003cimg alt=\"ios_proxy_one\" src=\"./assets/ios_proxy_one.png\" width=\"200\" height=\"400\" /\u003e\n\n**Update your proxy**\n\n\u003cimg alt=\"ios_proxy_two\" src=\"./assets/ios_proxy_two.png\" width=\"200\" height=\"400\" /\u003e\n\n\nOpen Safari and browse to [https://chls.pro/ssl](https://chls.pro/ssl). Safari will prompt you to install the SSL certificate.\nIf you are on iOS 10.3 or later, open the Settings.app and navigate to General \u003e About \u003e Certificate Trust Settings, and find the Charles Proxy certificate, \nand switch it on to enable full trust for it (More information about this change in iOS 10).\n\n\u003cimg alt=\"ios_proxy_three\" src=\"./assets/ios_cert_trust.png\" width=\"200\" height=\"400\" /\u003e\n\nDone!\n\n### Capturing Nest Traffic\n\nNow that you have your iOS/Android device configured to route traffic through the Charles Proxy you are ready to start intercepting Nest camera requests to\nlocate your credentials!\n\n#### Nest ID\n\nThe Nest Id is easy to find. Fire up your Nest App on your phone and watch Charles Proxy capture the traffic! \n\nMake sure you:\n\n- Set your Charles Proxy to use \"Sequence\". This ensures you see requests in the order they were sent\n- Filter for the word \"nexus\". This will get rid of requests you dont care about (there will be a lot of them)\n\n![nest_id_proxy](./assets/nest_id_proxy.png)\n\nYour nest ID is highlighted in the picture above.\n\n#### Refresh Token \u0026 Client Id\n\nIn Charles Proxy:\n\n- Filter for \"google\"\n- Look for the request from the host: `oauth2.googleapis.com`\n- Select \"Contents\" (right beneath the filter bar) to view the contents of the Http Request\n\n![refresh_client_id_charles](./assets/refresh_client_id_charles.png)\n\nYour client id and refresh token are highlighted in the picture above. **Note:** If you cannot find this request\nin Charles Proxy try signing out of Nest on your iPhone and then signing in again.\n\nIf your refresh token isn't displayed check the response body of the request and you should find it there!\n\n#### API Key\n\nFinally your API key can be located by:\n\n- Filtering for \"nestauthproxyservice\"\n- It is located in the \"x-goog-api-key\" Header value\n\n![goog_api_key_nest](./assets/api_key_nest.png)\n\nThat's it your done!\n\n## About the SDK\n\nThis section describes how to use the Nest SDK to retrieve images, fetch events, and stream data\nfrom your Nest camera.\n\n### Initializing the SDK\n\nYou **must** call the `init()` method after initializing the Nest SDK. The init method will fetch your OAuth access_token and JWT token\nused to retrieve data from the Nest API.\n\n### Events\n\nThe Nest SDK works around events. An event is logged by your Nest camera whenever it detects motion or sound. You can periodically\nfetch Nest events through the API or subscribe to the event stream and be notified when a new event arrives.\n\nThe event object looks like this:\n\n```javascript\n {\n    \"playback_time\": 1586551361730,\n    \"start_time\": 1586551361730,\n    \"camera_uuid\": \"\u003cYour Nest Id\u003e\",\n    \"face_id\": \"\",\n    \"is_important\": false,\n    \"face_category\": \"UNSET\",\n    \"end_time\": 1586551371619,\n    \"importance\": 0,\n    \"face_name\": \"\",\n    \"in_progress\": false,\n    \"id\": \"1586551361-labs\",\n    \"zone_ids\": [],\n    \"types\": [\"motion\"]\n}\n```\n\n### Streaming Events\n\nThe streaming interface for the Nest SDK is built on top of Observables using [RxJS](https://rxjs-dev.firebaseapp.com/). It uses [Observables](https://rxjs-dev.firebaseapp.com/guide/observable) as the fundamental unit to \nstream Nest camera data directly to your applications. Events are streamed using the `nest.subscribe()` method. You must specify the event type you wish to subscribe to either \"event\" or \"snapshot\".\n\nYou can poll for two different types of data:\n\n- Snapshots - The latest snapshot image from the Nest camera\n- Events - The latest JSON event from the Nest API \n\nUnder the hood the streaming Observables will poll the Nest API at regular intervals for updates on new events (using you guessed it `getEvents()`)! You can configure how often\nthe observables poll the Nest API by passing values into the Nest constructor at start up. The values default to five seconds for snapshots and three seconds for events.\n\n## Nest SDK Configuration\n\nThe Nest constructor takes one parameter. The parameter is an object which contains configuration parameters to tweak the Nest SDK's behavior. \nIf no argument is provided the default options will be used. There are **four required properties** to the Nest options: Nest Id, Refresh Token, API Key, and client Id.\nPlease reference the documentation above if you need help finding your nest credentials. \n\nAll other configuration options are documented below: \n\n| **Name**       | **Data Type** | **Description**                                                                                                                                                                                                                                                   |\n|----------------|---------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `nestId`       | String        | A unique string which identifies your Nest Camera to the Google Nest API. This value will not change.                                                                                                                                                             |\n| `refreshToken` | String        | Nest uses OAuth 2.0 to securely authenticate users. A refresh token allows an application to obtain a new OAuth access token without prompting the user for any information. This is a long lived token which will expire but not for an estimated several weeks. |\n| `apiKey`       | String        | This value comes with special privileges to tell the Nest servers how often the client wielding the api key can call the backend. This value will not change.                                                                                                     |\n| `clientId`     | String        | The Client Id is a unique string which is used by the Nest API to identify which client or application is calling the backend resources.                                                                                                                          |  \n| `eventInterval`     | Integer       | The amount of time between polls to the Nest API when subscribing to events. A lower number will poll the API more often. Default is 3000. All values are in milliseconds                                                                                                                          |  \n| `snapshotInterval`     | Integer       | The amount of time between polls to the Nest API when subscribing to snapshots. A lower number will poll the API more often. Default is 5000. All values are in milliseconds                                                                                                                         |  \n\n```javascript\nconst Nest = require('nest-cam');\n\nconst options = {\n    nestId: '...',\n    clientId: '...',\n    refreshToken: '...',\n    apiKey: '...',\n    eventInterval: 9000,\n    snapshotInterval: 3000\n};\n\nlet nest = new Nest(options);\n\n// nest.init() etc...\n```\n\n## Examples\n\nHere are some helpful examples to get you started.\n\n### Fetching Camera Events\n\nYou can fetch all the latest events for your camera using the snippet below. You can also specify a start and end\ntime as parameters to the `getEvents()` method. For example `nest.getEvents('1586551371619', '1586551374320')`.\n\n```javascript\nconst Nest = require('nest-cam');\n\nconst nest = new Nest({\n    nestId: \"YOUR_NEST_ID\",\n    refreshToken: \"YOUR_REFRESH_TOKEN\",\n    apiKey: \"YOUR_API_KEY\",\n    clientId: \"YOUR_CLIENT_ID\"\n});\n\nnest.init().then(() =\u003e {\n    nest.getEvents().then(events =\u003e {\n        ...\n    }).catch(err =\u003e console.log('Failed to fetch events: ', err));\n});\n```\n\n### Streaming Camera Events\n\n```javascript\nconst Nest = require('nest-cam');\n\nconst nest = new Nest({\n    nestId: \"YOUR_NEST_ID\",\n    refreshToken: \"YOUR_REFRESH_TOKEN\",\n    apiKey: \"YOUR_API_KEY\",\n    clientId: \"YOUR_CLIENT_ID\"\n});\n\nnest.init().then(() =\u003e {\n    nest.subscribe((event) =\u003e {\n        ...\n    })\n});\n```\n\nYou can also configure how often the Nest API is polled under the hood to publish new events to your subscription. All values \nare in milliseconds. A lower value will poll the Nest API more often and return new events faster but will also consume more computing\nresources. We have found 3 seconds between each poll to be sufficient for most application use cases but feel free to tweak it to your needs.\n\n```javascript\nconst Nest = require('nest-cam');\n\n// This will poll subscriptions to snapshots every 2 seconds (instead of 5) and subscriptions to events\n// every second (instead of 3 seconds).\nconst nest = new Nest({\n    nestId: \"YOUR_NEST_ID\",\n    refreshToken: \"YOUR_REFRESH_TOKEN\",\n    apiKey: \"YOUR_API_KEY\",\n    clientId: \"YOUR_CLIENT_ID\",\n    eventInterval: 1000,\n    snapshotInterval: 2000\n});\n\n// ... \n```\n\n### Fetching Latest Image\n\nThis method is not subscription based rather it simply finds the latest snapshot image from your nest cam and \nreturns the response back to you in the form of a promise. You can do whatever you would like with the image \nsuch as: Uploading to Amazon S3 for processing, saving to disk, etc...\n\n```javascript\nconst Nest = require('nest-cam');\n\nconst nest = new Nest({\n    nestId: \"YOUR_NEST_ID\",\n    refreshToken: \"YOUR_REFRESH_TOKEN\",\n    apiKey: \"YOUR_API_KEY\",\n    clientId: \"YOUR_CLIENT_ID\"\n});\n\nnest.init().then(() =\u003e {\n    // Finds the latest snapshot\n    nest.getLatestSnapshot().then((data) =\u003e {\n        console.log('Found the latest snapshot!');\n        data.pipe(fs.createWriteStream('/My/Path/to/save/image_3.jpg'));\n    });\n});\n```\n\n### Fetching Event Image\n\n```javascript\nconst Nest = require('nest-cam');\n\nconst nest = new Nest({\n    nestId: \"YOUR_NEST_ID\",\n    refreshToken: \"YOUR_REFRESH_TOKEN\",\n    apiKey: \"YOUR_API_KEY\",\n    clientId: \"YOUR_CLIENT_ID\"\n});\n\nnest.init().then(() =\u003e {\n    // 1586551361-labs comes from an event.id property found from getEvents() or subscribe()\n    nest.getSnapshot('1586551361-labs', (data) =\u003e {\n        console.log('Fetched a specific snapshot image: ', data);\n    });\n});\n```\n\n### Streaming Live Camera Images\n\nThis is the moment you all have been waiting for! With the Nest package you can stream live images from your Nest camera\nas a reactive stream.\n\nThis method will subscribe to image data polling the Nest API on a specified cadence (through the nest options) and \nreturn the image data to your code via promise based callback. You can configure where a new image is fetched \nthrough the `snapshotInterval` option when you create your `Nest` object.\n\n```javascript\nconst Nest = require('nest-cam');\nconst fs = require('fs');\n\nconst nest = new Nest({\n    nestId: \"YOUR_NEST_ID\",\n    refreshToken: \"YOUR_REFRESH_TOKEN\",\n    apiKey: \"YOUR_API_KEY\",\n    clientId: \"YOUR_CLIENT_ID\",\n    snapshotInterval: 20000 // Fetch a new image every 20 seconds \n});\n\nnest.init().then(() =\u003e {\n    nest.subscribeSnapshot((imageData) =\u003e {\n        console.log('Writing latest snapshot image to disk!');\n        data.pipe(fs.createWriteStream('/My/Path/to/save/image_3.jpg'));\n    })\n});\n```\n\n## Running the tests\n\nUnit tests for this project are managed with Mocha and can be executed with:\n\n```shell script\n$ npm test\n```\n\n### Coding Style Tests\n\nThis project uses [ESLint](https://eslint.org/) to manage the coding style. To run the eslint tests and ensure the code is formatted correctly\naccording to the style guide run:\n\n```shell script\n$ sh ./scripts/coding_style_tests.sh\n```\n\n### Code Coverage\n\nA new code coverage report can be generated with the following NPM command:\n\n```shell script\n$ npm run coverage\n```\n\nCode coverage output is stored in lcov format within the `coverage` directory.\n\n## Deployment\n\nThis project uses Travis CI to test and deploy the built artifact to NPM. Travis CI configuration settings are managed\nin the `.travis.yml` file. \n\nDeployments are done on tagged commits to the master branch when all the unit and coding style tests pass. Make sure\nto bump the version in the `package.json` accordingly before deploying!\n\n## Built With\n\n* [Node.JS](http://www.dropwizard.io/1.0.2/docs/) - The server side library used\n* [Javascript](https://maven.apache.org/) - Programming Language Used\n* [NPM](https://npmjs.com) - Dependency Management\n* [RxJS](https://rometools.github.io/rome/) - Reactive Javascript library for working with streaming data and observables\n\n## Contributing\n\nPlease read [CONTRIBUTING.md](https://gist.github.com/PurpleBooth/b24679402957c63ec426) for details on our code of conduct, and the process for submitting pull requests to us.\n\n## Versioning\n\nWe use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/your/project/tags). \n\n## Authors\n\n* **Christian Bartram** - *Initial work* - [cbartram](https://github.com/cbartram)\n\nSee also the list of [contributors](https://github.com/cbartram/Nest/contributors) who participated in this project.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE.md](LICENSE) file for details\n\n## Acknowledgments\n\n* Nest for making a cool camera\n* Google for taking down the nest API's without which this project would not be possible\n* Charles Proxy for helping me decode the Nest API calls\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcbartram%2Fnest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcbartram%2Fnest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcbartram%2Fnest/lists"}