Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alliegaytor/temp-charter
some scripts using pirate weather and influxdb for a temperature sensor
https://github.com/alliegaytor/temp-charter
Last synced: 13 days ago
JSON representation
some scripts using pirate weather and influxdb for a temperature sensor
- Host: GitHub
- URL: https://github.com/alliegaytor/temp-charter
- Owner: Alliegaytor
- License: 0bsd
- Created: 2024-01-08T07:30:35.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-07-24T10:59:54.000Z (4 months ago)
- Last Synced: 2024-10-11T09:57:44.613Z (about 1 month ago)
- Language: Python
- Homepage:
- Size: 4.03 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Some small python scripts to:
1. parse and save historical weather data (temperature in 30 min intervals) from pirate weather api
2. download my temperature sensor data from influxdb
3. concat both sets of data
4. graph the dataIt's designed around the [sensor-software](https://github.com/opendata-stuttgart/sensors-software) project that's running on an esp8266 that sends data to both [api-rrd.madavi.de](https://api-rrd.madavi.de:3000) and a local [influxdb](https://www.influxdata.com/) server. The scripts handle importing csv files from either source, Grafana data export or fluxscript.
click for graphs
![](plot/plot_7day.png)
![](plot/plot_delta.png)
![](plot/plot_daily.png)
![](plot/plot.png)## Usage
Anyone can run the weather data collection script easily, but you must have an in.csv file formated just like how I do to use the other two scripts. Hopefully the code is simple enough to tweak to your data setup :)
1. To download pirate weather data in 30 min intervals simply add your apikey, lat, long, timezone, and how far back you want to go in `config.yml`. Then run [downloadWeatherData.py](./downloadWeatherData.py). It will output the data to `out_${date +%F}.csv`. By passting the option `-t` it will attempt to calculate how far back should be downloaded based on the last recorded time in `out.csv`.
2. Assuming you are using influxdb v2 and have the same data structure (and have bash), the [exportInfluxdbData.sh](./exportInfluxdbData.sh) will attempt to export the last 7 days of temperature data to `in_new.csv` using curl to send the [influxdb.flux](./influxdb.flux) script to influxdb and recieve the response. Make sure you add your apikey and server ip to the script.
3. If you have the same temperature data structure as in my `in.csv` (time s, temp) and `in_new.csv` (time ms,temp), then you can run [mergeData.py](./mergeData.py) and it will combine the `in.csv` with the `in_new.csv` (making sure to change the timestamp to seconds), as well as the `out.csv` with any other `out*.csv` files you have in the directory. It will then save a `merged.csv` with the data merged nicely.
4. You can then run [graphData.py](./graphData.py) to generate some nice looking charts. These include comparing outside vs. inside temperatures, finding the difference between them, and calculating the minimum, maximum, and average temperature per day.
There is an example `in_new.csv` and `out_${date +%F}.csv` provided in this repo, as well as the flux script I use in a notebook to export the sensor data in the same way Grafana did. Please don't run the scripts with important csv files in the working directory, and always take backups!