A simple Sinatra backend for fetching air quality data from the Netatmo API.
- Exchange a username & password for an access token
- Refreshes the access token before it expires
- Caches the tokens in Redis
- Fetch current air quality data for all registered devices
- Fetch data for the past hour for the given device ID
- Measurement responses are automatically cached in Redis
- Hardware
- Dependencies
- Redis
- Ruby
- Bundler
- Clone the repo
- Install dependencies with
bundle install
- Create a
.env.local
file in the root of the project:
export NETATMO_CLIENT_ID="IDIDIDIDIDIDIDIDID"
export NETATMO_CLIENT_SECRET="SECRETSECRETSECRET"
export NETATMO_USERNAME="you@example.com"
export NETATMO_PASSWORD="superpassword"
- Start the Sinatra app:
rackup