Skip to main content

A simple alerting system to get notified about important events or breaking news.

Project description

Ninette

PyPI Python Versions License

A simple alerting system to get notified about important events or news.

Ninette generates alerts as email messages or by executing a command (which could generate a Signal, Jabber, Matrix, SMS, ... message) to inform about important events or news in your region.

It can be used as an alternative or addition to smart phone apps which create push notifications. With the Command alerter, any form of notification can be used.

Currently supported alert providers are: NINA (service of the German disaster control organization) and Tagesschau (German television news service).

More providers can be added easily.

Features

  • Alerts from German Bundesamt für Bevölkerungsschutz (NINA API via https://nina.api.bund.dev, including events from DWD, MOWAS, Hochwasserzentrale)
  • Alerts for breaking news from Tagesschau (via https://www.tagesschau.de)
  • Notification via Email
  • Notification via custom command, e.g. to create a Signal, Jabber, Matrix, SMS message
  • Regional events can be filtered by location (based on county), multiple locations can be configured
  • Automatic creation of a map image for each event if it contains geo coordinates
  • Event state is stored in a SQLite database to not create alerts for already alerted events
  • Made with Python and love

Installation and setup

Ninette requires Python 3.8 or newer. The easiest method is to install directly from pypi using pip:

pip install ninette

When installing or running manually, the following requirements must be installed: html2text, py-staticmaps, requests

Before using Ninette, you need to create a configuration file called ninette.conf. Ninette will search for ninette.conf in the following locations (in that order):

  • /etc/ninette.conf
  • ~/.config/ninette.conf
  • ninette.conf (in current working directory)

Alternatively, you can specify the name of the configuration file to be read using the --config command line parameter.

An example configuration file can be found in the sources or online at https://raw.githubusercontent.com/eht16/ninette/main/ninette.conf.example.

For details on the configuration options, consider the comments in the example configuration file.

Usage

Run only once:

ninette

Run in foreground:

ninette -f

Run in foreground and override configured event fetch interval to 5 minutes (300 seconds):

ninette -f -i 300

Run with verbose output and dry-run to not send any alerts:

ninette -v -n

Command line options

usage: ninette [-h] [-V] [-d] [-v] [-c FILE] [-f] [-i NUM] [-n]

options:
  -h, --help            show this help message and exit
  -V, --version         show version and exit (default: False)
  -d, --debug           enable tracebacks and enable --verbose (default: False)
  -v, --verbose         Show more log messages (default: False)
  -c FILE, --config FILE
                        configuration file path (default: None)
  -f, --foreground      Keep running in foreground (default: False)
  -i NUM, --interval NUM
                        Check for new events every X seconds (only used when in foreground) (default: None)
  -n, --dry-run         Dry run mode - do not send and remember any alerts (default: False)

Available providers

NINA provider uses the NINA API (https://nina.api.bund.dev/) which is based on the warnings of the German Bundesamt für Bevölkerungsschutz (https://warnung.bund.de).

In general the alerts are created if the configured area is affected by accidents or disasters (fire, flood or a release of hazardous substances) from the following services:

  • MoWaS (modular warning system)
  • DWD - Deutscher Wetterdienst (weather service for Germany)
  • Hochwasserzentrale (flood warnings for Germany)

The provider can generate alerts for multiple areas which are listed in the configuration file. To add an area, the "Amtlicher Gemeindeschlüssel" (Community Identification Number) for the area must be used. A list of such numbers can be found on https://www.xrepository.de/details/urn:de:bund:destatis:bevoelkerungsstatistik:schluessel:rs.

Since the warnings are provided only on county level, the last seven digits of the number must be replaced by "0000000".

Tagesschau breaking news provider queries the German television news service for breaking news and creates alerts for each breaking news.

Ping provider a provider for debugging purposes only which generates an alert every hour.

Available alerters

Email alerter sends an email to a configured list of recipients, email server and credentials can be configured.

Command alerter executes a custom command which receives all alert information so it can generate a push notification or SMS for a mobile phone, a message in a chat like Matrix, a message for a Pager or any other form of notification or post processing.

Disclaimer

Use this tool at your own risk only. There is no warranty that all alerts are processed and sent reliably and in time.

This project has no relation to the official German NINA warn app.

Author

Enrico Tröger enrico.troeger@uvena.de

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

ninette-1.1.0.tar.gz (21.8 kB view details)

Uploaded Source

Built Distribution

ninette-1.1.0-py3-none-any.whl (23.3 kB view details)

Uploaded Python 3

File details

Details for the file ninette-1.1.0.tar.gz.

File metadata

  • Download URL: ninette-1.1.0.tar.gz
  • Upload date:
  • Size: 21.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for ninette-1.1.0.tar.gz
Algorithm Hash digest
SHA256 489000fa2c3a3810da3466fb9b00595516ca6041150523e84d26fe43ef3f6ab0
MD5 24d866154b3a638cef4988576e07a615
BLAKE2b-256 94531fe54fea06052fd213e675090ede40d2c1efeb6d6f83e54ef91dadafaa16

See more details on using hashes here.

File details

Details for the file ninette-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: ninette-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 23.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for ninette-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 49fc27bb2eab7191e7c0ed37d23d1a1118cee58ec1c106ed13a88785c547e3ff
MD5 feec0640c42a30fd37ed556b8dede129
BLAKE2b-256 f03d1d371d429f19051a3057aea80e5e359988ae49bb98387f3ea1e023bd79b8

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