Schrolli91 / BOSWatch

Python Script to process input data from rtl_fm and multimon-NG - multiple Plugin support
https://bwcc.boswatch.de
GNU General Public License v2.0
132 stars 60 forks source link

Boswatch 2.5.2 Telegram Bot #504

Open N00Bmeister opened 3 years ago

N00Bmeister commented 3 years ago

Bei Fragen und Problemen zu BOSWatch oder Plugins bitte unten gennante Informationen angeben:

19.01.2021 17:17:56 - boswatch [DEBUG ] BOSWatch has started 19.01.2021 17:17:56 - boswatch [DEBUG ] Logfiles cleared 19.01.2021 17:17:56 - boswatch [DEBUG ] SW Version: 2.5.2 19.01.2021 17:17:56 - boswatch [DEBUG ] Branch: master 19.01.2021 17:17:56 - boswatch [DEBUG ] Build Date: 08.01.2021 19.01.2021 17:17:56 - boswatch [DEBUG ] Python Vers: 2.7.16 (default, Oct 10 2019, 22:02:15) [GCC 8.3.0] 19.01.2021 17:17:56 - boswatch [DEBUG ] BOSWatch given arguments 19.01.2021 17:17:56 - boswatch [DEBUG ] - Frequency: 123456789 19.01.2021 17:17:56 - boswatch [DEBUG ] - Device: 0 19.01.2021 17:17:56 - boswatch [DEBUG ] - PPM Error: -5 19.01.2021 17:17:56 - boswatch [DEBUG ] - Squelch: 0 19.01.2021 17:17:56 - boswatch [DEBUG ] - Gain: 100 19.01.2021 17:17:56 - boswatch [DEBUG ] - Demod: FMS 19.01.2021 17:17:56 - boswatch [DEBUG ] - Use /var/log: False 19.01.2021 17:17:56 - boswatch [DEBUG ] - Verbose Mode: True 19.01.2021 17:17:56 - boswatch [DEBUG ] - Quiet Mode: False


/ __ )/ __ \/ ___/ |     / /___ _/ /______/ /_

/ / / / /_ | | /| / / `/ / / \ / // / // // /| |/ |/ / // / /_/ /_/ / / / //_//__/ |/|_/\,/_/_// // German BOS Information Script by Bastian Schroll, Jens Herrmann

SW Version: 2.5.2 Branch: master Build Date: 08.01.2021

Frequency: 12.3456789M Device-ID: 0 Error in PPM: -5 Active Demods: 1

19.01.2021 17:17:56 - boswatch [DEBUG ] reading config file 19.01.2021 17:17:56 - configHandler [DEBUG ] read [BOSWatch] from config file 19.01.2021 17:17:56 - configHandler [DEBUG ] - loglevel = 10 19.01.2021 17:17:56 - configHandler [DEBUG ] - backupcount = 7 19.01.2021 17:17:56 - configHandler [DEBUG ] - processalarmasync = 0 19.01.2021 17:17:56 - configHandler [DEBUG ] - useregexfilter = 1 19.01.2021 17:17:56 - configHandler [DEBUG ] - doublefilter_ignore_entries = 10 19.01.2021 17:17:56 - configHandler [DEBUG ] - doublefilter_ignore_time = 5 19.01.2021 17:17:56 - configHandler [DEBUG ] - doublefilter_check_msg = 0 19.01.2021 17:17:56 - configHandler [DEBUG ] - writemultimonraw = 0 19.01.2021 17:17:56 - configHandler [DEBUG ] read [multicastAlarm] from config file 19.01.2021 17:17:56 - configHandler [DEBUG ] - multicastalarm = 0 19.01.2021 17:17:56 - configHandler [DEBUG ] - multicastalarm_ignore_time = 15 19.01.2021 17:17:56 - configHandler [DEBUG ] - multicastalarm_delimiter_ric = 19.01.2021 17:17:56 - configHandler [DEBUG ] - multicastalarm_ric = 19.01.2021 17:17:56 - configHandler [DEBUG ] read [Filters] from config file 19.01.2021 17:17:56 - configHandler [DEBUG ] - fms_telegram = FMS;status;Telegram;123456789;(1)|(2)|(3)|(4)|(5)|(6)|(7)|(8)|(9)|(0) 19.01.2021 17:17:56 - configHandler [DEBUG ] read [FMS] from config file 19.01.2021 17:17:56 - configHandler [DEBUG ] - iddescribed = 1 19.01.2021 17:17:56 - configHandler [DEBUG ] - checkcrc = 1 19.01.2021 17:17:56 - configHandler [DEBUG ] read [ZVEI] from config file 19.01.2021 17:17:56 - configHandler [DEBUG ] - iddescribed = 0 19.01.2021 17:17:56 - configHandler [DEBUG ] read [POC] from config file 19.01.2021 17:17:56 - configHandler [DEBUG ] - allow_ric = 19.01.2021 17:17:56 - configHandler [DEBUG ] - deny_ric = 19.01.2021 17:17:56 - configHandler [DEBUG ] - filter_range_start = 0000000 19.01.2021 17:17:56 - configHandler [DEBUG ] - filter_range_end = 9999999 19.01.2021 17:17:56 - configHandler [DEBUG ] - iddescribed = 1 19.01.2021 17:17:56 - configHandler [DEBUG ] - onlysubric = 0 19.01.2021 17:17:56 - configHandler [DEBUG ] - rica = Feuer 19.01.2021 17:17:56 - configHandler [DEBUG ] - ricb = TH 19.01.2021 17:17:56 - configHandler [DEBUG ] - ricc = AGT 19.01.2021 17:17:56 - configHandler [DEBUG ] - ricd = Unwetter 19.01.2021 17:17:56 - configHandler [DEBUG ] - netident_ric = 0174760, 1398098 19.01.2021 17:17:56 - configHandler [DEBUG ] - netident_history = 0 19.01.2021 17:17:56 - configHandler [DEBUG ] - geo_enable = 0 19.01.2021 17:17:56 - configHandler [DEBUG ] - geo_format = #C(\d{2})(\d{5}),(\d{2})(\d{5})# 19.01.2021 17:17:56 - configHandler [DEBUG ] - geo_order = LON, lon, LAT, lat 19.01.2021 17:17:56 - configHandler [DEBUG ] read [Plugins] from config file 19.01.2021 17:17:56 - configHandler [DEBUG ] - mysql = 0 19.01.2021 17:17:56 - configHandler [DEBUG ] - httprequest = 0 19.01.2021 17:17:56 - configHandler [DEBUG ] - email = 0 19.01.2021 17:17:56 - configHandler [DEBUG ] - bosmon = 0 19.01.2021 17:17:56 - configHandler [DEBUG ] - firemergency = 0 19.01.2021 17:17:56 - configHandler [DEBUG ] - jsonsocket = 0 19.01.2021 17:17:56 - configHandler [DEBUG ] - sms = 0 19.01.2021 17:17:56 - configHandler [DEBUG ] - sms77 = 0 19.01.2021 17:17:56 - configHandler [DEBUG ] - ffagent = 0 19.01.2021 17:17:56 - configHandler [DEBUG ] - pushover = 0 19.01.2021 17:17:56 - configHandler [DEBUG ] - telegram = 1 19.01.2021 17:17:56 - configHandler [DEBUG ] - yowsup = 0 19.01.2021 17:17:56 - configHandler [DEBUG ] - hue = 0 19.01.2021 17:17:56 - configHandler [DEBUG ] - divera = 0 19.01.2021 17:17:56 - configHandler [DEBUG ] - gpiocontrol = 0 19.01.2021 17:17:56 - configHandler [DEBUG ] - fhemcmd = 0 19.01.2021 17:17:56 - configHandler [DEBUG ] - mqtt = 0 19.01.2021 17:17:56 - configHandler [DEBUG ] - template = 0 19.01.2021 17:17:56 - configHandler [DEBUG ] read [Filters] from config file 19.01.2021 17:17:56 - configHandler [DEBUG ] - fms_telegram = FMS;status;Telegram;123456789;(1)|(2)|(3)|(4)|(5)|(6)|(7)|(8)|(9)|(0) 19.01.2021 17:17:56 - boswatch [DEBUG ] set loglevel of fileHandler to: 10 19.01.2021 17:17:56 - boswatch [DEBUG ] set backupCount of fileHandler to: 7 19.01.2021 17:17:56 - pluginLoader [DEBUG ] loading plugins 19.01.2021 17:17:56 - pluginLoader [DEBUG ] Search in plugin folder 19.01.2021 17:17:56 - pluginLoader [DEBUG ] Plugin [DISABLED] Sms77 19.01.2021 17:17:56 - pluginLoader [DEBUG ] Plugin [DISABLED] SMS 19.01.2021 17:17:56 - pluginLoader [DEBUG ] Plugin [DISABLED] firEmergency 19.01.2021 17:17:56 - pluginLoader [DEBUG ] Plugin [DISABLED] fhemCmd 19.01.2021 17:17:56 - pluginLoader [DEBUG ] Plugin [DISABLED] template 19.01.2021 17:17:56 - pluginLoader [DEBUG ] Plugin [DISABLED] eMail 19.01.2021 17:17:56 - pluginLoader [DEBUG ] Plugin [DISABLED] MySQL 19.01.2021 17:17:56 - pluginLoader [DEBUG ] Plugin [DISABLED] mqtt 19.01.2021 17:17:56 - pluginLoader [DEBUG ] Plugin [DISABLED] Pushover 19.01.2021 17:17:56 - pluginLoader [DEBUG ] Plugin [DISABLED] BosMon 19.01.2021 17:17:56 - pluginLoader [DEBUG ] Plugin [DISABLED] yowsup 19.01.2021 17:17:56 - pluginLoader [DEBUG ] Plugin [DISABLED] gpiocontrol 19.01.2021 17:17:56 - pluginLoader [DEBUG ] Plugin [DISABLED] jsonSocket 19.01.2021 17:17:56 - pluginLoader [DEBUG ] Plugin [DISABLED] hue 19.01.2021 17:17:56 - pluginLoader [DEBUG ] Plugin [DISABLED] Divera 19.01.2021 17:17:56 - pluginLoader [DEBUG ] Plugin [DISABLED] FFAgent 19.01.2021 17:17:56 - pluginLoader [DEBUG ] Plugin [DISABLED] httpRequest 19.01.2021 17:17:56 - pluginLoader [DEBUG ] Plugin [ENABLED ] Telegram 19.01.2021 17:17:56 - pluginLoader [DEBUG ] load plugin: Telegram 19.01.2021 17:17:56 - pluginLoader [ERROR ] cannot load plugin: Telegram 19.01.2021 17:17:56 - pluginLoader [DEBUG ] cannot load plugin: Telegram Traceback (most recent call last): File "/opt/boswatch/includes/pluginLoader.py", line 106, in loadPlugin return imp.load_module(plugin["name"], plugin["info"]) File "/opt/boswatch/plugins/Telegram/Telegram.py", line 14, in import telegram File "/usr/local/lib/python2.7/dist-packages/telegram/init.py", line 21, in from .base import TelegramObject File "/usr/local/lib/python2.7/dist-packages/telegram/base.py", line 42 _id_attrs: Tuple[Any, ...] = () ^ SyntaxError: invalid syntax 19.01.2021 17:17:56 - pluginLoader [ERROR ] error loading plugin: Telegram 19.01.2021 17:17:56 - pluginLoader [DEBUG ] error loading plugin: Telegram Traceback (most recent call last): File "/opt/boswatch/includes/pluginLoader.py", line 32, in loadPlugins plugin = loadPlugin(i) File "/opt/boswatch/includes/pluginLoader.py", line 106, in loadPlugin return imp.load_module(plugin["name"], plugin["info"]) File "/opt/boswatch/plugins/Telegram/Telegram.py", line 14, in import telegram File "/usr/local/lib/python2.7/dist-packages/telegram/init.py", line 21, in from .base import TelegramObject File "/usr/local/lib/python2.7/dist-packages/telegram/base.py", line 42 _id_attrs: Tuple[Any, ...] = () ^ SyntaxError: invalid syntax 19.01.2021 17:17:56 - regexFilter [DEBUG ] loading filters 19.01.2021 17:17:56 - regexFilter [DEBUG ] - fms_telegram = FMS;status;Telegram;123456789;(1)|(2)|(3)|(4)|(5)|(6)|(7)|(8)|(9)|(0) 19.01.2021 17:17:57 - descriptionList [DEBUG ] loading description lists 19.01.2021 17:17:57 - descriptionList [DEBUG ] - load FMS description list 19.01.2021 17:17:57 - descriptionList [DEBUG ] -- loading fms.csv XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 19.01.2021 17:17:57 - descriptionList [DEBUG ] -- loading csv finished 19.01.2021 17:17:57 - descriptionList [DEBUG ] - load pocsag description list 19.01.2021 17:17:57 - descriptionList [DEBUG ] -- loading poc.csv XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 19.01.2021 17:17:58 - descriptionList [DEBUG ] -- loading csv finished 19.01.2021 17:17:58 - boswatch [DEBUG ] starting rtl_fm 19.01.2021 17:18:01 - boswatch [DEBUG ] starting multimon-ng 19.01.2021 17:18:04 - boswatch [DEBUG ] start decoding


Hallo, ich habe heute auf meinem Raspi 2b (RaspiOS 2021-01-11 Kernel 5.4) Boswatch 2.5.2 installiert. Die Installation verlief auch ohne Probleme jedoch funktioniert das Telegram plugin nicht. Installiert habe ich den python-telegram-bot, der mit der Version 13.1 aufgespielt wurde, des weiterem habe ich noch python3-pip installiert (version 3.7.3), zudem ist python mit der Version 2.7.16 vorhanden. Warum auch immer bekomme ich das Plugin in Boswatch nicht zum laufen. Teste ich den Bot ohne Boswatch via curl -k, so bekomme ich ohne Probleme eine Nachricht auf meinem Handy.

Nutze ich an Stelle der 13.1 Bot Version die 12.8, dann bekomme ich folgende Meldung imLog beim starten des Plugins.

19.01.2021 17:34:50 - pluginLoader [DEBUG ] Plugin [ENABLED ] Telegram 19.01.2021 17:34:50 - pluginLoader [DEBUG ] load plugin: Telegram 19.01.2021 17:34:50 - pluginLoader [ERROR ] cannot load plugin: Telegram 19.01.2021 17:34:50 - pluginLoader [DEBUG ] cannot load plugin: Telegram Traceback (most recent call last): File "/opt/boswatch/includes/pluginLoader.py", line 106, in loadPlugin return imp.load_module(plugin["name"], plugin["info"]) File "/opt/boswatch/plugins/Telegram/Telegram.py", line 14, in import telegram File "/usr/local/lib/python2.7/dist-packages/telegram/init.py", line 23, in from .user import User File "/usr/local/lib/python2.7/dist-packages/telegram/user.py", line 23, in from telegram.utils.helpers import mention_html as util_mention_html File "/usr/local/lib/python2.7/dist-packages/telegram/utils/helpers.py", line 26, in from html import escape ImportError: No module named html 19.01.2021 17:34:50 - pluginLoader [ERROR ] error loading plugin: Telegram 19.01.2021 17:34:50 - pluginLoader [DEBUG ] error loading plugin: Telegram Traceback (most recent call last): File "/opt/boswatch/includes/pluginLoader.py", line 32, in loadPlugins plugin = loadPlugin(i) File "/opt/boswatch/includes/pluginLoader.py", line 106, in loadPlugin return imp.load_module(plugin["name"], plugin["info"]) File "/opt/boswatch/plugins/Telegram/Telegram.py", line 14, in import telegram File "/usr/local/lib/python2.7/dist-packages/telegram/init.py", line 23, in from .user import User File "/usr/local/lib/python2.7/dist-packages/telegram/user.py", line 23, in from telegram.utils.helpers import mention_html as util_mention_html File "/usr/local/lib/python2.7/dist-packages/telegram/utils/helpers.py", line 26, in from html import escape ImportError: No module named html

Hat einer von Euch eine Idee wie ich das ganze zum laufen bekomme?

PS Den Bot habe ich wie folgt installiert. sudo pip install python-telegram-bot und einmal als sudo pip install python-telegram-bot==12.8

Grüße

lgremme commented 3 years ago

bei der zweiten Installation fehlt dir ein Modul in python: sudo pip install html

Schrolli91 commented 3 years ago

Es gibt ein requriements File im Telegram Plugin Ordner https://github.com/Schrolli91/BOSWatch/blob/master/plugins/Telegram/requirements.txt sudo pip install -r requirements.txt - oder so ähnlich ... sollte eigentlich alle notwendigen Deps installieren

N00Bmeister commented 3 years ago

@lgremme

ich habe den Befehl ausgeführt und danach manuell Boswacth mit -v gestartet, jedoch ohne Erfolg

19.01.2021 19:01:37 - pluginLoader [ERROR ] cannot load plugin: Telegram 19.01.2021 19:01:37 - pluginLoader [DEBUG ] cannot load plugin: Telegram Traceback (most recent call last): File "/opt/boswatch/includes/pluginLoader.py", line 106, in loadPlugin return imp.load_module(plugin["name"], plugin["info"]) File "/opt/boswatch/plugins/Telegram/Telegram.py", line 14, in import telegram File "/usr/local/lib/python2.7/dist-packages/telegram/init.py", line 21, in from .base import TelegramObject File "/usr/local/lib/python2.7/dist-packages/telegram/base.py", line 42 _id_attrs: Tuple[Any, ...] = () ^ SyntaxError: invalid syntax 19.01.2021 19:01:37 - pluginLoader [ERROR ] error loading plugin: Telegram 19.01.2021 19:01:37 - pluginLoader [DEBUG ] error loading plugin: Telegram Traceback (most recent call last): File "/opt/boswatch/includes/pluginLoader.py", line 32, in loadPlugins plugin = loadPlugin(i) File "/opt/boswatch/includes/pluginLoader.py", line 106, in loadPlugin return imp.load_module(plugin["name"], plugin["info"]) File "/opt/boswatch/plugins/Telegram/Telegram.py", line 14, in import telegram File "/usr/local/lib/python2.7/dist-packages/telegram/init.py", line 21, in from .base import TelegramObject File "/usr/local/lib/python2.7/dist-packages/telegram/base.py", line 42 _id_attrs: Tuple[Any, ...] = () ^ SyntaxError: invalid syntax 19.01.2021 19:01:37 - regexFilter [DEBUG ] loading filters

N00Bmeister commented 3 years ago

@Schrolli91

Habe die requirements neu installiert, leider auch hier kein Erfolg

19.01.2021 19:05:12 - pluginLoader [DEBUG ] load plugin: Telegram 19.01.2021 19:05:12 - pluginLoader [ERROR ] cannot load plugin: Telegram 19.01.2021 19:05:12 - pluginLoader [DEBUG ] cannot load plugin: Telegram Traceback (most recent call last): File "/opt/boswatch/includes/pluginLoader.py", line 106, in loadPlugin return imp.load_module(plugin["name"], plugin["info"]) File "/opt/boswatch/plugins/Telegram/Telegram.py", line 14, in import telegram File "/usr/local/lib/python2.7/dist-packages/telegram/init.py", line 21, in from .base import TelegramObject File "/usr/local/lib/python2.7/dist-packages/telegram/base.py", line 42 _id_attrs: Tuple[Any, ...] = () ^ SyntaxError: invalid syntax 19.01.2021 19:05:12 - pluginLoader [ERROR ] error loading plugin: Telegram 19.01.2021 19:05:12 - pluginLoader [DEBUG ] error loading plugin: Telegram Traceback (most recent call last): File "/opt/boswatch/includes/pluginLoader.py", line 32, in loadPlugins plugin = loadPlugin(i) File "/opt/boswatch/includes/pluginLoader.py", line 106, in loadPlugin return imp.load_module(plugin["name"], plugin["info"]) File "/opt/boswatch/plugins/Telegram/Telegram.py", line 14, in import telegram File "/usr/local/lib/python2.7/dist-packages/telegram/init.py", line 21, in from .base import TelegramObject File "/usr/local/lib/python2.7/dist-packages/telegram/base.py", line 42 _id_attrs: Tuple[Any, ...] = () ^ SyntaxError: invalid syntax 19.01.2021 19:05:12 - regexFilter [DEBUG ] loading filters

N00Bmeister commented 3 years ago

Ich hab es jetzt hinbekommen, dass keine Fehlermeldung beim starten von Boswatch kommen. Boswatch empfängt und wertet Telegramme aus, jedoch gibt es dann Errors beim senden der Telegramme via Telegram.

Ich habe nachträglich noch folgendes installiert sudo pip install html

20.01.2021 17:23:50 - alarmHandler [DEBUG ] call Plugin: Telegram 20.01.2021 17:23:50 - Telegram [DEBUG ] Read format and compose output for FMS-message 20.01.2021 17:23:50 - wildcardHandler [DEBUG ] wildcards been replaced 20.01.2021 17:23:50 - Telegram [DEBUG ] Initiate Telegram BOT 20.01.2021 17:23:50 - Telegram [DEBUG ] Send message to chat via Telegram BOT API 20.01.2021 17:23:50 - Telegram [ERROR ] unknown error 20.01.2021 17:23:50 - Telegram [DEBUG ] unknown error Traceback (most recent call last): File "/opt/boswatch/plugins/Telegram/Telegram.py", line 97, in run bot.sendMessage('%s' % BOTChatIDAPIKey, text, parse_mode=telegram.ParseMode.HTML) AttributeError: 'module' object has no attribute 'ParseMode' 20.01.2021 17:23:50 - alarmHandler [DEBUG ] return from: Telegram 20.01.2021 17:23:50 - alarmHandler [DEBUG ] [END ALARM]

Leider komme ich bei dem Problem nicht weiter. -.-

Schrolli91 commented 3 years ago

Irgendwas scheint mit der von dir installierten Bot Version nicht zu passen - da ich das Plugin nicht am Laufen habe kann ich dazu aber nicht sehr viel beitragen ...

N00Bmeister commented 3 years ago

Hm.

Dann an die Leute die das Telegram Plugin erfolgreich nutzen, was genau wurde nach der Boswatch Installation wie installiert?

PeterLaemmle commented 3 years ago

Ich habe das Telegram-Plugin bis jetzt nur mit Python 2.x getestet. python-telegram-bot unterstützt ab v12.8 kein Python 2.x mehr. Versuch es doch bitte mal mit python-telegram-bot v12.7.

UBeiSa commented 3 years ago

Die letzte Version von python-telegram-bot, die bei mir mit Python 2.7 funktioniert, ist die Version 11.1

thalion0 commented 2 years ago

Bis Version 12.6 läuft alles mit Python 2.7.16 bei mir. Meine Lösung war also: sudo pip install python-telegram-bot==12.6