This is a Mastodon bot that regularly posts information about the current water level of the Dreisam river in Freiburg/Germany.
https://freiburg.social/@dreisampegel
- The bot is activated every couple of hours by a cronjob
- It fetches the current water level data from the official water level site (https://www.hvz.baden-wuerttemberg.de/pegel.html?id=00389) and stores it into a timeseries CSV file
- If the water level is critically high (>105cm, at which there are closures of nearby bike lanes) or the last post was > 1 day ago, it will contine
- A chart is rendered from the CSV file using https://github.com/fogleman/gg
- A Mastodon post is made using https://github.com/mattn/go-mastodon, which includes the rendered chart, was well as some additional information
The "normal" chart (no critical water level); current time is on the right, 1 week history to the left:
The "critical" chart (water level > 105cm); note that there are three official criticality levels (105cm, 125cm, 145cm) at which certain actions are performed (e.g. closure of paths along the river, etc.) - they are marked as horizontal lines.
The actual measuring station near Freiburg-Ebnet:


