Download the PHP package gboudreau/nest-api without Composer
On this page you can find all versions of the php package gboudreau/nest-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download gboudreau/nest-api
More information about gboudreau/nest-api
Files in gboudreau/nest-api
Package nest-api
Short Description This is a simple library that will allow you to monitor and control your Nest Learning Thermostat, and Nest Protect.
License GPL-3.0-or-later
Homepage https://github.com/gboudreau/nest-api
Informations about the package nest-api
Unofficial Nest Learning Thermostat API
This is a PHP class that will allow you to monitor and control your Nest Learning Thermostat, and Nest Protect.
Note that since I started this, Nest have started an official Developer program. You might be better served using the official APIs, versus this PHP class here in which you need to store your credentials in plain text, and which use the non-supported APIs used by the mobile & web apps.
i.e. if you're building a serious commercial application, go sign-up into Nest's Developer program. If you just want to build something for yourself, then you're probably fine with this PHP class here.
Features
- Caching so that it doesn't re-login when it doesn't need to. i.e. faster operations.
- Getters:
- Current & target temperatures, humidity
- Time to target temperature
- Target temperature mode, fan mode
- AC, heat, and fan status: on or off
- Manual and automatic away mode
- Location information
- Network information (local & WAN IPs, MAC address, online status)
- Currently active schedule (by day)
- Next scheduled event
- Last 10 days energy report
- Device name, devices list
- Battery level (voltage)
- Nest Protect device information
- Setters:
- Target temperatures (single, or range)
- Target temperature mode: cool, heat, range
- Fan mode: auto, on, minutes per hour
- Fan: every day schedule (start & stop time)
- Fan: on with timer (stops after X minutes/hours)
- Eco (Away) mode: on, off, min/max temperatures, Auto-Away
- Dual fuel: breakpoint (use alt. fuel when outdoor temp is below X), always alt, always primary
- Safety temperatures (low & high temperatures)
- Humidity (on, off, %)
- Turn off HVAC
Usage
You can just download nest.class.php and require/include it, or use composer: require "gboudreau/nest-api": "dev-master"
.
See examples.php for details, but here's a Quick Start.
Example output for getDeviceInfo()
:
Use try...catch to catch exceptions that could occur:
Using a Google Account
The values of $issue_token
, and $cookies
are specific to your Google Account. To get them, follow these steps (only needs to be done once, as long as you stay logged into your Google Account).
- Open a Chrome browser tab in Incognito Mode (or clear your cache).
- Open Developer Tools (View/Developer/Developer Tools).
- Click on
Network
tab. Make surePreserve Log
is checked. - In the
Filter
box, enterissueToken
- Go to https://home.nest.com, and click
Sign in with Google
. Log into your account. - One network call (beginning with
iframerpc
) will appear in the Dev Tools window. Click on it. - In the
Headers
tab, underGeneral
, copy the entireRequest URL
(beginning withhttps://accounts.google.com
, ending withnest.com
). This is your$issue_token
. - In the
Filter
box, enteroauth2/iframe
- Several network calls will appear in the Dev Tools window. Click on the last iframe call.
- In the
Headers
tab, underRequest Headers
, copy the entire cookie value (include the whole string which is several lines long and has many field/value pairs - do not include theCookie:
prefix). This is your$cookies
; make sure all of it is on a single line.
Troubleshooting
If you have any issues, try adding this at the top of your PHP script, to ask PHP to echo all errors and warnings.
Acknowledgements
- Jacob McSwain, https://github.com/USA-RedDragon for https://github.com/USA-RedDragon/badnest
- Chris J. Shull, https://github.com/chrisjshull for https://github.com/chrisjshull/homebridge-nest/
- Andy Blyler, http://andyblyler.com/ for https://github.com/ablyler/nest-php-api
- Scott M Baker, http://www.smbaker.com/ for https://github.com/smbaker/pynest
- Chris Burris, http://www.chilitechno.com/ for https://github.com/chilitechno/SiriProxy-NestLearningThermostat
- Chad Corbin for http://code.google.com/p/jnest/
- Aaron Cornelius for http://www.wiredprairie.us/blog/index.php/archives/1442
Developed mainly using a free open-source license of PHPStorm kindly provided by JetBrains. Thanks guys!
All versions of nest-api with dependencies
ext-json Version *
ext-curl Version *