AlexLamson / log-temperature

Log indoor temperature / air pressure with a raspberry to a google sheet

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Log Temperature

Log temperature / air pressure to a Google Sheet with a Raspberry Pi

Graph of example data

Setup

1. Python configuration

Install Python 3.6 (Note: This step can take several hours to run)

Install the required packages: pip3.6 install gspread oauth2client

2. Setup the temperature sensor

Install Adafruit_Python_BMP python module

Enable the I2C protocol feature in Raspberry Pi

3. Get access to Google Sheets API

Follow the tutorial here to get API access to Google Sheets

Put the resulting client_secret.json file in this directory

Open logger.py and set the SPREADSHEET_NAME variable to the title of your spreadsheet. (You can also specify the worksheet tab name, if you're using a specific tab)

4. Running the script

Run python3.6 logger.py to get a temperature and pressure reading and log it to the google sheet.

5. Scheduling the script

Run crontab -e to edit your crontab and add the following line (you may have to adjust the path based on where you cloned the repository). This will make the script run every 5 minutes.

*/5 * * * * /usr/local/bin/python3.6 /home/pi/log-temperature/logger.py /home/pi/log-temperature/client_secret.json

About

Log indoor temperature / air pressure with a raspberry to a google sheet

License:MIT License


Languages

Language:Python 100.0%