Skip to content
This repository has been archived by the owner on May 9, 2023. It is now read-only.

mh-superbox/openweathermap-telegram-alert

Repository files navigation

OpenWeatherMap Telegram Alert

Send OpenWeatherMap alerts (One Call API) to telegram users.

Features

Installation

Requirements:

  • Python 3.8
$ apt install python3-yaml python3-requests

Copy the om-telegram-alert.py file:

$ cp src/usr/local/sbin/om-telegram-alert.py /usr/local/sbin/om-telegram-alert.py
$ chmod +x /usr/local/sbin/om-telegram-alert.py

Copy the om-telegram-alert.yaml configuration file:

$ cp src/etc/default/om-telegram-alert.yaml /etc/default

Configuration

You can set OpenWeatherMap and Telegram settings in the /etc/default/om-telegram-alert.yaml.

OpenWeaterMap

Key Value
lat latitude - Geographical coordinates (required).
lon longitude - Geographical coordinates (required).
appid Your unique API key (required).
exclude_tags A list of tags to exlclude from sending messages.

Telegram

Key Value
token Bot token (required).
chat_ids User chat ids (required).

Start systemd timer

The timer check every 15 minutes for new entries.

$ cp src/etc/systemd/system/om-telegram-alert.* /etc/systemd/system
$ systemctl enable --now om-telegram-alert.timer

Changelog

1.0.2

  • Avoid sending alerts that are duplicates and have a new timestamp

1.0.1

  • Clean temporary file if there are more than 20 entries

About

Send OpenWeatherMap alerts (One Call API) to telegram users.

Resources

License

Stars

Watchers

Forks

Languages