Checks the weather forecast for your home town and sends an e-mail reminder to pack your rain gear if precipitation is forecast.
Project description
Wolkenbruch
Checks the weather forecast for a configurable place and sends an e-mail reminder to pack your rain gear if precipitation is forecast.
Wolkenbruch makes use of the MET Norway API, and uses OpenStreetmap to find the location from place names.
Dependencies
Wolkenbruch is written in Python 3, and depends on the Python modules geocoder, requests and yaml.
Installation
- using
pip
or similar:
pip3 install wolkenbruch
-
OR: manually:
- Clone this repository
git clone https://gitlab.com/christoph.fink/wolkenbruch.git
- Change to the cloned directory
- Use the Python
setuptools
to install the package:
cd wolkenbruch python3 ./setup.py install
-
OR: (Arch Linux only) from AUR:
# e.g. using yay
yay python-wolkenbruch
Configuration
Copy the example configuration file wolkenbruch.yml.example to a suiteable location, depending on your operating system:
- on Linux systems:
- system-wide configuration:
/etc/wolkenbruch.yml
- per-user configuration:
~/.config/wolkenbruch.yml
OR${XDG_CONFIG_HOME}/wolkenbruch.yml
- system-wide configuration:
- on MacOS systems:
- per-user configuration:
${XDG_CONFIG_HOME}/wolkenbruch.yml
- per-user configuration:
- on Microsoft Windows systems:
- per-user configuration:
%APPDATA%\wolkenbruch.yml
- per-user configuration:
Adapt the configuration:
- Change the place the forecast searches for. For bigger cities their name might be sufficient (Unicode is supported), e.g. “Helsinki”. When it comes to smaller places, or places that share their name with other places in different parts of the world, you might have to add a country, state or county name, e.g. ”Springfield, Fife”.
- Adapt the SMTP host and credentials (leave user and password empty if not authentication is required). Be careful: the credentials are (obviously) saved in plain-text. Protect access to the configuration file, e.g. on a GNU/Linux or MacOS system using
chmod 0600 "~/.config/wolkenbruch.yml"
. - Set the sender and receiver e-mail address (they can and often will be the same address)
- If you feel like it, change the subject line and message body of the e-mail. The message body can contain Python string formatting code for a float variables
a
andm
(the average and maximum precipitation rates over the next 14 hours, in mm/h). - Adjust the amount of rain you can stand:
average_precipitation_rate_threshold
is the average precipitation rate over the next 14 hours (in mm per hour) that has to be exceeded to send you a reminder,max_precipitation_rate_threshold
the highest single hourly value that makes you want to not forget your rain gear. - The verbose flag toggles whether
wolkenbruch
prints a status or operated silently.
# example configuration file
# (/etc/wolkenbruch.yml, ~/.config/wolkenbruch.yml,
# %APPDATA%/wolkenbruch.yml, ${XDG_CONFIG_HOME}/wolkenbruch.yml)
smtp:
host: localhost:587
user: foobar
password: BARFOO
email:
from: me@wherever.com
to: myself@wherever.com
subject: Pack your rain gear!
message: The forecast precipitation rate for today is {a:.2f} mm/h, maximum {m:2f} mm/h.
place: Helsinki
average_precipitation_rate_threshold: 0.1
max_precipitation_rate_threshold: 0.5
verbose: False
Usage
Run wolkenbruch
to check the precipitation for the next 14 hours and send you an e-mail reminder. Ideally, set up a cron job or a systemd timer to run wolkenbruch
e.g. every morning.
Systemd timer
Copy wolkenbruch@.service
and wolkenbruch@.timer
from extra/systemd/ to /etc/systemd/system/
and enable the timer to run wolkenbruch for user christoph
at 6:30 every morning:
sudo systemctl daemon-reload
sudo systemctl enable --now wolkenbruch@christoph.timer
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for wolkenbruch-0.5.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2daab8faf53ff8c07a3f9592f2cd7bf050217b0a2a56a397e6cd57f41c05fdfd |
|
MD5 | a81271be0c11567879ead13a6b28e2c7 |
|
BLAKE2b-256 | 245761b7651150df7545ae3e8da5e3e63c4bf22f1951d1822d1840ad697dfe96 |