https://github.com/erwinsteffens/darksky-influxdb
Logs weather information from darksky.io to InfluxDB
https://github.com/erwinsteffens/darksky-influxdb
darksky influxdb nodejs weather
Last synced: about 2 months ago
JSON representation
Logs weather information from darksky.io to InfluxDB
- Host: GitHub
- URL: https://github.com/erwinsteffens/darksky-influxdb
- Owner: ErwinSteffens
- License: mit
- Created: 2017-02-25T09:55:58.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-09-19T14:53:56.000Z (over 5 years ago)
- Last Synced: 2025-03-25T18:45:16.268Z (2 months ago)
- Topics: darksky, influxdb, nodejs, weather
- Language: JavaScript
- Size: 11.7 KB
- Stars: 20
- Watchers: 4
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# darksky-influxdb
Docker image which logs weather information from [DarkSky.net](https://darksky.net) to InfluxDB.
# DarkSky key
A DarkSky api key can be requested here: [https://darksky.net/dev](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.
# Usage
An example of using this in docker-compose can be found [here](https://github.com/ErwinSteffens/server/blob/master/docker-compose.yml).
Run it once:
```
docker run -rm -it \
-e 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= \
-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)`
# Environment variables
### DEBUG
When set to any value, write request output to the command line.
### CRON
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.### DARKSKY_KEY
Your DarkSky api key. Request it here: [https://darksky.net/dev](https://darksky.net/dev)
### DARKSKY_UNITS
The metric units to use. Choose from:
* `auto`: automatically select units based on geographic location
* `ca`: same as si, except that windSpeed is in kilometers per hour
* `uk2`: same as si, except that nearestStormDistance and visibility are in miles and windSpeed is in miles per hour
* `us`: Imperial units (the default)
* `si`: SI units### DARKSKY_LATITUDE and DARKSKY_LONGITUDE
Your geo coordinates to get the weater data for. You can find them here: [http://mygeoposition.com/](http://mygeoposition.com/).
### INFLUXDB_HOST
Hostname of IP of your InfluxDB server.
### INFLUXDB_PORT
Port of your InfluxDB server.
### INFLUXDB_DATABASE
Database to write to for InfluxDB.
### INFLUXDB_USERNAME and INFLUXDB_PASSWORD
Credentials to use for InfluxDB.