I recently wrote a tool to synchronize my weather stations’ data with a local SQLite database. My motivations were:
- to make it easier and faster to work with my data,
- to reduce load on the Tempest API, and
- to keep a copy of my data, just in case the Tempest API becomes unavailable.
In case you might also find the tool useful, I’m sharing it here:
Features:
- Simple. Just supply your API token, a path to a SQLite3 database, and your Tempest device id(s). The tool will do the rest. It will create the database if needed and then download your historical weather data at 1-minute resolution using the Tempest API.
- Smart. If you’ve already downloaded your data before, the tool will only download new data. (Don’t worry, it will always download the most-recent 24 hours’ data to update any previously downloaded data that has been revised.)
- Small. The tool is implemented as a single, small Python script.
- No dependencies beyond Python 3. The tool requires only a reasonably up-to-date Python 3 installation with its normal sqlite3 and HTTPS support. It uses only packages in the Python Standard Library.
Here’s a usage example:
# Sync data for two weather station devices 123 and 456.
sync_weather.py \
--api_token "replace this text with your actual API token" \
--database $HOME/weather.db \
--device_id 123 456
Please let me know if you find the tool helpful or run into any problems.
Cheers,
Tom