Skip to main content

Send an e-mail reminder if precipitation is forecast

Project description

rain cloud

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:
pip install wolkenbruch

Configuration

Copy the example configuration file wolkenbruch.yml.template 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
  • on MacOS systems:
    • per-user configuration:
      • ${XDG_CONFIG_HOME}/wolkenbruch.yml
  • on Microsoft Windows systems:
    • per-user configuration: %APPDATA%\wolkenbruch.yml

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 and m (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)
place: Helsinki
average_precipitation_rate_threshold: 0.1
max_precipitation_rate_threshold: 0.5

email-to: myself@whereever.com
email-from: me@whereever.com
email-subject: Pack your rain gear!
email-message: The average forecast precipitation rate for today is {a:0.2f}, maximum {m:0.2f} mm/h.

smtp-host: localhost:587
smtp-user: foobar
smtp-password: BARFOO

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/user/ or ~/.config/systemd/user/ and enable the timer to run wolkenbruch at 6:30 every morning:

systemctl --user daemon-reload
systemctl --user enable --now wolkenbruch.timer 

If you want the systemd timer to trigger when you’re not logged in, enable lingering for your user:

sudo loginctl enable-linger USERNAME

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wolkenbruch-0.7.3.tar.gz (24.3 kB view details)

Uploaded Source

Built Distribution

wolkenbruch-0.7.3-py3-none-any.whl (24.0 kB view details)

Uploaded Python 3

File details

Details for the file wolkenbruch-0.7.3.tar.gz.

File metadata

  • Download URL: wolkenbruch-0.7.3.tar.gz
  • Upload date:
  • Size: 24.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for wolkenbruch-0.7.3.tar.gz
Algorithm Hash digest
SHA256 f447eac81120d2576ac2c82e116e990dac58e500c35169ec70c3a1135b2d4bf2
MD5 8cbc43bced011877c8d6ea2f285b333f
BLAKE2b-256 2cc5091a7ade6c987c7329d42b106e63d4e875116a4688c1cbba892a22858ee8

See more details on using hashes here.

File details

Details for the file wolkenbruch-0.7.3-py3-none-any.whl.

File metadata

  • Download URL: wolkenbruch-0.7.3-py3-none-any.whl
  • Upload date:
  • Size: 24.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for wolkenbruch-0.7.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c7de42512259de90cf0fe45e1b77d11636b28ca853357d8992ccc1848834a00e
MD5 4808ac81d3fb5d10c0c2512b4ee1fa47
BLAKE2b-256 34ef82feefec85ee2574b07b693b5eb9c26adba7b33012b8b689d11502f82f09

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page