Docker image which logs weather information from DarkSky.net to InfluxDB.
A DarkSky api key can be requested here: https://darksky.net/dev. This key needs to be provided to the docker image as an environment variable.
You get 1000 requests per day for free. Enough to use for your personal weather logger.
An example of using this in docker-compose can be found here.
Run it once:
docker run -rm -it \
-e DARKSKY_KEY=<your-darksky-key> \
-e INFLUXDB_HOST=influxdb.myhost.io \
-e INFLUXDB_PORT=8086 \
-e INFLUXDB_DATABASE=weather \
erwinsteffens/darksky-influxdb:latest
Run it every 10 seconds:
docker run -rm -it \
-e DARKSKY_KEY=<your-darksky-key> \
-e CRON="*\10 * * * * *" \
-e INFLUXDB_HOST=influxdb.myhost.io \
-e INFLUXDB_PORT=8086 \
-e INFLUXDB_DATABASE=weather \
erwinsteffens/darksky-influxdb:latest
Query the weather data from your InfluxDB instance. For example show average temperature for the last 7 days:
SELECT MEAN("temperature") FROM weather WHERE time > now() - 7d GROUP BY time(1d)
When set to any value, write request output to the command line.
When set the data will be updated on the given interval.
Examples:
*\10 * * * * *
: update every 10 seconds.* *\10 * * * *
: update every 10 minutes.* 5 * * * *
: update every hour on the 5th minute.
Your DarkSky api key. Request it here: https://darksky.net/dev
The metric units to use. Choose from:
auto
: automatically select units based on geographic locationca
: same as si, except that windSpeed is in kilometers per houruk2
: same as si, except that nearestStormDistance and visibility are in miles and windSpeed is in miles per hourus
: Imperial units (the default)si
: SI units
Your geo coordinates to get the weater data for. You can find them here: http://mygeoposition.com/.
Hostname of IP of your InfluxDB server.
Port of your InfluxDB server.
Database to write to for InfluxDB.
Credentials to use for InfluxDB.