This project try to fill the biggest Nest Thermostat gap, data history using Python and LAMP stack.
It allow you to browse your Nest thermostat history data with some pretty charts, analyze your consumption and keep a eye on your environment.
Feel free to create a pull request, open an issue or fork it !
- Polls Nest API to fetch thermostat data
- Consumptions data are stored in a local database
- Generates (Google) Chart with your consumptions
- Select specific date ranges
- Hover over charts to get the exact timestamp and temperature
- Verify your Nest Protect devices state
- And more !
- Nest Account
- OpenWeatherMap API Key
This example is based on Debian Jessie with NGinx/PHP-FPM web server and MariaDB database engine.
-
Update your package lists and any pending updates before starting:
sudo apt-get update
sudo apt-get upgrade -y
-
Install required packages:
sudo apt-get install nginx php5-fpm php5-mysql mariadb-server mariadb-client git
-
Clone the repository:
cd /opt && git clone [email protected]:gchenuet/nest-datagraph.git
-
Setup NGinx Virtual Host:
sudo cp /opt/nest-datagraph/config/nginx/nest-datagraph.conf /etc/nginx/sites-available/
sudo ln -s /etc/nginx/sites-available/nest-datagraph.conf /etc/nginx/sites-enabled/nest-datagraph.conf
-
Modify the
server_name
parameter with your FQDN in nest-datagraph.conf :vim /etc/nginx/sites-enabled/nest-datagraph.conf
-
Reload NGinx
sudo service nginx reload
-
Create a new MySQL user:
CREATE USER '[username]'@'localhost' IDENTIFIED BY '[password]';
GRANT ALL PRIVILEGES ON * . * TO '[username]'@'localhost';
-
Create the database and grant permissions:
CREATE DATABASE nest_datagraph;
GRANT ALL PRIVILEGES ON nest_datagraph.* TO '[username]'@'localhost';
-
Import the DB schema:
sudo mysql -h <HOST> -u <USER> -p<PASSWORD> nest_datagraph < /opt/nest-datagraph/config/db/nest-datagraph.sql
-
Setup Nest DataGraph backend
cp /opt/nest-datagraph/backend/settings.py.example /opt/nest-datagraph/backend/settings.py vi /opt/nest-datagraph/backend/settings.py
-
Fill in variables with your parameters:
OWM
- OpenWeatherMap API KeyOWM_CITY
- Your city (Ex: 'Paris,fr')NEST_ID
- Nest loginNEST_PWD
- Nest passwordNEST_SN
- Nest Thermostat serial numberDB_USER
- MySQL userDB_PWD
- MySQL passwordDB_HOST
= IP or FQDN of your MySQL serverDB_NAME
= Database name
-
Open the crontab and add the line at the end of the file:
crontab -e
0 * * * * /usr/bin/python /opt/nest-datagraph/backend/poller.py
-
Setup Nest DataGraph frontend
cp /opt/nest-datagraph/frontend/php/params.ini.example /opt/nest-datagraph/frontend/php/params.ini vi /opt/nest-datagraph/frontend/php/params.ini
-
Fill in variables with your parameters:
timezone
- Your timezone (Ex: 'Europe/Paris')protect
- Set to 'true' if you have one or more Nest Protect devicenest_username
- Nest loginnest_password
- Nest passwordmysql_hostname
= IP or FQDN of your MySQL servermysql_database
= Database namemysql_username
= MySQL usermysql_password
= MySQL password
-
Enjoy (and wait a hour) !
You can find and post new features or known issues in the Issues
tab.
- Fork it
- Create your feature branch
(git checkout -b my-new-feature)
- Commit your changes
(git commit -am 'Added some feature')
- Push to the branch
(git push origin my-new-feature)
- Create new Pull Request
- Create an new issue
- Explain with details your issue
- Add your configuration (OS, Software version, etc)
- (Opt) Attach files
- Submit !
- Scott M Baker, http://www.smbaker.com/ for https://github.com/smbaker/pynest
- Guillaume Boudreau, https://www.pommepause.com for https://github.com/gboudreau/nest-api
- Google for Google Chart, https://developers.google.com/chart/
- Nest for images and logos, https://nest.com